From owner-svn-src-head@freebsd.org Sun Dec 27 01:14: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 55726A4CB05; Sun, 27 Dec 2015 01:14:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 261A018C2; Sun, 27 Dec 2015 01:14:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR1Egjb040503; Sun, 27 Dec 2015 01:14:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR1EgHc040502; Sun, 27 Dec 2015 01:14:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512270114.tBR1EgHc040502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Dec 2015 01:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292763 - 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: Sun, 27 Dec 2015 01:14:43 -0000 Author: kib Date: Sun Dec 27 01:14:42 2015 New Revision: 292763 URL: https://svnweb.freebsd.org/changeset/base/292763 Log: Typo. Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Sun Dec 27 00:42:13 2015 (r292762) +++ head/lib/libthr/thread/thr_fork.c Sun Dec 27 01:14:42 2015 (r292763) @@ -209,7 +209,7 @@ __thr_fork(void) /* reinitalize library. */ _libpthread_init(curthread); - /* atfork is reinitializeded by _libpthread_init()! */ + /* atfork is reinitialized by _libpthread_init()! */ _thr_rwl_rdlock(&_thr_atfork_lock); if (was_threaded) { From owner-svn-src-head@freebsd.org Sun Dec 27 06:16: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 743F4A5203E; Sun, 27 Dec 2015 06:16:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3ADBB137B; Sun, 27 Dec 2015 06:16:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR6G2YG029244; Sun, 27 Dec 2015 06:16:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR6G2r1029240; Sun, 27 Dec 2015 06:16:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512270616.tBR6G2r1029240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Dec 2015 06:16:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292764 - head/sys/dev/isp 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, 27 Dec 2015 06:16:03 -0000 Author: mav Date: Sun Dec 27 06:16:02 2015 New Revision: 292764 URL: https://svnweb.freebsd.org/changeset/base/292764 Log: Split DMA buffers for request, response and ATIO queues. Modified: head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_pci.c head/sys/dev/isp/isp_sbus.c Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Sun Dec 27 01:14:42 2015 (r292763) +++ head/sys/dev/isp/isp_freebsd.h Sun Dec 27 06:16:02 2015 (r292764) @@ -289,9 +289,13 @@ struct isposinfo { struct resource * regs; struct resource * regs2; bus_dma_tag_t dmat; - bus_dma_tag_t cdmat; - bus_dmamap_t cdmap; + bus_dma_tag_t reqdmat; + bus_dma_tag_t respdmat; + bus_dma_tag_t atiodmat; bus_dma_tag_t scdmat; + bus_dmamap_t reqmap; + bus_dmamap_t respmap; + bus_dmamap_t atiomap; /* * Command and transaction related related stuff @@ -406,6 +410,14 @@ struct isposinfo { #define MEMORYBARRIER(isp, type, offset, size, chan) \ switch (type) { \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.reqdmat, \ + isp->isp_osinfo.reqmap, BUS_DMASYNC_PREWRITE); \ + break; \ +case SYNC_RESULT: \ + bus_dmamap_sync(isp->isp_osinfo.respdmat, \ + isp->isp_osinfo.respmap, BUS_DMASYNC_POSTREAD); \ + break; \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -413,11 +425,6 @@ case SYNC_SFORDEV: \ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ break; \ } \ -case SYNC_REQUEST: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ - break; \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -425,21 +432,24 @@ case SYNC_SFORCPU: \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ } \ -case SYNC_RESULT: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ - break; \ case SYNC_REG: \ bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ break; \ +case SYNC_ATIOQ: \ + bus_dmamap_sync(isp->isp_osinfo.atiodmat, \ + isp->isp_osinfo.atiomap, BUS_DMASYNC_POSTREAD); \ + break; \ default: \ break; \ } #define MEMORYBARRIERW(isp, type, offset, size, chan) \ switch (type) { \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.reqdmat, \ + isp->isp_osinfo.reqmap, BUS_DMASYNC_PREWRITE); \ + break; \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -447,10 +457,6 @@ case SYNC_SFORDEV: \ BUS_DMASYNC_PREWRITE); \ break; \ } \ -case SYNC_REQUEST: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, BUS_DMASYNC_PREWRITE); \ - break; \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -458,10 +464,6 @@ case SYNC_SFORCPU: \ BUS_DMASYNC_POSTWRITE); \ break; \ } \ -case SYNC_RESULT: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, BUS_DMASYNC_POSTWRITE); \ - break; \ case SYNC_REG: \ bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_WRITE); \ Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Sun Dec 27 01:14:42 2015 (r292763) +++ head/sys/dev/isp/isp_pci.c Sun Dec 27 06:16:02 2015 (r292764) @@ -1539,75 +1539,17 @@ isp_pci_wr_reg_2600(ispsoftc_t *isp, int struct imush { - ispsoftc_t *isp; - caddr_t vbase; - int chan; + bus_addr_t maddr; int error; }; -static void imc(void *, bus_dma_segment_t *, int, int); -static void imc1(void *, bus_dma_segment_t *, int, int); - static void imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct imush *imushp = (struct imush *) arg; - isp_ecmd_t *ecmd; - - if (error) { - imushp->error = error; - return; - } - if (nseg != 1) { - imushp->error = EINVAL; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "request/result area @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - - imushp->isp->isp_rquest = imushp->vbase; - imushp->isp->isp_rquest_dma = segs->ds_addr; - segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - - imushp->isp->isp_result_dma = segs->ds_addr; - imushp->isp->isp_result = imushp->vbase; - segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - - if (imushp->isp->isp_type >= ISP_HA_FC_2200) { - imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr; - imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase; - imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free; - for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { - if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) { - ecmd->next = NULL; - } else { - ecmd->next = ecmd + 1; - } - } - } -#ifdef ISP_TARGET_MODE - segs->ds_addr += (N_XCMDS * XCMD_SIZE); - imushp->vbase += (N_XCMDS * XCMD_SIZE); - if (IS_24XX(imushp->isp)) { - imushp->isp->isp_atioq_dma = segs->ds_addr; - imushp->isp->isp_atioq = imushp->vbase; - } -#endif -} -static void -imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - if (error) { - imushp->error = error; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", - (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - FCPARAM(imushp->isp, imushp->chan)->isp_scdma = segs->ds_addr; - FCPARAM(imushp->isp, imushp->chan)->isp_scratch = imushp->vbase; + if (!(imushp->error = error)) + imushp->maddr = segs[0].ds_addr; } static int @@ -1620,6 +1562,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) bus_addr_t llim; /* low limit of unavailable dma */ bus_addr_t hlim; /* high limit of unavailable dma */ struct imush im; + isp_ecmd_t *ecmd; /* * Already been here? If so, leave... @@ -1683,53 +1626,106 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_xffree = isp->isp_xflist; /* - * Allocate and map the request and result queues (and ATIO queue - * if we're a 2400 supporting target mode), and a region for - * external dma addressable command/status structures (23XX and - * later). + * Allocate and map the request queue and a region for external + * DMA addressable command/status structures (22XX and later). */ len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); -#ifdef ISP_TARGET_MODE - if (IS_24XX(isp)) { - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp->isp_type >= ISP_HA_FC_2200) + len += (N_XCMDS * XCMD_SIZE); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + goto bad1; } -#endif + isp->isp_rquest = base; + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); + goto bad1; + } + isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_rquest_dma = im.maddr; + base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); + im.maddr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); if (isp->isp_type >= ISP_HA_FC_2200) { - len += (N_XCMDS * XCMD_SIZE); + isp->isp_osinfo.ecmd_dma = im.maddr; + isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)base; + isp->isp_osinfo.ecmd_base = isp->isp_osinfo.ecmd_free; + for (ecmd = isp->isp_osinfo.ecmd_free; + ecmd < &isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { + if (ecmd == &isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) + ecmd->next = NULL; + else + ecmd->next = ecmd + 1; + } } /* - * Create a tag for the control spaces. We don't always need this - * to be 32 bits, but we do this for simplicity and speed's sake. + * Allocate and map the result queue. */ - if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, slim, 0, &isp->isp_osinfo.cdmat)) { - isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.respdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + goto bad1; } - - if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &isp->isp_osinfo.cdmap) != 0) { - isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); - } - - im.isp = isp; - im.chan = 0; - im.vbase = base; + isp->isp_result = base; im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); + goto bad1; + } + isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_result_dma = im.maddr; - bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0); - if (im.error) { - isp_prt(isp, ISP_LOGERR, "error %d loading dma map for control areas", im.error); - goto bad; +#ifdef ISP_TARGET_MODE + /* + * Allocate and map ATIO queue on 24xx with target mode. + */ + if (IS_24XX(isp)) { + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.atiodmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); + goto bad1; + } + isp->isp_atioq = base; + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error); + goto bad; + } + isp_prt(isp, ISP_LOGDEBUG0, "ATIO area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_atioq_dma = im.maddr; } +#endif if (IS_FC(isp)) { if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, @@ -1740,21 +1736,17 @@ isp_pci_mbxdma(ispsoftc_t *isp) for (cmap = 0; cmap < isp->isp_nchan; cmap++) { struct isp_fc *fc = ISP_FC_PC(isp, cmap); if (bus_dmamem_alloc(isp->isp_osinfo.scdmat, - (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &fc->scmap) != 0) { + (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) goto bad; - } - im.isp = isp; - im.chan = cmap; - im.vbase = base; + FCPARAM(isp, cmap)->isp_scratch = base; im.error = 0; - bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, - base, ISP_FC_SCRLEN, imc1, &im, 0); - if (im.error) { + if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, + base, ISP_FC_SCRLEN, imc, &im, 0) || im.error) { bus_dmamem_free(isp->isp_osinfo.scdmat, base, fc->scmap); goto bad; } + FCPARAM(isp, cmap)->isp_scdma = im.maddr; if (!IS_2100(isp)) { for (i = 0; i < INITIAL_NEXUS_COUNT; i++) { struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -1808,10 +1800,38 @@ bad: } bus_dma_tag_destroy(isp->isp_osinfo.scdmat); } - if (isp->isp_rquest_dma != 0) - bus_dmamap_unload(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap); - bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); +bad1: + if (isp->isp_rquest_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.reqdmat, + isp->isp_osinfo.reqmap); + } + if (isp->isp_rquest != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, + isp->isp_osinfo.reqmap); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + } + if (isp->isp_result_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.respdmat, + isp->isp_osinfo.respmap); + } + if (isp->isp_result != NULL) { + bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, + isp->isp_osinfo.respmap); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + } +#ifdef ISP_TARGET_MODE + if (IS_24XX(isp)) { + if (isp->isp_atioq_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.atiodmat, + isp->isp_osinfo.atiomap); + } + if (isp->isp_atioq != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_atioq, + isp->isp_osinfo.atiomap); + bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); + } + } +#endif free(isp->isp_xflist, M_DEVBUF); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); isp->isp_rquest = NULL; Modified: head/sys/dev/isp/isp_sbus.c ============================================================================== --- head/sys/dev/isp/isp_sbus.c Sun Dec 27 01:14:42 2015 (r292763) +++ head/sys/dev/isp/isp_sbus.c Sun Dec 27 06:16:02 2015 (r292764) @@ -413,7 +413,7 @@ isp_sbus_wr_reg(ispsoftc_t *isp, int reg } struct imush { - ispsoftc_t *isp; + bus_addr_t maddr; int error; }; @@ -423,16 +423,9 @@ static void imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct imush *imushp = (struct imush *) arg; - if (error) { - imushp->error = error; - } else { - ispsoftc_t *isp =imushp->isp; - bus_addr_t addr = segs->ds_addr; - isp->isp_rquest_dma = addr; - addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - isp->isp_result_dma = addr; - } + if (!(imushp->error = error)) + imushp->maddr = segs[0].ds_addr; } static int @@ -479,40 +472,62 @@ isp_sbus_mbxdma(ispsoftc_t *isp) BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, ISP_NSEG_MAX, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.dmat)) { isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return(1); + goto bad; } /* - * Allocate and map the request, result queues, plus FC scratch area. + * Allocate and map the request queue. */ len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); - - if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, - BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR_32BIT, NULL, NULL, len, 1, - BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.cdmat)) { - isp_prt(isp, ISP_LOGERR, - "cannot create a dma tag for control spaces"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); + goto bad; + } + if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + goto bad; + } + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); + goto bad; } + isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_rquest = base; + isp->isp_rquest_dma = im.maddr; - if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &isp->isp_osinfo.cdmap) != 0) { - isp_prt(isp, ISP_LOGERR, - "cannot allocate %d bytes of CCB memory", len); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + /* + * Allocate and map the result queue. + */ + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.respdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); + goto bad; + } + if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + goto bad; } + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); + goto bad; + } + isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_result = base; + isp->isp_result_dma = im.maddr; for (i = 0; i < isp->isp_maxcmds; i++) { struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; @@ -534,25 +549,28 @@ isp_sbus_mbxdma(ispsoftc_t *isp) } } isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0]; - - im.isp = isp; - im.error = 0; - bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0); - if (im.error) { - isp_prt(isp, ISP_LOGERR, - "error %d loading dma map for control areas", im.error); - goto bad; - } - - isp->isp_rquest = base; - base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - isp->isp_result = base; ISP_LOCK(isp); return (0); bad: - bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); + if (isp->isp_rquest_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.reqdmat, + isp->isp_osinfo.reqmap); + } + if (isp->isp_rquest != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, + isp->isp_osinfo.reqmap); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + } + if (isp->isp_result_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.respdmat, + isp->isp_osinfo.respmap); + } + if (isp->isp_result != NULL) { + bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, + isp->isp_osinfo.respmap); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + } free(isp->isp_xflist, M_DEVBUF); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); isp->isp_rquest = NULL; From owner-svn-src-head@freebsd.org Sun Dec 27 06:28:32 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 ADC11A52439; Sun, 27 Dec 2015 06:28:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 77C5E1A18; Sun, 27 Dec 2015 06:28:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR6SVH9032252; Sun, 27 Dec 2015 06:28:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR6SVaj032250; Sun, 27 Dec 2015 06:28:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512270628.tBR6SVaj032250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Dec 2015 06:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292765 - head/sys/dev/isp 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, 27 Dec 2015 06:28:32 -0000 Author: mav Date: Sun Dec 27 06:28:31 2015 New Revision: 292765 URL: https://svnweb.freebsd.org/changeset/base/292765 Log: Allocate separate scratch space for scanner purposes. This space does not require DMA syncing. It reduces lock scope of the DMA scratch space. It allows whole DMA scratch space to be used to I/O, so now we can fetch up to ~1000 ports from SNS. Due to the last fact, increase maximal number of ports from 256 to 1024. Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/ispvar.h Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sun Dec 27 06:16:02 2015 (r292764) +++ head/sys/dev/isp/isp.c Sun Dec 27 06:28:31 2015 (r292765) @@ -111,9 +111,9 @@ static void isp_mark_portdb(ispsoftc_t * static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int); static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t); static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t); -static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int); -static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int, int); -static void isp_dump_chip_portdb(ispsoftc_t *, int, int); +static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *); +static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int); +static void isp_dump_chip_portdb(ispsoftc_t *, int); static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int); static int isp_fclink_test(ispsoftc_t *, int, int); static int isp_pdb_sync(ispsoftc_t *, int); @@ -2762,7 +2762,7 @@ isp_port_logout(ispsoftc_t *isp, uint16_ } static int -isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb, int dolock) +isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; @@ -2786,18 +2786,14 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui mbs.param[3] = DMA_WD0(fcp->isp_scdma); mbs.param[6] = DMA_WD3(fcp->isp_scdma); mbs.param[7] = DMA_WD2(fcp->isp_scdma); - if (dolock) { - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } if (IS_24XX(isp)) { @@ -2813,9 +2809,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui un.bill.pdb_curstate); if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) { mbs.param[0] = MBOX_NOT_LOGGED_IN; - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0]); } } else { @@ -2828,15 +2822,12 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui isp_prt(isp, ISP_LOGDEBUG1, "Chan %d handle 0x%x Port 0x%06x", chan, id, pdb->portid); } - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (0); } static int -isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, - int dolock, int loop) +isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; @@ -2862,18 +2853,14 @@ isp_gethandles(ispsoftc_t *isp, int chan mbs.param[3] = DMA_WD3(fcp->isp_scdma); mbs.param[6] = DMA_WD2(fcp->isp_scdma); } - if (dolock) { - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, ISP_FC_SCRLEN, chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } elp1 = fcp->isp_scratch; @@ -2901,13 +2888,12 @@ isp_gethandles(ispsoftc_t *isp, int chan handles[j++] = h; } *num = j; - if (dolock) - FC_SCRATCH_RELEASE(isp, chan); + FC_SCRATCH_RELEASE(isp, chan); return (0); } static void -isp_dump_chip_portdb(ispsoftc_t *isp, int chan, int dolock) +isp_dump_chip_portdb(ispsoftc_t *isp, int chan) { isp_pdb_t pdb; uint16_t lim, nphdl; @@ -2919,7 +2905,7 @@ isp_dump_chip_portdb(ispsoftc_t *isp, in lim = NPH_MAX; } for (nphdl = 0; nphdl != lim; nphdl++) { - if (isp_getpdb(isp, chan, nphdl, &pdb, dolock)) { + if (isp_getpdb(isp, chan, nphdl, &pdb)) { continue; } isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d Handle 0x%04x " @@ -3069,7 +3055,7 @@ isp_fclink_test(ispsoftc_t *isp, int cha if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) { nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; - r = isp_getpdb(isp, chan, nphdl, &pdb, 1); + r = isp_getpdb(isp, chan, nphdl, &pdb); if (r != 0 || pdb.portid == 0) { if (IS_2100(isp)) { fcp->isp_topo = TOPO_NL_PORT; @@ -3311,7 +3297,7 @@ isp_fix_portids(ispsoftc_t *isp, int cha if (VALID_PORT(lp->portid)) continue; - r = isp_getpdb(isp, chan, lp->handle, &pdb, 1); + r = isp_getpdb(isp, chan, lp->handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) return; if (r != 0) { @@ -3340,7 +3326,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan) fcparam *fcp = FCPARAM(isp, chan); int idx, lim, r; isp_pdb_t pdb; - uint16_t handles[LOCAL_LOOP_LIM]; + uint16_t *handles; uint16_t handle; if (fcp->isp_loopstate < LOOP_LTEST_DONE) @@ -3362,8 +3348,9 @@ isp_scan_loop(ispsoftc_t *isp, int chan) return (0); } - lim = LOCAL_LOOP_LIM; - r = isp_gethandles(isp, chan, handles, &lim, 1, 1); + handles = (uint16_t *)fcp->isp_scanscratch; + lim = ISP_FC_SCRLEN / 2; + r = isp_gethandles(isp, chan, handles, &lim, 1); if (r != 0) { isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Getting list of handles failed with %x", chan, r); @@ -3413,7 +3400,7 @@ abort: /* * Get the port database entity for this index. */ - r = isp_getpdb(isp, chan, handle, &pdb, 1); + r = isp_getpdb(isp, chan, handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) goto abort; if (r != 0) { @@ -3442,20 +3429,10 @@ abort: * * For the 24XX card, we have to use CT-Pass through run via the Execute IOCB * mailbox command. - * - * The net result is to leave the list of Port IDs setting untranslated in - * offset IGPOFF of the FC scratch area, whereupon we'll canonicalize it to - * host order at OGPOFF. */ - -/* - * Take half of our scratch area to store Port IDs - */ -#define GIDLEN (ISP_FC_SCRLEN >> 1) +#define GIDLEN (ISP_FC_SCRLEN - (3 * QENTRY_LEN)) #define NGENT ((GIDLEN - 16) >> 2) -#define IGPOFF (0) -#define OGPOFF (ISP_FC_SCRLEN >> 1) #define XTXOFF (ISP_FC_SCRLEN - (3 * QENTRY_LEN)) /* CT request */ #define CTXOFF (ISP_FC_SCRLEN - (2 * QENTRY_LEN)) /* Request IOCB */ #define ZTXOFF (ISP_FC_SCRLEN - (1 * QENTRY_LEN)) /* Response IOCB */ @@ -3472,21 +3449,25 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan uint8_t *scp = fcp->isp_scratch; mbreg_t mbs; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d scanning fabric (GID_FT) via SNS", chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via SNS", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } ISP_MEMZERO(rq, SNS_GID_FT_REQ_SIZE); rq->snscb_rblen = GIDLEN >> 1; - rq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma + IGPOFF); + rq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); + rq->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); + rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); + rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); rq->snscb_sblen = 6; rq->snscb_cmd = SNS_GID_FT; rq->snscb_mword_div_2 = NGENT; rq->snscb_fc4_type = FC4_SCSI; isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *)&scp[CTXOFF]); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan); + MEMORYBARRIER(isp, SYNC_SFORDEV, CTXOFF, SNS_GID_FT_REQ_SIZE, chan); MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000); mbs.param[0] = MBOX_SEND_SNS; @@ -3503,6 +3484,12 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan return (-1); } } + MEMORYBARRIER(isp, SYNC_SFORCPU, 0, GIDLEN, chan); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT response", GIDLEN, scp); + isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, + (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT); + FC_SCRATCH_RELEASE(isp, chan); return (0); } @@ -3521,7 +3508,11 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, uint32_t *rp; uint8_t *scp = fcp->isp_scratch; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d scanning fabric (GID_FT) via CT", chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via CT", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } /* * Build a Passthrough IOCB in memory. @@ -3541,8 +3532,8 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (*ct) + sizeof (uint32_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = GIDLEN; if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "ct IOCB", QENTRY_LEN, pt); @@ -3582,7 +3573,7 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan); + MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan); pt = &un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -3591,14 +3582,15 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) { isp_prt(isp, ISP_LOGWARN, - "Chan %d ISP GID FT CT Passthrough returned 0x%x", + "Chan %d GID_FT CT Passthrough returned 0x%x", chan, pt->ctp_status); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT response", GIDLEN, &scp[IGPOFF]); - } + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT response", GIDLEN, scp); + isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, + (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT); + FC_SCRATCH_RELEASE(isp, chan); return (0); } @@ -3611,7 +3603,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha uint16_t nphdl; isp_pdb_t pdb; int portidx, portlim, r; - sns_gid_ft_rsp_t *rs0, *rs1; + sns_gid_ft_rsp_t *rs; if (fcp->isp_loopstate < LOOP_LSCAN_DONE) return (-1); @@ -3627,13 +3619,6 @@ isp_scan_fabric(ispsoftc_t *isp, int cha return (0); } - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); -fail: - isp_prt(isp, ISP_LOG_SANCFG, - "Chan %d FC fabric scan done (bad)", chan); - return (-1); - } if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) { abort: FC_SCRATCH_RELEASE(isp, chan); @@ -3646,14 +3631,16 @@ abort: * Make sure we still are logged into the fabric controller. */ nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; - r = isp_getpdb(isp, chan, nphdl, &pdb, 0); + r = isp_getpdb(isp, chan, nphdl, &pdb); if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) { - isp_dump_chip_portdb(isp, chan, 0); + isp_dump_chip_portdb(isp, chan); } if (r) { fcp->isp_loopstate = LOOP_LTEST_DONE; - FC_SCRATCH_RELEASE(isp, chan); - goto fail; +fail: + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d FC fabric scan done (bad)", chan); + return (-1); } /* Get list of port IDs from SNS. */ @@ -3665,42 +3652,36 @@ abort: goto abort; if (r > 0) { fcp->isp_loopstate = LOOP_FSCAN_DONE; - FC_SCRATCH_RELEASE(isp, chan); return (-1); } else if (r < 0) { fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */ - FC_SCRATCH_RELEASE(isp, chan); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan); - rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF); - rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF); - isp_get_gid_ft_response(isp, rs0, rs1, NGENT); + rs = (sns_gid_ft_rsp_t *) fcp->isp_scanscratch; if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; - if (rs1->snscb_cthdr.ct_cmd_resp != LS_ACC) { + if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) { int level; - if (rs1->snscb_cthdr.ct_reason == 9 && rs1->snscb_cthdr.ct_explanation == 7) { + if (rs->snscb_cthdr.ct_reason == 9 && rs->snscb_cthdr.ct_explanation == 7) { level = ISP_LOG_SANCFG; } else { level = ISP_LOGWARN; } isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT" " (Reason=0x%x Expl=0x%x)", chan, - rs1->snscb_cthdr.ct_reason, - rs1->snscb_cthdr.ct_explanation); - FC_SCRATCH_RELEASE(isp, chan); + rs->snscb_cthdr.ct_reason, + rs->snscb_cthdr.ct_explanation); fcp->isp_loopstate = LOOP_FSCAN_DONE; return (-1); } /* Check our buffer was big enough to get the full list. */ for (portidx = 0; portidx < NGENT-1; portidx++) { - if (rs1->snscb_ports[portidx].control & 0x80) + if (rs->snscb_ports[portidx].control & 0x80) break; } - if ((rs1->snscb_ports[portidx].control & 0x80) == 0) { + if ((rs->snscb_ports[portidx].control & 0x80) == 0) { isp_prt(isp, ISP_LOGWARN, "fabric too big for scratch area: increase ISP_FC_SCRLEN"); } @@ -3713,24 +3694,24 @@ abort: int npidx; portid = - ((rs1->snscb_ports[portidx].portid[0]) << 16) | - ((rs1->snscb_ports[portidx].portid[1]) << 8) | - ((rs1->snscb_ports[portidx].portid[2])); + ((rs->snscb_ports[portidx].portid[0]) << 16) | + ((rs->snscb_ports[portidx].portid[1]) << 8) | + ((rs->snscb_ports[portidx].portid[2])); for (npidx = portidx + 1; npidx < portlim; npidx++) { uint32_t new_portid = - ((rs1->snscb_ports[npidx].portid[0]) << 16) | - ((rs1->snscb_ports[npidx].portid[1]) << 8) | - ((rs1->snscb_ports[npidx].portid[2])); + ((rs->snscb_ports[npidx].portid[0]) << 16) | + ((rs->snscb_ports[npidx].portid[1]) << 8) | + ((rs->snscb_ports[npidx].portid[2])); if (new_portid == portid) { break; } } if (npidx < portlim) { - rs1->snscb_ports[npidx].portid[0] = 0; - rs1->snscb_ports[npidx].portid[1] = 0; - rs1->snscb_ports[npidx].portid[2] = 0; + rs->snscb_ports[npidx].portid[0] = 0; + rs->snscb_ports[npidx].portid[1] = 0; + rs->snscb_ports[npidx].portid[2] = 0; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d removing duplicate PortID 0x%06x entry from list", chan, portid); } } @@ -3751,9 +3732,9 @@ abort: */ isp_mark_portdb(isp, chan); for (portidx = 0; portidx < portlim; portidx++) { - portid = ((rs1->snscb_ports[portidx].portid[0]) << 16) | - ((rs1->snscb_ports[portidx].portid[1]) << 8) | - ((rs1->snscb_ports[portidx].portid[2])); + portid = ((rs->snscb_ports[portidx].portid[0]) << 16) | + ((rs->snscb_ports[portidx].portid[1]) << 8) | + ((rs->snscb_ports[portidx].portid[2])); isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Checking fabric port 0x%06x", chan, portid); if (portid == 0) { @@ -3775,7 +3756,6 @@ abort: "Chan %d Port 0x%06x@0x%04x [%d] is not probational (0x%x)", chan, lp->portid, lp->handle, FC_PORTDB_TGT(isp, chan, lp), lp->state); - FC_SCRATCH_RELEASE(isp, chan); isp_dump_portdb(isp, chan); goto fail; } @@ -3795,7 +3775,7 @@ abort: * database entry for somebody further along to * decide what to do (policy choice). */ - r = isp_getpdb(isp, chan, lp->handle, &pdb, 0); + r = isp_getpdb(isp, chan, lp->handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; if (r != 0) { @@ -3829,7 +3809,6 @@ relogin: if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; - FC_SCRATCH_RELEASE(isp, chan); fcp->isp_loopstate = LOOP_FSCAN_DONE; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan done", chan); return (0); @@ -3856,7 +3835,7 @@ isp_login_device(ispsoftc_t *isp, int ch return (-1); /* Check if this handle is free. */ - r = isp_getpdb(isp, chan, handle, p, 0); + r = isp_getpdb(isp, chan, handle, p); if (r == 0) { if (p->portid != portid) { /* This handle is busy, try next one. */ @@ -3909,7 +3888,7 @@ isp_login_device(ispsoftc_t *isp, int ch * so we can crosscheck that it is still what we think it * is and that we also have the role it plays */ - r = isp_getpdb(isp, chan, handle, p, 0); + r = isp_getpdb(isp, chan, handle, p); if (r != 0) { isp_prt(isp, ISP_LOGERR, "Chan %d new device 0x%06x@0x%x disappeared", chan, portid, handle); return (-1); @@ -4013,8 +3992,8 @@ isp_register_fc4_type_24xx(ispsoftc_t *i pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (rft_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -4072,7 +4051,7 @@ isp_register_fc4_type_24xx(ispsoftc_t *i return (1); } - isp_get_ct_hdr(isp, (ct_hdr_t *) &scp[IGPOFF], ct); + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); if (ct->ct_cmd_resp == LS_RJT) { @@ -4125,8 +4104,8 @@ isp_register_fc4_features_24xx(ispsoftc_ pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (rff_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -4189,7 +4168,7 @@ isp_register_fc4_features_24xx(ispsoftc_ return (1); } - isp_get_ct_hdr(isp, (ct_hdr_t *) &scp[IGPOFF], ct); + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); if (ct->ct_cmd_resp == LS_RJT) { @@ -4877,7 +4856,7 @@ isp_control(ispsoftc_t *isp, ispctl_t ct tgt = va_arg(ap, int); pdb = va_arg(ap, isp_pdb_t *); va_end(ap); - return (isp_getpdb(isp, chan, tgt, pdb, 1)); + return (isp_getpdb(isp, chan, tgt, pdb)); } break; Modified: head/sys/dev/isp/ispvar.h ============================================================================== --- head/sys/dev/isp/ispvar.h Sun Dec 27 06:16:02 2015 (r292764) +++ head/sys/dev/isp/ispvar.h Sun Dec 27 06:28:31 2015 (r292765) @@ -77,7 +77,7 @@ struct ispmdvec { */ #define MAX_TARGETS 16 #ifndef MAX_FC_TARG -#define MAX_FC_TARG 256 +#define MAX_FC_TARG 1024 #endif #define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS) #define ISP_MAX_LUNS(isp) (isp)->isp_maxluns @@ -472,6 +472,8 @@ typedef struct { */ void * isp_scratch; XS_DMA_ADDR_T isp_scdma; + + uint8_t isp_scanscratch[ISP_FC_SCRLEN]; } fcparam; #define FW_CONFIG_WAIT 0 From owner-svn-src-head@freebsd.org Sun Dec 27 07:39:45 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 CF14FA4C862; Sun, 27 Dec 2015 07:39:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9D3CD1F98; Sun, 27 Dec 2015 07:39:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR7dioI052343; Sun, 27 Dec 2015 07:39:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR7diMm052342; Sun, 27 Dec 2015 07:39:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512270739.tBR7diMm052342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 27 Dec 2015 07:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292766 - head/sys/mips/atheros 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, 27 Dec 2015 07:39:45 -0000 Author: adrian Date: Sun Dec 27 07:39:44 2015 New Revision: 292766 URL: https://svnweb.freebsd.org/changeset/base/292766 Log: Fix missing path conversion from the previous commit to shuffle mdio around. It turns out the recent work to cut down the number of atheros kernels built didnt include one with ARGE_MDIO defined.. Modified: head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Sun Dec 27 06:28:31 2015 (r292765) +++ head/sys/mips/atheros/if_arge.c Sun Dec 27 07:39:44 2015 (r292766) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include "opt_arge.h" #if defined(ARGE_MDIO) -#include +#include #include #include "mdio_if.h" #endif From owner-svn-src-head@freebsd.org Sun Dec 27 07:50: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 E4D4CA4CBE4; Sun, 27 Dec 2015 07:50:13 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A8BA113D8; Sun, 27 Dec 2015 07:50:13 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR7oCea055298; Sun, 27 Dec 2015 07:50:12 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR7oCrv055290; Sun, 27 Dec 2015 07:50:12 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201512270750.tBR7oCrv055290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 27 Dec 2015 07:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292767 - in head: include lib/libc/stdlib 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, 27 Dec 2015 07:50:14 -0000 Author: ed Date: Sun Dec 27 07:50:11 2015 New Revision: 292767 URL: https://svnweb.freebsd.org/changeset/base/292767 Log: Replace implementation of hsearch() by one that scales. Traditionally the hcreate() function creates a hash table that uses chaining, using a fixed user-provided size. The problem with this approach is that this often either wastes memory (table too big) or yields bad performance (table too small). For applications it may not always be easy to estimate the right hash table size. A fixed number only increases performance compared to a linked list by a constant factor. This problem can be solved easily by dynamically resizing the hash table. If the size of the hash table is at least doubled, this has no negative on the running time complexity. If a dynamically sized hash table is used, we can also switch to using open addressing instead of chaining, which has the advantage of just using a single allocation for the entire table, instead of allocating many small objects. Finally, a problem with the existing implementation is that its deterministic algorithm for hashing makes it possible to come up with fixed patterns to trigger an excessive number of collisions. We can easily solve this by using FNV-1a as a hashing algorithm in combination with a randomly generated offset basis. Measurements have shown that this implementation is about 20-25% faster than the existing implementation (even if the existing implementation is given an excessive number of buckets). Though it allocates more memory through malloc() than the old implementation (between 4-8 pointers per used entry instead of 3), process memory use is similar to the old implementation as if the estimated size was underestimated by a factor 10. This is due to the fact that malloc() needs to perform less bookkeeping. Reviewed by: jilles, pfg Obtained from: https://github.com/NuxiNL/cloudlibc Differential Revision: https://reviews.freebsd.org/D4644 Added: head/lib/libc/stdlib/hcreate_r.c (contents, props changed) head/lib/libc/stdlib/hdestroy_r.c (contents, props changed) head/lib/libc/stdlib/hsearch.h (contents, props changed) head/lib/libc/stdlib/hsearch_r.c (contents, props changed) Replaced: head/lib/libc/stdlib/hcreate.c (contents, props changed) Modified: head/include/search.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/hcreate.3 Modified: head/include/search.h ============================================================================== --- head/include/search.h Sun Dec 27 07:39:44 2015 (r292766) +++ head/include/search.h Sun Dec 27 07:50:11 2015 (r292767) @@ -47,11 +47,8 @@ struct que_elem { #endif #if __BSD_VISIBLE -struct _ENTRY; struct hsearch_data { - struct _ENTRY *table; - size_t size; - size_t filled; + struct __hsearch *__hsearch; }; #endif Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Sun Dec 27 07:39:44 2015 (r292766) +++ head/lib/libc/stdlib/Makefile.inc Sun Dec 27 07:50:11 2015 (r292767) @@ -6,7 +6,8 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \ - getsubopt.c hcreate.c heapsort.c heapsort_b.c imaxabs.c imaxdiv.c \ + getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ + hsearch_r.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \ radixsort.c rand.c \ Modified: head/lib/libc/stdlib/hcreate.3 ============================================================================== --- head/lib/libc/stdlib/hcreate.3 Sun Dec 27 07:39:44 2015 (r292766) +++ head/lib/libc/stdlib/hcreate.3 Sun Dec 27 07:50:11 2015 (r292767) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2014 +.Dd December 26, 2015 .Dt HCREATE 3 .Os .Sh NAME @@ -76,8 +76,8 @@ The .Fa nel argument is an estimate of the maximum number of entries that the table should contain. -This number may be adjusted upward by the -algorithm in order to obtain certain mathematically favorable circumstances. +As this implementation resizes the hash table dynamically, +this argument is ignored. .Pp The .Fn hdestroy @@ -274,8 +274,6 @@ functions will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Insufficient memory is available. -.It Bq Er EINVAL -A table already exists. .El .Pp The Added: head/lib/libc/stdlib/hcreate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/hcreate.c Sun Dec 27 07:50:11 2015 (r292767) @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * 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 + +/* + * Thread unsafe interface: use a single process-wide hash table and + * forward calls to *_r() functions. + */ + +static struct hsearch_data global_hashtable; +static bool global_hashtable_initialized = false; + +int +hcreate(size_t nel) +{ + + return (1); +} + +void +hdestroy(void) +{ + + /* Destroy global hash table if present. */ + if (global_hashtable_initialized) { + hdestroy_r(&global_hashtable); + global_hashtable_initialized = false; + } +} + +ENTRY * +hsearch(ENTRY item, ACTION action) +{ + ENTRY *retval; + + /* Create global hash table if needed. */ + if (!global_hashtable_initialized) { + if (hcreate_r(0, &global_hashtable) == 0) + return (NULL); + global_hashtable_initialized = true; + } + if (hsearch_r(item, action, &retval, &global_hashtable) == 0) + return (NULL); + return (retval); +} Added: head/lib/libc/stdlib/hcreate_r.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/hcreate_r.c Sun Dec 27 07:50:11 2015 (r292767) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * 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 "hsearch.h" + +int +hcreate_r(size_t nel, struct hsearch_data *htab) +{ + struct __hsearch *hsearch; + + /* + * Allocate a hash table object. Ignore the provided hint and start + * off with a table of sixteen entries. In most cases this hint is + * just a wild guess. Resizing the table dynamically if the use + * increases a threshold does not affect the worst-case running time. + */ + hsearch = malloc(sizeof(*hsearch)); + if (hsearch == NULL) + return 0; + hsearch->entries = calloc(16, sizeof(ENTRY)); + if (hsearch->entries == NULL) { + free(hsearch); + return 0; + } + + /* + * Pick a random initialization for the FNV-1a hashing. This makes it + * hard to come up with a fixed set of keys to force hash collisions. + */ + arc4random_buf(&hsearch->offset_basis, sizeof(hsearch->offset_basis)); + hsearch->index_mask = 0xf; + hsearch->entries_used = 0; + htab->__hsearch = hsearch; + return 1; +} Added: head/lib/libc/stdlib/hdestroy_r.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/hdestroy_r.c Sun Dec 27 07:50:11 2015 (r292767) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * 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 "hsearch.h" + +void +hdestroy_r(struct hsearch_data *htab) +{ + struct __hsearch *hsearch; + + /* Free hash table object and its entries. */ + hsearch = htab->__hsearch; + free(hsearch->entries); + free(hsearch); +} Added: head/lib/libc/stdlib/hsearch.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/hsearch.h Sun Dec 27 07:50:11 2015 (r292767) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef HSEARCH_H +#define HSEARCH_H + +#include + +struct __hsearch { + size_t offset_basis; /* Initial value for FNV-1a hashing. */ + size_t index_mask; /* Bitmask for indexing the table. */ + size_t entries_used; /* Number of entries currently used. */ + ENTRY *entries; /* Hash table entries. */ +}; + +#endif Added: head/lib/libc/stdlib/hsearch_r.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/hsearch_r.c Sun Dec 27 07:50:11 2015 (r292767) @@ -0,0 +1,150 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * 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 "hsearch.h" + +/* + * Look up an unused entry in the hash table for a given hash. For this + * implementation we use quadratic probing. Quadratic probing has the + * advantage of preventing primary clustering. + */ +static ENTRY * +hsearch_lookup_free(struct __hsearch *hsearch, size_t hash) +{ + size_t index, i; + + for (index = hash, i = 0;; index += ++i) { + ENTRY *entry = &hsearch->entries[index & hsearch->index_mask]; + if (entry->key == NULL) + return (entry); + } +} + +/* + * Computes an FNV-1a hash of the key. Depending on the pointer size, this + * either uses the 32- or 64-bit FNV prime. + */ +static size_t +hsearch_hash(size_t offset_basis, const char *str) +{ + size_t hash; + + hash = offset_basis; + while (*str != '\0') { + hash ^= (uint8_t)*str++; + if (sizeof(size_t) * CHAR_BIT <= 32) + hash *= UINT32_C(16777619); + else + hash *= UINT64_C(1099511628211); + } + return (hash); +} + +int +hsearch_r(ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab) +{ + struct __hsearch *hsearch; + ENTRY *entry, *old_entries, *new_entries; + size_t hash, index, i, old_hash, old_count, new_count; + + hsearch = htab->__hsearch; + hash = hsearch_hash(hsearch->offset_basis, item.key); + + /* + * Search the hash table for an existing entry for this key. + * Stop searching if we run into an unused hash table entry. + */ + for (index = hash, i = 0;; index += ++i) { + entry = &hsearch->entries[index & hsearch->index_mask]; + if (entry->key == NULL) + break; + if (strcmp(entry->key, item.key) == 0) { + *retval = entry; + return (1); + } + } + + /* Only perform the insertion if action is set to ENTER. */ + if (action == FIND) { + errno = ESRCH; + return (0); + } + + if (hsearch->entries_used * 2 >= hsearch->index_mask) { + /* Preserve the old hash table entries. */ + old_count = hsearch->index_mask + 1; + old_entries = hsearch->entries; + + /* + * Allocate and install a new table if insertion would + * yield a hash table that is more than 50% used. By + * using 50% as a threshold, a lookup will only take up + * to two steps on average. + */ + new_count = (hsearch->index_mask + 1) * 2; + new_entries = calloc(new_count, sizeof(ENTRY)); + if (new_entries == NULL) + return (0); + hsearch->entries = new_entries; + hsearch->index_mask = new_count - 1; + + /* Copy over the entries from the old table to the new table. */ + for (i = 0; i < old_count; ++i) { + entry = &old_entries[i]; + if (entry->key != NULL) { + old_hash = hsearch_hash(hsearch->offset_basis, + entry->key); + *hsearch_lookup_free(hsearch, old_hash) = + *entry; + } + } + + /* Destroy the old hash table entries. */ + free(old_entries); + + /* + * Perform a new lookup for a free table entry, so that + * we insert the entry into the new hash table. + */ + hsearch = htab->__hsearch; + entry = hsearch_lookup_free(hsearch, hash); + } + + /* Insert the new entry into the hash table. */ + *entry = item; + ++hsearch->entries_used; + *retval = entry; + return (1); +} From owner-svn-src-head@freebsd.org Sun Dec 27 14:42: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 1A224A521CE; Sun, 27 Dec 2015 14:42:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D90301322; Sun, 27 Dec 2015 14:42:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBREgd6n079656; Sun, 27 Dec 2015 14:42:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBREgdRr079655; Sun, 27 Dec 2015 14:42:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512271442.tBREgdRr079655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Dec 2015 14:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292772 - 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: Sun, 27 Dec 2015 14:42:41 -0000 Author: kib Date: Sun Dec 27 14:42:39 2015 New Revision: 292772 URL: https://svnweb.freebsd.org/changeset/base/292772 Log: Add missed relpbuf() for a smallfs page-in. Reported by: Shawn Webb Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sun Dec 27 14:39:47 2015 (r292771) +++ head/sys/vm/vnode_pager.c Sun Dec 27 14:42:39 2015 (r292772) @@ -806,6 +806,7 @@ vnode_pager_generic_getpages(struct vnod * than a page size, then use special small filesystem code. */ if (pagesperblock == 0) { + relpbuf(bp, freecnt); for (i = 0; i < count; i++) { PCPU_INC(cnt.v_vnodein); PCPU_INC(cnt.v_vnodepgsin); From owner-svn-src-head@freebsd.org Sun Dec 27 15:37: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 23AAEA5324C; Sun, 27 Dec 2015 15:37:09 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D94BB10BA; Sun, 27 Dec 2015 15:37:08 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRFb82U095300; Sun, 27 Dec 2015 15:37:08 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRFb7nN095297; Sun, 27 Dec 2015 15:37:07 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201512271537.tBRFb7nN095297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 27 Dec 2015 15:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292777 - in head: lib/libc/sys 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: Sun, 27 Dec 2015 15:37:09 -0000 Author: dchagin Date: Sun Dec 27 15:37:07 2015 New Revision: 292777 URL: https://svnweb.freebsd.org/changeset/base/292777 Log: Verify that tv_sec value specified in settimeofday() and clock_settime() (CLOCK_REALTIME case) system calls is non negative. This commit hides a kernel panic in atrtc_settime() as the clock_ts_to_ct() does not properly convert negative tv_sec. ps. in my opinion clock_ts_to_ct() should be rewritten to properly handle negative tv_sec values. Differential Revision: https://reviews.freebsd.org/D4714 Reviewed by: kib MFC after: 1 week Modified: head/lib/libc/sys/clock_gettime.2 head/lib/libc/sys/gettimeofday.2 head/sys/kern/kern_time.c Modified: head/lib/libc/sys/clock_gettime.2 ============================================================================== --- head/lib/libc/sys/clock_gettime.2 Sun Dec 27 15:30:13 2015 (r292776) +++ head/lib/libc/sys/clock_gettime.2 Sun Dec 27 15:37:07 2015 (r292777) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2015 +.Dd December 27, 2015 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -134,6 +134,8 @@ The following error codes may be set in .It Bq Er EINVAL The .Fa clock_id +or +.Fa timespec argument was not a valid value. .It Bq Er EPERM Modified: head/lib/libc/sys/gettimeofday.2 ============================================================================== --- head/lib/libc/sys/gettimeofday.2 Sun Dec 27 15:30:13 2015 (r292776) +++ head/lib/libc/sys/gettimeofday.2 Sun Dec 27 15:37:07 2015 (r292777) @@ -28,7 +28,7 @@ .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 .\" $FreeBSD$ .\" -.Dd December 20, 2015 +.Dd December 27, 2015 .Dt GETTIMEOFDAY 2 .Os .Sh NAME @@ -110,6 +110,10 @@ system call even when the system is secu The following error codes may be set in .Va errno : .Bl -tag -width Er +.It Bq Er EINVAL +The supplied +.Fa timeval +value is invalid. .It Bq Er EPERM A user other than the super-user attempted to set the time. .El Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Sun Dec 27 15:30:13 2015 (r292776) +++ head/sys/kern/kern_time.c Sun Dec 27 15:37:07 2015 (r292777) @@ -398,7 +398,8 @@ kern_clock_settime(struct thread *td, cl return (error); if (clock_id != CLOCK_REALTIME) return (EINVAL); - if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000) + if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || + ats->tv_sec < 0) return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(&atv, ats); @@ -618,7 +619,8 @@ kern_settimeofday(struct thread *td, str return (error); /* Verify all parameters before changing time. */ if (tv) { - if (tv->tv_usec < 0 || tv->tv_usec >= 1000000) + if (tv->tv_usec < 0 || tv->tv_usec >= 1000000 || + tv->tv_sec < 0) return (EINVAL); error = settime(td, tv); } From owner-svn-src-head@freebsd.org Sun Dec 27 17:09: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 D920DA52CA7; Sun, 27 Dec 2015 17:09:24 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A98C717CA; Sun, 27 Dec 2015 17:09:24 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRH9NJR023038; Sun, 27 Dec 2015 17:09:23 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRH9NCt023037; Sun, 27 Dec 2015 17:09:23 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512271709.tBRH9NCt023037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Dec 2015 17:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292779 - head/sys/geom 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, 27 Dec 2015 17:09:24 -0000 Author: allanjude Date: Sun Dec 27 17:09:23 2015 New Revision: 292779 URL: https://svnweb.freebsd.org/changeset/base/292779 Log: Fix incorrect error message in geom map If geom_map fails to find the end of a mapped partition based on a search, it would return the incorrect error message, stating it could not parse the START value Reviewed by: adrian Approved by: bapt (mentor) Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D4187 Modified: head/sys/geom/geom_map.c Modified: head/sys/geom/geom_map.c ============================================================================== --- head/sys/geom/geom_map.c Sun Dec 27 15:55:15 2015 (r292778) +++ head/sys/geom/geom_map.c Sun Dec 27 17:09:23 2015 (r292779) @@ -259,7 +259,7 @@ g_map_parse_part(struct g_class *mp, str } if (find_marker(cp, value, &end) != 0) { if (bootverbose) { - printf("MAP: \"%s\" can't parse/use start value\n", + printf("MAP: \"%s\" can't parse/use end value\n", name); } return (1); From owner-svn-src-head@freebsd.org Sun Dec 27 17:10:45 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 E608EA52D36 for ; Sun, 27 Dec 2015 17:10:45 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from erouter6.ore.mailhop.org (erouter6.ore.mailhop.org [54.187.213.119]) (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 CA44619AA for ; Sun, 27 Dec 2015 17:10:45 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound3.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sun, 27 Dec 2015 17:10:02 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBRHAbVv012229; Sun, 27 Dec 2015 10:10:37 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451236237.1369.9.camel@freebsd.org> Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: Ian Lepore To: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 27 Dec 2015 10:10:37 -0700 In-Reply-To: <201512271537.tBRFb7nN095297@repo.freebsd.org> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Sun, 27 Dec 2015 17:10:46 -0000 On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Sun Dec 27 15:37:07 2015 > New Revision: 292777 > URL: https://svnweb.freebsd.org/changeset/base/292777 > > Log: > Verify that tv_sec value specified in settimeofday() and > clock_settime() > (CLOCK_REALTIME case) system calls is non negative. > This commit hides a kernel panic in atrtc_settime() as the > clock_ts_to_ct() > does not properly convert negative tv_sec. > > ps. in my opinion clock_ts_to_ct() should be rewritten to properly > handle > negative tv_sec values. > > Differential Revision: https://reviews.freebsd.org/D4714 > Reviewed by: kib > > MFC after: 1 week IMO, this change is completely unacceptable. If there is a bug in atrtc code, then by all means fix it, but preventing anyone from setting valid time values on the system because one driver's code can't handle it is just wrong. -- Ian From owner-svn-src-head@freebsd.org Sun Dec 27 17:34: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 CBFCDA535F5; Sun, 27 Dec 2015 17:34:03 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6976F1572; Sun, 27 Dec 2015 17:34:03 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRHY2oS031860; Sun, 27 Dec 2015 17:34:02 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHXxgN031823; Sun, 27 Dec 2015 17:33:59 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512271733.tBRHXxgN031823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Dec 2015 17:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292782 - in head: lib/libcrypt lib/libmd sbin/gbde sbin/geom/class/eli sbin/md5 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/conf sys/crypto/sha2 sys/dev/random sys/geom/bde 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, 27 Dec 2015 17:34:04 -0000 Author: allanjude Date: Sun Dec 27 17:33:59 2015 New Revision: 292782 URL: https://svnweb.freebsd.org/changeset/base/292782 Log: Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c cperciva's libmd implementation is 5-30% faster The same was done for SHA256 previously in r263218 cperciva's implementation was lacking SHA-384 which I implemented, validated against OpenSSL and the NIST documentation Extend sbin/md5 to create sha384(1) Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with sha512{c.c,.h} Reviewed by: cperciva, des, delphij Approved by: secteam, bapt (mentor) MFC after: 2 weeks Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3929 Added: head/sys/crypto/sha2/sha384.h (contents, props changed) head/sys/crypto/sha2/sha512.h - copied, changed from r292757, head/lib/libmd/sha512.h head/sys/crypto/sha2/sha512c.c - copied, changed from r289398, head/lib/libmd/sha512c.c Deleted: head/lib/libmd/sha512.h head/lib/libmd/sha512c.c head/sys/crypto/sha2/sha2.c head/sys/crypto/sha2/sha2.h Modified: head/lib/libcrypt/Makefile head/lib/libmd/Makefile head/lib/libmd/sha512.3 head/lib/libmd/shadriver.c head/sbin/gbde/Makefile head/sbin/gbde/gbde.c head/sbin/geom/class/eli/Makefile head/sbin/md5/Makefile head/sbin/md5/md5.1 head/sbin/md5/md5.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c head/sys/conf/files head/sys/crypto/sha2/sha256.h head/sys/dev/random/build.sh head/sys/dev/random/fortuna.c head/sys/dev/random/hash.c head/sys/dev/random/other_algorithm.c head/sys/dev/random/randomdev.c head/sys/dev/random/unit_test.c head/sys/dev/random/yarrow.c head/sys/geom/bde/g_bde.c head/sys/geom/bde/g_bde_crypt.c head/sys/geom/bde/g_bde_lock.c head/sys/geom/bde/g_bde_work.c head/sys/geom/eli/g_eli.h head/sys/modules/crypto/Makefile head/sys/modules/geom/geom_bde/Makefile head/sys/modules/zfs/Makefile head/sys/netinet/sctp_os_bsd.h head/sys/opencrypto/xform.h Modified: head/lib/libcrypt/Makefile ============================================================================== --- head/lib/libcrypt/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/lib/libcrypt/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -30,6 +30,7 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BL .for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ + SHA384_Init SHA384_Final SHA384_Update \ SHA512_Init SHA512_Final SHA512_Update CFLAGS+= -D${sym}=__${sym} .endfor Modified: head/lib/libmd/Makefile ============================================================================== --- head/lib/libmd/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/lib/libmd/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -7,8 +7,9 @@ SRCS= md4c.c md5c.c md4hl.c md5hl.c \ rmd160c.c rmd160hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ sha256c.c sha256hl.c \ + sha384hl.c \ sha512c.c sha512hl.c -INCS= md4.h md5.h ripemd.h sha.h sha256.h sha512.h +INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h WARNS?= 0 @@ -33,6 +34,10 @@ MLINKS+=sha256.3 SHA256_Init.3 sha256.3 MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 MLINKS+=sha256.3 SHA256_Data.3 +MLINKS+=sha512.3 SHA384_Init.3 sha512.3 SHA384_Update.3 +MLINKS+=sha512.3 SHA384_Final.3 sha512.3 SHA384_End.3 +MLINKS+=sha512.3 SHA384_File.3 sha512.3 SHA384_FileChunk.3 +MLINKS+=sha512.3 SHA384_Data.3 sha512.3 sha384.3 MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3 MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 @@ -40,7 +45,8 @@ MLINKS+=sha512.3 SHA512_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ - sha256.ref sha256hl.c sha512.ref sha512hl.c + sha256.ref sha256hl.c sha384hl.c sha384.ref \ + sha512.ref sha512hl.c # Define WEAK_REFS to provide weak aliases for libmd symbols # @@ -88,6 +94,12 @@ sha256hl.c: mdXhl.c -e 's/SHA256__/SHA256_/g' \ ${.ALLSRC}) > ${.TARGET} +sha384hl.c: mdXhl.c + (echo '#define LENGTH 48'; \ + sed -e 's/mdX/sha384/g' -e 's/MDX/SHA384_/g' \ + -e 's/SHA384__/SHA384_/g' \ + ${.ALLSRC}) > ${.TARGET} + sha512hl.c: mdXhl.c (echo '#define LENGTH 64'; \ sed -e 's/mdX/sha512/g' -e 's/MDX/SHA512_/g' \ @@ -168,6 +180,21 @@ sha256.ref: @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ 'f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} +sha384.ref: + echo 'SHA-384 test suite:' > ${.TARGET} + @echo 'SHA-384 ("") =' \ + '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b' >> ${.TARGET} + @echo 'SHA-384 ("abc") =' \ + 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7' >> ${.TARGET} + @echo 'SHA-384 ("message digest") =' \ + '473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5' >> ${.TARGET} + @echo 'SHA-384 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4' >> ${.TARGET} + @echo 'SHA-384 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84' >> ${.TARGET} + @echo 'SHA-384 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026' >> ${.TARGET} + sha512.ref: echo 'SHA-512 test suite:' > ${.TARGET} @echo 'SHA-512 ("") =' \ @@ -196,7 +223,8 @@ rmd160.ref: @echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ '9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET} -test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref +test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \ + sha512.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c libmd.a @@ -219,6 +247,9 @@ test: md4.ref md5.ref sha0.ref rmd160.re ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=384 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha384.ref - + @${ECHO} SHA-384 passed test ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha512.ref - @${ECHO} SHA-512 passed test Modified: head/lib/libmd/sha512.3 ============================================================================== --- head/lib/libmd/sha512.3 Sun Dec 27 17:19:46 2015 (r292781) +++ head/lib/libmd/sha512.3 Sun Dec 27 17:33:59 2015 (r292782) @@ -9,7 +9,7 @@ .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp .\" $FreeBSD$ .\" -.Dd March 28, 2014 +.Dd October 17, 2015 .Dt SHA512 3 .Os .Sh NAME @@ -19,8 +19,15 @@ .Nm SHA512_End , .Nm SHA512_File , .Nm SHA512_FileChunk , -.Nm SHA512_Data -.Nd calculate the FIPS 180-2 ``SHA-512'' message digest +.Nm SHA512_Data , +.Nm SHA384_Init , +.Nm SHA384_Update , +.Nm SHA384_Final , +.Nm SHA384_End , +.Nm SHA384_File , +.Nm SHA384_FileChunk , +.Nm SHA384_Data +.Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests .Sh LIBRARY .Lb libmd .Sh SYNOPSIS @@ -40,6 +47,20 @@ .Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" .Ft "char *" .Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" +.Ft void +.Fn SHA384_Init "SHA384_CTX *context" +.Ft void +.Fn SHA384_Update "SHA384_CTX *context" "const unsigned char *data" "size_t len" +.Ft void +.Fn SHA384_Final "unsigned char digest[48]" "SHA384_CTX *context" +.Ft "char *" +.Fn SHA384_End "SHA384_CTX *context" "char *buf" +.Ft "char *" +.Fn SHA384_File "const char *filename" "char *buf" +.Ft "char *" +.Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" +.Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf" .Sh DESCRIPTION The .Li SHA512_ @@ -119,6 +140,21 @@ after use. If the .Fa buf argument is non-null it must point to at least 65 characters of buffer space. +.Pp +The +.Li SHA384_ +functions are identical to the +.Li SHA512_ +functions except they use a different initial hash value and the output is +truncated to 384 bits. +.Pp +.Fn SHA384_End +is a wrapper for +.Fn SHA384_Final +which converts the return value to a 49-character +(including the terminating '\e0') +.Tn ASCII +string which represents the 384 bits in hexadecimal. .Sh SEE ALSO .Xr md4 3 , .Xr md5 3 , Modified: head/lib/libmd/shadriver.c ============================================================================== --- head/lib/libmd/shadriver.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/lib/libmd/shadriver.c Sun Dec 27 17:33:59 2015 (r292782) @@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$"); #include "sha.h" #include "sha256.h" +#include "sha384.h" #include "sha512.h" /* The following makes SHA default to SHA-1 if it has not already been @@ -36,6 +37,9 @@ __FBSDID("$FreeBSD$"); #elif SHA == 256 #undef SHA_Data #define SHA_Data SHA256_Data +#elif SHA == 384 +#undef SHA_Data +#define SHA_Data SHA384_Data #elif SHA == 512 #undef SHA_Data #define SHA_Data SHA512_Data Modified: head/sbin/gbde/Makefile ============================================================================== --- head/sbin/gbde/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/gbde/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -4,7 +4,7 @@ PROG= gbde SRCS= gbde.c template.c SRCS+= rijndael-alg-fst.c SRCS+= rijndael-api-fst.c -SRCS+= sha2.c +SRCS+= sha512c.c SRCS+= g_bde_lock.c # rijndael-fst.c does evil casting things which can results in warnings, Modified: head/sbin/gbde/gbde.c ============================================================================== --- head/sbin/gbde/gbde.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/gbde/gbde.c Sun Dec 27 17:33:59 2015 (r292782) @@ -84,7 +84,7 @@ #include #include #include -#include +#include #include #include Modified: head/sbin/geom/class/eli/Makefile ============================================================================== --- head/sbin/geom/class/eli/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/geom/class/eli/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -6,7 +6,8 @@ GEOM_CLASS= eli SRCS= g_eli_crypto.c SRCS+= g_eli_key.c SRCS+= pkcs5v2.c -SRCS+= sha2.c +SRCS+= sha256c.c +SRCS+= sha512c.c LIBADD= md crypto Modified: head/sbin/md5/Makefile ============================================================================== --- head/sbin/md5/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/md5/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -6,11 +6,13 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha384 \ ${BINDIR}/md5 ${BINDIR}/sha512 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 \ + md5.1 sha384.1 \ md5.1 sha512.1 LIBADD= md Modified: head/sbin/md5/md5.1 ============================================================================== --- head/sbin/md5/md5.1 Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/md5/md5.1 Sun Dec 27 17:33:59 2015 (r292782) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd May 17, 2014 +.Dd October 17, 2015 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha512, rmd160 +.Nm md5 , sha1 , sha256 , sha384 , sha512, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,6 +21,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha384 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm sha512 .Op Fl pqrtx .Op Fl c Ar string @@ -33,7 +38,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha512 +.Nm md5 , sha1 , sha256 , sha384 , sha512 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -46,7 +51,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 , SHA-512 +.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -123,6 +128,7 @@ option. .Xr ripemd 3 , .Xr sha 3 , .Xr sha256 3 , +.Xr sha384 3 , .Xr sha512 3 .Rs .%A R. Rivest Modified: head/sbin/md5/md5.c ============================================================================== --- head/sbin/md5/md5.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sbin/md5/md5.c Sun Dec 27 17:33:59 2015 (r292782) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; +extern const char *SHA384_TestOutput[MDTESTCOUNT]; extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; @@ -80,6 +82,7 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; + SHA384_CTX sha384; SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; @@ -101,6 +104,9 @@ static const struct Algorithm_t Algorith { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, + { "sha384", "SHA384", &SHA384_TestOutput, (DIGEST_Init*)&SHA384_Init, + (DIGEST_Update*)&SHA384_Update, (DIGEST_End*)&SHA384_End, + &SHA384_Data, &SHA384_File }, { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, &SHA512_Data, &SHA512_File }, @@ -327,6 +333,17 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; +const char *SHA384_TestOutput[MDTESTCOUNT] = { + "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", + "54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", + "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", + "473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5", + "feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4", + "1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84", + "b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026", + "99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb" +}; + const char *SHA512_TestOutput[MDTESTCOUNT] = { "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c Sun Dec 27 17:33:59 2015 (r292782) @@ -28,7 +28,7 @@ #include #include #ifdef _KERNEL -#include +#include #else #include #endif Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/conf/files Sun Dec 27 17:33:59 2015 (r292782) @@ -557,10 +557,9 @@ crypto/rijndael/rijndael-api-fst.c optio crypto/rijndael/rijndael-api.c optional crypto | ipsec | wlan_ccmp crypto/sha1.c optional carp | crypto | ipsec | \ netgraph_mppc_encryption | sctp -crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random !random_loadable | \ - sctp | zfs crypto/sha2/sha256c.c optional crypto | geom_bde | ipsec | random !random_loadable | \ sctp | zfs +crypto/sha2/sha512c.c optional crypto | geom_bde | ipsec | zfs crypto/siphash/siphash.c optional inet | inet6 crypto/siphash/siphash_test.c optional inet | inet6 ddb/db_access.c optional ddb Modified: head/sys/crypto/sha2/sha256.h ============================================================================== --- head/sys/crypto/sha2/sha256.h Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/crypto/sha2/sha256.h Sun Dec 27 17:33:59 2015 (r292782) @@ -33,10 +33,14 @@ #include #endif +#define SHA256_BLOCK_LENGTH 64 +#define SHA256_DIGEST_LENGTH 32 +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) + typedef struct SHA256Context { uint32_t state[8]; uint64_t count; - uint8_t buf[64]; + uint8_t buf[SHA256_BLOCK_LENGTH]; } SHA256_CTX; __BEGIN_DECLS @@ -74,10 +78,10 @@ __BEGIN_DECLS void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); -void SHA256_Final(unsigned char [32], SHA256_CTX *); +void SHA256_Final(unsigned char [SHA256_DIGEST_LENGTH], SHA256_CTX *); +#ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); -#ifndef _KERNEL char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif Added: head/sys/crypto/sha2/sha384.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/sha2/sha384.h Sun Dec 27 17:33:59 2015 (r292782) @@ -0,0 +1,87 @@ +/*- + * Copyright 2005 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SHA384_H_ +#define _SHA384_H_ + +#ifndef _KERNEL +#include +#endif + +#define SHA384_BLOCK_LENGTH 128 +#define SHA384_DIGEST_LENGTH 48 +#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) + +typedef struct SHA384Context { + uint64_t state[8]; + uint64_t count[2]; + uint8_t buf[SHA384_BLOCK_LENGTH]; +} SHA384_CTX; + +__BEGIN_DECLS + +/* Ensure libmd symbols do not clash with libcrypto */ +#ifndef SHA384_Init +#define SHA384_Init _libmd_SHA384_Init +#endif +#ifndef SHA384_Update +#define SHA384_Update _libmd_SHA384_Update +#endif +#ifndef SHA384_Final +#define SHA384_Final _libmd_SHA384_Final +#endif +#ifndef SHA384_End +#define SHA384_End _libmd_SHA384_End +#endif +#ifndef SHA384_File +#define SHA384_File _libmd_SHA384_File +#endif +#ifndef SHA384_FileChunk +#define SHA384_FileChunk _libmd_SHA384_FileChunk +#endif +#ifndef SHA384_Data +#define SHA384_Data _libmd_SHA384_Data +#endif + +#ifndef SHA384_version +#define SHA384_version _libmd_SHA384_version +#endif + +void SHA384_Init(SHA384_CTX *); +void SHA384_Update(SHA384_CTX *, const void *, size_t); +void SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *); +#ifndef _KERNEL +char *SHA384_End(SHA384_CTX *, char *); +char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_File(const char *, char *); +char *SHA384_FileChunk(const char *, char *, off_t, off_t); +#endif + +__END_DECLS + +#endif /* !_SHA384_H_ */ Copied and modified: head/sys/crypto/sha2/sha512.h (from r292757, head/lib/libmd/sha512.h) ============================================================================== --- head/lib/libmd/sha512.h Sat Dec 26 19:48:36 2015 (r292757, copy source) +++ head/sys/crypto/sha2/sha512.h Sun Dec 27 17:33:59 2015 (r292782) @@ -29,18 +29,23 @@ #ifndef _SHA512_H_ #define _SHA512_H_ +#ifndef _KERNEL #include +#endif + +#define SHA512_BLOCK_LENGTH 128 +#define SHA512_DIGEST_LENGTH 64 +#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) typedef struct SHA512Context { uint64_t state[8]; uint64_t count[2]; - unsigned char buf[128]; + uint8_t buf[SHA512_BLOCK_LENGTH]; } SHA512_CTX; __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ - #ifndef SHA512_Init #define SHA512_Init _libmd_SHA512_Init #endif @@ -72,11 +77,14 @@ __BEGIN_DECLS void SHA512_Init(SHA512_CTX *); void SHA512_Update(SHA512_CTX *, const void *, size_t); -void SHA512_Final(unsigned char [64], SHA512_CTX *); +void SHA512_Final(unsigned char [SHA512_DIGEST_LENGTH], SHA512_CTX *); +#ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); +char *SHA512_Data(const void *, unsigned int, char *); char *SHA512_File(const char *, char *); char *SHA512_FileChunk(const char *, char *, off_t, off_t); -char *SHA512_Data(const void *, unsigned int, char *); +#endif + __END_DECLS #endif /* !_SHA512_H_ */ Copied and modified: head/sys/crypto/sha2/sha512c.c (from r289398, head/lib/libmd/sha512c.c) ============================================================================== --- head/lib/libmd/sha512c.c Thu Oct 15 23:49:05 2015 (r289398, copy source) +++ head/sys/crypto/sha2/sha512c.c Sun Dec 27 17:33:59 2015 (r292782) @@ -30,9 +30,14 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef _KERNEL +#include +#else #include +#endif #include "sha512.h" +#include "sha384.h" #if BYTE_ORDER == BIG_ENDIAN @@ -104,7 +109,7 @@ be64dec_vect(uint64_t *dst, const unsign * the 512-bit input block to produce a new state. */ static void -SHA512_Transform(uint64_t * state, const unsigned char block[128]) +SHA512_Transform(uint64_t * state, const unsigned char block[SHA512_BLOCK_LENGTH]) { uint64_t W[80]; uint64_t S[8]; @@ -112,12 +117,12 @@ SHA512_Transform(uint64_t * state, const int i; /* 1. Prepare message schedule W. */ - be64dec_vect(W, block, 128); + be64dec_vect(W, block, SHA512_BLOCK_LENGTH); for (i = 16; i < 80; i++) W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; /* 2. Initialize working variables. */ - memcpy(S, state, 64); + memcpy(S, state, SHA512_DIGEST_LENGTH); /* 3. Mix. */ RNDr(S, W, 0, 0x428a2f98d728ae22ULL); @@ -206,7 +211,7 @@ SHA512_Transform(uint64_t * state, const state[i] += S[i]; } -static unsigned char PAD[128] = { +static unsigned char PAD[SHA512_BLOCK_LENGTH] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -279,22 +284,22 @@ SHA512_Update(SHA512_CTX * ctx, const vo ctx->count[0] += bitlen[0]; /* Handle the case where we don't need to perform any transforms */ - if (len < 128 - r) { + if (len < SHA512_BLOCK_LENGTH - r) { memcpy(&ctx->buf[r], src, len); return; } /* Finish the current block */ - memcpy(&ctx->buf[r], src, 128 - r); + memcpy(&ctx->buf[r], src, SHA512_BLOCK_LENGTH - r); SHA512_Transform(ctx->state, ctx->buf); - src += 128 - r; - len -= 128 - r; + src += SHA512_BLOCK_LENGTH - r; + len -= SHA512_BLOCK_LENGTH - r; /* Perform complete blocks */ - while (len >= 128) { + while (len >= SHA512_BLOCK_LENGTH) { SHA512_Transform(ctx->state, src); - src += 128; - len -= 128; + src += SHA512_BLOCK_LENGTH; + len -= SHA512_BLOCK_LENGTH; } /* Copy left over data into buffer */ @@ -306,14 +311,64 @@ SHA512_Update(SHA512_CTX * ctx, const vo * and clears the context state. */ void -SHA512_Final(unsigned char digest[64], SHA512_CTX * ctx) +SHA512_Final(unsigned char digest[SHA512_DIGEST_LENGTH], SHA512_CTX * ctx) { /* Add padding */ SHA512_Pad(ctx); /* Write the hash */ - be64enc_vect(digest, ctx->state, 64); + be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +/*** SHA-384: *********************************************************/ +/* + * the SHA384 and SHA512 transforms are identical, so SHA384 is skipped + */ + +/* SHA-384 initialization. Begins a SHA-384 operation. */ +void +SHA384_Init(SHA384_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0xcbbb9d5dc1059ed8ULL; + ctx->state[1] = 0x629a292a367cd507ULL; + ctx->state[2] = 0x9159015a3070dd17ULL; + ctx->state[3] = 0x152fecd8f70e5939ULL; + ctx->state[4] = 0x67332667ffc00b31ULL; + ctx->state[5] = 0x8eb44a8768581511ULL; + ctx->state[6] = 0xdb0c2e0d64f98fa7ULL; + ctx->state[7] = 0x47b5481dbefa4fa4ULL; +} + +/* Add bytes into the SHA-384 hash */ +void +SHA384_Update(SHA384_CTX * ctx, const void *in, size_t len) +{ + + SHA512_Update((SHA512_CTX *)ctx, in, len); +} + +/* + * SHA-384 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +SHA384_Final(unsigned char digest[SHA384_DIGEST_LENGTH], SHA384_CTX * ctx) +{ + + /* Add padding */ + SHA512_Pad((SHA512_CTX *)ctx); + + /* Write the hash */ + be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH); /* Clear the context state */ memset((void *)ctx, 0, sizeof(*ctx)); @@ -332,4 +387,11 @@ __weak_reference(_libmd_SHA512_Update, S __weak_reference(_libmd_SHA512_Final, SHA512_Final); #undef SHA512_Transform __weak_reference(_libmd_SHA512_Transform, SHA512_Transform); + +#undef SHA384_Init +__weak_reference(_libmd_SHA384_Init, SHA384_Init); +#undef SHA384_Update +__weak_reference(_libmd_SHA384_Update, SHA384_Update); +#undef SHA384_Final +__weak_reference(_libmd_SHA384_Final, SHA384_Final); #endif Modified: head/sys/dev/random/build.sh ============================================================================== --- head/sys/dev/random/build.sh Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/build.sh Sun Dec 27 17:33:59 2015 (r292782) @@ -42,7 +42,6 @@ cc -g -O0 -pthread \ hash.c \ ../../crypto/rijndael/rijndael-api-fst.c \ ../../crypto/rijndael/rijndael-alg-fst.c \ - ../../crypto/sha2/sha2.c \ ../../crypto/sha2/sha256c.c \ -lz \ -o yunit_test @@ -53,7 +52,6 @@ cc -g -O0 -pthread \ hash.c \ ../../crypto/rijndael/rijndael-api-fst.c \ ../../crypto/rijndael/rijndael-alg-fst.c \ - ../../crypto/sha2/sha2.c \ ../../crypto/sha2/sha256c.c \ -lz \ -o funit_test Modified: head/sys/dev/random/fortuna.c ============================================================================== --- head/sys/dev/random/fortuna.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/fortuna.c Sun Dec 27 17:33:59 2015 (r292782) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #include "unit_test.h" #include -#include +#include #include #include Modified: head/sys/dev/random/hash.c ============================================================================== --- head/sys/dev/random/hash.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/hash.c Sun Dec 27 17:33:59 2015 (r292782) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #endif /* _KERNEL */ #include -#include +#include #include Modified: head/sys/dev/random/other_algorithm.c ============================================================================== --- head/sys/dev/random/other_algorithm.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/other_algorithm.c Sun Dec 27 17:33:59 2015 (r292782) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/dev/random/randomdev.c ============================================================================== --- head/sys/dev/random/randomdev.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/randomdev.c Sun Dec 27 17:33:59 2015 (r292782) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/dev/random/unit_test.c ============================================================================== --- head/sys/dev/random/unit_test.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/unit_test.c Sun Dec 27 17:33:59 2015 (r292782) @@ -36,7 +36,7 @@ cc -g -O0 -pthread -DRANDOM_ -I../. hash.c \ ../../crypto/rijndael/rijndael-api-fst.c \ ../../crypto/rijndael/rijndael-alg-fst.c \ - ../../crypto/sha2/sha2.c \ + ../../crypto/sha2/sha256c.c \ -lz \ -o unit_test ./unit_test Modified: head/sys/dev/random/yarrow.c ============================================================================== --- head/sys/dev/random/yarrow.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/dev/random/yarrow.c Sun Dec 27 17:33:59 2015 (r292782) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include "unit_test.h" #include -#include +#include #include #include Modified: head/sys/geom/bde/g_bde.c ============================================================================== --- head/sys/geom/bde/g_bde.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/geom/bde/g_bde.c Sun Dec 27 17:33:59 2015 (r292782) @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include #define BDE_CLASS_NAME "BDE" Modified: head/sys/geom/bde/g_bde_crypt.c ============================================================================== --- head/sys/geom/bde/g_bde_crypt.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/geom/bde/g_bde_crypt.c Sun Dec 27 17:33:59 2015 (r292782) @@ -47,7 +47,7 @@ #include #include -#include +#include #include #include Modified: head/sys/geom/bde/g_bde_lock.c ============================================================================== --- head/sys/geom/bde/g_bde_lock.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/geom/bde/g_bde_lock.c Sun Dec 27 17:33:59 2015 (r292782) @@ -58,7 +58,7 @@ #endif #include -#include +#include #include #include Modified: head/sys/geom/bde/g_bde_work.c ============================================================================== --- head/sys/geom/bde/g_bde_work.c Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/geom/bde/g_bde_work.c Sun Dec 27 17:33:59 2015 (r292782) @@ -71,7 +71,7 @@ #include #include -#include +#include #include #include Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/geom/eli/g_eli.h Sun Dec 27 17:33:59 2015 (r292782) @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include #include #ifdef _KERNEL #include Modified: head/sys/modules/crypto/Makefile ============================================================================== --- head/sys/modules/crypto/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/modules/crypto/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -16,7 +16,7 @@ SRCS += cast.c cryptodeflate.c rmd160.c SRCS += skipjack.c bf_enc.c bf_ecb.c bf_skey.c SRCS += camellia.c camellia-api.c SRCS += des_ecb.c des_enc.c des_setkey.c -SRCS += sha1.c sha2.c sha256c.c +SRCS += sha1.c sha256c.c sha512c.c SRCS += siphash.c SRCS += gmac.c gfmult.c SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h Modified: head/sys/modules/geom/geom_bde/Makefile ============================================================================== --- head/sys/modules/geom/geom_bde/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/modules/geom/geom_bde/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -6,6 +6,6 @@ KMOD= geom_bde SRCS= g_bde.c g_bde_crypt.c g_bde_lock.c g_bde_work.c -SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c sha256c.c +SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha256c.c sha512c.c .include Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/modules/zfs/Makefile Sun Dec 27 17:33:59 2015 (r292782) @@ -68,7 +68,7 @@ SRCS+= zmod_subr.c SRCS+= zutil.c .PATH: ${SYSDIR}/crypto/sha2 -SRCS+= sha2.c sha256c.c +SRCS+= sha256c.c sha512c.c .PATH: ${SUNW}/common/zfs .include "${SUNW}/uts/common/Makefile.files" Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/netinet/sctp_os_bsd.h Sun Dec 27 17:33:59 2015 (r292782) @@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #ifndef in6pcb #define in6pcb inpcb Modified: head/sys/opencrypto/xform.h ============================================================================== --- head/sys/opencrypto/xform.h Sun Dec 27 17:19:46 2015 (r292781) +++ head/sys/opencrypto/xform.h Sun Dec 27 17:33:59 2015 (r292782) @@ -33,7 +33,9 @@ #include #include -#include +#include +#include +#include #include #include From owner-svn-src-head@freebsd.org Sun Dec 27 18:12: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 86F82A52104; Sun, 27 Dec 2015 18:12:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 521C51C9E; Sun, 27 Dec 2015 18:12:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRICDWo044567; Sun, 27 Dec 2015 18:12:13 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRICD3A044563; Sun, 27 Dec 2015 18:12:13 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512271812.tBRICD3A044563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Dec 2015 18:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292788 - in head/sys: geom/part 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, 27 Dec 2015 18:12:14 -0000 Author: allanjude Date: Sun Dec 27 18:12:13 2015 New Revision: 292788 URL: https://svnweb.freebsd.org/changeset/base/292788 Log: Add some additional GPT partition types 4 ChromeOS GPT types 2 Microsoft partition types the new OpenBSD partition type Approved by: marcel (mentor) MFC after: 1 week Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3841 Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part.h head/sys/geom/part/g_part_gpt.c head/sys/sys/gpt.h Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Sun Dec 27 17:58:58 2015 (r292787) +++ head/sys/geom/part/g_part.c Sun Dec 27 18:12:13 2015 (r292788) @@ -78,6 +78,19 @@ struct g_part_alias_list { { "apple-tv-recovery", G_PART_ALIAS_APPLE_TV_RECOVERY }, { "apple-ufs", G_PART_ALIAS_APPLE_UFS }, { "bios-boot", G_PART_ALIAS_BIOS_BOOT }, + { "chromeos-firmware", G_PART_ALIAS_CHROMEOS_FIRMWARE }, + { "chromeos-kernel", G_PART_ALIAS_CHROMEOS_KERNEL }, + { "chromeos-reserved", G_PART_ALIAS_CHROMEOS_RESERVED }, + { "chromeos-root", G_PART_ALIAS_CHROMEOS_ROOT }, + { "dragonfly-ccd", G_PART_ALIAS_DFBSD_CCD }, + { "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER }, + { "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 }, + { "dragonfly-label32", G_PART_ALIAS_DFBSD }, + { "dragonfly-label64", G_PART_ALIAS_DFBSD64 }, + { "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY }, + { "dragonfly-swap", G_PART_ALIAS_DFBSD_SWAP }, + { "dragonfly-ufs", G_PART_ALIAS_DFBSD_UFS }, + { "dragonfly-vinum", G_PART_ALIAS_DFBSD_VINUM }, { "ebr", G_PART_ALIAS_EBR }, { "efi", G_PART_ALIAS_EFI }, { "fat16", G_PART_ALIAS_MS_FAT16 }, @@ -97,28 +110,22 @@ struct g_part_alias_list { { "ms-basic-data", G_PART_ALIAS_MS_BASIC_DATA }, { "ms-ldm-data", G_PART_ALIAS_MS_LDM_DATA }, { "ms-ldm-metadata", G_PART_ALIAS_MS_LDM_METADATA }, + { "ms-recovery", G_PART_ALIAS_MS_RECOVERY }, { "ms-reserved", G_PART_ALIAS_MS_RESERVED }, - { "ntfs", G_PART_ALIAS_MS_NTFS }, + { "ms-spaces", G_PART_ALIAS_MS_SPACES }, { "netbsd-ccd", G_PART_ALIAS_NETBSD_CCD }, { "netbsd-cgd", G_PART_ALIAS_NETBSD_CGD }, { "netbsd-ffs", G_PART_ALIAS_NETBSD_FFS }, { "netbsd-lfs", G_PART_ALIAS_NETBSD_LFS }, { "netbsd-raid", G_PART_ALIAS_NETBSD_RAID }, { "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP }, + { "ntfs", G_PART_ALIAS_MS_NTFS }, + { "openbsd-data", G_PART_ALIAS_OPENBSD_DATA }, + { "prep-boot", G_PART_ALIAS_PREP_BOOT }, + { "vmware-reserved", G_PART_ALIAS_VMRESERVED }, { "vmware-vmfs", G_PART_ALIAS_VMFS }, { "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG }, - { "vmware-reserved", G_PART_ALIAS_VMRESERVED }, { "vmware-vsanhdr", G_PART_ALIAS_VMVSANHDR }, - { "dragonfly-label32", G_PART_ALIAS_DFBSD }, - { "dragonfly-label64", G_PART_ALIAS_DFBSD64 }, - { "dragonfly-swap", G_PART_ALIAS_DFBSD_SWAP }, - { "dragonfly-ufs", G_PART_ALIAS_DFBSD_UFS }, - { "dragonfly-vinum", G_PART_ALIAS_DFBSD_VINUM }, - { "dragonfly-ccd", G_PART_ALIAS_DFBSD_CCD }, - { "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY }, - { "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER }, - { "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 }, - { "prep-boot", G_PART_ALIAS_PREP_BOOT }, }; SYSCTL_DECL(_kern_geom); Modified: head/sys/geom/part/g_part.h ============================================================================== --- head/sys/geom/part/g_part.h Sun Dec 27 17:58:58 2015 (r292787) +++ head/sys/geom/part/g_part.h Sun Dec 27 18:12:13 2015 (r292788) @@ -37,12 +37,28 @@ enum g_part_alias { G_PART_ALIAS_APPLE_BOOT, /* An Apple boot partition entry. */ + G_PART_ALIAS_APPLE_CORE_STORAGE,/* An Apple Core Storage partition. */ G_PART_ALIAS_APPLE_HFS, /* An HFS+ file system entry. */ G_PART_ALIAS_APPLE_LABEL, /* An Apple label partition entry. */ G_PART_ALIAS_APPLE_RAID, /* An Apple RAID partition entry. */ G_PART_ALIAS_APPLE_RAID_OFFLINE,/* An Apple RAID (offline) part entry.*/ G_PART_ALIAS_APPLE_TV_RECOVERY, /* An Apple TV recovery part entry. */ G_PART_ALIAS_APPLE_UFS, /* An Apple UFS partition entry. */ + G_PART_ALIAS_BIOS_BOOT, /* A GRUB 2 boot partition entry. */ + G_PART_ALIAS_CHROMEOS_FIRMWARE, /* A ChromeOS firmware part. entry. */ + G_PART_ALIAS_CHROMEOS_KERNEL, /* A ChromeOS Kernel part. entry. */ + G_PART_ALIAS_CHROMEOS_RESERVED, /* ChromeOS. Reserved for future use. */ + G_PART_ALIAS_CHROMEOS_ROOT, /* A ChromeOS root part. entry. */ + G_PART_ALIAS_DFBSD, /* A DfBSD label32 partition entry */ + G_PART_ALIAS_DFBSD64, /* A DfBSD label64 partition entry */ + G_PART_ALIAS_DFBSD_CCD, /* A DfBSD CCD partition entry */ + G_PART_ALIAS_DFBSD_HAMMER, /* A DfBSD HAMMER FS partition entry */ + G_PART_ALIAS_DFBSD_HAMMER2, /* A DfBSD HAMMER2 FS partition entry */ + G_PART_ALIAS_DFBSD_LEGACY, /* A DfBSD legacy partition entry */ + G_PART_ALIAS_DFBSD_SWAP, /* A DfBSD swap partition entry */ + G_PART_ALIAS_DFBSD_UFS, /* A DfBSD UFS partition entry */ + G_PART_ALIAS_DFBSD_VINUM, /* A DfBSD Vinum partition entry */ + G_PART_ALIAS_EBR, /* A EBR partition entry. */ G_PART_ALIAS_EFI, /* A EFI system partition entry. */ G_PART_ALIAS_FREEBSD, /* A BSD labeled partition entry. */ G_PART_ALIAS_FREEBSD_BOOT, /* A FreeBSD boot partition entry. */ @@ -51,41 +67,32 @@ enum g_part_alias { G_PART_ALIAS_FREEBSD_UFS, /* A UFS/UFS2 file system entry. */ G_PART_ALIAS_FREEBSD_VINUM, /* A Vinum partition entry. */ G_PART_ALIAS_FREEBSD_ZFS, /* A ZFS file system entry. */ - G_PART_ALIAS_MBR, /* A MBR (extended) partition entry. */ G_PART_ALIAS_LINUX_DATA, /* A Linux data partition entry. */ G_PART_ALIAS_LINUX_LVM, /* A Linux LVM partition entry. */ G_PART_ALIAS_LINUX_RAID, /* A Linux RAID partition entry. */ G_PART_ALIAS_LINUX_SWAP, /* A Linux swap partition entry. */ + G_PART_ALIAS_MBR, /* A MBR (extended) partition entry. */ G_PART_ALIAS_MS_BASIC_DATA, /* A Microsoft Data part. entry. */ + G_PART_ALIAS_MS_FAT16, /* A Microsoft FAT16 partition entry. */ + G_PART_ALIAS_MS_FAT32, /* A Microsoft FAT32 partition entry. */ G_PART_ALIAS_MS_LDM_DATA, /* A Microsoft LDM Data part. entry. */ G_PART_ALIAS_MS_LDM_METADATA, /* A Microsoft LDM Metadata entry. */ - G_PART_ALIAS_MS_RESERVED, /* A Microsoft Reserved part. entry. */ G_PART_ALIAS_MS_NTFS, /* A Microsoft NTFS partition entry */ + G_PART_ALIAS_MS_RECOVERY, /* A Microsoft recovery part. entry. */ + G_PART_ALIAS_MS_RESERVED, /* A Microsoft Reserved part. entry. */ + G_PART_ALIAS_MS_SPACES, /* A Microsoft Spaces part. entry. */ G_PART_ALIAS_NETBSD_CCD, /* A NetBSD CCD partition entry. */ G_PART_ALIAS_NETBSD_CGD, /* A NetBSD CGD partition entry. */ G_PART_ALIAS_NETBSD_FFS, /* A NetBSD FFS partition entry. */ + G_PART_ALIAS_NETBSD_LFS, /* A NetBSD LFS partition entry. */ G_PART_ALIAS_NETBSD_RAID, /* A NetBSD RAID partition entry. */ G_PART_ALIAS_NETBSD_SWAP, /* A NetBSD swap partition entry. */ - G_PART_ALIAS_NETBSD_LFS, /* A NetBSD LFS partition entry. */ - G_PART_ALIAS_EBR, /* A EBR partition entry. */ - G_PART_ALIAS_MS_FAT16, /* A Microsoft FAT16 partition entry. */ - G_PART_ALIAS_MS_FAT32, /* A Microsoft FAT32 partition entry. */ - G_PART_ALIAS_BIOS_BOOT, /* A GRUB 2 boot partition entry. */ + G_PART_ALIAS_OPENBSD_DATA, /* An OpenBSD data partition entry. */ + G_PART_ALIAS_PREP_BOOT, /* A PREP/CHRP boot partition entry. */ G_PART_ALIAS_VMFS, /* A VMware VMFS partition entry */ G_PART_ALIAS_VMKDIAG, /* A VMware vmkDiagnostic partition entry */ G_PART_ALIAS_VMRESERVED, /* A VMware reserved partition entry */ G_PART_ALIAS_VMVSANHDR, /* A VMware vSAN header partition entry */ - G_PART_ALIAS_DFBSD, /* A DfBSD label32 partition entry */ - G_PART_ALIAS_DFBSD64, /* A DfBSD label64 partition entry */ - G_PART_ALIAS_DFBSD_SWAP, /* A DfBSD swap partition entry */ - G_PART_ALIAS_DFBSD_UFS, /* A DfBSD UFS partition entry */ - G_PART_ALIAS_DFBSD_VINUM, /* A DfBSD Vinum partition entry */ - G_PART_ALIAS_DFBSD_CCD, /* A DfBSD CCD partition entry */ - G_PART_ALIAS_DFBSD_LEGACY, /* A DfBSD legacy partition entry */ - G_PART_ALIAS_DFBSD_HAMMER, /* A DfBSD HAMMER FS partition entry */ - G_PART_ALIAS_DFBSD_HAMMER2, /* A DfBSD HAMMER2 FS partition entry */ - G_PART_ALIAS_PREP_BOOT, /* A PREP/CHRP boot partition entry. */ - G_PART_ALIAS_APPLE_CORE_STORAGE,/* An Apple Core Storage partition. */ /* Keep the following last */ G_PART_ALIAS_COUNT }; Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Sun Dec 27 17:58:58 2015 (r292787) +++ head/sys/geom/part/g_part_gpt.c Sun Dec 27 18:12:13 2015 (r292788) @@ -155,6 +155,19 @@ static struct uuid gpt_uuid_apple_raid_o static struct uuid gpt_uuid_apple_tv_recovery = GPT_ENT_TYPE_APPLE_TV_RECOVERY; static struct uuid gpt_uuid_apple_ufs = GPT_ENT_TYPE_APPLE_UFS; static struct uuid gpt_uuid_bios_boot = GPT_ENT_TYPE_BIOS_BOOT; +static struct uuid gpt_uuid_chromeos_firmware = GPT_ENT_TYPE_CHROMEOS_FIRMWARE; +static struct uuid gpt_uuid_chromeos_kernel = GPT_ENT_TYPE_CHROMEOS_KERNEL; +static struct uuid gpt_uuid_chromeos_reserved = GPT_ENT_TYPE_CHROMEOS_RESERVED; +static struct uuid gpt_uuid_chromeos_root = GPT_ENT_TYPE_CHROMEOS_ROOT; +static struct uuid gpt_uuid_dfbsd_ccd = GPT_ENT_TYPE_DRAGONFLY_CCD; +static struct uuid gpt_uuid_dfbsd_hammer = GPT_ENT_TYPE_DRAGONFLY_HAMMER; +static struct uuid gpt_uuid_dfbsd_hammer2 = GPT_ENT_TYPE_DRAGONFLY_HAMMER2; +static struct uuid gpt_uuid_dfbsd_label32 = GPT_ENT_TYPE_DRAGONFLY_LABEL32; +static struct uuid gpt_uuid_dfbsd_label64 = GPT_ENT_TYPE_DRAGONFLY_LABEL64; +static struct uuid gpt_uuid_dfbsd_legacy = GPT_ENT_TYPE_DRAGONFLY_LEGACY; +static struct uuid gpt_uuid_dfbsd_swap = GPT_ENT_TYPE_DRAGONFLY_SWAP; +static struct uuid gpt_uuid_dfbsd_ufs1 = GPT_ENT_TYPE_DRAGONFLY_UFS1; +static struct uuid gpt_uuid_dfbsd_vinum = GPT_ENT_TYPE_DRAGONFLY_VINUM; static struct uuid gpt_uuid_efi = GPT_ENT_TYPE_EFI; static struct uuid gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; static struct uuid gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; @@ -167,32 +180,26 @@ static struct uuid gpt_uuid_linux_data = static struct uuid gpt_uuid_linux_lvm = GPT_ENT_TYPE_LINUX_LVM; static struct uuid gpt_uuid_linux_raid = GPT_ENT_TYPE_LINUX_RAID; static struct uuid gpt_uuid_linux_swap = GPT_ENT_TYPE_LINUX_SWAP; -static struct uuid gpt_uuid_vmfs = GPT_ENT_TYPE_VMFS; -static struct uuid gpt_uuid_vmkdiag = GPT_ENT_TYPE_VMKDIAG; -static struct uuid gpt_uuid_vmreserved = GPT_ENT_TYPE_VMRESERVED; -static struct uuid gpt_uuid_vmvsanhdr = GPT_ENT_TYPE_VMVSANHDR; +static struct uuid gpt_uuid_mbr = GPT_ENT_TYPE_MBR; static struct uuid gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; -static struct uuid gpt_uuid_ms_reserved = GPT_ENT_TYPE_MS_RESERVED; static struct uuid gpt_uuid_ms_ldm_data = GPT_ENT_TYPE_MS_LDM_DATA; static struct uuid gpt_uuid_ms_ldm_metadata = GPT_ENT_TYPE_MS_LDM_METADATA; +static struct uuid gpt_uuid_ms_recovery = GPT_ENT_TYPE_MS_RECOVERY; +static struct uuid gpt_uuid_ms_reserved = GPT_ENT_TYPE_MS_RESERVED; +static struct uuid gpt_uuid_ms_spaces = GPT_ENT_TYPE_MS_SPACES; static struct uuid gpt_uuid_netbsd_ccd = GPT_ENT_TYPE_NETBSD_CCD; static struct uuid gpt_uuid_netbsd_cgd = GPT_ENT_TYPE_NETBSD_CGD; static struct uuid gpt_uuid_netbsd_ffs = GPT_ENT_TYPE_NETBSD_FFS; static struct uuid gpt_uuid_netbsd_lfs = GPT_ENT_TYPE_NETBSD_LFS; static struct uuid gpt_uuid_netbsd_raid = GPT_ENT_TYPE_NETBSD_RAID; static struct uuid gpt_uuid_netbsd_swap = GPT_ENT_TYPE_NETBSD_SWAP; -static struct uuid gpt_uuid_mbr = GPT_ENT_TYPE_MBR; -static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; -static struct uuid gpt_uuid_dfbsd_swap = GPT_ENT_TYPE_DRAGONFLY_SWAP; -static struct uuid gpt_uuid_dfbsd_ufs1 = GPT_ENT_TYPE_DRAGONFLY_UFS1; -static struct uuid gpt_uuid_dfbsd_vinum = GPT_ENT_TYPE_DRAGONFLY_VINUM; -static struct uuid gpt_uuid_dfbsd_ccd = GPT_ENT_TYPE_DRAGONFLY_CCD; -static struct uuid gpt_uuid_dfbsd_legacy = GPT_ENT_TYPE_DRAGONFLY_LEGACY; -static struct uuid gpt_uuid_dfbsd_hammer = GPT_ENT_TYPE_DRAGONFLY_HAMMER; -static struct uuid gpt_uuid_dfbsd_hammer2 = GPT_ENT_TYPE_DRAGONFLY_HAMMER2; -static struct uuid gpt_uuid_dfbsd_label32 = GPT_ENT_TYPE_DRAGONFLY_LABEL32; -static struct uuid gpt_uuid_dfbsd_label64 = GPT_ENT_TYPE_DRAGONFLY_LABEL64; +static struct uuid gpt_uuid_openbsd_data = GPT_ENT_TYPE_OPENBSD_DATA; static struct uuid gpt_uuid_prep_boot = GPT_ENT_TYPE_PREP_BOOT; +static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; +static struct uuid gpt_uuid_vmfs = GPT_ENT_TYPE_VMFS; +static struct uuid gpt_uuid_vmkdiag = GPT_ENT_TYPE_VMKDIAG; +static struct uuid gpt_uuid_vmreserved = GPT_ENT_TYPE_VMRESERVED; +static struct uuid gpt_uuid_vmvsanhdr = GPT_ENT_TYPE_VMVSANHDR; static struct g_part_uuid_alias { struct uuid *uuid; @@ -208,6 +215,19 @@ static struct g_part_uuid_alias { { &gpt_uuid_apple_tv_recovery, G_PART_ALIAS_APPLE_TV_RECOVERY, 0 }, { &gpt_uuid_apple_ufs, G_PART_ALIAS_APPLE_UFS, 0 }, { &gpt_uuid_bios_boot, G_PART_ALIAS_BIOS_BOOT, 0 }, + { &gpt_uuid_chromeos_firmware, G_PART_ALIAS_CHROMEOS_FIRMWARE, 0 }, + { &gpt_uuid_chromeos_kernel, G_PART_ALIAS_CHROMEOS_KERNEL, 0 }, + { &gpt_uuid_chromeos_reserved, G_PART_ALIAS_CHROMEOS_RESERVED, 0 }, + { &gpt_uuid_chromeos_root, G_PART_ALIAS_CHROMEOS_ROOT, 0 }, + { &gpt_uuid_dfbsd_ccd, G_PART_ALIAS_DFBSD_CCD, 0 }, + { &gpt_uuid_dfbsd_hammer, G_PART_ALIAS_DFBSD_HAMMER, 0 }, + { &gpt_uuid_dfbsd_hammer2, G_PART_ALIAS_DFBSD_HAMMER2, 0 }, + { &gpt_uuid_dfbsd_label32, G_PART_ALIAS_DFBSD, 0xa5 }, + { &gpt_uuid_dfbsd_label64, G_PART_ALIAS_DFBSD64, 0xa5 }, + { &gpt_uuid_dfbsd_legacy, G_PART_ALIAS_DFBSD_LEGACY, 0 }, + { &gpt_uuid_dfbsd_swap, G_PART_ALIAS_DFBSD_SWAP, 0 }, + { &gpt_uuid_dfbsd_ufs1, G_PART_ALIAS_DFBSD_UFS, 0 }, + { &gpt_uuid_dfbsd_vinum, G_PART_ALIAS_DFBSD_VINUM, 0 }, { &gpt_uuid_efi, G_PART_ALIAS_EFI, 0xee }, { &gpt_uuid_freebsd, G_PART_ALIAS_FREEBSD, 0xa5 }, { &gpt_uuid_freebsd_boot, G_PART_ALIAS_FREEBSD_BOOT, 0 }, @@ -220,31 +240,25 @@ static struct g_part_uuid_alias { { &gpt_uuid_linux_lvm, G_PART_ALIAS_LINUX_LVM, 0 }, { &gpt_uuid_linux_raid, G_PART_ALIAS_LINUX_RAID, 0 }, { &gpt_uuid_linux_swap, G_PART_ALIAS_LINUX_SWAP, 0 }, - { &gpt_uuid_vmfs, G_PART_ALIAS_VMFS, 0 }, - { &gpt_uuid_vmkdiag, G_PART_ALIAS_VMKDIAG, 0 }, - { &gpt_uuid_vmreserved, G_PART_ALIAS_VMRESERVED, 0 }, - { &gpt_uuid_vmvsanhdr, G_PART_ALIAS_VMVSANHDR, 0 }, { &gpt_uuid_mbr, G_PART_ALIAS_MBR, 0 }, { &gpt_uuid_ms_basic_data, G_PART_ALIAS_MS_BASIC_DATA, 0x0b }, { &gpt_uuid_ms_ldm_data, G_PART_ALIAS_MS_LDM_DATA, 0 }, { &gpt_uuid_ms_ldm_metadata, G_PART_ALIAS_MS_LDM_METADATA, 0 }, + { &gpt_uuid_ms_recovery, G_PART_ALIAS_MS_RECOVERY, 0 }, { &gpt_uuid_ms_reserved, G_PART_ALIAS_MS_RESERVED, 0 }, + { &gpt_uuid_ms_spaces, G_PART_ALIAS_MS_SPACES, 0 }, { &gpt_uuid_netbsd_ccd, G_PART_ALIAS_NETBSD_CCD, 0 }, { &gpt_uuid_netbsd_cgd, G_PART_ALIAS_NETBSD_CGD, 0 }, { &gpt_uuid_netbsd_ffs, G_PART_ALIAS_NETBSD_FFS, 0 }, { &gpt_uuid_netbsd_lfs, G_PART_ALIAS_NETBSD_LFS, 0 }, { &gpt_uuid_netbsd_raid, G_PART_ALIAS_NETBSD_RAID, 0 }, { &gpt_uuid_netbsd_swap, G_PART_ALIAS_NETBSD_SWAP, 0 }, - { &gpt_uuid_dfbsd_swap, G_PART_ALIAS_DFBSD_SWAP, 0 }, - { &gpt_uuid_dfbsd_ufs1, G_PART_ALIAS_DFBSD_UFS, 0 }, - { &gpt_uuid_dfbsd_vinum, G_PART_ALIAS_DFBSD_VINUM, 0 }, - { &gpt_uuid_dfbsd_ccd, G_PART_ALIAS_DFBSD_CCD, 0 }, - { &gpt_uuid_dfbsd_legacy, G_PART_ALIAS_DFBSD_LEGACY, 0 }, - { &gpt_uuid_dfbsd_hammer, G_PART_ALIAS_DFBSD_HAMMER, 0 }, - { &gpt_uuid_dfbsd_hammer2, G_PART_ALIAS_DFBSD_HAMMER2, 0 }, - { &gpt_uuid_dfbsd_label32, G_PART_ALIAS_DFBSD, 0xa5 }, - { &gpt_uuid_dfbsd_label64, G_PART_ALIAS_DFBSD64, 0xa5 }, + { &gpt_uuid_openbsd_data, G_PART_ALIAS_OPENBSD_DATA, 0 }, { &gpt_uuid_prep_boot, G_PART_ALIAS_PREP_BOOT, 0x41 }, + { &gpt_uuid_vmfs, G_PART_ALIAS_VMFS, 0 }, + { &gpt_uuid_vmkdiag, G_PART_ALIAS_VMKDIAG, 0 }, + { &gpt_uuid_vmreserved, G_PART_ALIAS_VMRESERVED, 0 }, + { &gpt_uuid_vmvsanhdr, G_PART_ALIAS_VMVSANHDR, 0 }, { NULL, 0, 0 } }; Modified: head/sys/sys/gpt.h ============================================================================== --- head/sys/sys/gpt.h Sun Dec 27 17:58:58 2015 (r292787) +++ head/sys/sys/gpt.h Sun Dec 27 18:12:13 2015 (r292788) @@ -107,14 +107,18 @@ struct gpt_ent { * advantage might be. I can see how sharing swap partitions is advantageous * though. */ -#define GPT_ENT_TYPE_MS_RESERVED \ - {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}} #define GPT_ENT_TYPE_MS_BASIC_DATA \ {0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}} -#define GPT_ENT_TYPE_MS_LDM_METADATA \ - {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}} #define GPT_ENT_TYPE_MS_LDM_DATA \ {0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}} +#define GPT_ENT_TYPE_MS_LDM_METADATA \ + {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}} +#define GPT_ENT_TYPE_MS_RECOVERY \ + {0xde94bba4,0x06d1,0x4d40,0xa1,0x6a,{0xbf,0xd5,0x01,0x79,0xd6,0xac}} +#define GPT_ENT_TYPE_MS_RESERVED \ + {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}} +#define GPT_ENT_TYPE_MS_SPACES \ + {0xe75caf8f,0xf680,0x4cee,0xaf,0xa3,{0xb0,0x01,0xe5,0x6e,0xfc,0x2d}} #define GPT_ENT_TYPE_LINUX_DATA \ {0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}} @@ -185,6 +189,18 @@ struct gpt_ent { #define GPT_ENT_TYPE_DRAGONFLY_HAMMER2 \ {0x5cbb9ad1,0x862d,0x11dc,0xa9,0x4d,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_CHROMEOS_FIRMWARE \ + {0xcab6e88e,0xabf3,0x4102,0xa0,0x7a,{0xd4,0xbb,0x9b,0xe3,0xc1,0xd3}} +#define GPT_ENT_TYPE_CHROMEOS_KERNEL \ + {0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}} +#define GPT_ENT_TYPE_CHROMEOS_RESERVED \ + {0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}} +#define GPT_ENT_TYPE_CHROMEOS_ROOT \ + {0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}} + +#define GPT_ENT_TYPE_OPENBSD_DATA \ + {0x824cc7a0,0x36a8,0x11e3,0x89,0x0a,{0x95,0x25,0x19,0xad,0x3f,0x61}} + /* * Boot partition used by GRUB 2. */ From owner-svn-src-head@freebsd.org Sun Dec 27 18:41: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 39A0AA5287F; Sun, 27 Dec 2015 18:41:11 +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 E02631789; Sun, 27 Dec 2015 18:41:10 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aDGFZ-000CSU-D0; Sun, 27 Dec 2015 21:41:01 +0300 Date: Sun, 27 Dec 2015 21:41:01 +0300 From: Slawa Olhovchenkov To: Ian Lepore Cc: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern Message-ID: <20151227184101.GG70867@zxy.spb.ru> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1451236237.1369.9.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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: Sun, 27 Dec 2015 18:41:11 -0000 On Sun, Dec 27, 2015 at 10:10:37AM -0700, Ian Lepore wrote: > On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Dec 27 15:37:07 2015 > > New Revision: 292777 > > URL: https://svnweb.freebsd.org/changeset/base/292777 > > > > Log: > > Verify that tv_sec value specified in settimeofday() and > > clock_settime() > > (CLOCK_REALTIME case) system calls is non negative. > > This commit hides a kernel panic in atrtc_settime() as the > > clock_ts_to_ct() > > does not properly convert negative tv_sec. > > > > ps. in my opinion clock_ts_to_ct() should be rewritten to properly > > handle > > negative tv_sec values. > > > > Differential Revision: https://reviews.freebsd.org/D4714 > > Reviewed by: kib > > > > MFC after: 1 week > > IMO, this change is completely unacceptable. If there is a bug in > atrtc code, then by all means fix it, but preventing anyone from > setting valid time values on the system because one driver's code can't > handle it is just wrong. You talk about kernel panic when internal data structures not destructed is normal behavior? Realy? From owner-svn-src-head@freebsd.org Sun Dec 27 19:08: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 04B7EA53024 for ; Sun, 27 Dec 2015 19:08:31 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::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 AB29D12B4 for ; Sun, 27 Dec 2015 19:08:30 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qg0-x22f.google.com with SMTP id o11so136076984qge.2 for ; Sun, 27 Dec 2015 11:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=351W88FJnaVUS4PdsXycttwLDre2rJG8Tqke2ipivC0=; b=BB1g0WlL92msI7ifWDYJ1/wazRCnrraiFwf1/riEg1G7MP+T1xfJpvD3Rk+segDyTk QAPeEWINvnKCuCUxcV7q2PWQnNKCdyRPnnNwYpTyPWjxB/FEjqtMiMk1msnHLKNewA4p 328W4vN0HeVADUHXgeC3sz5aC5qLTOA6bqw5sDrUxSEPam7+JMrdCz4E0UL8tf6E4jHH tU4BEELVF81HwInGxKvy3J4qy5q9IYTRJCN741aR/vw2bT2TLp3wp4VX0l3pMXVBUxFP YM+vPojmwI+tfpBrRybYShyVPCB7WEUWMdNcysGmo0/Nh1N+IVk0MiLHAmViT+2JIJNm 64sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=351W88FJnaVUS4PdsXycttwLDre2rJG8Tqke2ipivC0=; b=Fq3E4MmcuHcnvfR5S7DMapt/APgLvSAWe3IeN8utJydqkWk4c8LKGNqzy7+jDK9haI ja7dftLsUlcaC8Xo3Kh+U1LKZr/60Nv7VQXN2S0xPZnEfXElbZvKUd8d1Q5O9F26ZEQ/ 0qtglrJePQg3Uvkpiv22y5Qc4S1JeQlcVnU6l74Z5iWZK88lGxyOL0dN0eLjEpNnoHCk 4TJIo7KwhivISANcqNXy911G7zogAYRKUHVnzsMVotZW+8vMn0ldRU8APxdoaW6ZCUUL qEiBRj97e7y6/30EvURk3LB6zWJKqsSH6vVtqKypTgCztrhl1nYVvey2dtluZjIXAabL dU2g== X-Gm-Message-State: ALoCoQmlnBrYV2b9J25pmzarB+2nGy0IW1oJxWZVzvunC5Y8rGLm40di9+VO7DfHcoIK59JoK/3Id4UJ2sr3OVOFeMri9qr6sg== X-Received: by 10.140.161.137 with SMTP id h131mr69958043qhh.57.1451243309802; Sun, 27 Dec 2015 11:08:29 -0800 (PST) Received: from mutt-hardenedbsd (c-73-135-80-144.hsd1.md.comcast.net. [73.135.80.144]) by smtp.gmail.com with ESMTPSA id a71sm18845785qkj.42.2015.12.27.11.08.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Dec 2015 11:08:28 -0800 (PST) Date: Sun, 27 Dec 2015 14:08:26 -0500 From: Shawn Webb To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292772 - head/sys/vm Message-ID: <20151227190826.GB43841@mutt-hardenedbsd> References: <201512271442.tBREgdRr079655@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1LKvkjL3sHcu1TtY" Content-Disposition: inline In-Reply-To: <201512271442.tBREgdRr079655@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hardenedbsd 11.0-CURRENT-HBSD FreeBSD 11.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.5.24 (2015-08-30) 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, 27 Dec 2015 19:08:31 -0000 --1LKvkjL3sHcu1TtY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 27, 2015 at 02:42:39PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Sun Dec 27 14:42:39 2015 > New Revision: 292772 > URL: https://svnweb.freebsd.org/changeset/base/292772 >=20 > Log: > Add missed relpbuf() for a smallfs page-in. > =20 > Reported by: Shawn Webb > Tested by: pho > Sponsored by: The FreeBSD Foundation This should actually be Reported by: Shawn Debnath. It appears I didn't search bugzilla when I posted to freebsd-current@. His bug report came in seven days before my email. Thanks, --=20 Shawn Webb HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --1LKvkjL3sHcu1TtY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWgDcoAAoJEGqEZY9SRW7uYx0QAKpshDGaF158DBHvx7SpMKHH HSj72cT2gQwYqcLI0kRxA2xXFRhi91WKNAuuhK0rZIbomGJCqNnuFka6EM1ycATI mhUnE65eiHd67D0qDTPyVYsFOyC3Ya81hZTgtqoG8tyxs4zcj3G5uZeopwO8RqHR v69yZv3/RYpH6mJ47ejkLwe4Zoj8rcN8Ac+buTVMQj7Xb6jCeDIIrJUKL+ad6K3N OLDiHJGtMBLkDGJIjU1Jx2xi5TrH1sz3griOMMhIxS2/Fwo1IjD7+j0O9cFakRMJ 5vLR8VOqTmqCq/BJu/c1aHBU9mhwjOu4jNhPymCaTZmyfrVchiWX4kQ/N+Po/TE5 jz8l9JPRBwgQi1OJhlDuDJ9j35nlcpuIZfAH11+cMM8g7/6iQl0GLmPktVBV5m6z Lv11GXHW82Yk+xcI5fpbtOZw6mdX7rPx7EOFN6Nv+GmUVag3hzyGvz24VyELAlsd l7V8LwDsOZ5Yau9c9T6IGmeE9bvfB8pJmvxhzY1BIkuvdvSmfs+Fsa/kYKKV1jTp HSlO6SUIqGTv15aHWPbngHbzxS9gI2O+jcDK3pYiiDnsRSNKwYqmobSWSV5NjR2U TTQf8lP3ZUOggFZ9X3PxjDEE8NhArUfKpbZWAjvsx8dHaxM8ZlDXdK08B0Zr7B2Y f0N0vtmK6E9jmy3Q/OQu =ImYB -----END PGP SIGNATURE----- --1LKvkjL3sHcu1TtY-- From owner-svn-src-head@freebsd.org Sun Dec 27 19:16: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 83874A53298 for ; Sun, 27 Dec 2015 19:16:54 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from erouter6.ore.mailhop.org (erouter6.ore.mailhop.org [54.187.213.119]) (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 641D81889 for ; Sun, 27 Dec 2015 19:16:54 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound3.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sun, 27 Dec 2015 19:16:15 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBRJGobM012426; Sun, 27 Dec 2015 12:16:50 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451243810.1369.10.camel@freebsd.org> Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: Ian Lepore To: Slawa Olhovchenkov Cc: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 27 Dec 2015 12:16:50 -0700 In-Reply-To: <20151227184101.GG70867@zxy.spb.ru> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Sun, 27 Dec 2015 19:16:54 -0000 On Sun, 2015-12-27 at 21:41 +0300, Slawa Olhovchenkov wrote: > On Sun, Dec 27, 2015 at 10:10:37AM -0700, Ian Lepore wrote: > > > On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: > > > Author: dchagin > > > Date: Sun Dec 27 15:37:07 2015 > > > New Revision: 292777 > > > URL: https://svnweb.freebsd.org/changeset/base/292777 > > > > > > Log: > > > Verify that tv_sec value specified in settimeofday() and > > > clock_settime() > > > (CLOCK_REALTIME case) system calls is non negative. > > > This commit hides a kernel panic in atrtc_settime() as the > > > clock_ts_to_ct() > > > does not properly convert negative tv_sec. > > > > > > ps. in my opinion clock_ts_to_ct() should be rewritten to > > > properly > > > handle > > > negative tv_sec values. > > > > > > Differential Revision: https://reviews.freebsd.org/D4714 > > > Reviewed by: kib > > > > > > MFC after: 1 week > > > > IMO, this change is completely unacceptable. If there is a bug in > > atrtc code, then by all means fix it, but preventing anyone from > > setting valid time values on the system because one driver's code > > can't > > handle it is just wrong. > > You talk about kernel panic when internal data structures not > destructed is normal behavior? Realy? > I have no idea what you mean by that -- I didn't say anything at all about panic. -- Ian From owner-svn-src-head@freebsd.org Sun Dec 27 19:30: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 1A8B4A538E5; Sun, 27 Dec 2015 19:30:49 +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 C89A21E7C; Sun, 27 Dec 2015 19:30:48 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aDH1i-000DW5-Np; Sun, 27 Dec 2015 22:30:46 +0300 Date: Sun, 27 Dec 2015 22:30:46 +0300 From: Slawa Olhovchenkov To: Ian Lepore Cc: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern Message-ID: <20151227193046.GE4535@zxy.spb.ru> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> <1451243810.1369.10.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1451243810.1369.10.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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: Sun, 27 Dec 2015 19:30:49 -0000 On Sun, Dec 27, 2015 at 12:16:50PM -0700, Ian Lepore wrote: > On Sun, 2015-12-27 at 21:41 +0300, Slawa Olhovchenkov wrote: > > On Sun, Dec 27, 2015 at 10:10:37AM -0700, Ian Lepore wrote: > > > > > On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: > > > > Author: dchagin > > > > Date: Sun Dec 27 15:37:07 2015 > > > > New Revision: 292777 > > > > URL: https://svnweb.freebsd.org/changeset/base/292777 > > > > > > > > Log: > > > > Verify that tv_sec value specified in settimeofday() and > > > > clock_settime() > > > > (CLOCK_REALTIME case) system calls is non negative. > > > > This commit hides a kernel panic in atrtc_settime() as the > > > > clock_ts_to_ct() > > > > does not properly convert negative tv_sec. > > > > > > > > ps. in my opinion clock_ts_to_ct() should be rewritten to > > > > properly > > > > handle > > > > negative tv_sec values. > > > > > > > > Differential Revision: https://reviews.freebsd.org/D4714 > > > > Reviewed by: kib > > > > > > > > MFC after: 1 week > > > > > > IMO, this change is completely unacceptable. If there is a bug in > > > atrtc code, then by all means fix it, but preventing anyone from > > > setting valid time values on the system because one driver's code > > > can't > > > handle it is just wrong. > > > > You talk about kernel panic when internal data structures not > > destructed is normal behavior? Realy? > > > > I have no idea what you mean by that -- I didn't say anything at all > about panic. As I understund commit log -- this is prevent kernel panic at some call (with illegal arguments). This accpetable irrelevant to bugs in calling code. From owner-svn-src-head@freebsd.org Sun Dec 27 20:05: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 67B6AA5232A; Sun, 27 Dec 2015 20:05:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::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 3AD3F1758; Sun, 27 Dec 2015 20:05:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id q63so66969349pfb.0; Sun, 27 Dec 2015 12:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qYpQWQnp58DoltxSZDlR/0YjUvYCqKxmM3NG14i0DNg=; b=QpoON1MBZXcVOa3yBwd+CfNUMpSWZIxSGBuRCogmTvpKJzFhhA5xxhqunfF+xtnSpZ JLyRCUjvr1hLmh0FIrxibWnvlaQW+Czdf0vR9/MTwtxUmpZ+8n6/16/aI26a4AobkWsZ ebXZqnwfmfVDbbKogZK2e70zSdYEnKLDWbsGjJTJ2mAb8D5hEyvUgYiaWC2Y0fQ8wpcu bbE6uoZk5+CXRWULWcrE4Ai9Y1ShCecGR3uNrBQYxQcPRxt6WU3bXrfd/x+vD28A4WGD 1QyOTkxbywvtRrMjz0C7j1pL4Cdj15QDQetsHDEfxOd2c32yEKJ77vqxVWKPn0B5Y84N /kWA== X-Received: by 10.98.68.146 with SMTP id m18mr50942527pfi.77.1451246727842; Sun, 27 Dec 2015 12:05:27 -0800 (PST) Received: from ?IPv6:2601:601:800:126d:fd97:b044:5389:fa9b? ([2601:601:800:126d:fd97:b044:5389:fa9b]) by smtp.gmail.com with ESMTPSA id q27sm27981560pfi.83.2015.12.27.12.05.25 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 12:05:26 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: NGie Cooper In-Reply-To: <20151227193046.GE4535@zxy.spb.ru> Date: Sun, 27 Dec 2015 12:05:24 -0800 Cc: Ian Lepore , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <8D7D617E-FF9E-4D74-87CB-1F3EE65D108A@gmail.com> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> <1451243810.1369.10.camel@freebsd.org> <20151227193046.GE4535@zxy.spb.ru> To: Slawa Olhovchenkov X-Mailer: Apple Mail (2.2104) 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, 27 Dec 2015 20:05:28 -0000 > On Dec 27, 2015, at 11:30, Slawa Olhovchenkov wrote: =E2=80=A6 >> I have no idea what you mean by that -- I didn't say anything at all >> about panic. >=20 > As I understund commit log -- this is prevent kernel panic at some > call (with illegal arguments). This accpetable irrelevant to bugs in > calling code. This also makes us POSIX compliant and more compatible with = Linux: = http://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_settime.html = (search for =E2=80=9Cnegative=E2=80=9D). Thanks kib! -NGie= From owner-svn-src-head@freebsd.org Sun Dec 27 20:25: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 49E01A52914 for ; Sun, 27 Dec 2015 20:25:37 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 2B9771F6B for ; Sun, 27 Dec 2015 20:25:36 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound2.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sun, 27 Dec 2015 20:24:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBRKOSYV012518; Sun, 27 Dec 2015 13:24:28 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451247868.1369.16.camel@freebsd.org> Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: Ian Lepore To: NGie Cooper , Slawa Olhovchenkov Cc: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 27 Dec 2015 13:24:28 -0700 In-Reply-To: <8D7D617E-FF9E-4D74-87CB-1F3EE65D108A@gmail.com> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> <1451243810.1369.10.camel@freebsd.org> <20151227193046.GE4535@zxy.spb.ru> <8D7D617E-FF9E-4D74-87CB-1F3EE65D108A@gmail.com> Content-Type: text/plain; charset="windows-1251" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 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, 27 Dec 2015 20:25:37 -0000 On Sun, 2015-12-27 at 12:05 -0800, NGie Cooper wrote: > > On Dec 27, 2015, at 11:30, Slawa Olhovchenkov > > wrote: > > … > > > > I have no idea what you mean by that -- I didn't say anything at > > > all > > > about panic. > > > > As I understund commit log -- this is prevent kernel panic at some > > call (with illegal arguments). This accpetable irrelevant to bugs > > in > > calling code. > > This also makes us POSIX compliant and more compatible with > Linux: > http://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_settime.html > (search for “negative”). > Thanks kib! > -NGie This thread just keeps becoming more and more surrealistic. First someone tries to reply to the original commit (I guess?) by replying with a complete non sequitur to my reply. Now you cite a document that says nothing directly related to the commit at all. The only reference to "negative" in what you cited is part of specifying how to truncate/round fractional values that fall between two representable values given the resolution of the clock you're setting. Later in that document they specifically require EINVAL for negative fractional second values. If they intended to to prohibit negative whole-second values, that would certainly have been the place to mention it, and they don't. -- Ian From owner-svn-src-head@freebsd.org Sun Dec 27 21:52: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 35F50A52643; Sun, 27 Dec 2015 21:52:04 +0000 (UTC) (envelope-from trtrmitya@gmail.com) Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com [IPv6:2a00:1450:4010:c07::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 D088A1126; Sun, 27 Dec 2015 21:52:03 +0000 (UTC) (envelope-from trtrmitya@gmail.com) Received: by mail-lf0-x233.google.com with SMTP id z124so185729245lfa.3; Sun, 27 Dec 2015 13:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=XoWL28MqSVyemzAxGWA/7ojbJpLj7BZGLxSQPm8Blv4=; b=oCVkFKRCYj7qacnIy45FTiTtMIAmMGukyNA9U+/AyF6CdkiRKn0l4JfKUvYp7HovB3 oWYiQW78S4eKieIioRScXPsRHIvry8SH2Arklk+q5XbWbttPcenN/GOpABbwjvDdZhzy mpfZHYusr1u6q6YEQ7wpS/tJTcul+ShfP4gUdHWRJW9Fsf+c68hHVEHwClUQ3Vqz7l0x Zeli10efwXMmDIigqwo+0CUdVgSYhiZ9Gu7qTKqzdZ0RHpi0aRhBMR9kxD7Vss/gz2SI GjbIVqh+Or8cYKBWM8DccXVAIoog8GSBgzHwr1pi2IlKFZI8ff76PRb4L8p5a16k3Jql WzQA== X-Received: by 10.25.134.2 with SMTP id i2mr18772865lfd.68.1451253120623; Sun, 27 Dec 2015 13:52:00 -0800 (PST) Received: from [10.0.1.2] (broadband-5-228-251-240.nationalcablenetworks.ru. [5.228.251.240]) by smtp.gmail.com with ESMTPSA id e9sm9958696lbs.13.2015.12.27.13.51.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 13:51:59 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: svn commit: r292788 - in head/sys: geom/part sys From: Dmitry Sivachenko In-Reply-To: <201512271812.tBRICD3A044563@repo.freebsd.org> Date: Mon, 28 Dec 2015 00:51:58 +0300 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201512271812.tBRICD3A044563@repo.freebsd.org> To: Allan Jude X-Mailer: Apple Mail (2.3112) 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, 27 Dec 2015 21:52:04 -0000 > On 27 Dec 2015, at 21:12, Allan Jude wrote: > > Author: allanjude > Date: Sun Dec 27 18:12:13 2015 > New Revision: 292788 > URL: https://svnweb.freebsd.org/changeset/base/292788 > > Log: > Add some additional GPT partition types <...> May be list these in man page too? From owner-svn-src-head@freebsd.org Sun Dec 27 22:09: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 02B70A52CB0; Sun, 27 Dec 2015 22:09:01 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 B0CC81D6C; Sun, 27 Dec 2015 22:09:00 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id p187so249305296wmp.0; Sun, 27 Dec 2015 14:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=cu6RhYJF5L47ZKYKEUveoslUmEr1Sia4GFxzKHc/1XE=; b=PHD+AZmc+9xfcRFBNYGAD604f7xyftFmvnvB273nPdr8JSk2Gf0ArG18l1wRAO2mGc dmnUGqF4EJZOSBGxqqmffsgqzmP5paVvPOohs9JREt15tQGMmbdL5AZM9L03ryHN6/7A dsVUipBMly8xSeY66MjU6IlcZ8qd4p8TLULgGOYlhRH8fnd0M8TNgvSijfJPfY0M3Bfy GCwtFNUCP0CGX6sbKzz5L5AqleNdCwiKWu2yMD5MMcaiB0qpukCDBv017JRuCKYu1JBE ElVPPjhlgHVJJSVzOFUITISH0DzHtfkV+Nqi4dSxsLi0v6ktDEfkkBkWDDBjvgONsHNG xKZg== X-Received: by 10.194.205.134 with SMTP id lg6mr52960922wjc.156.1451254138158; Sun, 27 Dec 2015 14:08:58 -0800 (PST) Received: from brick.home (adee66.neoplus.adsl.tpnet.pl. [79.184.82.66]) by smtp.gmail.com with ESMTPSA id l184sm45998481wmf.6.2015.12.27.14.08.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Dec 2015 14:08:57 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 27 Dec 2015 23:08:53 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Navdeep Parhar Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292740 - in head/sys: dev/cxgbe/cxgbei modules/cxgbe modules/cxgbe/cxgbei Message-ID: <20151227220853.GA1364@brick.home> Mail-Followup-To: Navdeep Parhar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201512260605.tBQ65LXL002774@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201512260605.tBQ65LXL002774@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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, 27 Dec 2015 22:09:01 -0000 On 1226T0605, Navdeep Parhar wrote: > Author: np > Date: Sat Dec 26 06:05:21 2015 > New Revision: 292740 > URL: https://svnweb.freebsd.org/changeset/base/292740 > > Log: > cxgbei: Hardware accelerated iSCSI target and initiator for TOE capable > cards supported by cxgbe(4). > > On the host side this driver interfaces with the storage stack via the > ICL (iSCSI Common Layer) in the kernel. On the wire the traffic is > standard iSCSI (SCSI over TCP as per RFC 3720/7143 etc.) that > interoperates with all other standards compliant implementations. The > driver is layered on top of the TOE driver (t4_tom) and promotes > connections being handled by t4_tom to iSCSI ULP (Upper Layer Protocol) > mode. Hardware assistance in this mode includes: > > - Full TCP processing. > - iSCSI PDU identification and recovery within the TCP stream. > - Header and/or data digest insertion (tx) and verification (rx). > - Zero copy (both tx and rx). > > Man page will follow in a separate commit in a couple of weeks. Thank you! :-) From owner-svn-src-head@freebsd.org Sun Dec 27 22:53: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 E3A05A53C7C; Sun, 27 Dec 2015 22:53:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 7881F151A; Sun, 27 Dec 2015 22:53:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id D3BCFD4A8F3; Mon, 28 Dec 2015 09:35:12 +1100 (AEDT) Date: Mon, 28 Dec 2015 09:35:11 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern In-Reply-To: <1451236237.1369.9.camel@freebsd.org> Message-ID: <20151228083418.B1014@besplex.bde.org> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=cK4dyQqN c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=de58p1aFqIafv5_1YksA:9 a=CjuIK1q_8ugA:10 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, 27 Dec 2015 22:53:37 -0000 On Sun, 27 Dec 2015, Ian Lepore wrote: > On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: >> Author: dchagin >> Date: Sun Dec 27 15:37:07 2015 >> New Revision: 292777 >> URL: https://svnweb.freebsd.org/changeset/base/292777 >> >> Log: >> Verify that tv_sec value specified in settimeofday() and >> clock_settime() >> (CLOCK_REALTIME case) system calls is non negative. >> This commit hides a kernel panic in atrtc_settime() as the >> clock_ts_to_ct() >> does not properly convert negative tv_sec. >> >> ps. in my opinion clock_ts_to_ct() should be rewritten to properly >> handle >> negative tv_sec values. >> >> Differential Revision: https://reviews.freebsd.org/D4714 >> Reviewed by: kib >> >> MFC after: 1 week > > IMO, this change is completely unacceptable. If there is a bug in > atrtc code, then by all means fix it, but preventing anyone from > setting valid time values on the system because one driver's code can't > handle it is just wrong. I agree. Even (time_t)-1 should be a valid time for input, although it is an error indicator for output. (This API makes correctly using functions like time(1) difficult or impossible (impossible for time(1) specifically. The implementation might reserve (time_t)-1 for representing an invalid time. But nothing requires it to. (POSIX almost requires the reverse. It requires a broken implementation that represents times as seconds since the Epoch. I think POSIX doesn't require times before the Epoch to work. But FreeBSD and the ado time package tries to make them work.) So if the representation of the current time is (time_t)-1, then time(1) can't do anything better than return this value. But this value is also the error value. There is no way to distinguish this value from the error value, since time(1) is not required to set errno.) I think the change also doesn't actually work, especially in the Western hemisphere, but it was written in the Eastern hemisphere. Suppose that the time is the Epoch. This is 0, so it is pefectly valid. Then if the clock is on local time, utc_offset() is added before calling clock_cs_to_ct() and the result is a negative time_t in the Western hemisphere. Similarly in the Eastern hemisphere when you test with with Western settings. The main bug in clock_ts_ct() is due to division being specified as broken in C: X void X clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) X { X int i, year, days; X time_t rsec; /* remainder seconds */ X time_t secs; X X secs = ts->tv_sec; X days = secs / SECDAY; X rsec = secs % SECDAY; Division of negative numbers used to be implementation-defined in C, but C90 or C99 broke this by requiring the broken alternative of rounding towards 0 like most hardware does. The remainder operation is consistently broken. So when secs < 0, this always gives days < 0 and rsec either 0 or < 0. If this causes a panic, then it is from a sanity check detecting the invalid conversion later. A negative value in days breaks the loop logic but seems to give premature exit from the loops instead of many iterations. Another bug here is the type of rsec. This variable is a small integer (< SECDAY = 86400), not a time_t. Code like this is probably common in userland. w(1) uses it, but w(1) only deals with uptimes which should be positive. clock_ct_to_ts() is also buggy: X int X clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) X { X int i, year, days; X ... X /* Sanity checks. */ X if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 || X ct->day > days_in_month(year, ct->mon) || X ct->hour > 23 || ct->min > 59 || ct->sec > 59 || X (sizeof(time_t) == 4 && year > 2037)) { /* time_t overflow */ X if (ct_debug) X printf(" = EINVAL\n"); X return (EINVAL); X } The limit of 2037 is bogus with 64-bit time_t's or even with 32-bit unsigned time_t's. Years before 1970 are insane due to the C bug, and years before ~1906 are insanse due to representability problems, but there is no check for the lower limit of 'year'. There is also no check for the lower limit of ct->hour, ct->min or ct->sec. Bruce From owner-svn-src-head@freebsd.org Sun Dec 27 23:04: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 3520BA53FB4; Sun, 27 Dec 2015 23:04:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E2D011A29; Sun, 27 Dec 2015 23:04:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRN4C5Q034465; Sun, 27 Dec 2015 23:04:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRN4C5D034464; Sun, 27 Dec 2015 23:04:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201512272304.tBRN4C5D034464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 27 Dec 2015 23:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292809 - head/lib/libc/stdio 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, 27 Dec 2015 23:04:13 -0000 Author: imp Date: Sun Dec 27 23:04:11 2015 New Revision: 292809 URL: https://svnweb.freebsd.org/changeset/base/292809 Log: The FILE structure has a mbstate_t in it. This structure needs to be aligned on a int64_t boundary. However, when we allocate the array of these structures, we use ALIGNBYTES which defaults to sizeof(int) on arm, i386 and others. The i386 stuff can handle unaligned accesses seemlessly. However, arm cannot. Take this into account when creating the array of FILEs, and add some comments about why. Differential Revision: https://reviews.freebsd.org/D4708 Modified: head/lib/libc/stdio/findfp.c Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:10 2015 (r292808) +++ head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:11 2015 (r292809) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -96,11 +97,22 @@ moreglue(int n) struct glue *g; static FILE empty = { ._fl_mutex = PTHREAD_MUTEX_INITIALIZER }; FILE *p; + size_t align; - g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE)); + /* + * FILE has a mbstate_t variable. This variable tries to be int64_t + * aligned through its definition. int64_t may be larger than void *, + * which is the size traditionally used for ALIGNBYTES. So, use our own + * rounding instead of the MI ALIGN macros. If for some reason + * ALIGNBYTES is larger than int64_t, respect that too. There appears to + * be no portable way to ask for FILE's alignment requirements other + * than just knowing here. + */ + align = MAX(ALIGNBYTES, sizeof(int64_t)); + g = (struct glue *)malloc(sizeof(*g) + align + n * sizeof(FILE)); if (g == NULL) return (NULL); - p = (FILE *)ALIGN(g + 1); + p = (FILE *)roundup((uintptr_t)(g + 1), align); g->next = NULL; g->niobs = n; g->iobs = p; From owner-svn-src-head@freebsd.org Sun Dec 27 23:04: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 3CF94A53FAD; Sun, 27 Dec 2015 23:04:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0A39F1A28; Sun, 27 Dec 2015 23:04:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRN4BcY034422; Sun, 27 Dec 2015 23:04:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRN4BKC034421; Sun, 27 Dec 2015 23:04:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201512272304.tBRN4BKC034421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 27 Dec 2015 23:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292808 - head/tools/tools/nanobsd/embedded 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, 27 Dec 2015 23:04:12 -0000 Author: imp Date: Sun Dec 27 23:04:10 2015 New Revision: 292808 URL: https://svnweb.freebsd.org/changeset/base/292808 Log: There's currently some issues with armv7-class of CPUs code generation with our default toolchain. Turn it off here until that all gets sorted out. Modified: head/tools/tools/nanobsd/embedded/rpi2.cfg Modified: head/tools/tools/nanobsd/embedded/rpi2.cfg ============================================================================== --- head/tools/tools/nanobsd/embedded/rpi2.cfg Sun Dec 27 21:58:13 2015 (r292807) +++ head/tools/tools/nanobsd/embedded/rpi2.cfg Sun Dec 27 23:04:10 2015 (r292808) @@ -31,6 +31,6 @@ NANO_KERNEL=RPI2 NANO_DRIVE=mmcsd0 NANO_NAME=rpi2 NANO_BOOT_PKG=u-boot-rpi2 -NANO_CPUTYPE=cortex-a7 +# NANO_CPUTYPE=cortex-a7 . common # Pull in common definitions, keep last From owner-svn-src-head@freebsd.org Sun Dec 27 23:04: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 71529A53FBC; Sun, 27 Dec 2015 23:04:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2F2861A2A; Sun, 27 Dec 2015 23:04:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRN4DCc034509; Sun, 27 Dec 2015 23:04:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRN4DSm034507; Sun, 27 Dec 2015 23:04:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201512272304.tBRN4DSm034507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 27 Dec 2015 23:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292810 - in head/libexec/rtld-elf: . arm 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, 27 Dec 2015 23:04:14 -0000 Author: imp Date: Sun Dec 27 23:04:12 2015 New Revision: 292810 URL: https://svnweb.freebsd.org/changeset/base/292810 Log: Use a macro to create the names for the library path names. This will allow later substitution at run time instead of compile time of the environment variable name prefix. Differential Review: https://reviews.freebsd.org/D2718 Modified: head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Sun Dec 27 23:04:11 2015 (r292809) +++ head/libexec/rtld-elf/arm/reloc.c Sun Dec 27 23:04:12 2015 (r292810) @@ -15,6 +15,7 @@ __FBSDID("$FreeBSD$"); #include "debug.h" #include "rtld.h" +#include "paths.h" void init_pltgot(Obj_Entry *obj) Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sun Dec 27 23:04:11 2015 (r292809) +++ head/libexec/rtld-elf/rtld.c Sun Dec 27 23:04:12 2015 (r292810) @@ -204,6 +204,8 @@ extern Elf_Dyn _DYNAMIC; #define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL) #endif +#define _LD(x) LD_ x + int dlclose(void *) __exported; char *dlerror(void) __exported; void *dlopen(const char *, int) __exported; @@ -417,7 +419,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ trust = !issetugid(); - ld_bind_now = getenv(LD_ "BIND_NOW"); + ld_bind_now = getenv(_LD("BIND_NOW")); /* * If the process is tainted, then we un-set the dangerous environment * variables. The process will be marked as tainted until setuid(2) @@ -425,24 +427,24 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ * future processes to honor the potentially un-safe variables. */ if (!trust) { - if (unsetenv(LD_ "PRELOAD") || unsetenv(LD_ "LIBMAP") || - unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBRARY_PATH_FDS") || - unsetenv(LD_ "LIBMAP_DISABLE") || - unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH") || - unsetenv(LD_ "LOADFLTR") || unsetenv(LD_ "LIBRARY_PATH_RPATH")) { + if (unsetenv(_LD("PRELOAD")) || unsetenv(_LD("LIBMAP")) || + unsetenv(_LD("LIBRARY_PATH")) || unsetenv(_LD("LIBRARY_PATH_FDS")) || + unsetenv(_LD("LIBMAP_DISABLE")) || + unsetenv(_LD("DEBUG")) || unsetenv(_LD("ELF_HINTS_PATH")) || + unsetenv(_LD("LOADFLTR")) || unsetenv(_LD("LIBRARY_PATH_RPATH"))) { _rtld_error("environment corrupt; aborting"); rtld_die(); } } - ld_debug = getenv(LD_ "DEBUG"); - libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; - libmap_override = getenv(LD_ "LIBMAP"); - ld_library_path = getenv(LD_ "LIBRARY_PATH"); - ld_library_dirs = getenv(LD_ "LIBRARY_PATH_FDS"); - ld_preload = getenv(LD_ "PRELOAD"); - ld_elf_hints_path = getenv(LD_ "ELF_HINTS_PATH"); - ld_loadfltr = getenv(LD_ "LOADFLTR") != NULL; - library_path_rpath = getenv(LD_ "LIBRARY_PATH_RPATH"); + ld_debug = getenv(_LD("DEBUG")); + libmap_disable = getenv(_LD("LIBMAP_DISABLE")) != NULL; + libmap_override = getenv(_LD("LIBMAP")); + ld_library_path = getenv(_LD("LIBRARY_PATH")); + ld_library_dirs = getenv(_LD("LIBRARY_PATH_FDS")); + ld_preload = getenv(_LD("PRELOAD")); + ld_elf_hints_path = getenv(_LD("ELF_HINTS_PATH")); + ld_loadfltr = getenv(_LD("LOADFLTR")) != NULL; + library_path_rpath = getenv(_LD("LIBRARY_PATH_RPATH")); if (library_path_rpath != NULL) { if (library_path_rpath[0] == 'y' || library_path_rpath[0] == 'Y' || @@ -454,8 +456,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ dangerous_ld_env = libmap_disable || (libmap_override != NULL) || (ld_library_path != NULL) || (ld_preload != NULL) || (ld_elf_hints_path != NULL) || ld_loadfltr; - ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS"); - ld_utrace = getenv(LD_ "UTRACE"); + ld_tracing = getenv(_LD("TRACE_LOADED_OBJECTS")); + ld_utrace = getenv(_LD("UTRACE")); if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) ld_elf_hints_path = ld_elf_hints_default; @@ -592,7 +594,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ exit(0); } - if (getenv(LD_ "DUMP_REL_PRE") != NULL) { + if (getenv(_LD("DUMP_REL_PRE")) != NULL) { dump_relocations(obj_main); exit (0); } @@ -620,7 +622,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ if (do_copy_relocations(obj_main) == -1) rtld_die(); - if (getenv(LD_ "DUMP_REL_POST") != NULL) { + if (getenv(_LD("DUMP_REL_POST")) != NULL) { dump_relocations(obj_main); exit (0); } @@ -4177,16 +4179,16 @@ trace_loaded_objects(Obj_Entry *obj) char *fmt1, *fmt2, *fmt, *main_local, *list_containers; int c; - if ((main_local = getenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME")) == NULL) + if ((main_local = getenv(_LD("TRACE_LOADED_OBJECTS_PROGNAME"))) == NULL) main_local = ""; - if ((fmt1 = getenv(LD_ "TRACE_LOADED_OBJECTS_FMT1")) == NULL) + if ((fmt1 = getenv(_LD("TRACE_LOADED_OBJECTS_FMT1"))) == NULL) fmt1 = "\t%o => %p (%x)\n"; - if ((fmt2 = getenv(LD_ "TRACE_LOADED_OBJECTS_FMT2")) == NULL) + if ((fmt2 = getenv(_LD("TRACE_LOADED_OBJECTS_FMT2"))) == NULL) fmt2 = "\t%o (%x)\n"; - list_containers = getenv(LD_ "TRACE_LOADED_OBJECTS_ALL"); + list_containers = getenv(_LD("TRACE_LOADED_OBJECTS_ALL")); for (; obj; obj = obj->next) { Needed_Entry *needed; From owner-svn-src-head@freebsd.org Sun Dec 27 23: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 14FD8A52713; Sun, 27 Dec 2015 23:23:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id B798017F7; Sun, 27 Dec 2015 23:23:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id DBB17D43A81; Mon, 28 Dec 2015 10:23:19 +1100 (AEDT) Date: Mon, 28 Dec 2015 10:23:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: NGie Cooper , Slawa Olhovchenkov , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern In-Reply-To: <1451247868.1369.16.camel@freebsd.org> Message-ID: <20151228093724.D1014@besplex.bde.org> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> <1451243810.1369.10.camel@freebsd.org> <20151227193046.GE4535@zxy.spb.ru> <8D7D617E-FF9E-4D74-87CB-1F3EE65D108A@gmail.com> <1451247868.1369.16.camel@freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=cK4dyQqN c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=KawIFhhbAAAA:8 a=uZvujYp8AAAA:8 a=vpkWZ2P-BIJPKdODiGkA:9 a=U06k2VRVBVR3QubT:21 a=PKJ5vzlG4ZyLU95Q:21 a=45ClL6m2LaAA:10 a=oBuQxKqGozsA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE 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: Sun, 27 Dec 2015 23:23:24 -0000 On Sun, 27 Dec 2015, Ian Lepore wrote: > On Sun, 2015-12-27 at 12:05 -0800, NGie Cooper wrote: >>> On Dec 27, 2015, at 11:30, Slawa Olhovchenkov >>> wrote: >> >> =85 >> >>>> I have no idea what you mean by that -- I didn't say anything at >>>> all >>>> about panic. >>> >>> As I understund commit log -- this is prevent kernel panic at some >>> call (with illegal arguments). This accpetable irrelevant to bugs >>> in >>> calling code. >> >> =09This also makes us POSIX compliant and more compatible with >> Linux: >> http://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_settime.html >> (search for =93negative=94). >> Thanks kib! >> -NGie > > This thread just keeps becoming more and more surrealistic. First > someone tries to reply to the original commit (I guess?) by replying > with a complete non sequitur to my reply. Now you cite a document that > says nothing directly related to the commit at all. > > The only reference to "negative" in what you cited is part of > specifying how to truncate/round fractional values that fall between > two representable values given the resolution of the clock you're > setting. It also has an obfuscated verbose spelling of negative as "less than zero" in the description of [EINVAL]. This is the specification of a invalid timespec which is repeated ad nauseum. The upper limit is spelled even more verbosely as "greater than or equal to 1000 million". The correct spelling of this is ">=3D 1000000000" but that is hard to read in another way (too many 0's to count quickly). Spelling this value is remarkably difficult. There are about 10 different spellings that are no good since they depend on the locale or language (natural or programming). Mixing digits and words is ugly. 1 billion is shorter but is off by a factor of 1000 in some locales. I stared at this description many times. It doesn't allow considering negative times as invalid generally. setitimer(2) has to be specially broken to disallow them. This bug is missing for nanosleep(). FreeBSD still documents a non-POSIX limit of 100000000 seconds for setitimer(2), but its implementation has been broken to overflow instead of enforcing this limit. Note that this is 1 followed by 8 zeros and applies to the seconds value, while the limit for nanoseconds os 1 followed by 9 zeros. Different spellings of 1 followed by a large number of zeros makes thes value hard to grep for. 1 followed by 8 zeros is in about 50 man pages (counting links). It is documented as the limit on seconds in get/setitimer(2). mtree(8) misspells 1 followed by 9 zeros as 1 followed by 8 zeros. alarm(3) is implemented using itimers and documents the same limit. ularm(3) documents the bizarre limit of 1 followed by 14 zeros "in case this value fits in an the unsigned integer". This is alarm(3)'s documented but not actual limit of 10**8 seconds converted to microseconds. It is reachable on systems with >=3D 47 bit longs. This spelling is not used in any man page for the limit on the number of nanoseconds (as in POSIX). > Later in that document they specifically require EINVAL for negative > fractional second values. If they intended to to prohibit negative > whole-second values, that would certainly have been the place to > mention it, and they don't. This is the "obfuscated verbose spelling" part. This is not really a restriction on negative fractions. It is just that negative fractions are represented as a negative integer plus a proper fraction, where by definition a proper fraction is nonnegative and less than 1. Normalization gives this (except when it would overflow). The requirement is essentially that callers don't pass unnormalized values. Bruce From owner-svn-src-head@freebsd.org Sun Dec 27 23:26: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 03318A5288D; Sun, 27 Dec 2015 23:26:52 +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 ADC121BF7; Sun, 27 Dec 2015 23:26:51 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id DKi4awFJHkK49DKi5a8KbA; Sun, 27 Dec 2015 16:26:51 -0700 X-Authority-Analysis: v=2.1 cv=AMkI9oPf c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=BWvPGDcYAAAA:8 a=VxmjJ2MpAAAA:8 a=kj9zAlcOel0A:10 a=wUQvQvOEmiQA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=hBRiNyo2w7lXQ92ch0sA:9 a=Q-0BtGJeCf-BjTat:21 a=HlmSUPbtQm4zg2Cc:21 a=-x0AuQ5L8kJXOgZ1:21 a=CjuIK1q_8ugA:10 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 1A2CB13752; Wed, 23 Dec 2015 16:28:14 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id tBRNQiQJ008124; Sun, 27 Dec 2015 15:26:44 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201512272326.tBRNQiQJ008124@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: "George Neville-Neil" cc: "Cy Schubert" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r290383 - in head/sys: net netinet In-Reply-To: Message from "George Neville-Neil" of "Thu, 24 Dec 2015 16:18:52 -0500." <98F16C2B-3904-438D-912B-85C17ACFBDEA@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 27 Dec 2015 15:26:44 -0800 X-CMAE-Envelope: MS4wfMOUhXRNio73hSBoEAxh8H73GDgKkuQlSfWiv3oa+KL9mXRdOE3d5YBkeyRpMNyrlIutFvoiZPrYUzdirsWavZc38P8q8d5OfVZSg9zYqRiH+vwmmkK6 cRtI1orprSSwk66AdLVbMDF2EmpGq91oxjPfp4ocTNsNhWxiDPsHAwBWYW7an+xW0337IfPXoGf+yINy26tWb+04FtqpTRqi84mvsWD5cI8DYJz8izjeCL+p /EGrq4p0w0RF2BS4bvJo8wagkEb35IMANR7/ZmpX1KybbywT5KqpOuzaTF6vr6iU 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, 27 Dec 2015 23:26:52 -0000 In message <98F16C2B-3904-438D-912B-85C17ACFBDEA@freebsd.org>, "George Neville- Neil" writes: > > > > On 20 Dec 2015, at 13:02, Cy Schubert wrote: > > > Cy Schubert writes: > >> In message <201511050726.tA57QXlu074213@repo.freebsd.org>, "George V. > >> Neville-N > >> eil" writes: > >>> Author: gnn > >>> Date: Thu Nov 5 07:26:32 2015 > >>> New Revision: 290383 > >>> URL: https://svnweb.freebsd.org/changeset/base/290383 > >>> > >>> Log: > >>> Replace the fastforward path with tryforward which does not require > >>> a > >>> sysctl and will always be on. The former split between default and > >>> fast forwarding is removed by this commit while preserving the > >>> ability > >>> to use all network stack features. > >>> > >>> Differential Revision: https://reviews.freebsd.org/D4042 > >>> Reviewed by: ae, melifaro, olivier, rwatson > >>> MFC after: 1 month > >>> Sponsored by: Rubicon Communications (Netgate) > >>> > >>> Modified: > >>> head/sys/net/if_arcsubr.c > >>> head/sys/net/if_ethersubr.c > >>> head/sys/net/if_fddisubr.c > >>> head/sys/net/if_fwsubr.c > >>> head/sys/net/if_iso88025subr.c > >>> head/sys/netinet/in_var.h > >>> head/sys/netinet/ip_fastfwd.c > >>> head/sys/netinet/ip_input.c > >>> > >>> Modified: head/sys/net/if_arcsubr.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/net/if_arcsubr.c Thu Nov 5 04:16:03 2015 (r29038 > >> 2) > >>> +++ head/sys/net/if_arcsubr.c Thu Nov 5 07:26:32 2015 (r29038 > >> 3) > >>> @@ -550,15 +550,11 @@ arc_input(struct ifnet *ifp, struct mbuf > >>> #ifdef INET > >>> case ARCTYPE_IP: > >>> m_adj(m, ARC_HDRNEWLEN); > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> case ARCTYPE_IP_OLD: > >>> m_adj(m, ARC_HDRLEN); > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> > >>> Modified: head/sys/net/if_ethersubr.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/net/if_ethersubr.c Thu Nov 5 04:16:03 2015 (r29038 > >>> 2) > >>> +++ head/sys/net/if_ethersubr.c Thu Nov 5 07:26:32 2015 (r29038 > >>> 3) > >>> @@ -722,8 +722,6 @@ ether_demux(struct ifnet *ifp, struct mb > >>> switch (ether_type) { > >>> #ifdef INET > >>> case ETHERTYPE_IP: > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> > >>> Modified: head/sys/net/if_fddisubr.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/net/if_fddisubr.c Thu Nov 5 04:16:03 2015 (r29038 > >>> 2) > >>> +++ head/sys/net/if_fddisubr.c Thu Nov 5 07:26:32 2015 (r29038 > >>> 3) > >>> @@ -429,8 +429,6 @@ fddi_input(ifp, m) > >>> switch (type) { > >>> #ifdef INET > >>> case ETHERTYPE_IP: > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> > >>> Modified: head/sys/net/if_fwsubr.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/net/if_fwsubr.c Thu Nov 5 04:16:03 2015 (r29038 > >> 2) > >>> +++ head/sys/net/if_fwsubr.c Thu Nov 5 07:26:32 2015 (r29038 > >> 3) > >>> @@ -605,8 +605,6 @@ firewire_input(struct ifnet *ifp, struct > >>> switch (type) { > >>> #ifdef INET > >>> case ETHERTYPE_IP: > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> > >>> Modified: head/sys/net/if_iso88025subr.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/net/if_iso88025subr.c Thu Nov 5 04:16:03 2015 > (r29038 > >>> 2) > >>> +++ head/sys/net/if_iso88025subr.c Thu Nov 5 07:26:32 2015 > (r29038 > >>> 3) > >>> @@ -519,8 +519,6 @@ iso88025_input(ifp, m) > >>> #ifdef INET > >>> case ETHERTYPE_IP: > >>> th->iso88025_shost[0] &= ~(TR_RII); > >>> - if ((m = ip_fastforward(m)) == NULL) > >>> - return; > >>> isr = NETISR_IP; > >>> break; > >>> > >>> > >>> Modified: head/sys/netinet/in_var.h > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/netinet/in_var.h Thu Nov 5 04:16:03 2015 (r29038 > >> 2) > >>> +++ head/sys/netinet/in_var.h Thu Nov 5 07:26:32 2015 (r29038 > >> 3) > >>> @@ -380,7 +380,7 @@ int in_scrubprefix(struct in_ifaddr *, u > >>> void ip_input(struct mbuf *); > >>> void ip_direct_input(struct mbuf *); > >>> void in_ifadown(struct ifaddr *ifa, int); > >>> -struct mbuf *ip_fastforward(struct mbuf *); > >>> +struct mbuf *ip_tryforward(struct mbuf *); > >>> void *in_domifattach(struct ifnet *); > >>> void in_domifdetach(struct ifnet *, void *); > >>> > >>> > >>> Modified: head/sys/netinet/ip_fastfwd.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/netinet/ip_fastfwd.c Thu Nov 5 04:16:03 2015 (r29038 > >>> 2) > >>> +++ head/sys/netinet/ip_fastfwd.c Thu Nov 5 07:26:32 2015 (r29038 > >>> 3) > >>> @@ -108,12 +108,6 @@ __FBSDID("$FreeBSD$"); > >>> > >>> #include > >>> > >>> -static VNET_DEFINE(int, ipfastforward_active); > >>> -#define V_ipfastforward_active VNET(ipfastforward_active) > >>> - > >>> -SYSCTL_INT(_net_inet_ip, OID_AUTO, fastforwarding, CTLFLAG_VNET | > >>> CTLFLAG_ > >> RW > >>> , > >>> - &VNET_NAME(ipfastforward_active), 0, "Enable fast IP > >>> forwarding"); > >>> - > >>> static struct sockaddr_in * > >>> ip_findroute(struct route *ro, struct in_addr dest, struct mbuf *m) > >>> { > >>> @@ -158,7 +152,7 @@ ip_findroute(struct route *ro, struct in > >>> * to ip_input for full processing. > >>> */ > >>> struct mbuf * > >>> -ip_fastforward(struct mbuf *m) > >>> +ip_tryforward(struct mbuf *m) > >>> { > >>> struct ip *ip; > >>> struct mbuf *m0 = NULL; > >>> @@ -166,119 +160,20 @@ ip_fastforward(struct mbuf *m) > >>> struct sockaddr_in *dst = NULL; > >>> struct ifnet *ifp; > >>> struct in_addr odest, dest; > >>> - uint16_t sum, ip_len, ip_off; > >>> + uint16_t ip_len, ip_off; > >>> int error = 0; > >>> - int hlen, mtu; > >>> + int mtu; > >>> struct m_tag *fwd_tag = NULL; > >>> > >>> /* > >>> * Are we active and forwarding packets? > >>> */ > >>> - if (!V_ipfastforward_active || !V_ipforwarding) > >>> - return m; > >>> > >>> M_ASSERTVALID(m); > >>> M_ASSERTPKTHDR(m); > >>> > >>> bzero(&ro, sizeof(ro)); > >>> > >>> - /* > >>> - * Step 1: check for packet drop conditions (and sanity checks) > >>> - */ > >>> - > >>> - /* > >>> - * Is entire packet big enough? > >>> - */ > >>> - if (m->m_pkthdr.len < sizeof(struct ip)) { > >>> - IPSTAT_INC(ips_tooshort); > >>> - goto drop; > >>> - } > >>> - > >>> - /* > >>> - * Is first mbuf large enough for ip header and is header present? > >>> - */ > >>> - if (m->m_len < sizeof (struct ip) && > >>> - (m = m_pullup(m, sizeof (struct ip))) == NULL) { > >>> - IPSTAT_INC(ips_toosmall); > >>> - return NULL; /* mbuf already free'd */ > >>> - } > >>> - > >>> - ip = mtod(m, struct ip *); > >>> - > >>> - /* > >>> - * Is it IPv4? > >>> - */ > >>> - if (ip->ip_v != IPVERSION) { > >>> - IPSTAT_INC(ips_badvers); > >>> - goto drop; > >>> - } > >>> - > >>> - /* > >>> - * Is IP header length correct and is it in first mbuf? > >>> - */ > >>> - hlen = ip->ip_hl << 2; > >>> - if (hlen < sizeof(struct ip)) { /* minimum header length */ > >>> - IPSTAT_INC(ips_badhlen); > >>> - goto drop; > >>> - } > >>> - if (hlen > m->m_len) { > >>> - if ((m = m_pullup(m, hlen)) == NULL) { > >>> - IPSTAT_INC(ips_badhlen); > >>> - return NULL; /* mbuf already free'd */ > >>> - } > >>> - ip = mtod(m, struct ip *); > >>> - } > >>> - > >>> - /* > >>> - * Checksum correct? > >>> - */ > >>> - if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) > >>> - sum = !(m->m_pkthdr.csum_flags & CSUM_IP_VALID); > >>> - else { > >>> - if (hlen == sizeof(struct ip)) > >>> - sum = in_cksum_hdr(ip); > >>> - else > >>> - sum = in_cksum(m, hlen); > >>> - } > >>> - if (sum) { > >>> - IPSTAT_INC(ips_badsum); > >>> - goto drop; > >>> - } > >>> - > >>> - /* > >>> - * Remember that we have checked the IP header and found it valid. > >>> - */ > >>> - m->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); > >>> - > >>> - ip_len = ntohs(ip->ip_len); > >>> - > >>> - /* > >>> - * Is IP length longer than packet we have got? > >>> - */ > >>> - if (m->m_pkthdr.len < ip_len) { > >>> - IPSTAT_INC(ips_tooshort); > >>> - goto drop; > >>> - } > >>> - > >>> - /* > >>> - * Is packet longer than IP header tells us? If yes, truncate > >>> packet. > >>> - */ > >>> - if (m->m_pkthdr.len > ip_len) { > >>> - if (m->m_len == m->m_pkthdr.len) { > >>> - m->m_len = ip_len; > >>> - m->m_pkthdr.len = ip_len; > >>> - } else > >>> - m_adj(m, ip_len - m->m_pkthdr.len); > >>> - } > >>> - > >>> - /* > >>> - * Is packet from or to 127/8? > >>> - */ > >>> - if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == > >>> IN_LOOPBACKNET || > >>> - (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == > >>> IN_LOOPBACKNET) { > >>> - IPSTAT_INC(ips_badaddr); > >>> - goto drop; > >>> - } > >>> > >>> #ifdef ALTQ > >>> /* > >>> @@ -289,12 +184,10 @@ ip_fastforward(struct mbuf *m) > >>> #endif > >>> > >>> /* > >>> - * Step 2: fallback conditions to normal ip_input path processing > >>> - */ > >>> - > >>> - /* > >>> * Only IP packets without options > >>> */ > >>> + ip = mtod(m, struct ip *); > >>> + > >>> if (ip->ip_hl != (sizeof(struct ip) >> 2)) { > >>> if (V_ip_doopts == 1) > >>> return m; > >>> > >>> Modified: head/sys/netinet/ip_input.c > >>> ========================================================================= > == > >> == > >>> = > >>> --- head/sys/netinet/ip_input.c Thu Nov 5 04:16:03 2015 (r29038 > >>> 2) > >>> +++ head/sys/netinet/ip_input.c Thu Nov 5 07:26:32 2015 (r29038 > >>> 3) > >>> @@ -79,6 +79,8 @@ __FBSDID("$FreeBSD$"); > >>> #include > >>> #ifdef IPSEC > >>> #include > >>> +#include > >>> +#include > >>> #endif /* IPSEC */ > >>> #include > >>> > >>> @@ -500,12 +502,22 @@ tooshort: > >>> m_adj(m, ip_len - m->m_pkthdr.len); > >>> } > >>> > >>> + /* Try to forward the packet, but if we fail continue */ > >>> #ifdef IPSEC > >>> + /* For now we do not handle IPSEC in tryforward. */ > >>> + if (!key_havesp(IPSEC_DIR_INBOUND) && > >>> !key_havesp(IPSEC_DIR_OUTBOUND) & > >>> & > >>> + (V_ipforwarding == 1)) > >>> + if (ip_tryforward(m) == NULL) > >>> + return; > >>> /* > >>> * Bypass packet filtering for packets previously handled by IPsec. > >>> */ > >>> if (ip_ipsec_filtertunnel(m)) > >>> goto passin; > >>> +#else > >>> + if (V_ipforwarding == 1) > >>> + if (ip_tryforward(m) == NULL) > >>> + return; > >>> #endif /* IPSEC */ > >>> > >>> /* > >>> > >>> > >> > >> Hi George, > >> > >> Sorry for the lateness of this reply, I finally got some time off for > >> Christmas and have time to myself to boot. > >> > >> This breaks ipfilter's ipnat. I want to let you know before anyone > >> MFCs > >> this. > > > > A fix to ipfilter has been committed to head and will be MFCed in a > > week. > > > > Let me know when that's done. It's been MFCd. Thanks for waiting. -- 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 Mon Dec 28 00:42: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 79C45A53F56; Mon, 28 Dec 2015 00:42:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 49A961992; Mon, 28 Dec 2015 00:42:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS0gFoG067981; Mon, 28 Dec 2015 00:42:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS0gFbA067980; Mon, 28 Dec 2015 00:42:15 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201512280042.tBS0gFbA067980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 28 Dec 2015 00:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292813 - 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: Mon, 28 Dec 2015 00:42:16 -0000 Author: cy Date: Mon Dec 28 00:42:15 2015 New Revision: 292813 URL: https://svnweb.freebsd.org/changeset/base/292813 Log: Correct __FreeBSD__ check. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Mon Dec 28 00:05:31 2015 (r292812) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Mon Dec 28 00:42:15 2015 (r292813) @@ -5235,7 +5235,7 @@ ipf_nat_out(fin, nat, natadd, nflags) uh->uh_ulen += fin->fin_plen; uh->uh_ulen = htons(uh->uh_ulen); #if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \ - defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD) + defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__) ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0); #endif From owner-svn-src-head@freebsd.org Mon Dec 28 00:53: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 457F9A512DA; Mon, 28 Dec 2015 00:53:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EE84C10C0; Mon, 28 Dec 2015 00:53:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS0rckG071805; Mon, 28 Dec 2015 00:53:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS0rbxg071804; Mon, 28 Dec 2015 00:53:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280053.tBS0rbxg071804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 00:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292814 - head/tools/regression/sockets/unix_passfd 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, 28 Dec 2015 00:53:39 -0000 Author: ngie Date: Mon Dec 28 00:53:37 2015 New Revision: 292814 URL: https://svnweb.freebsd.org/changeset/base/292814 Log: - Explicitly initialize ch to 0 - Delete some spurious whitespace - Use calloc instead of malloc in the last test to ensure that sendspace is properly zero'ed out Differential Revision: https://reviews.freebsd.org/D689 (part of a larger diff) MFC after: 1 week Reviewed by: asomers, ngie Submitted by: markj Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c ============================================================================== --- head/tools/regression/sockets/unix_passfd/unix_passfd.c Mon Dec 28 00:42:15 2015 (r292813) +++ head/tools/regression/sockets/unix_passfd/unix_passfd.c Mon Dec 28 00:53:37 2015 (r292814) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2005 Robert N. M. Watson + * Copyright (c) 2015 Mark Johnston * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,7 +147,7 @@ sendfd_payload(const char *test, int soc static void sendfd(const char *test, int sockfd, int sendfd) { - char ch; + char ch = 0; return (sendfd_payload(test, sockfd, sendfd, &ch, sizeof(ch))); } @@ -199,7 +200,7 @@ recvfd_payload(const char *test, int soc static void recvfd(const char *test, int sockfd, int *recvfd) { - char ch; + char ch = 0; return (recvfd_payload(test, sockfd, recvfd, &ch, sizeof(ch))); } @@ -369,8 +370,8 @@ main(void) err(-1, "%s: sysctlbyname(net.local.stream.sendspace)", test); - if ((buf = malloc(sendspace)) == NULL) - err(-1, "%s: malloc", test); + if ((buf = calloc(1, sendspace)) == NULL) + err(-1, "%s: calloc", test); domainsocketpair(test, fd); if (setsockopt(fd[1], 0, LOCAL_CREDS, &on, sizeof(on)) < 0) @@ -384,6 +385,6 @@ main(void) } printf("%s passed\n", test); - + return (0); } From owner-svn-src-head@freebsd.org Mon Dec 28 01: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 D10F1A523ED; Mon, 28 Dec 2015 01:51:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8C8DA1375; Mon, 28 Dec 2015 01:51:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS1pKqc090642; Mon, 28 Dec 2015 01:51:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS1pKol090640; Mon, 28 Dec 2015 01:51:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280151.tBS1pKol090640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 01:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292815 - head/contrib/bsnmp/snmpd 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, 28 Dec 2015 01:51:22 -0000 Author: ngie Date: Mon Dec 28 01:51:20 2015 New Revision: 292815 URL: https://svnweb.freebsd.org/changeset/base/292815 Log: Staticize several variables that are used exclusively in bsnmpd/main.c and bsnmpd/trap.c This fixes several -Wmissing-variable-declaration warnings noted by clang Differential Revision: https://reviews.freebsd.org/D4718 MFC after: 1 week Reported by: Jenkins Reviewed by: araujo Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/trap.c Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Mon Dec 28 00:53:37 2015 (r292814) +++ head/contrib/bsnmp/snmpd/main.c Mon Dec 28 01:51:20 2015 (r292815) @@ -119,26 +119,30 @@ static struct lmodules modules_start = T struct community_list community_list = TAILQ_HEAD_INITIALIZER(community_list); /* list of all known USM users */ -struct usm_userlist usm_userlist = SLIST_HEAD_INITIALIZER(usm_userlist); +static struct usm_userlist usm_userlist = SLIST_HEAD_INITIALIZER(usm_userlist); /* A list of all VACM users configured, including v1, v2c and v3 */ -struct vacm_userlist vacm_userlist = SLIST_HEAD_INITIALIZER(vacm_userlist); +static struct vacm_userlist vacm_userlist = + SLIST_HEAD_INITIALIZER(vacm_userlist); /* A list of all VACM groups */ -struct vacm_grouplist vacm_grouplist = SLIST_HEAD_INITIALIZER(vacm_grouplist); +static struct vacm_grouplist vacm_grouplist = + SLIST_HEAD_INITIALIZER(vacm_grouplist); static struct vacm_group vacm_default_group = { .groupname = "", }; /* The list of configured access entries */ -struct vacm_accesslist vacm_accesslist = TAILQ_HEAD_INITIALIZER(vacm_accesslist); +static struct vacm_accesslist vacm_accesslist = + TAILQ_HEAD_INITIALIZER(vacm_accesslist); /* The list of configured views */ -struct vacm_viewlist vacm_viewlist = SLIST_HEAD_INITIALIZER(vacm_viewlist); +static struct vacm_viewlist vacm_viewlist = + SLIST_HEAD_INITIALIZER(vacm_viewlist); /* The list of configured contexts */ -struct vacm_contextlist vacm_contextlist = +static struct vacm_contextlist vacm_contextlist = SLIST_HEAD_INITIALIZER(vacm_contextlist); /* list of all installed object resources */ Modified: head/contrib/bsnmp/snmpd/trap.c ============================================================================== --- head/contrib/bsnmp/snmpd/trap.c Mon Dec 28 00:53:37 2015 (r292814) +++ head/contrib/bsnmp/snmpd/trap.c Mon Dec 28 01:51:20 2015 (r292815) @@ -60,15 +60,15 @@ struct trapsink_list trapsink_list = TAILQ_HEAD_INITIALIZER(trapsink_list); /* List of target addresses */ -struct target_addresslist target_addresslist = +static struct target_addresslist target_addresslist = SLIST_HEAD_INITIALIZER(target_addresslist); /* List of target parameters */ -struct target_paramlist target_paramlist = +static struct target_paramlist target_paramlist = SLIST_HEAD_INITIALIZER(target_paramlist); /* List of notification targets */ -struct target_notifylist target_notifylist = +static struct target_notifylist target_notifylist = SLIST_HEAD_INITIALIZER(target_notifylist); static const struct asn_oid oid_begemotTrapSinkTable = From owner-svn-src-head@freebsd.org Mon Dec 28 02:01: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 EBDABA527CF; Mon, 28 Dec 2015 02:01:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A485519AC; Mon, 28 Dec 2015 02:01:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS21fZq094146; Mon, 28 Dec 2015 02:01:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS21fZO094145; Mon, 28 Dec 2015 02:01:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280201.tBS21fZO094145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292816 - head/tests/sys/aio 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, 28 Dec 2015 02:01:43 -0000 Author: ngie Date: Mon Dec 28 02:01:41 2015 New Revision: 292816 URL: https://svnweb.freebsd.org/changeset/base/292816 Log: Place cancel and error under #ifdef DEBUG to mute -Wunused-but-set-variable warnings reported by gcc 4.9 Remove some trailing whitespace as well Tested with and without -DDEBUG MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/aio/aio_kqueue_test.c Modified: head/tests/sys/aio/aio_kqueue_test.c ============================================================================== --- head/tests/sys/aio/aio_kqueue_test.c Mon Dec 28 01:51:20 2015 (r292815) +++ head/tests/sys/aio/aio_kqueue_test.c Mon Dec 28 02:01:41 2015 (r292816) @@ -62,7 +62,10 @@ main (int argc, char *argv[]) struct kevent ke, kq_returned; struct timespec ts; char buffer[32768]; - int cancel, error, failed = 0, fd, kq, pending, result, run; +#ifdef DEBUG + int cancel, error; +#endif + int failed = 0, fd, kq, pending, result, run; int tmp_file = 0; unsigned i, j; @@ -96,19 +99,19 @@ main (int argc, char *argv[]) if (iocb[i] == NULL) err(1, "calloc"); } - - pending = 0; + + pending = 0; for (i = 0; i < nitems(iocb); i++) { pending++; iocb[i]->aio_nbytes = sizeof(buffer); iocb[i]->aio_buf = buffer; iocb[i]->aio_fildes = fd; iocb[i]->aio_offset = iocb[i]->aio_nbytes * i * run; - + iocb[i]->aio_sigevent.sigev_notify_kqueue = kq; iocb[i]->aio_sigevent.sigev_value.sival_ptr = iocb[i]; iocb[i]->aio_sigevent.sigev_notify = SIGEV_KEVENT; - + result = aio_write(iocb[i]); if (result != 0) { perror("aio_write"); @@ -133,7 +136,9 @@ main (int argc, char *argv[]) } } } +#ifdef DEBUG cancel = nitems(iocb) - pending; +#endif i = 0; while (pending) { @@ -144,34 +149,36 @@ main (int argc, char *argv[]) bzero(&kq_returned, sizeof(ke)); ts.tv_sec = 0; ts.tv_nsec = 1; - result = kevent(kq, NULL, 0, + result = kevent(kq, NULL, 0, &kq_returned, 1, &ts); +#ifdef DEBUG error = errno; +#endif if (result < 0) perror("kevent error: "); kq_iocb = kq_returned.udata; #ifdef DEBUG printf("kevent %d %d errno %d return.ident %p " - "return.data %p return.udata %p %p\n", - i, result, error, - kq_returned.ident, kq_returned.data, - kq_returned.udata, + "return.data %p return.udata %p %p\n", + i, result, error, + kq_returned.ident, kq_returned.data, + kq_returned.udata, kq_iocb); #endif - + if (kq_iocb) break; #ifdef DEBUG printf("Try again left %d out of %d %d\n", pending, nitems(iocb), cancel); #endif - } - + } + for (j = 0; j < nitems(iocb) && iocb[j] != kq_iocb; j++) ; #ifdef DEBUG printf("kq_iocb %p\n", kq_iocb); - + printf("Error Result for %d is %d pending %d\n", j, result, pending); #endif @@ -192,7 +199,7 @@ main (int argc, char *argv[]) iocb[j] = NULL; pending--; i++; - } + } for (i = 0; i < nitems(iocb); i++) free(iocb[i]); From owner-svn-src-head@freebsd.org Mon Dec 28 02:07: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 2FD60A52BDA; Mon, 28 Dec 2015 02:07:58 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DABDA1D2A; Mon, 28 Dec 2015 02:07:57 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS27veB094914; Mon, 28 Dec 2015 02:07:57 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS27vds094913; Mon, 28 Dec 2015 02:07:57 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512280207.tBS27vds094913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 28 Dec 2015 02:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292817 - 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: Mon, 28 Dec 2015 02:07:58 -0000 Author: araujo Date: Mon Dec 28 02:07:56 2015 New Revision: 292817 URL: https://svnweb.freebsd.org/changeset/base/292817 Log: Add on systat -vm the ability to display the physical and kernel memory percent usage. PR: bin/203917 Submitted by: ota Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D4281 Modified: head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Mon Dec 28 02:01:41 2015 (r292816) +++ head/usr.bin/systat/vmstat.c Mon Dec 28 02:07:56 2015 (r292817) @@ -108,6 +108,7 @@ static struct Info { u_int v_active_count; /* number of pages active */ u_int v_inactive_count; /* number of pages inactive */ u_int v_cache_count; /* number of pages on buffer cache queue */ + u_long v_kmem_map_size; /* Current kmem allocation size */ struct vmtotal Total; struct nchstats nchstats; long nchcount; @@ -118,6 +119,8 @@ static struct Info { long freevnodes; int numdirtybuffers; } s, s1, s2, z; +static u_long kmem_size; +static u_int v_page_count; struct statinfo cur, last, run; @@ -278,6 +281,8 @@ initkre(void) allocinfo(&s2); allocinfo(&z); } + GETSYSCTL("vm.kmem_size", kmem_size); + GETSYSCTL("vm.stats.vm.v_page_count", v_page_count); getinfo(&s2); copyinfo(&s2, &s1); return(1); @@ -307,7 +312,8 @@ labelkre(void) clear(); mvprintw(STATROW, STATCOL + 6, "users Load"); - mvprintw(MEMROW, MEMCOL, "Mem:KB REAL VIRTUAL"); + mvprintw(STATROW + 1, STATCOL + 3, "Mem usage: %%Phy %%Kmem"); + mvprintw(MEMROW, MEMCOL, "Mem: KB REAL VIRTUAL"); mvprintw(MEMROW + 1, MEMCOL, " Tot Share Tot Share"); mvprintw(MEMROW + 2, MEMCOL, "Act"); mvprintw(MEMROW + 3, MEMCOL, "All"); @@ -478,6 +484,11 @@ showkre(void) putfloat(avenrun[2], STATROW, STATCOL + 32, 5, 2, 0); mvaddstr(STATROW, STATCOL + 55, buf); #define pgtokb(pg) ((pg) * (s.v_page_size / 1024)) + putfloat(100.0 * (v_page_count - total.t_free) / v_page_count, + STATROW + 1, STATCOL + 15, 2, 0, 1); + putfloat(100.0 * s.v_kmem_map_size / kmem_size, + STATROW + 1, STATCOL + 22, 2, 0, 1); + putint(pgtokb(total.t_arm), MEMROW + 2, MEMCOL + 4, 7); putint(pgtokb(total.t_armshr), MEMROW + 2, MEMCOL + 12, 7); putint(pgtokb(total.t_avm), MEMROW + 2, MEMCOL + 20, 8); @@ -790,6 +801,7 @@ getinfo(struct Info *ls) GETSYSCTL("vfs.freevnodes", ls->freevnodes); GETSYSCTL("vfs.cache.nchstats", ls->nchstats); GETSYSCTL("vfs.numdirtybuffers", ls->numdirtybuffers); + GETSYSCTL("vm.kmem_map_size", ls->v_kmem_map_size); getsysctl("hw.intrcnt", ls->intrcnt, nintr * sizeof(u_long)); size = sizeof(ls->Total); From owner-svn-src-head@freebsd.org Mon Dec 28 02:18: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 3E924A52FBE; Mon, 28 Dec 2015 02:18:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 19BAD11A3; Mon, 28 Dec 2015 02:18:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2IN99098128; Mon, 28 Dec 2015 02:18:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2INuW098127; Mon, 28 Dec 2015 02:18:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280218.tBS2INuW098127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292818 - head/tests/sys/aio 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, 28 Dec 2015 02:18:24 -0000 Author: ngie Date: Mon Dec 28 02:18:22 2015 New Revision: 292818 URL: https://svnweb.freebsd.org/changeset/base/292818 Log: Fix style(9) a bit and ensure that error from initializing kqueue(2) is sane - Push the kqueue(2) initialization down so the errno will correspond with the failure instead of potentially being stomped on by functions called by `PLAIN_REQUIRE_KERNEL_MODULE` - Delete trailing whitespace - Add spaces between braces for conditional and control blocks (for/if) - Use err/errx instead of perror+printf+exit/printf+exit. - Remove braces for single-line conditionals Tested with and without -DDEBUG MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/aio/lio_kqueue_test.c Modified: head/tests/sys/aio/lio_kqueue_test.c ============================================================================== --- head/tests/sys/aio/lio_kqueue_test.c Mon Dec 28 02:07:56 2015 (r292817) +++ head/tests/sys/aio/lio_kqueue_test.c Mon Dec 28 02:18:22 2015 (r292818) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -57,13 +58,14 @@ #define MAX_RUNS 300 int -main(int argc, char *argv[]){ +main(int argc, char *argv[]) +{ int fd; struct aiocb *iocb[MAX_IOCBS]; struct aiocb **lio[LIO_MAX], **lio_element, **kq_lio; int i, result, run, error, j, k; char buffer[32768]; - int kq = kqueue(); + int kq; struct kevent ke, kq_returned; struct timespec ts; struct sigevent sig; @@ -73,10 +75,9 @@ main(int argc, char *argv[]){ PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); - if (kq < 0) { - perror("No kqeueue\n"); - exit(1); - } + kq = kqueue(); + if (kq < 0) + err(1, "kqeueue(2) failed"); if (argc == 1) { strcpy(pathname, PATH_TEMPLATE); @@ -87,34 +88,30 @@ main(int argc, char *argv[]){ file = argv[1]; fd = open(file, O_RDWR|O_CREAT, 0666); } - if (fd < 0){ - fprintf(stderr, "Can't open %s\n", argv[1]); - perror(""); - exit(1); - } + if (fd < 0) + err(1, "can't open %s", argv[1]); #ifdef DEBUG printf("Hello kq %d fd %d\n", kq, fd); #endif - for (run = 0; run < MAX_RUNS; run++){ + for (run = 0; run < MAX_RUNS; run++) { #ifdef DEBUG printf("Run %d\n", run); #endif for (j = 0; j < LIO_MAX; j++) { - lio[j] = (struct aiocb **) + lio[j] = malloc(sizeof(struct aiocb *) * MAX_IOCBS/LIO_MAX); - for(i = 0; i < MAX_IOCBS / LIO_MAX; i++) { + for (i = 0; i < MAX_IOCBS / LIO_MAX; i++) { k = (MAX_IOCBS / LIO_MAX * j) + i; lio_element = lio[j]; - lio[j][i] = iocb[k] = (struct aiocb *) - malloc(sizeof(struct aiocb)); - bzero(iocb[k], sizeof(struct aiocb)); + lio[j][i] = iocb[k] = + calloc(1, sizeof(struct aiocb)); iocb[k]->aio_nbytes = sizeof(buffer); iocb[k]->aio_buf = buffer; iocb[k]->aio_fildes = fd; - iocb[k]->aio_offset - = iocb[k]->aio_nbytes * k * (run + 1); + iocb[k]->aio_offset + = iocb[k]->aio_nbytes * k * (run + 1); #ifdef DEBUG printf("hello iocb[k] %d\n", @@ -131,27 +128,26 @@ main(int argc, char *argv[]){ error = errno; time(&time2); #ifdef DEBUG - printf("Time %d %d %d result -> %d\n", + printf("Time %d %d %d result -> %d\n", time1, time2, time2-time1, result); #endif if (result != 0) { errno = error; - perror("list_listio"); - printf("FAIL: Result %d iteration %d\n",result, j); - exit(1); + err(1, "FAIL: Result %d iteration %d\n", + result, j); } #ifdef DEBUG printf("write %d is at %p\n", j, lio[j]); #endif } - for(i = 0; i < LIO_MAX; i++) { - for(j = LIO_MAX - 1; j >=0; j--) { + for (i = 0; i < LIO_MAX; i++) { + for (j = LIO_MAX - 1; j >=0; j--) { if (lio[j]) break; } - for(;;) { + for (;;) { bzero(&ke, sizeof(ke)); bzero(&kq_returned, sizeof(ke)); ts.tv_sec = 0; @@ -159,9 +155,9 @@ main(int argc, char *argv[]){ #ifdef DEBUG printf("FOO lio %d -> %p\n", j, lio[j]); #endif - EV_SET(&ke, (uintptr_t)lio[j], + EV_SET(&ke, (uintptr_t)lio[j], EVFILT_LIO, EV_ONESHOT, 0, 0, iocb[j]); - result = kevent(kq, NULL, 0, + result = kevent(kq, NULL, 0, &kq_returned, 1, &ts); error = errno; if (result < 0) { @@ -170,14 +166,14 @@ main(int argc, char *argv[]){ kq_lio = kq_returned.udata; #ifdef DEBUG printf("kevent %d %d errno %d return.ident %p " - "return.data %p return.udata %p %p\n", - i, result, error, - kq_returned.ident, kq_returned.data, - kq_returned.udata, + "return.data %p return.udata %p %p\n", + i, result, error, + kq_returned.ident, kq_returned.data, + kq_returned.udata, lio[j]); #endif - if(kq_lio) + if (kq_lio) break; #ifdef DEBUG printf("Try again\n"); @@ -189,25 +185,21 @@ main(int argc, char *argv[]){ #endif for (j = 0; j < LIO_MAX; j++) { - if (lio[j] == kq_lio) { + if (lio[j] == kq_lio) break; - } - } - if (j == LIO_MAX) { - printf("FAIL:\n"); - exit(1); } + if (j == LIO_MAX) + errx(1, "FAIL: "); #ifdef DEBUG printf("Error Result for %d is %d\n", j, result); #endif if (result < 0) { printf("FAIL: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result); - failed = 1; - } else { + failed++; + } else printf("PASS: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result); - } - for(k = 0; k < MAX_IOCBS / LIO_MAX; k++){ + for (k = 0; k < MAX_IOCBS / LIO_MAX; k++) { result = aio_return(kq_lio[k]); #ifdef DEBUG printf("Return Resulto for %d %d is %d\n", j, k, result); @@ -224,9 +216,8 @@ main(int argc, char *argv[]){ printf("\n"); #endif - for(k = 0; k < MAX_IOCBS / LIO_MAX; k++) { + for (k = 0; k < MAX_IOCBS / LIO_MAX; k++) free(lio[j][k]); - } free(lio[j]); lio[j] = NULL; } @@ -235,15 +226,12 @@ main(int argc, char *argv[]){ printf("Done\n"); #endif - if (tmp_file) { + if (tmp_file) unlink(pathname); - } - if (failed) { - printf("FAIL: Atleast one\n"); - exit(1); - } else { - printf("PASS: All\n"); - exit(0); - } + if (failed) + errx(1, "FAIL: %d testcases failed", failed); + else + errx(0, "PASS: All\n"); + } From owner-svn-src-head@freebsd.org Mon Dec 28 02:21: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 C7F74A4C1C6; Mon, 28 Dec 2015 02:21:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 945071532; Mon, 28 Dec 2015 02:21:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2LaHP099019; Mon, 28 Dec 2015 02:21:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2LaTC099018; Mon, 28 Dec 2015 02:21:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280221.tBS2LaTC099018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292819 - head/tests/sys/aio 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, 28 Dec 2015 02:21:37 -0000 Author: ngie Date: Mon Dec 28 02:21:36 2015 New Revision: 292819 URL: https://svnweb.freebsd.org/changeset/base/292819 Log: - Fix an improperly sized buffer for `pathname` [1] - Fix a -Wunused-but-set-variable warning [2] MFC after: 1 week Reported by: cppcheck [1], gcc 4.9 [2] Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/aio/lio_kqueue_test.c Modified: head/tests/sys/aio/lio_kqueue_test.c ============================================================================== --- head/tests/sys/aio/lio_kqueue_test.c Mon Dec 28 02:18:22 2015 (r292818) +++ head/tests/sys/aio/lio_kqueue_test.c Mon Dec 28 02:21:36 2015 (r292819) @@ -62,7 +62,7 @@ main(int argc, char *argv[]) { int fd; struct aiocb *iocb[MAX_IOCBS]; - struct aiocb **lio[LIO_MAX], **lio_element, **kq_lio; + struct aiocb **lio[LIO_MAX], **kq_lio; int i, result, run, error, j, k; char buffer[32768]; int kq; @@ -70,7 +70,7 @@ main(int argc, char *argv[]) struct timespec ts; struct sigevent sig; time_t time1, time2; - char *file, pathname[sizeof(PATH_TEMPLATE)-1]; + char *file, pathname[sizeof(PATH_TEMPLATE)]; int tmp_file = 0, failed = 0; PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); @@ -104,7 +104,6 @@ main(int argc, char *argv[]) malloc(sizeof(struct aiocb *) * MAX_IOCBS/LIO_MAX); for (i = 0; i < MAX_IOCBS / LIO_MAX; i++) { k = (MAX_IOCBS / LIO_MAX * j) + i; - lio_element = lio[j]; lio[j][i] = iocb[k] = calloc(1, sizeof(struct aiocb)); iocb[k]->aio_nbytes = sizeof(buffer); From owner-svn-src-head@freebsd.org Mon Dec 28 02:28: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 3D163A4C426; Mon, 28 Dec 2015 02:28:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F2AEE1898; Mon, 28 Dec 2015 02:28:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2SDTw001572; Mon, 28 Dec 2015 02:28:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2SDvx001571; Mon, 28 Dec 2015 02:28:13 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280228.tBS2SDvx001571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292820 - 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: Mon, 28 Dec 2015 02:28:14 -0000 Author: ngie Date: Mon Dec 28 02:28:12 2015 New Revision: 292820 URL: https://svnweb.freebsd.org/changeset/base/292820 Log: Clean trailing whitespace MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/kern/unix_seqpacket_test.c Modified: head/tests/sys/kern/unix_seqpacket_test.c ============================================================================== --- head/tests/sys/kern/unix_seqpacket_test.c Mon Dec 28 02:21:36 2015 (r292819) +++ head/tests/sys/kern/unix_seqpacket_test.c Mon Dec 28 02:28:12 2015 (r292820) @@ -47,7 +47,7 @@ static void do_socketpair(int *sv) { int s; - + s = socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sv); ATF_REQUIRE_EQ(0, s); ATF_REQUIRE(sv[0] >= 0); @@ -59,7 +59,7 @@ static void do_socketpair_nonblocking(int *sv) { int s; - + s = socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sv); ATF_REQUIRE_EQ(0, s); ATF_REQUIRE(sv[0] >= 0); @@ -69,7 +69,7 @@ do_socketpair_nonblocking(int *sv) ATF_REQUIRE(-1 != fcntl(sv[1], F_SETFL, O_NONBLOCK)); } -/* +/* * Returns a pair of sockets made the hard way: bind, listen, connect & accept * @return const char* The path to the socket */ @@ -100,7 +100,7 @@ mk_pair_of_sockets(int *sv) perror("connect"); atf_tc_fail("connect(2) failed"); } - + /* Accept it */ s1 = accept(s, NULL, NULL); if (s1 == -1) { @@ -239,7 +239,7 @@ test_pipe_simulator(size_t sndbufsize, s memset(sndbuf, num_sent, pktsize); ssize = send(sv[0], sndbuf, pktsize, MSG_EOR); if (ssize < 0) { - /* + /* * XXX: This is bug-compatible with the kernel. * The kernel returns EMSGSIZE when it should * return EAGAIN @@ -275,7 +275,7 @@ test_pipe_simulator(size_t sndbufsize, s pktsize, rsize); memset(comparebuf, num_received, pktsize); ATF_CHECK_EQ_MSG(0, memcmp(comparebuf, rcvbuf, - pktsize), + pktsize), "Received data miscompare"); num_received++; } @@ -333,7 +333,7 @@ test_pipe_reader(void* args) "expected %zd=send(...) but got %zd", td->pktsize, rsize); d = memcmp(comparebuf, rcvbuf, td->pktsize); - ATF_CHECK_EQ_MSG(0, d, + ATF_CHECK_EQ_MSG(0, d, "Received data miscompare on packet %d", i); } return (0); @@ -369,7 +369,7 @@ test_pipe(size_t sndbufsize, size_t rcvb reader_data.so = sv[1]; ATF_REQUIRE_EQ(0, pthread_create(&writer, NULL, test_pipe_writer, (void*)&writer_data)); - /* + /* * Give the writer time to start writing, and hopefully block, before * starting the reader. This increases the likelihood of the test case * failing due to PR kern/185812 @@ -561,7 +561,7 @@ ATF_TC_BODY(resize_buffers, tc) ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_SNDBUF, &xs, &sl)); ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_RCVBUF, &xr, &sl)); printf("After changing SNDBUF | %7d | %7d |\n", xs, xr); - + if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)) != 0){ perror("setsockopt"); atf_tc_fail("setsockopt(SO_RCVBUF) failed"); @@ -703,7 +703,7 @@ ATF_TC_BODY(sendto_recvfrom, tc) } ATF_CHECK_EQ(datalen, rsize); - /* + /* * FreeBSD does not currently provide the source address for SEQ_PACKET * AF_UNIX sockets, and POSIX does not require it, so these two checks * are disabled. If FreeBSD gains that feature in the future, then @@ -715,7 +715,7 @@ ATF_TC_BODY(sendto_recvfrom, tc) close(sv[1]); } -/* +/* * send(2) and recv(2) a single short record with sockets created the * traditional way, involving bind, listen, connect, and accept */ @@ -861,7 +861,7 @@ ATF_TC_BODY(send_recv_nonblocking, tc) close(sv[1]); } -/* +/* * We should get EMSGSIZE if we try to send a message larger than the socket * buffer, with blocking sockets */ @@ -890,7 +890,7 @@ ATF_TC_BODY(emsgsize, tc) close(sv[1]); } -/* +/* * We should get EMSGSIZE if we try to send a message larger than the socket * buffer, with nonblocking sockets */ @@ -920,7 +920,7 @@ ATF_TC_BODY(emsgsize_nonblocking, tc) } -/* +/* * We should get EAGAIN if we try to send a message larger than the socket * buffer, with nonblocking sockets. Test with several different sockbuf sizes */ @@ -946,7 +946,7 @@ ATF_TC_BODY(eagain_128k_128k, tc) } -/* +/* * nonblocking send(2) and recv(2) of several records, which should collectively * fill up the send buffer but not the receive buffer */ @@ -971,7 +971,7 @@ ATF_TC_BODY(rcvbuf_oversized, tc) ATF_REQUIRE_EQ(0, setsockopt(sv[1], SOL_SOCKET, SO_RCVBUF, &rcvbufsize, sizeof(rcvbufsize))); - /* + /* * Send and receive packets that are collectively greater than the send * buffer, but less than the receive buffer */ @@ -999,7 +999,7 @@ ATF_TC_BODY(rcvbuf_oversized, tc) "expected %zd=send(...) but got %zd", pktsize, rsize); /* Verify the contents */ - ATF_CHECK_EQ_MSG(0, memcmp(sndbuf, recv_buf, pktsize), + ATF_CHECK_EQ_MSG(0, memcmp(sndbuf, recv_buf, pktsize), "Received data miscompare"); } @@ -1011,7 +1011,7 @@ ATF_TC_BODY(rcvbuf_oversized, tc) close(sv[1]); } -/* +/* * Simulate the behavior of a blocking pipe. The sender will send until his * buffer fills up, then we'll simulate a scheduler switch that will allow the * receiver to read until his buffer empties. Repeat the process until the @@ -1042,7 +1042,7 @@ ATF_TC_BODY(pipe_simulator_128k_128k, tc test_pipe_simulator(131072, 131072); } -/* +/* * Test blocking I/O by passing data between two threads. The total amount of * data will be >> buffer size to force blocking. Repeat the test with multiple * send and receive buffer sizes From owner-svn-src-head@freebsd.org Mon Dec 28 02:35: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 A0C6EA4C73E; Mon, 28 Dec 2015 02:35:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 550961E7D; Mon, 28 Dec 2015 02:35:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2YxuT004837; Mon, 28 Dec 2015 02:34:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2YxER004836; Mon, 28 Dec 2015 02:34:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280234.tBS2YxER004836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292821 - 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: Mon, 28 Dec 2015 02:35:00 -0000 Author: ngie Date: Mon Dec 28 02:34:59 2015 New Revision: 292821 URL: https://svnweb.freebsd.org/changeset/base/292821 Log: - Remove unused but set ssize in shutdown_send_sigpipe - Add #ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS` for untestable code because FreeBSD doesn't have a means to map source addresses for SEQ_PACKET AF_UNIX sockets (paraphrased). Put pathname variable under the #ifdef to mute another unused but set variable warning MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/kern/unix_seqpacket_test.c Modified: head/tests/sys/kern/unix_seqpacket_test.c ============================================================================== --- head/tests/sys/kern/unix_seqpacket_test.c Mon Dec 28 02:28:12 2015 (r292820) +++ head/tests/sys/kern/unix_seqpacket_test.c Mon Dec 28 02:34:59 2015 (r292821) @@ -671,7 +671,9 @@ ATF_TC_BODY(send_recv, tc) ATF_TC_WITHOUT_HEAD(sendto_recvfrom); ATF_TC_BODY(sendto_recvfrom, tc) { +#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS const char* path; +#endif struct sockaddr_storage from; int sv[2]; const int bufsize = 64; @@ -682,7 +684,10 @@ ATF_TC_BODY(sendto_recvfrom, tc) socklen_t fromlen; /* setup the socket pair */ - path = mk_pair_of_sockets(sv); +#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS + path = +#endif + mk_pair_of_sockets(sv); /* send and receive a small packet */ datalen = strlen(data) + 1; /* +1 for the null */ @@ -703,14 +708,16 @@ ATF_TC_BODY(sendto_recvfrom, tc) } ATF_CHECK_EQ(datalen, rsize); +#ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS /* * FreeBSD does not currently provide the source address for SEQ_PACKET * AF_UNIX sockets, and POSIX does not require it, so these two checks * are disabled. If FreeBSD gains that feature in the future, then * these checks may be reenabled */ - /* ATF_CHECK_EQ(PF_LOCAL, from.ss_family); */ - /* ATF_CHECK_STREQ(path, ((struct sockaddr_un*)&from)->sun_path); */ + ATF_CHECK_EQ(PF_LOCAL, from.ss_family); + ATF_CHECK_STREQ(path, ((struct sockaddr_un*)&from)->sun_path); +#endif close(sv[0]); close(sv[1]); } @@ -795,7 +802,6 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc) /* ATF's isolation mechanisms will guarantee uniqueness of this file */ const char *path = "sock"; const char *data = "data"; - ssize_t ssize; int s, err, s2; s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); @@ -820,7 +826,7 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc) ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR)); ATF_REQUIRE(SIG_ERR != signal(SIGPIPE, shutdown_send_sigpipe_handler)); - ssize = send(s2, data, sizeof(data), MSG_EOR); + (void)send(s2, data, sizeof(data), MSG_EOR); ATF_CHECK_EQ(1, got_sigpipe); close(s); close(s2); From owner-svn-src-head@freebsd.org Mon Dec 28 02:36: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 2BDF5A4C806; Mon, 28 Dec 2015 02:36:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F2AC410F2; Mon, 28 Dec 2015 02:36:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2awUd005148; Mon, 28 Dec 2015 02:36:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2aw11005147; Mon, 28 Dec 2015 02:36:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280236.tBS2aw11005147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 02:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292822 - head/tests/sys/kern/pipe 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, 28 Dec 2015 02:36:59 -0000 Author: ngie Date: Mon Dec 28 02:36:57 2015 New Revision: 292822 URL: https://svnweb.freebsd.org/changeset/base/292822 Log: Remove retval to fix a -Wunused-but-set-variable warning from gcc 4.9 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/kern/pipe/pipe_overcommit1_test.c Modified: head/tests/sys/kern/pipe/pipe_overcommit1_test.c ============================================================================== --- head/tests/sys/kern/pipe/pipe_overcommit1_test.c Mon Dec 28 02:34:59 2015 (r292821) +++ head/tests/sys/kern/pipe/pipe_overcommit1_test.c Mon Dec 28 02:36:57 2015 (r292822) @@ -40,12 +40,11 @@ int main(void) { - int pipes[10000], returnval; + int pipes[10000]; unsigned int i; - for (i = 0; i < nitems(pipes); i++) { - returnval = pipe(&pipes[i]); - } + for (i = 0; i < nitems(pipes); i++) + (void)pipe(&pipes[i]); printf("PASS\n"); exit(0); From owner-svn-src-head@freebsd.org Mon Dec 28 03:14: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 DC820A4D58B for ; Mon, 28 Dec 2015 03:14:54 +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 CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BCB6919B0 for ; Mon, 28 Dec 2015 03:14:54 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-250-125.lns20.per4.internode.on.net [121.45.250.125]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id tBS3ELVh022776 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 27 Dec 2015 19:14:24 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern To: Bruce Evans , Ian Lepore References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151227184101.GG70867@zxy.spb.ru> <1451243810.1369.10.camel@freebsd.org> <20151227193046.GE4535@zxy.spb.ru> <8D7D617E-FF9E-4D74-87CB-1F3EE65D108A@gmail.com> <1451247868.1369.16.camel@freebsd.org> <20151228093724.D1014@besplex.bde.org> Cc: NGie Cooper , Slawa Olhovchenkov , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Julian Elischer Message-ID: <5680A907.4020407@freebsd.org> Date: Mon, 28 Dec 2015 11:14:15 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20151228093724.D1014@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed 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, 28 Dec 2015 03:14:55 -0000 On 28/12/2015 7:23 AM, Bruce Evans wrote: > On Sun, 27 Dec 2015, Ian Lepore wrote: > >> On Sun, 2015-12-27 at 12:05 -0800, NGie Cooper wrote: >>>> On Dec 27, 2015, at 11:30, Slawa Olhovchenkov >>>> wrote: >>> >>> � >>> >>>>> I have no idea what you mean by that -- I didn't say anything at >>>>> all >>>>> about panic. >>>> >>>> As I understund commit log -- this is prevent kernel panic at some >>>> call (with illegal arguments). This accpetable irrelevant to bugs >>>> in >>>> calling code. >>> >>> This also makes us POSIX compliant and more compatible with >>> Linux: >>> http://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_settime.html >>> (search for �negative�). >>> Thanks kib! >>> -NGie >> >> This thread just keeps becoming more and more surrealistic. First >> someone tries to reply to the original commit (I guess?) by replying >> with a complete non sequitur to my reply. Now you cite a document >> that >> says nothing directly related to the commit at all. >> >> The only reference to "negative" in what you cited is part of >> specifying how to truncate/round fractional values that fall between >> two representable values given the resolution of the clock you're >> setting. > > It also has an obfuscated verbose spelling of negative as "less than > zero" in the description of [EINVAL]. This is the specification of > a invalid timespec which is repeated ad nauseum. The upper limit is > spelled even more verbosely as "greater than or equal to 1000 million". > The correct spelling of this is ">= 1000000000" but that is hard to > read in another way (too many 0's to count quickly). Spelling this > value is remarkably difficult. There are about 10 different spellings > that are no good since they depend on the locale or language (natural > or programming). Mixing digits and words is ugly. 1 billion is > shorter but is off by a factor of 1000 in some locales. > so, now that you have all that loaded into your interneal cache, how about suggesting the least suboptimal behaviour. > I stared at this description many times. It doesn't allow considering > negative times as invalid generally. setitimer(2) has to be specially > broken to disallow them. This bug is missing for nanosleep(). FreeBSD > still documents a non-POSIX limit of 100000000 seconds for > setitimer(2), > but its implementation has been broken to overflow instead of enforcing > this limit. Note that this is 1 followed by 8 zeros and applies to > the seconds value, while the limit for nanoseconds os 1 followed by 9 > zeros. > > Different spellings of 1 followed by a large number of zeros makes thes > value hard to grep for. 1 followed by 8 zeros is in about 50 man pages > (counting links). It is documented as the limit on seconds in > get/setitimer(2). mtree(8) misspells 1 followed by 9 zeros as 1 > followed > by 8 zeros. alarm(3) is implemented using itimers and documents the > same limit. ularm(3) documents the bizarre limit of 1 followed by 14 > zeros "in case this value fits in an the unsigned integer". This is > alarm(3)'s documented but not actual limit of 10**8 seconds converted > to microseconds. It is reachable on systems with >= 47 bit longs. > This spelling is not used in any man page for the limit on the number > of nanoseconds (as in POSIX). > >> Later in that document they specifically require EINVAL for negative >> fractional second values. If they intended to to prohibit negative >> whole-second values, that would certainly have been the place to >> mention it, and they don't. > > This is the "obfuscated verbose spelling" part. This is not really > a restriction on negative fractions. It is just that negative > fractions > are represented as a negative integer plus a proper fraction, where by > definition a proper fraction is nonnegative and less than 1. > Normalization gives this (except when it would overflow). The > requirement is essentially that callers don't pass unnormalized values. > > Bruce From owner-svn-src-head@freebsd.org Mon Dec 28 05:48: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 81845A5237A; Mon, 28 Dec 2015 05:48:23 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 545081575; Mon, 28 Dec 2015 05:48:23 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS5mMLH065527; Mon, 28 Dec 2015 05:48:22 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS5mMNe065526; Mon, 28 Dec 2015 05:48:22 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512280548.tBS5mMNe065526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 28 Dec 2015 05:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292828 - head/usr.sbin/pwd_mkdb 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, 28 Dec 2015 05:48:23 -0000 Author: araujo Date: Mon Dec 28 05:48:22 2015 New Revision: 292828 URL: https://svnweb.freebsd.org/changeset/base/292828 Log: The sdp opens the database with PERM_SECURE mode and it is different than dp that opens the database with PERM_INSECURE, so we need to check sdp->put against sdp instead of use dp->put. PR: bin/191720 Submitted by: Miles Ohlrich Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4255 Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c ============================================================================== --- head/usr.sbin/pwd_mkdb/pwd_mkdb.c Mon Dec 28 03:39:32 2015 (r292827) +++ head/usr.sbin/pwd_mkdb/pwd_mkdb.c Mon Dec 28 05:48:22 2015 (r292828) @@ -352,7 +352,7 @@ main(int argc, char *argv[]) data.size = 1; if ((dp->put)(dp, &key, &data, 0) == -1) error("put"); - if ((dp->put)(sdp, &key, &data, 0) == -1) + if ((sdp->put)(sdp, &key, &data, 0) == -1) error("put"); } ypcnt = 0; From owner-svn-src-head@freebsd.org Mon Dec 28 07:46: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 E067BA54857; Mon, 28 Dec 2015 07:46:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id ACEA71D0F; Mon, 28 Dec 2015 07:46:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 85DA3781CD9; Mon, 28 Dec 2015 18:21:42 +1100 (AEDT) Date: Mon, 28 Dec 2015 18:21:41 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcelo Araujo cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292817 - head/usr.bin/systat In-Reply-To: <201512280207.tBS27vds094913@repo.freebsd.org> Message-ID: <20151228170552.V2375@besplex.bde.org> References: <201512280207.tBS27vds094913@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=R4L+YolX c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=7DT2vUWpYU7gVe86gssA:9 a=CjuIK1q_8ugA:10 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, 28 Dec 2015 07:46:51 -0000 On Mon, 28 Dec 2015, Marcelo Araujo wrote: > Log: > Add on systat -vm the ability to display the physical and kernel memory > percent usage. > > PR: bin/203917 > Submitted by: ota > Approved by: bapt (mentor) > Differential Revision: https://reviews.freebsd.org/D4281 This has lots of style bugs in both the output and the source code. There was negative space for expansion, but some space is used to squeeze memory- related variables in between the general stats line and the memory lines. I think they would fit in the general stats line and not look quites as bad there. This line now uses 67 columns and only needs about 50 of these. Style bugs start with not updating the comment about STATROW. It still says that that this (really the STAT window) uses 1 row and 67 columns, but it now uses 2 row. This use is an abuse. It would be clearer to put the new memory statistics in a new window. They don't really fit in tje MEM window either, and putting them there would change all the existing line numbers there. Some other statistics are squeezed into out of the way places and not printed if the terminal is not large enough. nbuf is one of these. Displaying it is not very useful since (like the variables in this commit and unlike almost all the other variables in the display), it is constant. It is also less useful than the variables in this commit. So it is put on line 24 of 0-24 and not displayed unless the terminal has > 25 lines since the last line is reserved for input. I recently noticed that the interrupt lines are misformatted by letting them run into the interactive i/o line (probably also outside the window where they are not displayed of course) if there are many of them. Then if you do input, it makes a mess by erasing the last displayed interrupt line, but not completely. The line is first erased completely, but later the count is refreshed but the description is not. Switching to another display and back gives the same mess, with the description displayed for an instant on switching back before it is erased by info on the i/o line. Bruce From owner-svn-src-head@freebsd.org Mon Dec 28 08:13: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 3EC53A52205; Mon, 28 Dec 2015 08:13:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B21791867; Mon, 28 Dec 2015 08:13:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id tBS8DG8O020764 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 28 Dec 2015 10:13:16 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua tBS8DG8O020764 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id tBS8DDET020763; Mon, 28 Dec 2015 10:13:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 28 Dec 2015 10:13:13 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Ian Lepore , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern Message-ID: <20151228081313.GM3625@kib.kiev.ua> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151228083418.B1014@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151228083418.B1014@besplex.bde.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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, 28 Dec 2015 08:13:27 -0000 On Mon, Dec 28, 2015 at 09:35:11AM +1100, Bruce Evans wrote: > If this causes a panic, then it is from a sanity check detecting the > invalid conversion later. A negative value in days breaks the loop > logic but seems to give premature exit from the loops instead of many > iterations. It causes the panic due to out of bound accesses to bin2bcd_data[] array. The issue affects around twenty rtc drivers, according to the quick grep for clock_ts_to_ct() usage. It probably also affects geom raid modules, but I did not looked there at all. As I understand, people prefer to have ability to test practically useless values for the current time, by the cost the unplugged easy kernel panic, in the production systems ? Am I right ? The commit gave the immediate relief for the issue. If somebody have the correct fix for clock_ts_to_ct(), I am happy to see this commit reverted after the proper fix. From owner-svn-src-head@freebsd.org Mon Dec 28 08:33: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 79C8DA5294E; Mon, 28 Dec 2015 08:33:11 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward11p.cmail.yandex.net (forward11p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::bb]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0382101F; Mon, 28 Dec 2015 08:33:10 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp17.mail.yandex.net (smtp17.mail.yandex.net [IPv6:2a02:6b8:0:1402::118]) by forward11p.cmail.yandex.net (Yandex) with ESMTP id BB0E4206CB; Mon, 28 Dec 2015 11:33:06 +0300 (MSK) Received: from smtp17.mail.yandex.net (localhost [127.0.0.1]) by smtp17.mail.yandex.net (Yandex) with ESMTP id EF491190126F; Mon, 28 Dec 2015 11:33:05 +0300 (MSK) Received: by smtp17.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RU7hIds2g2-X5OSukDA; Mon, 28 Dec 2015 11:33:05 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1451291585; bh=4oFjIBctEY4vX6WayVZ5vUpHylTpf6dQ3svgknjPRMo=; h=Subject:To:References:From:X-Enigmail-Draft-Status:Message-ID: Date:User-Agent:MIME-Version:In-Reply-To:Content-Type; b=KyvSS+KsNg0ps3hkrqk7A0KzVssArzN63ZBlCL/PICEjScCPX8RPWinnVFKFLMm94 bcuoOeEZVzaRVIz3eCV1PRtspNxwXzIj8wpcQZ0ad4Zyhj3edl8p7rRTNgXrEAvTn5 exZlJsaK0WrzWG8uczqqJPJTWo37U2ldnJlk5qUw= Authentication-Results: smtp17.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-ForeignMX: US Subject: Re: svn commit: r292788 - in head/sys: geom/part sys To: Allan Jude , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201512271812.tBRICD3A044563@repo.freebsd.org> From: "Andrey V. Elsukov" X-Enigmail-Draft-Status: N1110 Message-ID: <5680F39D.8070002@yandex.ru> Date: Mon, 28 Dec 2015 11:32:29 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201512271812.tBRICD3A044563@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4BMdNf3VQL6TkIXMpQ3E3ahphsWWW4mJG" 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, 28 Dec 2015 08:33:11 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --4BMdNf3VQL6TkIXMpQ3E3ahphsWWW4mJG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 27.12.15 21:12, Allan Jude wrote: > Author: allanjude > Date: Sun Dec 27 18:12:13 2015 > New Revision: 292788 > URL: https://svnweb.freebsd.org/changeset/base/292788 >=20 > Log: > Add some additional GPT partition types > =20 > 4 ChromeOS GPT types > 2 Microsoft partition types > the new OpenBSD partition type > =20 > Modified: head/sys/geom/part/g_part.h > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/geom/part/g_part.h Sun Dec 27 17:58:58 2015 (r292787) > +++ head/sys/geom/part/g_part.h Sun Dec 27 18:12:13 2015 (r292788) > @@ -37,12 +37,28 @@ > =20 > enum g_part_alias { > G_PART_ALIAS_APPLE_BOOT, /* An Apple boot partition entry. */ > + G_PART_ALIAS_APPLE_CORE_STORAGE,/* An Apple Core Storage partition. *= / > G_PART_ALIAS_APPLE_HFS, /* An HFS+ file system entry. */ > G_PART_ALIAS_APPLE_LABEL, /* An Apple label partition entry. */ > G_PART_ALIAS_APPLE_RAID, /* An Apple RAID partition entry. */ > G_PART_ALIAS_APPLE_RAID_OFFLINE,/* An Apple RAID (offline) part entry= =2E*/ > G_PART_ALIAS_APPLE_TV_RECOVERY, /* An Apple TV recovery part entry. *= / > G_PART_ALIAS_APPLE_UFS, /* An Apple UFS partition entry. */ > + G_PART_ALIAS_BIOS_BOOT, /* A GRUB 2 boot partition entry. */ > + G_PART_ALIAS_CHROMEOS_FIRMWARE, /* A ChromeOS firmware part. entry. *= / > + G_PART_ALIAS_CHROMEOS_KERNEL, /* A ChromeOS Kernel part. entry. */ > + G_PART_ALIAS_CHROMEOS_RESERVED, /* ChromeOS. Reserved for future use.= */ > + G_PART_ALIAS_CHROMEOS_ROOT, /* A ChromeOS root part. entry. */ This enum could be used by third-party kernel module and in general it is not good to change the order of elements here. This can break `gpart show` output for such modules. Just for the future. :) --=20 WBR, Andrey V. Elsukov --4BMdNf3VQL6TkIXMpQ3E3ahphsWWW4mJG 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 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWgPOiAAoJEAHF6gQQyKF6VHcH/iqX1TFfGHCE+g1yPDKuUWpV WLpCMb4MtEVk4rhQatauwIAG+65MwJHwN4/D9BvWCYMmUgTyD/B5zBfcTvYPNcCl KCeTqV97Sf2BX9TJfYrtwPPn8RTpzCI1xUdqyyEXN1pPbit6HoKsciwwRVSHAPcP KbWO/J0IsHXokpf5FtvWLeJ8JfD25zIDc3yX4yppcL1NYGgvve5uLyJ/2dYuvQH7 ZDpv40odbYiG8jn8Oolt17xWmjLGcTWVKDrHEAXZf5pZ256s8JFfIQMo90yU9TTF bc7TNIRr+aA57RXEOPPK6wZC/tCav346HwskyYnCjPAbr1ktnEARCq6mt9GAWPU= =Yk1W -----END PGP SIGNATURE----- --4BMdNf3VQL6TkIXMpQ3E3ahphsWWW4mJG-- From owner-svn-src-head@freebsd.org Mon Dec 28 08:53:32 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 D71BAA530FA; Mon, 28 Dec 2015 08:53:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A833D19E3; Mon, 28 Dec 2015 08:53:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS8rVkb022078; Mon, 28 Dec 2015 08:53:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS8rVmj022076; Mon, 28 Dec 2015 08:53:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201512280853.tBS8rVmj022076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 28 Dec 2015 08:53:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292829 - head/usr.sbin/fstyp 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, 28 Dec 2015 08:53:32 -0000 Author: delphij Date: Mon Dec 28 08:53:31 2015 New Revision: 292829 URL: https://svnweb.freebsd.org/changeset/base/292829 Log: Eliminate unneeded includes. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D4716 Modified: head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/geli.c Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Mon Dec 28 05:48:22 2015 (r292828) +++ head/usr.sbin/fstyp/fstyp.c Mon Dec 28 08:53:31 2015 (r292829) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/usr.sbin/fstyp/geli.c ============================================================================== --- head/usr.sbin/fstyp/geli.c Mon Dec 28 05:48:22 2015 (r292828) +++ head/usr.sbin/fstyp/geli.c Mon Dec 28 08:53:31 2015 (r292829) @@ -29,11 +29,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include -#include #include From owner-svn-src-head@freebsd.org Mon Dec 28 09:26: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 1664BA53E6C; Mon, 28 Dec 2015 09:26:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DC8BA1729; Mon, 28 Dec 2015 09:26:08 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS9Q7KZ030762; Mon, 28 Dec 2015 09:26:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS9Q7sr030760; Mon, 28 Dec 2015 09:26:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201512280926.tBS9Q7sr030760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 28 Dec 2015 09:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292831 - in head: sbin/ifconfig 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: Mon, 28 Dec 2015 09:26:09 -0000 Author: melifaro Date: Mon Dec 28 09:26:07 2015 New Revision: 292831 URL: https://svnweb.freebsd.org/changeset/base/292831 Log: Add SFF-8024 Extended Specification Compliance Submitted by: markb_mellanox.com MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4666 Modified: head/sbin/ifconfig/sfp.c head/sys/net/sff8436.h Modified: head/sbin/ifconfig/sfp.c ============================================================================== --- head/sbin/ifconfig/sfp.c Mon Dec 28 09:03:29 2015 (r292830) +++ head/sbin/ifconfig/sfp.c Mon Dec 28 09:26:07 2015 (r292831) @@ -171,7 +171,7 @@ static struct _nv fc_speed[] = { /* 10/40G Ethernet compliance codes, byte 128 + 3 */ static struct _nv eth_1040g[] = { - { 0x80, "Reserved" }, + { 0x80, "Extended" }, { 0x40, "10GBASE-LRM" }, { 0x20, "10GBASE-LR" }, { 0x10, "10GBASE-SR" }, @@ -181,6 +181,38 @@ static struct _nv eth_1040g[] = { { 0x01, "40G Active Cable" }, { 0, NULL } }; +#define SFF_8636_EXT_COMPLIANCE 0x80 + +/* SFF-8024 Rev. 3.4 table 4.4: Extended Specification Compliance */ +static struct _nv eth_extended_comp[] = { + { 0xFF, "Reserved" }, + { 0x1A, "2 lambda DWDM 100G" }, + { 0x19, "100G ACC or 25GAUI C2M ACC" }, + { 0x18, "100G AOC or 25GAUI C2M AOC" }, + { 0x17, "100G CLR4" }, + { 0x16, "10GBASE-T with SFI electrical interface" }, + { 0x15, "G959.1 profile P1L1-2D2" }, + { 0x14, "G959.1 profile P1S1-2D2" }, + { 0x13, "G959.1 profile P1I1-2D1" }, + { 0x12, "40G PSM4 Parallel SMF" }, + { 0x11, "4 x 10GBASE-SR" }, + { 0x10, "40GBASE-ER4" }, + { 0x0F, "Reserved" }, + { 0x0D, "25GBASE-CR CA-N" }, + { 0x0C, "25GBASE-CR CA-S" }, + { 0x0B, "100GBASE-CR4 or 25GBASE-CR CA-L" }, + { 0x0A, "Reserved" }, + { 0x09, "100G CWDM4 MSA without FEC" }, + { 0x08, "100G ACC (Active Copper Cable)" }, + { 0x07, "100G PSM4 Parallel SMF" }, + { 0x06, "100G CWDM4 MSA with FEC" }, + { 0x05, "100GBASE-SR10" }, + { 0x04, "100GBASE-ER4" }, + { 0x03, "100GBASE-LR4" }, + { 0x02, "100GBASE-SR4" }, + { 0x01, "100G AOC (Active Optical Cable) or 25GAUI C2M ACC" }, + { 0x00, "Unspecified" } +}; /* SFF-8636 Rev. 2.5 table 6.3: Revision compliance */ static struct _nv rev_compl[] = { @@ -371,9 +403,16 @@ get_qsfp_transceiver_class(struct i2c_in const char *tech_class; uint8_t code; - /* Check 10/40G Ethernet class only */ - read_i2c(ii, SFF_8436_BASE, SFF_8436_CODE_E1040G, 1, &code); - tech_class = find_zero_bit(eth_1040g, code, 1); + read_i2c(ii, SFF_8436_BASE, SFF_8436_CODE_E1040100G, 1, &code); + + /* Check for extended specification compliance */ + if (code & SFF_8636_EXT_COMPLIANCE) { + read_i2c(ii, SFF_8436_BASE, SFF_8436_OPTIONS_START, 1, &code); + tech_class = find_value(eth_extended_comp, code); + } else + /* Check 10/40G Ethernet class only */ + tech_class = find_zero_bit(eth_1040g, code, 1); + if (tech_class == NULL) tech_class = "Unknown"; @@ -873,6 +912,7 @@ sfp_status(int s, struct ifreq *ifr, int switch (id_byte) { case SFF_8024_ID_QSFP: case SFF_8024_ID_QSFPPLUS: + case SFF_8024_ID_QSFP28: print_qsfp_status(&ii, verbose); break; default: Modified: head/sys/net/sff8436.h ============================================================================== --- head/sys/net/sff8436.h Mon Dec 28 09:03:29 2015 (r292830) +++ head/sys/net/sff8436.h Mon Dec 28 09:26:07 2015 (r292831) @@ -131,7 +131,7 @@ enum { SFF_8436_CONNECTOR = 130, /* Connector type (Table 32) */ SFF_8436_TRANS_START = 131, /* Electric or Optical Compatibility * (Table 33) */ - SFF_8436_CODE_E1040G = 131, /* 10/40G Ethernet Compliance Code */ + SFF_8436_CODE_E1040100G = 131, /* 10/40/100G Ethernet Compliance Code */ SFF_8436_CODE_SONET = 132, /* SONET Compliance codes */ SFF_8436_CODE_SATA = 133, /* SAS/SATA compliance codes */ SFF_8436_CODE_E1G = 134, /* Gigabit Ethernet Compliant codes */ From owner-svn-src-head@freebsd.org Mon Dec 28 10:17:55 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 65F1AA530D2; Mon, 28 Dec 2015 10:17:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id F0A451DB6; Mon, 28 Dec 2015 10:17:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 3E17AD41B60; Mon, 28 Dec 2015 21:17:51 +1100 (AEDT) Date: Mon, 28 Dec 2015 21:17:50 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Ian Lepore , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern In-Reply-To: <20151228081313.GM3625@kib.kiev.ua> Message-ID: <20151228200006.Q2819@besplex.bde.org> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151228083418.B1014@besplex.bde.org> <20151228081313.GM3625@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=zHtpgXBBUDIKY00hTuEA:9 a=CjuIK1q_8ugA:10 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, 28 Dec 2015 10:17:55 -0000 On Mon, 28 Dec 2015, Konstantin Belousov wrote: > On Mon, Dec 28, 2015 at 09:35:11AM +1100, Bruce Evans wrote: >> If this causes a panic, then it is from a sanity check detecting the >> invalid conversion later. A negative value in days breaks the loop >> logic but seems to give premature exit from the loops instead of many >> iterations. > It causes the panic due to out of bound accesses to bin2bcd_data[] array. > The issue affects around twenty rtc drivers, according to the quick grep > for clock_ts_to_ct() usage. It probably also affects geom raid modules, > but I did not looked there at all. > > As I understand, people prefer to have ability to test practically > useless values for the current time, by the cost the unplugged easy > kernel panic, in the production systems ? Am I right ? It is not unreasonable to panic when such tests fail, just like for other settings of unreasonable values. Only the superuser can make them, and the superuser should know better than to run them on production systems. Of course, the correct fix is to fail for unrepresentable values. Different subsystems have different limits, so valid negative timevals may become invalid for certain RTC hardware or software. Valid positive timevals may also become invalid. The RTC might not have a century register, or one that it has might be unreliable as on x86 (the option USE_RTC_CENTURY tells atrtc to use the century register, but this is so little used that it is not a supported option). We use a hack to translate to a range of years including the current time. This used to be done almost correctly. It gave the range 1970-2069, so the Epoch as representable except in the Western hemisphere when the RTC is on local time. Now the range is 1980- 2079, so the Epoch is never representable. If someone tries to set the time to the Epoch, they get 2070 instead of 1970. > The commit gave > the immediate relief for the issue. If somebody have the correct fix > for clock_ts_to_ct(), I am happy to see this commit reverted after the > proper fix. It only avoids for some out of bounds value. I already pointed out that negative seconds still occur in the Western hemisphere for times near the Epoch, etc. Other overflow bugs are now easier to see. 64-bit time_t's allow really large times. The maximum with signed ones is about 292 billion years. 'year' has the wrong type (int) so it cannot represent that many. I think the loop to reduce 'days' iterates that many times and 'year' overflows every 2**32'nd iteration and the result is normally as if calculated correctly but then assigned to a 32-bit signed int. It can overflow to any 32-bit signed value. Fortunately, the calculation doesn't overrun a table of leap years. It just uses a simple rule for leap years which is expected to work until 2037. Years larger than that are not supported elsewhere. Next, the overflowed year is assigned to ct->year. This is also int, so no further overflow occurs. ct->year is misnamed (missing a prefix) and has a comment saying that it is a 4-digit year, but the code can produce any value. Next, ct->year is trusted by at least the atrtc driver. This gives an out of bound accesses to bin2bcd_data[] in about 49.5% of cases if USE_RTC_CENTURY is not configured, and in almost all cases if USE_RTC_CENTURY is configured: X writertc(RTC_YEAR, bin2bcd(ct.year % 100)); /* Write back Year */ X #ifdef USE_RTC_CENTURY X writertc(RTC_CENTURY, bin2bcd(ct.year / 100)); /* ... and Century */ #endif ct.year overflows to a negative value in about 50% of the cases. Then ct.year % 100 is negative in 99% of the subcases and 0 in 1% of the subcases. ct.year / 100 is negative in about 50% of the cases. When it is positive, it is too large for the array except for the small range 0-9999 for ct.year. The comment on ct->year is correct that the year must have only 4 digits. Anything larger than that takes more than 2 bin2bcd steps and more than 2 bcd registers to represent. Probably other drivers are sloppy as above, but they should be able to handle 4 digits by throwing away the century digits as in the usual case above. The adjustment to give times between 1980 and 2079 is for the other direction. That direction is more careful since the time comes from untrusted hardware instead of the trusted superuser. I pointed out some missing checks on lower bounds in clock_ct_to_ts(). The one for the month is not missing and is most important since the month is used as an array index and has base 1. The month day also has base 1 but is not used as an array index. Buggy hardware might produce 0 but can't produce a negative value for seconds minutes or hours if it uses bcd encoding. This leaves the year as most in need of a lower bounds check. The code is accidentally fail-safe for years -- years before 1970 are converted to 1970 except for the leap year caclulation. subr_clock.c is a little under-engineered. subr_fattime.c is grossly over-engineered, but not enough to have the necessary overflow checking. Its overflow bugs are easy to exercise using 64-bit time_t's. Just use utimes() or even utime() to try to set huge or negative times. There are lots of overflows, but the end result is in bounds because range checks are done on garbage values produced by the overflows, so the garbage doesn't get far unless it is within bounds. Though ot is unimportant, subr_fattime.c needs to be more careful with overflow than subr_clock.c since using it is not restricted to the kernel and the super-user. Bruce From owner-svn-src-head@freebsd.org Mon Dec 28 10:49: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 0E6DFA53AA8; Mon, 28 Dec 2015 10:49:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 829B61959; Mon, 28 Dec 2015 10:49:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id tBSAnZtV057108 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 28 Dec 2015 12:49:35 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua tBSAnZtV057108 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id tBSAnZnh057107; Mon, 28 Dec 2015 12:49:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 28 Dec 2015 12:49:35 +0200 From: Konstantin Belousov To: "Andrey V. Elsukov" Cc: Allan Jude , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292788 - in head/sys: geom/part sys Message-ID: <20151228104935.GP3625@kib.kiev.ua> References: <201512271812.tBRICD3A044563@repo.freebsd.org> <5680F39D.8070002@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5680F39D.8070002@yandex.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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, 28 Dec 2015 10:49:41 -0000 On Mon, Dec 28, 2015 at 11:32:29AM +0300, Andrey V. Elsukov wrote: > On 27.12.15 21:12, Allan Jude wrote: > > enum g_part_alias { > > G_PART_ALIAS_APPLE_BOOT, /* An Apple boot partition entry. */ > > + G_PART_ALIAS_APPLE_CORE_STORAGE,/* An Apple Core Storage partition. */ > > G_PART_ALIAS_APPLE_HFS, /* An HFS+ file system entry. */ > > G_PART_ALIAS_APPLE_LABEL, /* An Apple label partition entry. */ > > G_PART_ALIAS_APPLE_RAID, /* An Apple RAID partition entry. */ > > G_PART_ALIAS_APPLE_RAID_OFFLINE,/* An Apple RAID (offline) part entry.*/ > > G_PART_ALIAS_APPLE_TV_RECOVERY, /* An Apple TV recovery part entry. */ > > G_PART_ALIAS_APPLE_UFS, /* An Apple UFS partition entry. */ > > + G_PART_ALIAS_BIOS_BOOT, /* A GRUB 2 boot partition entry. */ > > + G_PART_ALIAS_CHROMEOS_FIRMWARE, /* A ChromeOS firmware part. entry. */ > > + G_PART_ALIAS_CHROMEOS_KERNEL, /* A ChromeOS Kernel part. entry. */ > > + G_PART_ALIAS_CHROMEOS_RESERVED, /* ChromeOS. Reserved for future use. */ > > + G_PART_ALIAS_CHROMEOS_ROOT, /* A ChromeOS root part. entry. */ > > This enum could be used by third-party kernel module and in general it > is not good to change the order of elements here. This can break `gpart > show` output for such modules. Just for the future. :) If the enum values are considered part of KBI, then explicit assignment of the enum values is much preferred. From owner-svn-src-head@freebsd.org Mon Dec 28 13:44:32 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 1BA6EA544D9; Mon, 28 Dec 2015 13:44:32 +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 CCDD91802; Mon, 28 Dec 2015 13:44:31 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aDY66-000ETE-1J; Mon, 28 Dec 2015 16:44:26 +0300 Date: Mon, 28 Dec 2015 16:44:25 +0300 From: Slawa Olhovchenkov To: Bruce Evans Cc: Konstantin Belousov , src-committers@freebsd.org, Ian Lepore , svn-src-all@freebsd.org, Dmitry Chagin , svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern Message-ID: <20151228134425.GH70867@zxy.spb.ru> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151228083418.B1014@besplex.bde.org> <20151228081313.GM3625@kib.kiev.ua> <20151228200006.Q2819@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151228200006.Q2819@besplex.bde.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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: Mon, 28 Dec 2015 13:44:32 -0000 On Mon, Dec 28, 2015 at 09:17:50PM +1100, Bruce Evans wrote: > On Mon, 28 Dec 2015, Konstantin Belousov wrote: > > > On Mon, Dec 28, 2015 at 09:35:11AM +1100, Bruce Evans wrote: > >> If this causes a panic, then it is from a sanity check detecting the > >> invalid conversion later. A negative value in days breaks the loop > >> logic but seems to give premature exit from the loops instead of many > >> iterations. > > It causes the panic due to out of bound accesses to bin2bcd_data[] array. > > The issue affects around twenty rtc drivers, according to the quick grep > > for clock_ts_to_ct() usage. It probably also affects geom raid modules, > > but I did not looked there at all. > > > > As I understand, people prefer to have ability to test practically > > useless values for the current time, by the cost the unplugged easy > > kernel panic, in the production systems ? Am I right ? > > It is not unreasonable to panic when such tests fail, just like for other > settings of unreasonable values. Only the superuser can make them, and > the superuser should know better than to run them on production systems. Only one valid reasson for panic may be exist: fatal destruction of internal structures (impossibility to recovery). All other reaason must not be caused panic. Disconnecting USB flash. Removing floppy discs. Lost root FS. All above must not be cused panic. VAX/VMS don't panic after break half of RAM druing intesive work. From owner-svn-src-head@freebsd.org Mon Dec 28 17:27: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 BC50EA541E9; Mon, 28 Dec 2015 17:27:21 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 869FD1585; Mon, 28 Dec 2015 17:27:21 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSHRKBN079545; Mon, 28 Dec 2015 17:27:20 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSHRK4n079544; Mon, 28 Dec 2015 17:27:20 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512281727.tBSHRK4n079544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 28 Dec 2015 17:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292832 - 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: Mon, 28 Dec 2015 17:27:21 -0000 Author: dteske Date: Mon Dec 28 17:27:20 2015 New Revision: 292832 URL: https://svnweb.freebsd.org/changeset/base/292832 Log: Explicitly set permissions on entropy files Differential Revision: https://reviews.freebsd.org/D3933 Submitted by: jmg Reviewed by: delphij, markm Approved by: secteam (delphij) MFC after: 3 days X-MFC-to: stable/10 stable/9 Modified: head/usr.sbin/bsdinstall/scripts/entropy Modified: head/usr.sbin/bsdinstall/scripts/entropy ============================================================================== --- head/usr.sbin/bsdinstall/scripts/entropy Mon Dec 28 09:26:07 2015 (r292831) +++ head/usr.sbin/bsdinstall/scripts/entropy Mon Dec 28 17:27:20 2015 (r292832) @@ -26,4 +26,9 @@ # # $FreeBSD$ -dd if=/dev/random of=$BSDINSTALL_CHROOT/entropy bs=4096 count=1 +umask 077 +for i in /entropy /boot/entropy; do + i="$BSDINSTALL_CHROOT/$i" + dd if=/dev/random of="$i" bs=4096 count=1 + chown 0:0 "$i" +done From owner-svn-src-head@freebsd.org Mon Dec 28 17:41: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 0F3ECA5464F; Mon, 28 Dec 2015 17:41:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (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 DB91C1C6D; Mon, 28 Dec 2015 17:41:33 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x231.google.com with SMTP id 78so114847758pfw.2; Mon, 28 Dec 2015 09:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UtQwvNxY5mXepNj3loVaHOsTwJGG/hqdKHgG/VhdKWU=; b=fCToxYtAqChHtsEidpgcRp9vP61pdMOiBtp40hZJBU3zazToxrPyfH9KQfWF11TJkV XqaAZBIb8/2fR63lD4tv7VTbxKCsRZIz6FjsdlbDMXywVbZBhVKncYdKvcPl9jy4K38X MGLOAHwH8H44rLUXnPmcHQtWbrrzWdPutCZu8AjZWNzD0MwcRZ7q42k7eZ3EEFEXjAOK sLlN87sQKKkC/U59G40RaWx/JbgF1/q0TVBCujdvfWNySJA0ak7IBv1OfllXM5lF6tG1 3jwKJxx8IMat5mzLVEU9TuXzwzQptKRPE5MuzpjsdZmP0VedxQYGsRfpRX7NBgr87g6d sYCA== X-Received: by 10.98.10.17 with SMTP id s17mr72229989pfi.61.1451324493483; Mon, 28 Dec 2015 09:41:33 -0800 (PST) Received: from [192.168.254.38] ([50.35.62.220]) by smtp.gmail.com with ESMTPSA id x12sm576349pfa.74.2015.12.28.09.41.31 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Dec 2015 09:41:31 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: Garrett Cooper X-Mailer: iPhone Mail (13C75) In-Reply-To: <20151228200006.Q2819@besplex.bde.org> Date: Mon, 28 Dec 2015 09:41:30 -0800 Cc: Konstantin Belousov , Ian Lepore , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2CA74F95-00A0-4453-847E-0C6C59B57021@gmail.com> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151228083418.B1014@besplex.bde.org> <20151228081313.GM3625@kib.kiev.ua> <20151228200006.Q2819@besplex.bde.org> To: Bruce Evans 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, 28 Dec 2015 17:41:34 -0000 > On Dec 28, 2015, at 02:17, Bruce Evans wrote: ... > It is not unreasonable to panic when such tests fail, just like for other > settings of unreasonable values. Only the superuser can make them, and > the superuser should know better than to run them on production systems. On a development system, this is perfectly reasonable. However, on systems i= n production, dying on asserts or panicking when unexpected input is encount= ered instead of erroring out appropriately is not ideal: it causes unnecessa= ry downtime and can confuse others (customers, lower level admins) who are n= ot fully aware of how UNIX and FreeBSD works (and in turn generate support c= alls and bug reports). Thanks, -NGie= From owner-svn-src-head@freebsd.org Mon Dec 28 18:20: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 60FB4A5236D; Mon, 28 Dec 2015 18:20:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2055F10E4; Mon, 28 Dec 2015 18:20:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSIK6LH095080; Mon, 28 Dec 2015 18:20:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSIK6H3095078; Mon, 28 Dec 2015 18:20:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512281820.tBSIK6H3095078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Dec 2015 18:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292834 - in head/sys/compat/linuxkpi/common: include/linux src 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, 28 Dec 2015 18:20:07 -0000 Author: hselasky Date: Mon Dec 28 18:20:05 2015 New Revision: 292834 URL: https://svnweb.freebsd.org/changeset/base/292834 Log: Reduce memory consumption when allocating kobject strings in the LinuxKPI. Compute string length before allocating memory instead of using fixed size allocations. Make kobject_set_name_vargs() global instead of inline to save some bytes when compiling. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kobject.h Mon Dec 28 17:50:31 2015 (r292833) +++ head/sys/compat/linuxkpi/common/include/linux/kobject.h Mon Dec 28 18:20:05 2015 (r292834) @@ -103,29 +103,7 @@ kobject_get(struct kobject *kobj) return kobj; } -static inline int -kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args) -{ - char *old; - char *name; - - old = kobj->name; - - if (old && !fmt) - return 0; - - name = kzalloc(MAXPATHLEN, GFP_KERNEL); - if (!name) - return -ENOMEM; - vsnprintf(name, MAXPATHLEN, fmt, args); - kobj->name = name; - kfree(old); - for (; *name != '\0'; name++) - if (*name == '/') - *name = '!'; - return (0); -} - +int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list); int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...); Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 28 17:50:31 2015 (r292833) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 28 18:20:05 2015 (r292834) @@ -94,7 +94,50 @@ panic_cmp(struct rb_node *one, struct rb } RB_GENERATE(linux_root, rb_node, __entry, panic_cmp); - + +int +kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args) +{ + va_list tmp_va; + int len; + char *old; + char *name; + char dummy; + + old = kobj->name; + + if (old && fmt == NULL) + return (0); + + /* compute length of string */ + va_copy(tmp_va, args); + len = vsnprintf(&dummy, 0, fmt, tmp_va); + va_end(tmp_va); + + /* account for zero termination */ + len++; + + /* check for error */ + if (len < 1) + return (-EINVAL); + + /* allocate memory for string */ + name = kzalloc(len, GFP_KERNEL); + if (name == NULL) + return (-ENOMEM); + vsnprintf(name, len, fmt, args); + kobj->name = name; + + /* free old string */ + kfree(old); + + /* filter new string */ + for (; *name != '\0'; name++) + if (*name == '/') + *name = '!'; + return (0); +} + int kobject_set_name(struct kobject *kobj, const char *fmt, ...) { From owner-svn-src-head@freebsd.org Mon Dec 28 18:28: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 2B968A52675; Mon, 28 Dec 2015 18:28:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D4ADA1969; Mon, 28 Dec 2015 18:28:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSISIF3098277; Mon, 28 Dec 2015 18:28:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSISIxM098276; Mon, 28 Dec 2015 18:28:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512281828.tBSISIxM098276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Dec 2015 18:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292835 - head/sys/dev/mlx5/mlx5_en 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, 28 Dec 2015 18:28:20 -0000 Author: hselasky Date: Mon Dec 28 18:28:18 2015 New Revision: 292835 URL: https://svnweb.freebsd.org/changeset/base/292835 Log: Make the eeprom dump function more readable and rename variables for better clarity. MFC after: 1 week Submitted by: Daria Genzel Differential Revision: https://reviews.freebsd.org/D4551 Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:20:05 2015 (r292834) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:28:18 2015 (r292835) @@ -319,34 +319,33 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv static void mlx5e_print_eeprom(struct mlx5e_eeprom *eeprom) { - int i, j = 0; - int row = 0; + int row; + int index_in_row; + int byte_to_write = 0; + int line_length = 16; printf("\nOffset\t\tValues\n"); - printf("------\t\t------\n"); - while (row < eeprom->len) { - printf("0x%04x\t\t", row); - for (i = 0; i < 16; i++) { - printf("%02x ", ((u8 *)eeprom->data)[j]); - j++; - row++; + printf("------\t\t------"); + while (byte_to_write < eeprom->len) { + printf("\n0x%04X\t\t", byte_to_write); + for (index_in_row = 0; index_in_row < line_length; index_in_row++) { + printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); + byte_to_write++; } - printf("\n"); } if (eeprom->page_valid) { row = MLX5E_EEPROM_HIGH_PAGE_OFFSET; - printf("\nUpper Page 0x03\n"); + printf("\n\nUpper Page 0x03\n"); printf("\nOffset\t\tValues\n"); - printf("------\t\t------\n"); + printf("------\t\t------"); while (row < MLX5E_EEPROM_PAGE_LENGTH) { - printf("0x%04x\t\t", row); - for (i = 0; i < 16; i++) { - printf("%02x ", ((u8 *)eeprom->data)[j]); - j++; + printf("\n0x%04X\t\t", row); + for (index_in_row = 0; index_in_row < line_length; index_in_row++) { + printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); + byte_to_write++; row++; } - printf("\n"); } } } From owner-svn-src-head@freebsd.org Mon Dec 28 18:29: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 9D878A52737; Mon, 28 Dec 2015 18:29:48 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 69F0D1AE8; Mon, 28 Dec 2015 18:29:48 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSITlOh098366; Mon, 28 Dec 2015 18:29:47 GMT (envelope-from wollman@FreeBSD.org) Received: (from wollman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSITlSj098365; Mon, 28 Dec 2015 18:29:47 GMT (envelope-from wollman@FreeBSD.org) Message-Id: <201512281829.tBSITlSj098365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wollman set sender to wollman@FreeBSD.org using -f From: Garrett Wollman Date: Mon, 28 Dec 2015 18:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292836 - 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: Mon, 28 Dec 2015 18:29:48 -0000 Author: wollman Date: Mon Dec 28 18:29:47 2015 New Revision: 292836 URL: https://svnweb.freebsd.org/changeset/base/292836 Log: in6_if2idlen: treat bridge(4) interfaces like other Ethernet interfaces bridge(4) interfaces have an if_type of IFT_BRIDGE, rather than IFT_ETHER, even though they only support Ethernet-style links. This caused in6_if2idlen to emit an "unknown link type (209)" warning to the console every time it was called. Add IFT_BRIDGE to the case statement in the appropriate place, indicating that it uses the same IPv6 address format as other Ethernet-like interfaces. MFC after: 1 week Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Dec 28 18:28:18 2015 (r292835) +++ head/sys/netinet6/in6.c Mon Dec 28 18:29:47 2015 (r292836) @@ -2008,6 +2008,7 @@ in6_if2idlen(struct ifnet *ifp) case IFT_PROPVIRTUAL: /* XXX: no RFC. treat it as ether */ case IFT_L2VLAN: /* ditto */ case IFT_IEEE80211: /* ditto */ + case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */ case IFT_INFINIBAND: return (64); case IFT_FDDI: /* RFC2467 */ From owner-svn-src-head@freebsd.org Mon Dec 28 18:36: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 CBA65A52AAF; Mon, 28 Dec 2015 18:36:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 76A5A1F54; Mon, 28 Dec 2015 18:36:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSIa0Zf001302; Mon, 28 Dec 2015 18:36:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSIa0qh001301; Mon, 28 Dec 2015 18:36:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512281836.tBSIa0qh001301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Dec 2015 18:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292837 - head/sys/dev/mlx5/mlx5_en 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, 28 Dec 2015 18:36:01 -0000 Author: hselasky Date: Mon Dec 28 18:36:00 2015 New Revision: 292837 URL: https://svnweb.freebsd.org/changeset/base/292837 Log: Add support for sysctl tunables to 10-stable and older. Pushed through head first to simplify driver maintenance. MFC after: 1 week Submitted by: Drew Gallatin Differential Revision: https://reviews.freebsd.org/D4552 Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:29:47 2015 (r292836) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:36:00 2015 (r292837) @@ -58,13 +58,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG PRIV_LOCK(priv); value = priv->params_ethtool.arg[arg2]; - error = sysctl_handle_64(oidp, &value, 0, req); - if (error || req->newptr == NULL || - value == priv->params_ethtool.arg[arg2]) - goto done; + if (req != NULL) { + error = sysctl_handle_64(oidp, &value, 0, req); + if (error || req->newptr == NULL || + value == priv->params_ethtool.arg[arg2]) + goto done; - /* assign new value */ - priv->params_ethtool.arg[arg2] = value; + /* assign new value */ + priv->params_ethtool.arg[arg2] = value; + } else { + error = 0; + } /* check if device is gone */ if (priv->gone) { @@ -483,10 +487,30 @@ mlx5e_create_ethtool(struct mlx5e_priv * CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", mlx5e_params_desc[2 * x + 1]); } else { +#if (__FreeBSD_version < 1100000) + char path[64]; +#endif + /* + * NOTE: In FreeBSD-11 and newer the + * CTLFLAG_RWTUN flag will take care of + * loading default sysctl value from the + * kernel environment, if any: + */ SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", mlx5e_params_desc[2 * x + 1]); + +#if (__FreeBSD_version < 1100000) + /* compute path for sysctl */ + snprintf(path, sizeof(path), "dev.mce.%d.conf.%s", + device_get_unit(priv->mdev->pdev->dev.bsddev), + mlx5e_params_desc[2 * x]); + + /* try to fetch tunable, if any */ + if (TUNABLE_QUAD_FETCH(path, &priv->params_ethtool.arg[x])) + mlx5e_ethtool_handler(NULL, priv, x, NULL); +#endif } } From owner-svn-src-head@freebsd.org Mon Dec 28 18:50: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 591BEA53023; Mon, 28 Dec 2015 18:50:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 35F8A1572; Mon, 28 Dec 2015 18:50:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSIoJvb004285; Mon, 28 Dec 2015 18:50:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSIoIcF004277; Mon, 28 Dec 2015 18:50:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512281850.tBSIoIcF004277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Dec 2015 18:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292838 - in head/sys/dev/mlx5: . mlx5_en 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, 28 Dec 2015 18:50:20 -0000 Author: hselasky Date: Mon Dec 28 18:50:18 2015 New Revision: 292838 URL: https://svnweb.freebsd.org/changeset/base/292838 Log: Add support for CQE zipping. CQE zipping reduces PCI overhead by coalescing and zipping multiple CQEs into a single merged CQE. The feature is enabled by default and can be disabled by a sysctl. Implementing this feature mlx5_cqwq_pop() has been separated from mlx5e_get_cqe(). MFC after: 1 week Submitted by: Mark Bloch Differential Revision: https://reviews.freebsd.org/D4598 Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/device.h Mon Dec 28 18:50:18 2015 (r292838) @@ -1042,6 +1042,7 @@ enum { MLX5_ESW_VPORT_ADMIN_STATE_UP = 0x1, MLX5_ESW_VPORT_ADMIN_STATE_AUTO = 0x2, }; + /* MLX5 DEV CAPs */ /* TODO: EAT.ME */ @@ -1219,4 +1220,36 @@ struct mlx5_ifc_mcia_reg_bits { }; #define MLX5_CMD_OP_QUERY_EEPROM 0x93c + +struct mlx5_mini_cqe8 { + union { + u32 rx_hash_result; + u32 checksum; + struct { + u16 wqe_counter; + u8 s_wqe_opcode; + u8 reserved; + } s_wqe_info; + }; + u32 byte_cnt; +}; + +enum { + MLX5_NO_INLINE_DATA, + MLX5_INLINE_DATA32_SEG, + MLX5_INLINE_DATA64_SEG, + MLX5_COMPRESSED, +}; + +enum mlx5_exp_cqe_zip_recv_type { + MLX5_CQE_FORMAT_HASH, + MLX5_CQE_FORMAT_CSUM, +}; + +#define MLX5E_CQE_FORMAT_MASK 0xc +static inline int mlx5_get_cqe_format(const struct mlx5_cqe64 *cqe) +{ + return (cqe->op_own & MLX5E_CQE_FORMAT_MASK) >> 2; +} + #endif /* MLX5_DEVICE_H */ Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/en.h Mon Dec 28 18:50:18 2015 (r292838) @@ -370,6 +370,7 @@ struct mlx5e_params { u16 tx_cq_moderation_pkts; u16 min_rx_wqes; bool hw_lro_en; + bool cqe_zipping_en; u32 lro_wqe_sz; u16 rx_hash_log_tbl_sz; }; @@ -390,7 +391,8 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") + m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ + m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Dec 28 18:50:18 2015 (r292838) @@ -204,6 +204,18 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG priv->params.hw_lro_en = false; } + if (&priv->params_ethtool.arg[arg2] == + &priv->params_ethtool.cqe_zipping) { + if (priv->params_ethtool.cqe_zipping && + MLX5_CAP_GEN(priv->mdev, cqe_compression)) { + priv->params.cqe_zipping_en = true; + priv->params_ethtool.cqe_zipping = 1; + } else { + priv->params.cqe_zipping_en = false; + priv->params_ethtool.cqe_zipping = 0; + } + } + if (was_opened) mlx5e_open_locked(priv->ifp); done: @@ -472,6 +484,7 @@ mlx5e_create_ethtool(struct mlx5e_priv * priv->params_ethtool.tx_coalesce_usecs = priv->params.tx_cq_moderation_usec; priv->params_ethtool.tx_coalesce_pkts = priv->params.tx_cq_moderation_pkts; priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en; /* create root node */ node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 28 18:50:18 2015 (r292838) @@ -1604,6 +1604,16 @@ mlx5e_build_rx_cq_param(struct mlx5e_pri { void *cqc = param->cqc; + + /* + * TODO The sysctl to control on/off is a bool value for now, which means + * we only support CSUM, once HASH is implemnted we'll need to address that. + */ + if (priv->params.cqe_zipping_en) { + MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_CSUM); + MLX5_SET(cqc, cqc, cqe_compression_en, 1); + } + MLX5_SET(cqc, cqc, log_cq_size, priv->params.log_rq_size); MLX5_SET(cqc, cqc, cq_period, priv->params.rx_cq_moderation_usec); MLX5_SET(cqc, cqc, cq_max_count, priv->params.rx_cq_moderation_pkts); @@ -2571,6 +2581,8 @@ mlx5e_build_ifp_priv(struct mlx5_core_de priv->params.hw_lro_en = false; priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; + priv->params.cqe_zipping_en = !!MLX5_CAP_GEN(mdev, cqe_compression); + priv->mdev = mdev; priv->params.num_channels = num_comp_vectors; priv->order_base_2_num_channels = order_base_2(num_comp_vectors); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Mon Dec 28 18:50:18 2015 (r292838) @@ -248,6 +248,69 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *c } } +static inline void +mlx5e_read_cqe_slot(struct mlx5e_cq *cq, u32 cc, void *data) +{ + memcpy(data, mlx5_cqwq_get_wqe(&cq->wq, (cc & cq->wq.sz_m1)), + sizeof(struct mlx5_cqe64)); +} + +static inline void +mlx5e_write_cqe_slot(struct mlx5e_cq *cq, u32 cc, void *data) +{ + memcpy(mlx5_cqwq_get_wqe(&cq->wq, cc & cq->wq.sz_m1), + data, sizeof(struct mlx5_cqe64)); +} + +static inline void +mlx5e_decompress_cqe(struct mlx5e_cq *cq, struct mlx5_cqe64 *title, + struct mlx5_mini_cqe8 *mini, + u16 wqe_counter, int i) +{ + title->byte_cnt = mini->byte_cnt; + title->wqe_counter = cpu_to_be16((wqe_counter + i) & cq->wq.sz_m1); + title->check_sum = mini->checksum; + title->op_own = (title->op_own & 0xf0) | + (((cq->wq.cc + i) >> cq->wq.log_sz) & 1); +} + +#define MLX5E_MINI_ARRAY_SZ 8 +/* Make sure structs are not packet differently */ +CTASSERT(sizeof(struct mlx5_cqe64) == + sizeof(struct mlx5_mini_cqe8) * MLX5E_MINI_ARRAY_SZ); +static void +mlx5e_decompress_cqes(struct mlx5e_cq *cq) +{ + struct mlx5_mini_cqe8 mini_array[MLX5E_MINI_ARRAY_SZ]; + struct mlx5_cqe64 title; + u32 cqe_count; + u32 i = 0; + u16 title_wqe_counter; + + mlx5e_read_cqe_slot(cq, cq->wq.cc, &title); + title_wqe_counter = be16_to_cpu(title.wqe_counter); + cqe_count = be32_to_cpu(title.byte_cnt); + + /* Make sure we won't overflow */ + KASSERT(cqe_count <= cq->wq.sz_m1, + ("%s: cqe_count %u > cq->wq.sz_m1 %u", __func__, + cqe_count, cq->wq.sz_m1)); + + mlx5e_read_cqe_slot(cq, cq->wq.cc + 1, mini_array); + while (true) { + mlx5e_decompress_cqe(cq, &title, + &mini_array[i % MLX5E_MINI_ARRAY_SZ], + title_wqe_counter, i); + mlx5e_write_cqe_slot(cq, cq->wq.cc + i, &title); + i++; + + if (i == cqe_count) + break; + if (i % MLX5E_MINI_ARRAY_SZ == 0) + mlx5e_read_cqe_slot(cq, cq->wq.cc + i, mini_array); + } +} + static int mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) { @@ -268,6 +331,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, in if (!cqe) break; + if (mlx5_get_cqe_format(cqe) == MLX5_COMPRESSED) + mlx5e_decompress_cqes(&rq->cq); + + mlx5_cqwq_pop(&rq->cq.wq); + wqe_counter_be = cqe->wqe_counter; wqe_counter = be16_to_cpu(wqe_counter_be); wqe = mlx5_wq_ll_get_wqe(&rq->wq, wqe_counter); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Dec 28 18:50:18 2015 (r292838) @@ -383,6 +383,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, in if (!cqe) break; + mlx5_cqwq_pop(&sq->cq.wq); + ci = sqcc & sq->wq.sz_m1; mb = sq->mbuf[ci].mbuf; sq->mbuf[ci].mbuf = NULL; /* Safety clear */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Mon Dec 28 18:36:00 2015 (r292837) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Mon Dec 28 18:50:18 2015 (r292838) @@ -37,8 +37,6 @@ mlx5e_get_cqe(struct mlx5e_cq *cq) if ((cqe->op_own ^ mlx5_cqwq_get_wrap_cnt(&cq->wq)) & MLX5_CQE_OWNER_MASK) return (NULL); - mlx5_cqwq_pop(&cq->wq); - /* ensure cqe content is read after cqe ownership bit */ rmb(); From owner-svn-src-head@freebsd.org Mon Dec 28 19:29: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 1153DA53D6A; Mon, 28 Dec 2015 19:29:07 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BF8C81826; Mon, 28 Dec 2015 19:29:06 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSJT5nA016138; Mon, 28 Dec 2015 19:29:05 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSJT5H2016137; Mon, 28 Dec 2015 19:29:05 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512281929.tBSJT5H2016137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 28 Dec 2015 19:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292839 - head 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, 28 Dec 2015 19:29:07 -0000 Author: dteske Date: Mon Dec 28 19:29:05 2015 New Revision: 292839 URL: https://svnweb.freebsd.org/changeset/base/292839 Log: Add interests/maintainerships + notes Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Mon Dec 28 18:50:18 2015 (r292838) +++ head/MAINTAINERS Mon Dec 28 19:29:05 2015 (r292839) @@ -56,7 +56,9 @@ isci(4) jimharris Pre-commit review req iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org iwn(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org kqueue jmg Pre-commit review requested. Documentation Required. +libdpv dteske Pre-commit review requested. Keep in sync with dpv(1). libfetch des Pre-commit review requested. +libfigpar dteske Pre-commit review requested. libpam des Pre-commit review requested. linprocfs des Pre-commit review requested. lpr gad Pre-commit review requested, particularly for @@ -85,6 +87,7 @@ sh(1) jilles Pre-commit review request compiled in as builtins. share/mk imp, bapt, bdrewery, emaste, sjg Make is hard. share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too) Pre-commit review requested. +sys/boot/forth dteske Pre-commit review requested. sys/compat/linuxkpi hselasky If in doubt, ask. sys/dev/e1000 erj Pre-commit phabricator review requested. sys/dev/ixgbe erj Pre-commit phabricator review requested. @@ -94,5 +97,8 @@ sys/dev/usb hselasky If in doubt, ask. sys/netinet/ip_carp.c glebius Pre-commit review recommended. sys/netpfil/pf kp,glebius Pre-commit review recommended. tests freebsd-testing,ngie Pre-commit review requested. +usr.sbin/bsdconfig dteske Pre-commit phabricator review requested. +usr.sbin/dpv dteske Pre-commit review requested. Keep in sync with libdpv. usr.sbin/pkg pkg@ Please coordinate behavior or flag changes with pkg team. +usr.sbin/sysrc dteske Pre-commit phabricator review requested. Keep in sync with bsdconfig(8) sysrc.subr. vmm(4) neel,grehan Pre-commit review requested. From owner-svn-src-head@freebsd.org Mon Dec 28 19:42: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 2E7F0A5416B; Mon, 28 Dec 2015 19:42:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F46E1E3E; Mon, 28 Dec 2015 19:42:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6922CB93E; Mon, 28 Dec 2015 14:42:39 -0500 (EST) From: John Baldwin To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292809 - head/lib/libc/stdio Date: Mon, 28 Dec 2015 09:21:30 -0800 Message-ID: <41508412.yspAtSoPCD@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201512272304.tBRN4C5D034464@repo.freebsd.org> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 28 Dec 2015 14:42:39 -0500 (EST) 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, 28 Dec 2015 19:42:41 -0000 On Sunday, December 27, 2015 11:04:12 PM Warner Losh wrote: > Author: imp > Date: Sun Dec 27 23:04:11 2015 > New Revision: 292809 > URL: https://svnweb.freebsd.org/changeset/base/292809 > > Log: > The FILE structure has a mbstate_t in it. This structure needs to be > aligned on a int64_t boundary. However, when we allocate the array of > these structures, we use ALIGNBYTES which defaults to sizeof(int) on > arm, i386 and others. The i386 stuff can handle unaligned accesses > seemlessly. However, arm cannot. Take this into account when creating > the array of FILEs, and add some comments about why. > > Differential Revision: https://reviews.freebsd.org/D4708 > > Modified: > head/lib/libc/stdio/findfp.c > > Modified: head/lib/libc/stdio/findfp.c > ============================================================================== > --- head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:10 2015 (r292808) > +++ head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:11 2015 (r292809) > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > > #include > @@ -96,11 +97,22 @@ moreglue(int n) > struct glue *g; > static FILE empty = { ._fl_mutex = PTHREAD_MUTEX_INITIALIZER }; > FILE *p; > + size_t align; > > - g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE)); > + /* > + * FILE has a mbstate_t variable. This variable tries to be int64_t > + * aligned through its definition. int64_t may be larger than void *, > + * which is the size traditionally used for ALIGNBYTES. So, use our own > + * rounding instead of the MI ALIGN macros. If for some reason > + * ALIGNBYTES is larger than int64_t, respect that too. There appears to > + * be no portable way to ask for FILE's alignment requirements other > + * than just knowing here. > + */ > + align = MAX(ALIGNBYTES, sizeof(int64_t)); > + g = (struct glue *)malloc(sizeof(*g) + align + n * sizeof(FILE)); > if (g == NULL) > return (NULL); > - p = (FILE *)ALIGN(g + 1); > + p = (FILE *)roundup((uintptr_t)(g + 1), align); Can this use posix_memalign() rather than doing the alignment by hand? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Dec 28 20:01: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 769F6A54643 for ; Mon, 28 Dec 2015 20:01:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::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 2E2861795 for ; Mon, 28 Dec 2015 20:01:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qg0-x22f.google.com with SMTP id e32so61818396qgf.3 for ; Mon, 28 Dec 2015 12:01:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kOfT2RuXtm7sfTBFx9X0pQQgYTDbRADZFle+IarMY5I=; b=Nnp2iLR6j3LEjMrCswkeH5iwygr8izdD4Kk3V56nSoY8sWKVRyfhEpe1or+HvjoToO j9ljNUcrrUF3zDk5jA6XRF2serFM6BORJK5AqxOvdyAC45qAWJ8RoRam9L1MmxfEejp2 U8psF6owDVkmKr7pbhFMEO0VUm2ERlG7Cq//6JHODUOKaE9fjwqmg4hncKd7k5xUbga+ m9PefrnWGmODcRKZ9xQbk1TJ3JDpJOAgyRAEDbdR+LacxiCA23b+JWRRSPgTwEQgIiGQ 8ag7USMLp71L3pxaXvGzyG26pRDBxw6r0NCyMrNWAUtRvQJA18O1ETtVwH7ce5ApUNtL xGNA== 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=kOfT2RuXtm7sfTBFx9X0pQQgYTDbRADZFle+IarMY5I=; b=TkHYTc8yehNgv++PAJ2+jDrV6EiywIWSgxPuRSuJCkZNAiwVGD3ikpYTp/DCNuuYcF Pc8pn0iuw6E5vnpkjh1ArIppcQ1UVcJHw+v9eebaXxchAUBKkBMHMCHaf6T7DsxDxqXr 9aX65lDastDDaa9w6QBtLQGWsxM08QnayD5EW4lIfoBxDB5uCtQjo4B+zZ/KRxdv9Z5F 2bA+Gt5MxHuxpMnYJzrGA9g383Z0EZ5mllDfRhTRGj3JbPIhivfh8RLNtcDWjqHXt7EA i8VcRDHyDPiHbGDPTQ20a7PytI2eH/OzBsATYoGkPOX7K6wRQV5qkbuyd5uAUeGkl9vg rduQ== X-Gm-Message-State: ALoCoQmWYz8MRGhyNFf/8g6IVPH0ECaf0qzhY+F39LEhw+qZSP2teJRtd4gpYCm8C4BiS6bHrNXYX789AQahxVmc5DP9oyi2Mw== MIME-Version: 1.0 X-Received: by 10.140.30.197 with SMTP id d63mr72607489qgd.81.1451332887021; Mon, 28 Dec 2015 12:01:27 -0800 (PST) Sender: wlosh@bsdimp.com Received: by 10.140.27.181 with HTTP; Mon, 28 Dec 2015 12:01:26 -0800 (PST) X-Originating-IP: [2607:fb90:1908:5378:0:46:97bd:7401] Received: by 10.140.27.181 with HTTP; Mon, 28 Dec 2015 12:01:26 -0800 (PST) In-Reply-To: <41508412.yspAtSoPCD@ralph.baldwin.cx> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> Date: Mon, 28 Dec 2015 13:01:26 -0700 X-Google-Sender-Auth: VYwPxta0azBLs76t7XqmM_ne0i8 Message-ID: Subject: Re: svn commit: r292809 - head/lib/libc/stdio From: Warner Losh To: John Baldwin Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh 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: Mon, 28 Dec 2015 20:01:28 -0000 I'll look at that, but I don't think posix_memalign is the right way to go. The alignment of FILE is more strict than posix_memalign will return. Ian's idea of __alignof__ is the way to go. We allocate them in one block on purpose for performance, and posix_memalign would be a one at a time affair. Warner On Dec 28, 2015 12:42 PM, "John Baldwin" wrote: > On Sunday, December 27, 2015 11:04:12 PM Warner Losh wrote: > > Author: imp > > Date: Sun Dec 27 23:04:11 2015 > > New Revision: 292809 > > URL: https://svnweb.freebsd.org/changeset/base/292809 > > > > Log: > > The FILE structure has a mbstate_t in it. This structure needs to be > > aligned on a int64_t boundary. However, when we allocate the array of > > these structures, we use ALIGNBYTES which defaults to sizeof(int) on > > arm, i386 and others. The i386 stuff can handle unaligned accesses > > seemlessly. However, arm cannot. Take this into account when creating > > the array of FILEs, and add some comments about why. > > > > Differential Revision: https://reviews.freebsd.org/D4708 > > > > Modified: > > head/lib/libc/stdio/findfp.c > > > > Modified: head/lib/libc/stdio/findfp.c > > > ============================================================================== > > --- head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:10 2015 > (r292808) > > +++ head/lib/libc/stdio/findfp.c Sun Dec 27 23:04:11 2015 > (r292809) > > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > > > #include > > @@ -96,11 +97,22 @@ moreglue(int n) > > struct glue *g; > > static FILE empty = { ._fl_mutex = PTHREAD_MUTEX_INITIALIZER }; > > FILE *p; > > + size_t align; > > > > - g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * > sizeof(FILE)); > > + /* > > + * FILE has a mbstate_t variable. This variable tries to be int64_t > > + * aligned through its definition. int64_t may be larger than void > *, > > + * which is the size traditionally used for ALIGNBYTES. So, use > our own > > + * rounding instead of the MI ALIGN macros. If for some reason > > + * ALIGNBYTES is larger than int64_t, respect that too. There > appears to > > + * be no portable way to ask for FILE's alignment requirements > other > > + * than just knowing here. > > + */ > > + align = MAX(ALIGNBYTES, sizeof(int64_t)); > > + g = (struct glue *)malloc(sizeof(*g) + align + n * sizeof(FILE)); > > if (g == NULL) > > return (NULL); > > - p = (FILE *)ALIGN(g + 1); > > + p = (FILE *)roundup((uintptr_t)(g + 1), align); > > Can this use posix_memalign() rather than doing the alignment by hand? > > -- > John Baldwin > From owner-svn-src-head@freebsd.org Mon Dec 28 20:24: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 C258BA54D8F; Mon, 28 Dec 2015 20:24:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 949DE1188; Mon, 28 Dec 2015 20:24:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSKO81N033104; Mon, 28 Dec 2015 20:24:08 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSKO8oh033103; Mon, 28 Dec 2015 20:24:08 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512282024.tBSKO8oh033103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 28 Dec 2015 20:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292840 - head/sys/dev/puc 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, 28 Dec 2015 20:24:09 -0000 Author: marius Date: Mon Dec 28 20:24:08 2015 New Revision: 292840 URL: https://svnweb.freebsd.org/changeset/base/292840 Log: - Add an entry for the SIIG Cyber 2SP1 PCIe adapter, which is based on an Oxford Semiconductor OX16PCI954 but uses only two ports and a non-default clock rate. - Fix style/whitespace PR: 176407 MFC after: 3 days Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Mon Dec 28 19:29:05 2015 (r292839) +++ head/sys/dev/puc/pucdata.c Mon Dec 28 20:24:08 2015 (r292840) @@ -763,6 +763,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x10, 0, 8, }, + { 0x1415, 0x950a, 0x131f, 0x2061, + "SIIG Cyber 2SP1 PCIe", + DEFAULT_RCLK * 10, + PUC_PORT_2S, 0x10, 0, 8, + }, + { 0x1415, 0x950a, 0xffff, 0, "Oxford Semiconductor OX16PCI954 UARTs", DEFAULT_RCLK, @@ -840,9 +846,9 @@ const struct puc_cfg puc_pci_devices[] = */ { 0x1415, 0xc11b, 0xffff, 0, - "Oxford Semiconductor OXPCIe952 1S1P", - DEFAULT_RCLK * 0x22, - PUC_PORT_NONSTANDARD, 0x10, 0, -1, + "Oxford Semiconductor OXPCIe952 1S1P", + DEFAULT_RCLK * 0x22, + PUC_PORT_NONSTANDARD, 0x10, 0, -1, .config_function = puc_config_oxford_pcie }, @@ -1275,7 +1281,8 @@ puc_config_moxa(struct puc_softc *sc, en if (cmd == PUC_CFG_GET_OFS) { const struct puc_cfg *cfg = sc->sc_cfg; - if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144)) + if (port == 3 && (cfg->device == 0x1045 || + cfg->device == 0x1144)) port = 7; *res = port * 0x200; From owner-svn-src-head@freebsd.org Mon Dec 28 21:15: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 A0A8FA54B44; Mon, 28 Dec 2015 21:15:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 46F72130E; Mon, 28 Dec 2015 21:15:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id B6A36426246; Tue, 29 Dec 2015 08:15:37 +1100 (AEDT) Date: Tue, 29 Dec 2015 08:15:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper cc: Konstantin Belousov , Ian Lepore , Dmitry Chagin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern In-Reply-To: <2CA74F95-00A0-4453-847E-0C6C59B57021@gmail.com> Message-ID: <20151229070443.X864@besplex.bde.org> References: <201512271537.tBRFb7nN095297@repo.freebsd.org> <1451236237.1369.9.camel@freebsd.org> <20151228083418.B1014@besplex.bde.org> <20151228081313.GM3625@kib.kiev.ua> <20151228200006.Q2819@besplex.bde.org> <2CA74F95-00A0-4453-847E-0C6C59B57021@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=8fz06vd0j3YbmxNQynQA:9 a=CjuIK1q_8ugA:10 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, 28 Dec 2015 21:15:47 -0000 On Mon, 28 Dec 2015, Garrett Cooper wrote: > >> On Dec 28, 2015, at 02:17, Bruce Evans wrote: > > ... > >> It is not unreasonable to panic when such tests fail, just like for other >> settings of unreasonable values. Only the superuser can make them, and >> the superuser should know better than to run them on production systems. > > On a development system, this is perfectly reasonable. However, on systems in production, dying on asserts or panicking when unexpected input is encountered instead of erroring out appropriately is not ideal: it causes unnecessary downtime and can confuse others (customers, lower level admins) who are not fully aware of how UNIX and FreeBSD works (and in turn generate support calls and bug reports). This is sort of backwards. Unexpected cases by definition have no code to handle them. If you are lucky then they will be detected by an assertion or a bad pointer and cause a panic before they do further damage. Bad pointers works better for this since they cannot be turned off on production systems. Out of bounds input that is expected can be handled, but the handling can still reasonably be to panic. For example, add assertions at the lowest level that values are within bounds for the BCD array. This "handles" the bad input that is "expected" from buggy upper layers. Panics for expected cases are easier to avoid (or cause) than for unexpected cases. The super user should avoid them. Malicious users should try to caus them. But when the syscall that causes them is privileged, the malicious users can't get far. Another easy way to trigger the panic is: - abuse the adjkerntz sysctl to set a huge negative offset. utc_offset() is normally small, so it can only produce negative times from positive times in the Western hemisphere for times near the Epoch. The adjkerntz offset is added in utc_offset() so it can reach 68 years back from the current time, i.e., to 1947. The adjkerntz sysctl, like most sysctls, is correctly implemented with no bounds checking. Callers are trusted to know more about the correct bounds than the kernel. A not so way way to trigger the panic is: - set the time in the BIOS to before the Epoch if the BIOS supports that. Say 1969/01/01. - set this time in the kernel by booting if you can do that. On x86, this requires configuring with USE_RTC_CENTURY to prevent 1969 being interpreted as 2069. You now have a negative time. - find or create an ntp server that supports times before the Epoch, and set its time to 1969/01/01 - wait to sync with the ntp server with the fake time. The dubious periodic refresh of the TODR when the time is synced with ntp is not even an option and the default period is 1800 seconds. Also wait for the refresh. resettodr() is then called with a negative time. ntpd normally uses microadjustments so it is not affected by restrictions in settime(). I don't know of any other way of trying to write back the current time, and ntpd with a non-fake time doesn't do it because 1969 can only be in sync with a fake time. The periodic refresh is dubious because at least on x86 the RTC reading and setting code is sloppy and has an error of about 1 second each, and races. So setting the RTC more accurately than 1-2 seconds is worse than useless (it rarely helps, and may lose to races). It can be kept that accurate by setting it much less often than twice per hour, except for the initial setting after booting which is best done by ntpdate. Everything is best handled in userland. adjkerntz(8) handles more complicated things, and the adjkerntz sysctl can be used at any time for its side effect of calling resettodr(). The badly named machdep.disable_rtc_set sysctl still exists and is still used by adjkerntz(8) to make resettodr() do nothing. This is normally enabled, but adjkerntz(8) disables it transiently to avoid setting the RTC too often. This could be disabled more permantly to stop buggy things like settime() and the ntpd refresh ever setting the RTC. IIRC, adjkerntz(8) is fairly careful with this sysctl and restores it to its previous state after using it. Bruce From owner-svn-src-head@freebsd.org Mon Dec 28 23:57: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 A68B3A53162; Mon, 28 Dec 2015 23:57:23 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 784971235; Mon, 28 Dec 2015 23:57:23 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSNvMMf095500; Mon, 28 Dec 2015 23:57:22 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSNvMj9095499; Mon, 28 Dec 2015 23:57:22 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512282357.tBSNvMj9095499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 28 Dec 2015 23:57:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292846 - 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: Mon, 28 Dec 2015 23:57:23 -0000 Author: bapt Date: Mon Dec 28 23:57:22 2015 New Revision: 292846 URL: https://svnweb.freebsd.org/changeset/base/292846 Log: Restore dryrun support for pw groupmod Modified: head/usr.sbin/pw/pw_group.c Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Mon Dec 28 23:32:27 2015 (r292845) +++ head/usr.sbin/pw/pw_group.c Mon Dec 28 23:57:22 2015 (r292846) @@ -664,6 +664,11 @@ pw_group_mod(int argc, char **argv, char grp_add_members(&grp, newmembers); } + if (dryrun) { + print_group(grp, pretty); + return (EXIT_SUCCESS); + } + if ((rc = chggrent(name, grp)) != 0) { if (rc == -1) errx(EX_IOERR, "group '%s' not available (NIS?)", From owner-svn-src-head@freebsd.org Tue Dec 29 00:02: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 3613BA535A6; Tue, 29 Dec 2015 00:02:10 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 062B21802; Tue, 29 Dec 2015 00:02:09 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT029fw098291; Tue, 29 Dec 2015 00:02:09 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT029ng098290; Tue, 29 Dec 2015 00:02:09 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512290002.tBT029ng098290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 29 Dec 2015 00:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292847 - 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: Tue, 29 Dec 2015 00:02:10 -0000 Author: bapt Date: Tue Dec 29 00:02:08 2015 New Revision: 292847 URL: https://svnweb.freebsd.org/changeset/base/292847 Log: Remove useless assignement of linelen Modified: head/usr.sbin/pw/pw_vpw.c Modified: head/usr.sbin/pw/pw_vpw.c ============================================================================== --- head/usr.sbin/pw/pw_vpw.c Mon Dec 28 23:57:22 2015 (r292846) +++ head/usr.sbin/pw/pw_vpw.c Tue Dec 29 00:02:08 2015 (r292847) @@ -70,7 +70,6 @@ vnextpwent(char const *nam, uid_t uid, i pw = NULL; line = NULL; linecap = 0; - linelen = 0; if (pwd_fp != NULL || (pwd_fp = fopen(getpwpath(_MASTERPASSWD), "r")) != NULL) { while ((linelen = getline(&line, &linecap, pwd_fp)) > 0) { @@ -153,7 +152,6 @@ vnextgrent(char const *nam, gid_t gid, i gr = NULL; line = NULL; linecap = 0; - linelen = 0; if (grp_fp != NULL || (grp_fp = fopen(getgrpath(_GROUP), "r")) != NULL) { while ((linelen = getline(&line, &linecap, grp_fp)) > 0) { From owner-svn-src-head@freebsd.org Tue Dec 29 00:08: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 5AB0DA537CC; Tue, 29 Dec 2015 00:08:33 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2AAC21BE3; Tue, 29 Dec 2015 00:08:33 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT08WQr098573; Tue, 29 Dec 2015 00:08:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT08WKM098572; Tue, 29 Dec 2015 00:08:32 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512290008.tBT08WKM098572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 29 Dec 2015 00:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292849 - 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: Tue, 29 Dec 2015 00:08:33 -0000 Author: bapt Date: Tue Dec 29 00:08:32 2015 New Revision: 292849 URL: https://svnweb.freebsd.org/changeset/base/292849 Log: Simplify code for parsing extra groups Modified: head/usr.sbin/pw/pw_conf.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Tue Dec 29 00:04:21 2015 (r292848) +++ head/usr.sbin/pw/pw_conf.c Tue Dec 29 00:08:32 2015 (r292849) @@ -313,7 +313,7 @@ read_userconfig(char const * file) ? NULL : newstr(q); break; case _UC_EXTRAGROUPS: - for (i = 0; q != NULL; q = strtok(NULL, toks)) { + while ((q = strtok(NULL, toks)) != NULL) { if (config.groups == NULL) config.groups = sl_init(); sl_add(config.groups, newstr(q)); From owner-svn-src-head@freebsd.org Tue Dec 29 03:31: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 81901A53D6F; Tue, 29 Dec 2015 03:31:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 50C5D1D50; Tue, 29 Dec 2015 03:31:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT3V6O7057970; Tue, 29 Dec 2015 03:31:06 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT3V60d057969; Tue, 29 Dec 2015 03:31:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201512290331.tBT3V60d057969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 29 Dec 2015 03:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292858 - head/sys/powerpc/powerpc 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, 29 Dec 2015 03:31:07 -0000 Author: jhibbits Date: Tue Dec 29 03:31:06 2015 New Revision: 292858 URL: https://svnweb.freebsd.org/changeset/base/292858 Log: Update capabilities of e500mc, e5500, e6500. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Tue Dec 29 01:21:40 2015 (r292857) +++ head/sys/powerpc/powerpc/cpu.c Tue Dec 29 03:31:06 2015 (r292858) @@ -175,9 +175,12 @@ static const struct cputab models[] = { { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, 0, cpu_booke_setup }, { "Freescale e500mc core", FSL_E500mc, REVFMT_MAJMIN, - 0, cpu_booke_setup }, + PPC_FEATURE_HAS_FPU, cpu_booke_setup }, { "Freescale e5500 core", FSL_E5500, REVFMT_MAJMIN, - 0, cpu_booke_setup }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, cpu_booke_setup }, + { "Freescale e6500 core", FSL_E6500, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + cpu_booke_setup }, { "IBM Cell Broadband Engine", IBMCELLBE, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, NULL}, From owner-svn-src-head@freebsd.org Tue Dec 29 07: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 DB589A54DFA; Tue, 29 Dec 2015 07:54:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B89841533; Tue, 29 Dec 2015 07:54:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT7stpl036540; Tue, 29 Dec 2015 07:54:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT7stTf036538; Tue, 29 Dec 2015 07:54:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201512290754.tBT7stTf036538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Dec 2015 07:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292859 - in head/sys/dev/hyperv: include vmbus 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, 29 Dec 2015 07:54:57 -0000 Author: delphij Date: Tue Dec 29 07:54:55 2015 New Revision: 292859 URL: https://svnweb.freebsd.org/changeset/base/292859 Log: hyperv: vmbus: remove the per-channel control_work_queue Now vmbus_channel_on_offer() -> vmbus_channel_process_offer() can safely run on the global hv_vmbus_g_connection.work_queue now. We remove the per-channel control_work_queue to achieve the proper serialization of the message handling. I removed the bogus TODO in vmbus_channel_on_offer(): a vmbus offer can only come from the parent partition, i.e., the host. PR: kern/205156 Submitted by: Dexuan Cui Reviewed by: Howard Su , delphij MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4597 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Dec 29 03:31:06 2015 (r292858) +++ head/sys/dev/hyperv/include/hyperv.h Tue Dec 29 07:54:55 2015 (r292859) @@ -759,7 +759,6 @@ typedef struct hv_vmbus_channel { hv_vmbus_ring_buffer_info inbound; struct mtx inbound_lock; - hv_vmbus_handle control_work_queue; hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Dec 29 03:31:06 2015 (r292858) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Dec 29 07:54:55 2015 (r292859) @@ -49,7 +49,6 @@ static void vmbus_channel_on_gpadl_creat static void vmbus_channel_on_gpadl_torndown(hv_vmbus_channel_msg_header* hdr); static void vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr); static void vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_process_offer(void *context); /** * Channel message dispatch table @@ -206,15 +205,6 @@ hv_queue_work_item( return (taskqueue_enqueue(wq->queue, &w->work)); } -/** - * @brief Rescind the offer by initiating a device removal - */ -static void -vmbus_channel_process_rescind_offer(void *context) -{ - hv_vmbus_channel* channel = (hv_vmbus_channel*) context; - hv_vmbus_child_device_unregister(channel->device); -} /** * @brief Allocate and initialize a vmbus channel object @@ -237,14 +227,6 @@ hv_vmbus_allocate_channel(void) TAILQ_INIT(&channel->sc_list_anchor); - channel->control_work_queue = hv_work_queue_create("control"); - - if (channel->control_work_queue == NULL) { - mtx_destroy(&channel->inbound_lock); - free(channel, M_DEVBUF); - return (NULL); - } - return (channel); } @@ -255,7 +237,6 @@ static inline void ReleaseVmbusChannel(void *context) { hv_vmbus_channel* channel = (hv_vmbus_channel*) context; - hv_work_queue_close(channel->control_work_queue); free(channel, M_DEVBUF); } @@ -281,14 +262,12 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha * associated with this offer */ static void -vmbus_channel_process_offer(void *context) +vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { - hv_vmbus_channel* new_channel; boolean_t f_new; hv_vmbus_channel* channel; int ret; - new_channel = (hv_vmbus_channel*) context; f_new = TRUE; channel = NULL; @@ -521,11 +500,7 @@ vmbus_channel_on_offer(hv_vmbus_channel_ new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; - /* TODO: Make sure the offer comes from our parent partition */ - hv_queue_work_item( - new_channel->control_work_queue, - vmbus_channel_process_offer, - new_channel); + vmbus_channel_process_offer(new_channel); } /** @@ -546,8 +521,7 @@ vmbus_channel_on_offer_rescind(hv_vmbus_ if (channel == NULL) return; - hv_queue_work_item(channel->control_work_queue, - vmbus_channel_process_rescind_offer, channel); + hv_vmbus_child_device_unregister(channel->device); } /** From owner-svn-src-head@freebsd.org Tue Dec 29 08:19:45 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 18706A528B4; Tue, 29 Dec 2015 08:19:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E3FDF10AA; Tue, 29 Dec 2015 08:19:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT8Jh4a043071; Tue, 29 Dec 2015 08:19:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT8JhLs043068; Tue, 29 Dec 2015 08:19:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201512290819.tBT8JhLs043068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Dec 2015 08:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292861 - head/sys/dev/hyperv/vmbus 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, 29 Dec 2015 08:19:45 -0000 Author: delphij Date: Tue Dec 29 08:19:43 2015 New Revision: 292861 URL: https://svnweb.freebsd.org/changeset/base/292861 Log: hyperv: vmbus: run non-blocking message handlers in vmbus_msg_swintr() We'll remove the per-channel control_work_queue because it can't properly do serialization of message handling, e.g., when there are 2 NIC devices, vmbus_channel_on_offer() -> hv_queue_work_item() has a race condition: for an SMP VM, vmbus_channel_process_offer() can run concurrently on different CPUs and if the second NIC's vmbus_channel_process_offer() -> hv_vmbus_child_device_register() runs first, the second NIC's name will be hn0 and the first NIC's name will be hn1! We can fix the race condition by removing the per-channel control_work_queue and run all the message handlers in the global hv_vmbus_g_connection.work_queue -- we'll do this in the next patch. With the coming next patch, we have to run the non-blocking handlers directly in the kernel thread vmbus_msg_swintr(), because the special handling of sub-channel: when a sub-channel (e.g., of the storvsc driver) is received and being handled in vmbus_channel_on_offer() running on the global hv_vmbus_g_connection.work_queue, vmbus_channel_process_offer() invokes channel->sc_creation_callback, i.e., storvsc_handle_sc_creation, and the callback will invoke hv_vmbus_channel_open() -> hv_vmbus_post_message and expect a further reply from the host, but the handling of the further messag can't be done because the current message's handling hasn't finished yet; as result, hv_vmbus_channel_open() -> sema_timedwait() will time out and th device can't work. Also renamed the handler type from hv_pfn_channel_msg_handler to vmbus_msg_handler: the 'pfn' and 'channel' in the old name make no sense. Submitted by: Dexuan Cui Reviewed by: royger MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4596 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Dec 29 08:19:06 2015 (r292860) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Dec 29 08:19:43 2015 (r292861) @@ -31,13 +31,6 @@ #include "hv_vmbus_priv.h" -typedef void (*hv_pfn_channel_msg_handler)(hv_vmbus_channel_msg_header* msg); - -typedef struct hv_vmbus_channel_msg_table_entry { - hv_vmbus_channel_msg_type messageType; - hv_pfn_channel_msg_handler messageHandler; -} hv_vmbus_channel_msg_table_entry; - /* * Internal functions */ @@ -55,29 +48,40 @@ static void vmbus_channel_on_version_res */ hv_vmbus_channel_msg_table_entry g_channel_message_table[HV_CHANNEL_MESSAGE_COUNT] = { - { HV_CHANNEL_MESSAGE_INVALID, NULL }, - { HV_CHANNEL_MESSAGE_OFFER_CHANNEL, vmbus_channel_on_offer }, + { HV_CHANNEL_MESSAGE_INVALID, + 0, NULL }, + { HV_CHANNEL_MESSAGE_OFFER_CHANNEL, + 0, vmbus_channel_on_offer }, { HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER, - vmbus_channel_on_offer_rescind }, - { HV_CHANNEL_MESSAGE_REQUEST_OFFERS, NULL }, + 0, vmbus_channel_on_offer_rescind }, + { HV_CHANNEL_MESSAGE_REQUEST_OFFERS, + 0, NULL }, { HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED, - vmbus_channel_on_offers_delivered }, - { HV_CHANNEL_MESSAGE_OPEN_CHANNEL, NULL }, + 1, vmbus_channel_on_offers_delivered }, + { HV_CHANNEL_MESSAGE_OPEN_CHANNEL, + 0, NULL }, { HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT, - vmbus_channel_on_open_result }, - { HV_CHANNEL_MESSAGE_CLOSE_CHANNEL, NULL }, - { HV_CHANNEL_MESSAGEL_GPADL_HEADER, NULL }, - { HV_CHANNEL_MESSAGE_GPADL_BODY, NULL }, + 1, vmbus_channel_on_open_result }, + { HV_CHANNEL_MESSAGE_CLOSE_CHANNEL, + 0, NULL }, + { HV_CHANNEL_MESSAGEL_GPADL_HEADER, + 0, NULL }, + { HV_CHANNEL_MESSAGE_GPADL_BODY, + 0, NULL }, { HV_CHANNEL_MESSAGE_GPADL_CREATED, - vmbus_channel_on_gpadl_created }, - { HV_CHANNEL_MESSAGE_GPADL_TEARDOWN, NULL }, + 1, vmbus_channel_on_gpadl_created }, + { HV_CHANNEL_MESSAGE_GPADL_TEARDOWN, + 0, NULL }, { HV_CHANNEL_MESSAGE_GPADL_TORNDOWN, - vmbus_channel_on_gpadl_torndown }, - { HV_CHANNEL_MESSAGE_REL_ID_RELEASED, NULL }, - { HV_CHANNEL_MESSAGE_INITIATED_CONTACT, NULL }, + 1, vmbus_channel_on_gpadl_torndown }, + { HV_CHANNEL_MESSAGE_REL_ID_RELEASED, + 0, NULL }, + { HV_CHANNEL_MESSAGE_INITIATED_CONTACT, + 0, NULL }, { HV_CHANNEL_MESSAGE_VERSION_RESPONSE, - vmbus_channel_on_version_response }, - { HV_CHANNEL_MESSAGE_UNLOAD, NULL } + 1, vmbus_channel_on_version_response }, + { HV_CHANNEL_MESSAGE_UNLOAD, + 0, NULL } }; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Dec 29 08:19:06 2015 (r292860) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Dec 29 08:19:43 2015 (r292861) @@ -76,8 +76,12 @@ vmbus_msg_swintr(void *arg) { int cpu; void* page_addr; + hv_vmbus_channel_msg_header *hdr; + hv_vmbus_channel_msg_table_entry *entry; + hv_vmbus_channel_msg_type msg_type; hv_vmbus_message* msg; hv_vmbus_message* copied; + static bool warned = false; cpu = (int)(long)arg; KASSERT(cpu <= mp_maxid, ("VMBUS: vmbus_msg_swintr: " @@ -87,9 +91,24 @@ vmbus_msg_swintr(void *arg) msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT; for (;;) { - if (msg->header.message_type == HV_MESSAGE_TYPE_NONE) { + if (msg->header.message_type == HV_MESSAGE_TYPE_NONE) break; /* no message */ - } else { + + hdr = (hv_vmbus_channel_msg_header *)msg->u.payload; + msg_type = hdr->message_type; + + if (msg_type >= HV_CHANNEL_MESSAGE_COUNT && !warned) { + warned = true; + printf("VMBUS: unknown message type = %d\n", msg_type); + goto handled; + } + + entry = &g_channel_message_table[msg_type]; + + if (entry->handler_no_sleep) + entry->messageHandler(hdr); + else { + copied = malloc(sizeof(hv_vmbus_message), M_DEVBUF, M_NOWAIT); KASSERT(copied != NULL, @@ -97,11 +116,13 @@ vmbus_msg_swintr(void *arg) " hv_vmbus_message!")); if (copied == NULL) continue; + memcpy(copied, msg, sizeof(hv_vmbus_message)); hv_queue_work_item(hv_vmbus_g_connection.work_queue, - hv_vmbus_on_channel_message, copied); - } - + hv_vmbus_on_channel_message, + copied); + } +handled: msg->header.message_type = HV_MESSAGE_TYPE_NONE; /* Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Dec 29 08:19:06 2015 (r292860) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Dec 29 08:19:43 2015 (r292861) @@ -586,6 +586,16 @@ typedef enum { extern hv_vmbus_context hv_vmbus_g_context; extern hv_vmbus_connection hv_vmbus_g_connection; +typedef void (*vmbus_msg_handler)(hv_vmbus_channel_msg_header *msg); + +typedef struct hv_vmbus_channel_msg_table_entry { + hv_vmbus_channel_msg_type messageType; + + bool handler_no_sleep; /* true: the handler doesn't sleep */ + vmbus_msg_handler messageHandler; +} hv_vmbus_channel_msg_table_entry; + +extern hv_vmbus_channel_msg_table_entry g_channel_message_table[]; /* * Private, VM Bus functions From owner-svn-src-head@freebsd.org Tue Dec 29 11:24: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 2EEF1A554E5; Tue, 29 Dec 2015 11:24:37 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F0A9917C4; Tue, 29 Dec 2015 11:24:36 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTBOajH000716; Tue, 29 Dec 2015 11:24:36 GMT (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTBOZRW000714; Tue, 29 Dec 2015 11:24:35 GMT (envelope-from uqs@FreeBSD.org) Message-Id: <201512291124.tBTBOZRW000714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: uqs set sender to uqs@FreeBSD.org using -f From: Ulrich Spoerlein Date: Tue, 29 Dec 2015 11:24:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292863 - in head/sbin: mount umount 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, 29 Dec 2015 11:24:37 -0000 Author: uqs Date: Tue Dec 29 11:24:35 2015 New Revision: 292863 URL: https://svnweb.freebsd.org/changeset/base/292863 Log: Fix type mismatches for malloc(3) and Co. Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722 Modified: head/sbin/mount/mount.c head/sbin/umount/umount.c Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Tue Dec 29 08:39:07 2015 (r292862) +++ head/sbin/mount/mount.c Tue Dec 29 11:24:35 2015 (r292863) @@ -541,7 +541,7 @@ append_arg(struct cpa *sa, char *arg) { if (sa->c + 1 == sa->sz) { sa->sz = sa->sz == 0 ? 8 : sa->sz * 2; - sa->a = realloc(sa->a, sizeof(sa->a) * sa->sz); + sa->a = realloc(sa->a, sizeof(*sa->a) * sa->sz); if (sa->a == NULL) errx(1, "realloc failed"); } Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Tue Dec 29 08:39:07 2015 (r292862) +++ head/sbin/umount/umount.c Tue Dec 29 11:24:35 2015 (r292863) @@ -434,7 +434,7 @@ getmntentry(const char *fromname, const { static struct statfs *mntbuf; static size_t mntsize = 0; - static char *mntcheck = NULL; + static int *mntcheck = NULL; struct statfs *sfs, *foundsfs; int i, count; From owner-svn-src-head@freebsd.org Tue Dec 29 11:24: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 9DA85A55514; Tue, 29 Dec 2015 11:24:43 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 62B001954; Tue, 29 Dec 2015 11:24:43 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTBOg8F000773; Tue, 29 Dec 2015 11:24:42 GMT (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTBOfOO000765; Tue, 29 Dec 2015 11:24:41 GMT (envelope-from uqs@FreeBSD.org) Message-Id: <201512291124.tBTBOfOO000765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: uqs set sender to uqs@FreeBSD.org using -f From: Ulrich Spoerlein Date: Tue, 29 Dec 2015 11:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292864 - in head: usr.bin/column usr.bin/locate/locate usr.bin/xargs usr.sbin/mountd usr.sbin/mpsutil usr.sbin/rpc.lockd usr.sbin/rpc.statd 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: Tue, 29 Dec 2015 11:24:43 -0000 Author: uqs Date: Tue Dec 29 11:24:41 2015 New Revision: 292864 URL: https://svnweb.freebsd.org/changeset/base/292864 Log: Fix type mismatches for malloc(3) and Co. This is rather pedantic, as for most architectures it holds that sizeof(type *) == sizeof(type **) Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722 Modified: head/usr.bin/column/column.c head/usr.bin/locate/locate/util.c head/usr.bin/xargs/xargs.c head/usr.sbin/mountd/mountd.c head/usr.sbin/mpsutil/mps_cmd.c head/usr.sbin/rpc.lockd/lockd.c head/usr.sbin/rpc.statd/statd.c head/usr.sbin/rtsold/rtsold.c Modified: head/usr.bin/column/column.c ============================================================================== --- head/usr.bin/column/column.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.bin/column/column.c Tue Dec 29 11:24:41 2015 (r292864) @@ -244,7 +244,7 @@ maketbl(void) p = NULL) if (++coloff == maxcols) { if (!(cols = realloc(cols, ((u_int)maxcols + - DEFCOLS) * sizeof(char *))) || + DEFCOLS) * sizeof(wchar_t *))) || !(lens = realloc(lens, ((u_int)maxcols + DEFCOLS) * sizeof(int)))) err(1, NULL); Modified: head/usr.bin/locate/locate/util.c ============================================================================== --- head/usr.bin/locate/locate/util.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.bin/locate/locate/util.c Tue Dec 29 11:24:41 2015 (r292864) @@ -93,7 +93,7 @@ colon(dbv, path, dot) char **pv; if (dbv == NULL) { - if ((dbv = malloc(sizeof(char **))) == NULL) + if ((dbv = malloc(sizeof(char *))) == NULL) err(1, "malloc"); *dbv = NULL; } @@ -123,7 +123,7 @@ colon(dbv, path, dot) *(p + slen) = '\0'; } /* increase dbv with element p */ - if ((dbv = realloc(dbv, sizeof(char **) * (vlen + 2))) + if ((dbv = realloc(dbv, sizeof(char *) * (vlen + 2))) == NULL) err(1, "realloc"); *(dbv + vlen) = p; Modified: head/usr.bin/xargs/xargs.c ============================================================================== --- head/usr.bin/xargs/xargs.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.bin/xargs/xargs.c Tue Dec 29 11:24:41 2015 (r292864) @@ -234,7 +234,7 @@ main(int argc, char *argv[]) * NULL. */ linelen = 1 + argc + nargs + 1; - if ((av = bxp = malloc(linelen * sizeof(char **))) == NULL) + if ((av = bxp = malloc(linelen * sizeof(char *))) == NULL) errx(1, "malloc failed"); /* @@ -471,7 +471,7 @@ prerun(int argc, char *argv[]) * Allocate memory to hold the argument list, and * a NULL at the tail. */ - tmp = malloc((argc + 1) * sizeof(char**)); + tmp = malloc((argc + 1) * sizeof(char *)); if (tmp == NULL) { warnx("malloc failed"); xexit(*argv, 1); Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.sbin/mountd/mountd.c Tue Dec 29 11:24:41 2015 (r292864) @@ -422,7 +422,7 @@ main(int argc, char **argv) * list. */ if (nhosts == 0) { - hosts = malloc(sizeof(char**)); + hosts = malloc(sizeof(char *)); if (hosts == NULL) out_of_mem(); hosts[0] = "*"; Modified: head/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- head/usr.sbin/mpsutil/mps_cmd.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.sbin/mpsutil/mps_cmd.c Tue Dec 29 11:24:41 2015 (r292864) @@ -486,7 +486,7 @@ mps_firmware_get(int fd, unsigned char * } size = reply.ActualImageSize; - *firmware = calloc(1, sizeof(char) * size); + *firmware = calloc(1, sizeof(unsigned char) * size); if (*firmware == NULL) { warn("calloc"); return (-1); Modified: head/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- head/usr.sbin/rpc.lockd/lockd.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.sbin/rpc.lockd/lockd.c Tue Dec 29 11:24:41 2015 (r292864) @@ -220,7 +220,7 @@ main(int argc, char **argv) * list. */ if (nhosts == 0) { - hosts = malloc(sizeof(char**)); + hosts = malloc(sizeof(char *)); if (hosts == NULL) out_of_mem(); Modified: head/usr.sbin/rpc.statd/statd.c ============================================================================== --- head/usr.sbin/rpc.statd/statd.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.sbin/rpc.statd/statd.c Tue Dec 29 11:24:41 2015 (r292864) @@ -150,7 +150,7 @@ main(int argc, char **argv) * list. */ if (nhosts == 0) { - hosts = malloc(sizeof(char**)); + hosts = malloc(sizeof(char *)); if (hosts == NULL) out_of_mem(); Modified: head/usr.sbin/rtsold/rtsold.c ============================================================================== --- head/usr.sbin/rtsold/rtsold.c Tue Dec 29 11:24:35 2015 (r292863) +++ head/usr.sbin/rtsold/rtsold.c Tue Dec 29 11:24:41 2015 (r292864) @@ -888,7 +888,7 @@ autoifprobe(void) warnmsg(LOG_WARNING, __func__, "multiple interfaces found"); - a = (char **)realloc(argv, (n + 1) * sizeof(char **)); + a = realloc(argv, (n + 1) * sizeof(char *)); if (a == NULL) { warnmsg(LOG_ERR, __func__, "realloc"); exit(1); @@ -903,7 +903,7 @@ autoifprobe(void) } if (n) { - a = (char **)realloc(argv, (n + 1) * sizeof(char **)); + a = realloc(argv, (n + 1) * sizeof(char *)); if (a == NULL) { warnmsg(LOG_ERR, __func__, "realloc"); exit(1); From owner-svn-src-head@freebsd.org Tue Dec 29 11:53: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 65715A55D0C; Tue, 29 Dec 2015 11:53:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 238211397; Tue, 29 Dec 2015 11:53:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTBrELB009706; Tue, 29 Dec 2015 11:53:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTBrETu009704; Tue, 29 Dec 2015 11:53:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512291153.tBTBrETu009704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 29 Dec 2015 11:53:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292865 - 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, 29 Dec 2015 11:53:15 -0000 Author: hselasky Date: Tue Dec 29 11:53:13 2015 New Revision: 292865 URL: https://svnweb.freebsd.org/changeset/base/292865 Log: Update metadata for "tools/tools/bus_autoconf" after r292080. Use BYTE_ORDER instead of _BYTE_ORDER due to 3rd party USB software for now. Modified: head/sys/dev/usb/usb_lookup.c head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_lookup.c ============================================================================== --- head/sys/dev/usb/usb_lookup.c Tue Dec 29 11:24:41 2015 (r292864) +++ head/sys/dev/usb/usb_lookup.c Tue Dec 29 11:53:13 2015 (r292865) @@ -154,28 +154,10 @@ usbd_lookup_id_by_uaa(const struct usb_d /*------------------------------------------------------------------------* * Export the USB device ID format we use to userspace tools. *------------------------------------------------------------------------*/ -#if BYTE_ORDER == BIG_ENDIAN -#define U16_XOR "8" -#define U32_XOR "12" -#define U64_XOR "56" -#define U8_BITFIELD_XOR "7" -#define U16_BITFIELD_XOR "15" -#define U32_BITFIELD_XOR "31" -#define U64_BITFIELD_XOR "63" -#else +#if BYTE_ORDER == LITTLE_ENDIAN #define U16_XOR "0" -#define U32_XOR "0" -#define U64_XOR "0" -#define U8_BITFIELD_XOR "0" -#define U16_BITFIELD_XOR "0" -#define U32_BITFIELD_XOR "0" -#define U64_BITFIELD_XOR "0" -#endif - -#if USB_HAVE_COMPAT_LINUX -#define MFL_SIZE "1" #else -#define MFL_SIZE "0" +#define U16_XOR "8" #endif #if defined(KLD_MODULE) && (USB_HAVE_ID_SECTION != 0) @@ -189,20 +171,19 @@ static const char __section("bus_autocon /* List size of fields in the usb_device_id structure */ -#if ULONG_MAX >= 0xFFFFFFFFUL - "unused{0,8}" - "unused{0,8}" - "unused{0,8}" - "unused{0,8}" -#if ULONG_MAX >= 0xFFFFFFFFFFFFFFFFULL - "unused{0,8}" - "unused{0,8}" - "unused{0,8}" - "unused{0,8}" -#endif -#else -#error "Please update code." -#endif + "mf_vendor{" U16_XOR ",1}" + "mf_product{" U16_XOR ",1}" + "mf_dev_lo{" U16_XOR ",1}" + "mf_dev_hi{" U16_XOR ",1}" + + "mf_dev_class{" U16_XOR ",1}" + "mf_dev_subclass{" U16_XOR ",1}" + "mf_dev_protocol{" U16_XOR ",1}" + "mf_int_class{" U16_XOR ",1}" + + "mf_int_subclass{" U16_XOR ",1}" + "mf_int_protocol{" U16_XOR ",1}" + "unused{" U16_XOR ",6}" "idVendor[0]{" U16_XOR ",8}" "idVendor[1]{" U16_XOR ",8}" @@ -220,38 +201,20 @@ static const char __section("bus_autocon "bInterfaceSubClass{0,8}" "bInterfaceProtocol{0,8}" - "mf_vendor{" U8_BITFIELD_XOR ",1}" - "mf_product{" U8_BITFIELD_XOR ",1}" - "mf_dev_lo{" U8_BITFIELD_XOR ",1}" - "mf_dev_hi{" U8_BITFIELD_XOR ",1}" - - "mf_dev_class{" U8_BITFIELD_XOR ",1}" - "mf_dev_subclass{" U8_BITFIELD_XOR ",1}" - "mf_dev_protocol{" U8_BITFIELD_XOR ",1}" - "mf_int_class{" U8_BITFIELD_XOR ",1}" - - "mf_int_subclass{" U8_BITFIELD_XOR ",1}" - "mf_int_protocol{" U8_BITFIELD_XOR ",1}" - "unused{" U8_BITFIELD_XOR ",6}" - - "mfl_vendor{" U16_XOR "," MFL_SIZE "}" - "mfl_product{" U16_XOR "," MFL_SIZE "}" - "mfl_dev_lo{" U16_XOR "," MFL_SIZE "}" - "mfl_dev_hi{" U16_XOR "," MFL_SIZE "}" - - "mfl_dev_class{" U16_XOR "," MFL_SIZE "}" - "mfl_dev_subclass{" U16_XOR "," MFL_SIZE "}" - "mfl_dev_protocol{" U16_XOR "," MFL_SIZE "}" - "mfl_int_class{" U16_XOR "," MFL_SIZE "}" - - "mfl_int_subclass{" U16_XOR "," MFL_SIZE "}" - "mfl_int_protocol{" U16_XOR "," MFL_SIZE "}" - "unused{" U16_XOR "," MFL_SIZE "}" - "unused{" U16_XOR "," MFL_SIZE "}" - - "unused{" U16_XOR "," MFL_SIZE "}" - "unused{" U16_XOR "," MFL_SIZE "}" - "unused{" U16_XOR "," MFL_SIZE "}" - "unused{" U16_XOR "," MFL_SIZE "}" +#if USB_HAVE_COMPAT_LINUX + "mfl_vendor{" U16_XOR ",1}" + "mfl_product{" U16_XOR ",1}" + "mfl_dev_lo{" U16_XOR ",1}" + "mfl_dev_hi{" U16_XOR ",1}" + + "mfl_dev_class{" U16_XOR ",1}" + "mfl_dev_subclass{" U16_XOR ",1}" + "mfl_dev_protocol{" U16_XOR ",1}" + "mfl_int_class{" U16_XOR ",1}" + + "mfl_int_subclass{" U16_XOR ",1}" + "mfl_int_protocol{" U16_XOR ",1}" + "unused{" U16_XOR ",6}" +#endif }; #endif Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Tue Dec 29 11:24:41 2015 (r292864) +++ head/sys/dev/usb/usbdi.h Tue Dec 29 11:53:13 2015 (r292865) @@ -267,7 +267,7 @@ struct usb_config { struct usb_device_id { /* Select which fields to match against */ -#if _BYTE_ORDER == _LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN uint16_t match_flag_vendor:1, match_flag_product:1, @@ -315,13 +315,6 @@ struct usb_device_id { uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; - /* Hook for driver specific information */ - unsigned long driver_info; - -/* - * XXX can't currently participate in auto driver loading - * XXX making it a union with the match_flag_* above messes up init - */ #if USB_HAVE_COMPAT_LINUX /* which fields to match against */ uint16_t match_flags; @@ -336,6 +329,9 @@ struct usb_device_id { #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #endif + + /* Hook for driver specific information */ + unsigned long driver_info; } __aligned(32); #define USB_STD_PNP_INFO "M16:mask;U16:vendor;U16:product;L16:product;G16:product;" \ From owner-svn-src-head@freebsd.org Tue Dec 29 12:04: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 7091CA54772; Tue, 29 Dec 2015 12:04:36 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 0E5A31E8B; Tue, 29 Dec 2015 12:04:36 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id u188so35448919wmu.0; Tue, 29 Dec 2015 04:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=ZsmSwpeJo8ZB7R15P6OUYoZ5vUgldN9z2eq5Qf2Aumk=; b=Z9/3gSLxyoJNiAZ8Hlr3w23f+46fU31JyMhN7kzJt2u2ADeWeSltQ9oJhfWLETHnrS 5XALqlTTgcBeHAjGE5celaPY53OwuUj2qQy0zhxYDMzQp4CtNLHFZ2ihYmgrrWf+dnMU E4qpOxuNfkKIeBEEhKUzl/YqJ0aXoS4ngLycPA214vGZooCz3UecO4Nl02xhRH5YWAak mSywSsM0R2sMh6k0zGvK8TaRcjO23xS7/JQR4FlB2krtpA7B5Xnt0dFtEEmHh4d9TRlo Hsxu1FHDSiinsgXEHRCaTN41lOcnvJZkEHnUQIWhIsrna2u6y7tXvD57Jc5QRcms9ZJO TWCA== X-Received: by 10.28.214.76 with SMTP id n73mr8117956wmg.52.1451390674455; Tue, 29 Dec 2015 04:04:34 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id o132sm47788178wmb.7.2015.12.29.04.04.33 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 29 Dec 2015 04:04:33 -0800 (PST) Date: Tue, 29 Dec 2015 13:04:31 +0100 From: Mateusz Guzik To: NGie Cooper Cc: John Baldwin , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r292626 - head/sys/kern Message-ID: <20151229120431.GB15969@dft-labs.eu> References: <201512222107.tBML7XUO053901@repo.freebsd.org> <3052030.KADVjZoIBd@ralph.baldwin.cx> <2BB34BE5-B312-42DA-B89E-F25B823B9831@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2BB34BE5-B312-42DA-B89E-F25B823B9831@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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, 29 Dec 2015 12:04:36 -0000 On Tue, Dec 22, 2015 at 02:29:36PM -0800, NGie Cooper wrote: > > > On Dec 22, 2015, at 13:17, John Baldwin wrote: > > > > On Tuesday, December 22, 2015 09:07:33 PM Garrett Cooper wrote: > > … > > > It shouldn't be zero, I think == 1 would be best actually. > > I’ll boot up GENERIC and see whether or not it works with == 1. > Thanks :)! Any value other than in 1 is a bug. The value of 0 means the destination is not used, although it clearly is. Since the counter is signed, sufficiently big amount of users can actually make it negative, although that's an unrealistic for now. TL;DR please change it to equality check against 1. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Dec 29 12: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 1C039A5485A; Tue, 29 Dec 2015 12:06:21 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (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 DF9A71014; Tue, 29 Dec 2015 12:06:20 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by mail-ig0-x231.google.com with SMTP id mw1so35192579igb.1; Tue, 29 Dec 2015 04:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=5OB5aFzBJx6iqzmT5X+1ZzFsireOL8Ezvsc68FAEiBE=; b=sb8dfCaJA4UAZya0zYa/+WaSK5itXJ50Y1SvKMolNTrZCAEalavjIpQjFzTdW2sqaB PnRAYk5ArDm+RkxJXuLQc3WHD+qX5v0Z2wGNQBtANPJlHUE7nSftIKcNxFF5BD7jjA7B 1ODc/eAq8a3u4iJ26vvAkku5/DCHzMpJPMGWlEyMfFjOUkpB0HHgZ+3zXulWDkYFjm0/ Rg28mMhBOBRenMEI3we3ix6FX2TCCLIzeSCLObYKt9U2pxthSDQq87HEUwt+GWdhOvXJ js/P8auqdLEtKIfyY9L/KysHhH10uaeKnlGipEqe0EygOk3uocD2V0bPwnRREUzKg6dB t3Xg== MIME-Version: 1.0 X-Received: by 10.50.142.39 with SMTP id rt7mr7977832igb.29.1451390780253; Tue, 29 Dec 2015 04:06:20 -0800 (PST) Sender: chagin.dmitry@gmail.com Received: by 10.79.82.68 with HTTP; Tue, 29 Dec 2015 04:06:20 -0800 (PST) Date: Tue, 29 Dec 2015 15:06:20 +0300 X-Google-Sender-Auth: cJ0KDaAJOgDagyZTdim3_8Ipxso Message-ID: Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern From: Dmitry Chagin To: Bruce Evans , Konstantin Belousov Cc: Ian Lepore , Dmitry Chagin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Tue, 29 Dec 2015 12:06:21 -0000 2015-12-28 1:35 GMT+03:00 Bruce Evans : > On Sun, 27 Dec 2015, Ian Lepore wrote: > > On Sun, 2015-12-27 at 15:37 +0000, Dmitry Chagin wrote: >> >>> Author: dchagin >>> Date: Sun Dec 27 15:37:07 2015 >>> New Revision: 292777 >>> URL: https://svnweb.freebsd.org/changeset/base/292777 >>> >>> Log: >>> Verify that tv_sec value specified in settimeofday() and >>> clock_settime() >>> (CLOCK_REALTIME case) system calls is non negative. >>> This commit hides a kernel panic in atrtc_settime() as the >>> clock_ts_to_ct() >>> does not properly convert negative tv_sec. >>> >>> ps. in my opinion clock_ts_to_ct() should be rewritten to properly >>> handle >>> negative tv_sec values. >>> >>> Differential Revision: https://reviews.freebsd.org/D4714 >>> Reviewed by: kib >>> >>> MFC after: 1 week >>> >> >> IMO, this change is completely unacceptable. If there is a bug in >> atrtc code, then by all means fix it, but preventing anyone from >> setting valid time values on the system because one driver's code can't >> handle it is just wrong. >> > > I agree. Even (time_t)-1 should be a valid time for input, although it > is an error indicator for output. > (This API makes correctly using functions like time(1) difficult or > impossible (impossible for time(1) specifically. The implementation > might reserve (time_t)-1 for representing an invalid time. But > nothing requires it to. > (POSIX almost requires the reverse. It requires a broken > implementation that represents times as seconds since the Epoch. I > think POSIX doesn't require times before the Epoch to work. But > FreeBSD and the ado time package tries to make them work.) > So if the representation of the current time is (time_t)-1, then > time(1) can't do anything better than return this value. But this > value is also the error value. There is no way to distinguish this > value from the error value, since time(1) is not required to set > errno.) > > So, my point was: a) for a long time we have broken settimeofday() which does not allow us to set the system time before the Epoch b) as you already mentioned POSIX doesn't require times before the Epoch to work =D1=81) Linux does not allows negative seconds also d) we have settimeofsay(2) that consistent with POSIX and in my understanding phrase "The time is expressed in seconds and microseconds since midnight (0 hour), January 1, 1970." is a strict definition, which prohibits time before the Epoch I do not understand why we should have our own (separate from the rest world) behavior. > I think the change also doesn't actually work, especially in the Western > hemisphere, but it was written in the Eastern hemisphere. Suppose > that the time is the Epoch. This is 0, so it is pefectly valid. Then > if the clock is on local time, utc_offset() is added before calling > clock_cs_to_ct() and the result is a negative time_t in the Western > hemisphere. Similarly in the Eastern hemisphere when you test with > with Western settings. > > The main bug in clock_ts_ct() is due to division being specified as > broken in C: > > X void > X clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) > X { > X int i, year, days; > X time_t rsec; /* remainder seconds */ > X time_t secs; > X X secs =3D ts->tv_sec; > X days =3D secs / SECDAY; > X rsec =3D secs % SECDAY; > > Division of negative numbers used to be implementation-defined in C, but > C90 or C99 broke this by requiring the broken alternative of rounding > towards 0 like most hardware does. The remainder operation is consistent= ly > broken. So when secs < 0, this always gives days < 0 and rsec either 0 > or < 0. > > If this causes a panic, then it is from a sanity check detecting the > invalid conversion later. A negative value in days breaks the loop > logic but seems to give premature exit from the loops instead of many > iterations. > > Another bug here is the type of rsec. This variable is a small integer > (< SECDAY =3D 86400), not a time_t. > > Code like this is probably common in userland. w(1) uses it, but w(1) > only deals with uptimes which should be positive. > > clock_ct_to_ts() is also buggy: > > X int > X clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) > X { > X int i, year, days; > X ... > X /* Sanity checks. */ > X if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 || > X ct->day > days_in_month(year, ct->mon) || > X ct->hour > 23 || ct->min > 59 || ct->sec > 59 || > X (sizeof(time_t) =3D=3D 4 && year > 2037)) { /* time_t ove= rflow > */ > X if (ct_debug) > X printf(" =3D EINVAL\n"); > X return (EINVAL); > X } > > The limit of 2037 is bogus with 64-bit time_t's or even with 32-bit > unsigned time_t's. > > Years before 1970 are insane due to the C bug, and years before ~1906 > are insanse due to representability problems, but there is no check > for the lower limit of 'year'. > > There is also no check for the lower limit of ct->hour, ct->min or > ct->sec. > > Bruce > From owner-svn-src-head@freebsd.org Tue Dec 29 14:10: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 27830A55BFB; Tue, 29 Dec 2015 14:10:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id E377C1A13; Tue, 29 Dec 2015 14:09:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 9F661781843; Wed, 30 Dec 2015 01:09:47 +1100 (AEDT) Date: Wed, 30 Dec 2015 01:09:47 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dmitry Chagin cc: Bruce Evans , Konstantin Belousov , Ian Lepore , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r292777 - in head: lib/libc/sys sys/kern In-Reply-To: Message-ID: <20151229235754.T3714@besplex.bde.org> References: MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=cK4dyQqN c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=1ux614oztSyDE4AEBDIA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE 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: Tue, 29 Dec 2015 14:10:00 -0000 On Tue, 29 Dec 2015, Dmitry Chagin wrote: > So, my point was: > a) for a long time we have broken settimeofday() which does not allow us > to set the system time before the Epoch We still have a broken settimeofday that doesn't allow us to set the system time to the Epoch in the Western hemisphere if the clock is on local time, and doesn't allow as to set the system time to a year > 9999. More precise= ly it does allow us to set these and usually panics on x86 before completing. > b) as you already mentioned POSIX doesn't require times before the Epoch = to > work In fact, the representation of times is undefined for times before the Epoch in general. The specification of clock_settime() is interesting. At least in an old POSIX-2001 draft, It is required to set to the specified time and is not limited to the current time, whatever that is. It is only required to work for CLOCK_REALTIME. It is required to fail if the specified time is outside of the "legal range" for the clock id. "legal range" is bad wording and is unspecified. > =D1=81) Linux does not allows negative seconds also Old (~2004) versions of Linux seem to have less error checking for i386 settimeofday() FreeBSD then, so they seem to allow it. The implementation seems to be: - copy the requested value to the kernel software time without much error checking. Don't touch the hardware yet - update the RTC every 11 minutes if the clock is externally synchronized. So with 64-bit time_t anyone could easily set the time to year +-292g, or just to year +-10k. The AT RTC cannot represent this, and it is difficult to make it try since it is difficult to find external servers running that far off the current time. With 32-bit time_t the range is 1906-2037. Linux seems to have no range checking for the conversion to BCD, but it doesn't panic because the BCD macros are expressions. These macros of course don't work for arbitrary inputs. They just convert valid but unusual years to garbage. Before that, negative times are converted to garbage using a type pun: set_rtc_mmss(xtime.tv_sec) starts with a time_t, but the function takes an unsigned long. So 1 second before the Epoch becomes year +584g. The usual divisions by 60 are used to reduce the type-punned time. Since it is unsigned, these now give garbage in-range values. > d) we have settimeofsay(2) that consistent with POSIX and in my > understanding phrase "The time is expressed in seconds and microseconds > since midnight (0 hour), January 1, 1970." is a strict definition, which > prohibits time before the Epoch TImes before the Epoch give undefined behaviour, so they are allowed to work. They are even allowed to work better than times after the Epoch, since they can have any representation and are not require to be missing support for leap seconds. > I do not understand why we should have our own (separate from the rest > world) behavior. It would be good to not have such broken bounds checkng as the rest of the world. Updating the AT RTC synchronously in settimeofday() is already more significantly different than limiting the range of accepted times. One reason that Linux updates asynchronously is that a correct synchronous update (which FreeBSD doesn't do) requires waiting for a second or two. The asynchronous update gives the usual problems handling errors -- even if the interrupt handler detected representation errors, it wouldn't be able to return them to settimeofday(). So errors of a measly 292g years go unreported. Bruce From owner-svn-src-head@freebsd.org Tue Dec 29 15:23: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 CB024A555A8; Tue, 29 Dec 2015 15:23:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9BC34118A; Tue, 29 Dec 2015 15:23:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTFN3QH074515; Tue, 29 Dec 2015 15:23:03 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTFN3og074514; Tue, 29 Dec 2015 15:23:03 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201512291523.tBTFN3og074514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 29 Dec 2015 15:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292870 - head/contrib/binutils/bfd 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, 29 Dec 2015 15:23:04 -0000 Author: ian Date: Tue Dec 29 15:23:03 2015 New Revision: 292870 URL: https://svnweb.freebsd.org/changeset/base/292870 Log: Correct the code for sign-extending a 16 bit value. As near as I can tell this is effectively a no-op -- the addend term in MOVT/MOVW relocations always seems to be zero. But this is correct and the old code wasn't. Modified: head/contrib/binutils/bfd/elf32-arm.c Modified: head/contrib/binutils/bfd/elf32-arm.c ============================================================================== --- head/contrib/binutils/bfd/elf32-arm.c Tue Dec 29 12:38:04 2015 (r292869) +++ head/contrib/binutils/bfd/elf32-arm.c Tue Dec 29 15:23:03 2015 (r292870) @@ -5800,7 +5800,7 @@ elf32_arm_final_link_relocate (reloc_how if (globals->use_rel) { addend = ((insn >> 4) & 0xf000) | (insn & 0xfff); - signed_addend = (addend ^ 0x10000) - 0x10000; + signed_addend = (addend ^ 0x8000) - 0x8000; } value += signed_addend; From owner-svn-src-head@freebsd.org Tue Dec 29 15:36: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 93835A55940; Tue, 29 Dec 2015 15:36:47 +0000 (UTC) (envelope-from miwi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 625781A1F; Tue, 29 Dec 2015 15:36:47 +0000 (UTC) (envelope-from miwi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTFakEo077909; Tue, 29 Dec 2015 15:36:46 GMT (envelope-from miwi@FreeBSD.org) Received: (from miwi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTFakbH077908; Tue, 29 Dec 2015 15:36:46 GMT (envelope-from miwi@FreeBSD.org) Message-Id: <201512291536.tBTFakbH077908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: miwi set sender to miwi@FreeBSD.org using -f From: Martin Wilke Date: Tue, 29 Dec 2015 15:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292871 - head/share/misc 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, 29 Dec 2015 15:36:47 -0000 Author: miwi (doc,ports committer) Date: Tue Dec 29 15:36:46 2015 New Revision: 292871 URL: https://svnweb.freebsd.org/changeset/base/292871 Log: - Add myself to ports-secteam Approved by: delphij (implicit) Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Tue Dec 29 15:23:03 2015 (r292870) +++ head/share/misc/organization.dot Tue Dec 29 15:36:46 2015 (r292871) @@ -34,7 +34,7 @@ portmgr [label="Port Management Team\npo portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nculot"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] -portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, eadler, feld, jgh, rea, sbz, simon, swills, zi"] +portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, eadler, feld, jgh, rea, sbz, simon, swills, zi, miwi"] secteamsecretary [label="Security Team Secretary\nsecteam-secretary@FreeBSD.org\nremko"] securityofficer [label="Security Officer Team\nsecurity-officer@FreeBSD.org\ncperciva, simon, nectar"] srccommitters [label="Src Committers\nsrc-committers@FreeBSD.org"] From owner-svn-src-head@freebsd.org Tue Dec 29 15:51: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 EBC4BA55DFD; Tue, 29 Dec 2015 15:51:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BB5BB107F; Tue, 29 Dec 2015 15:51:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTFpqiC081004; Tue, 29 Dec 2015 15:51:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTFpqbt081003; Tue, 29 Dec 2015 15:51:52 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201512291551.tBTFpqbt081003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 29 Dec 2015 15:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292872 - head/sys/fs/ext2fs 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, 29 Dec 2015 15:51:54 -0000 Author: pfg Date: Tue Dec 29 15:51:52 2015 New Revision: 292872 URL: https://svnweb.freebsd.org/changeset/base/292872 Log: ext2: recognize ext4 INCOMPAT_RECOVER flag This is a flag specific for journalling in ext4. Add it to the list of ext4 features we ignore for read-only purposes. PR: 205668 MFC after: 1 week Modified: head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Tue Dec 29 15:36:46 2015 (r292871) +++ head/sys/fs/ext2fs/ext2fs.h Tue Dec 29 15:51:52 2015 (r292872) @@ -187,6 +187,7 @@ struct csum { #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 +#define EXT2F_INCOMPAT_RECOVER 0x0004 #define EXT2F_INCOMPAT_META_BG 0x0010 #define EXT2F_INCOMPAT_EXTENTS 0x0040 #define EXT2F_INCOMPAT_64BIT 0x0080 @@ -208,6 +209,7 @@ struct csum { * * We do not support these EXT4 features but they are irrelevant * for read-only support: + * - EXT2F_INCOMPAT_RECOVER * - EXT2F_INCOMPAT_FLEX_BG * - EXT2F_INCOMPAT_META_BG */ @@ -216,6 +218,7 @@ struct csum { EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE #define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \ + EXT2F_INCOMPAT_RECOVER | \ EXT2F_INCOMPAT_FLEX_BG | \ EXT2F_INCOMPAT_META_BG ) From owner-svn-src-head@freebsd.org Tue Dec 29 15: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 E1B23A54027; Tue, 29 Dec 2015 15:54:35 +0000 (UTC) (envelope-from miwi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AF2F21491; Tue, 29 Dec 2015 15:54:35 +0000 (UTC) (envelope-from miwi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTFsY81083689; Tue, 29 Dec 2015 15:54:34 GMT (envelope-from miwi@FreeBSD.org) Received: (from miwi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTFsYRo083688; Tue, 29 Dec 2015 15:54:34 GMT (envelope-from miwi@FreeBSD.org) Message-Id: <201512291554.tBTFsYRo083688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: miwi set sender to miwi@FreeBSD.org using -f From: Martin Wilke Date: Tue, 29 Dec 2015 15:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292873 - head/share/misc 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, 29 Dec 2015 15:54:36 -0000 Author: miwi (doc,ports committer) Date: Tue Dec 29 15:54:34 2015 New Revision: 292873 URL: https://svnweb.freebsd.org/changeset/base/292873 Log: - Sort ports-secteam Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Tue Dec 29 15:51:52 2015 (r292872) +++ head/share/misc/organization.dot Tue Dec 29 15:54:34 2015 (r292873) @@ -34,7 +34,7 @@ portmgr [label="Port Management Team\npo portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nculot"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] -portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, eadler, feld, jgh, rea, sbz, simon, swills, zi, miwi"] +portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, eadler, feld, jgh, miwi, rea, sbz, simon, swills, zi"] secteamsecretary [label="Security Team Secretary\nsecteam-secretary@FreeBSD.org\nremko"] securityofficer [label="Security Officer Team\nsecurity-officer@FreeBSD.org\ncperciva, simon, nectar"] srccommitters [label="Src Committers\nsrc-committers@FreeBSD.org"] From owner-svn-src-head@freebsd.org Tue Dec 29 16:29: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 77992A5523C; Tue, 29 Dec 2015 16:29:44 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 44112111D; Tue, 29 Dec 2015 16:29:44 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTGThpv093345; Tue, 29 Dec 2015 16:29:43 GMT (envelope-from theraven@FreeBSD.org) Received: (from theraven@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTGTgf8093337; Tue, 29 Dec 2015 16:29:42 GMT (envelope-from theraven@FreeBSD.org) Message-Id: <201512291629.tBTGTgf8093337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: theraven set sender to theraven@FreeBSD.org using -f From: David Chisnall Date: Tue, 29 Dec 2015 16:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292876 - head/usr.bin/dtc 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, 29 Dec 2015 16:29:44 -0000 Author: theraven Date: Tue Dec 29 16:29:42 2015 New Revision: 292876 URL: https://svnweb.freebsd.org/changeset/base/292876 Log: Improvements to BSD-licensed DTC. - Added an expression parser so that expressions from headers are now working - Fixed missing null terminators on cross references - Disabled exceptions / RTTI in the build for smaller binaries - Changed phandle order generation to be identical to GPL'd dtc Modified: head/usr.bin/dtc/Makefile head/usr.bin/dtc/checking.cc head/usr.bin/dtc/checking.hh head/usr.bin/dtc/dtb.hh head/usr.bin/dtc/fdt.cc head/usr.bin/dtc/fdt.hh head/usr.bin/dtc/input_buffer.cc head/usr.bin/dtc/input_buffer.hh Modified: head/usr.bin/dtc/Makefile ============================================================================== --- head/usr.bin/dtc/Makefile Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/Makefile Tue Dec 29 16:29:42 2015 (r292876) @@ -6,7 +6,7 @@ MAN= dtc.1 WARNS?= 3 -CXXFLAGS+= -std=c++11 +CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO Modified: head/usr.bin/dtc/checking.cc ============================================================================== --- head/usr.bin/dtc/checking.cc Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/checking.cc Tue Dec 29 16:29:42 2015 (r292876) @@ -51,7 +51,7 @@ namespace struct address_cells_checker : public checker { address_cells_checker(const char *name) : checker(name) {} - virtual bool check_node(device_tree *tree, const node_ptr &n) + virtual bool check_node(device_tree *, const node_ptr &n) { // If this has no children, it trivially meets the // conditions. @@ -151,7 +151,7 @@ property_checker::check_property(device_ } bool -property_size_checker::check(device_tree *tree, const node_ptr &n, property_ptr p) +property_size_checker::check(device_tree *, const node_ptr &, property_ptr p) { uint32_t psize = 0; for (property::value_iterator i=p->begin(),e=p->end() ; i!=e ; ++i) Modified: head/usr.bin/dtc/checking.hh ============================================================================== --- head/usr.bin/dtc/checking.hh Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/checking.hh Tue Dec 29 16:29:42 2015 (r292876) @@ -86,7 +86,7 @@ class checker * Method for checking that a node is valid. The root class version * does nothing, subclasses should override this. */ - virtual bool check_node(device_tree *tree, const node_ptr &n) + virtual bool check_node(device_tree *, const node_ptr &) { return true; } @@ -94,7 +94,7 @@ class checker * Method for checking that a property is valid. The root class * version does nothing, subclasses should override this. */ - virtual bool check_property(device_tree *tree, const node_ptr &n, property_ptr p) + virtual bool check_property(device_tree *, const node_ptr &, property_ptr ) { return true; } @@ -160,7 +160,7 @@ struct property_type_checker begin() == p->end(); } @@ -175,7 +175,7 @@ struct property_type_checker begin() + 1 == p->end()) && p->begin()->is_string(); } @@ -190,7 +190,7 @@ struct property_type_checker begin(),e=p->end() ; i!=e ; ++i) @@ -213,7 +213,7 @@ struct property_type_checker begin() + 1 == p->end()) && (tree->referenced_node(*p->begin()) != 0); Modified: head/usr.bin/dtc/dtb.hh ============================================================================== --- head/usr.bin/dtc/dtb.hh Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/dtb.hh Tue Dec 29 16:29:42 2015 (r292876) @@ -186,11 +186,11 @@ class binary_writer : public output_writ * The binary format does not support labels, so this method * does nothing. */ - virtual void write_label(string name) {} + virtual void write_label(string) {} /** * Comments are ignored by the binary writer. */ - virtual void write_comment(string name) {} + virtual void write_comment(string) {} virtual void write_string(string name); virtual void write_data(uint8_t v); virtual void write_data(uint32_t v); Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/fdt.cc Tue Dec 29 16:29:42 2015 (r292876) @@ -264,24 +264,6 @@ property::parse_string(input_buffer &inp void property::parse_cells(input_buffer &input, int cell_size) { - unsigned long long cell_max; - switch (cell_size) - { - case 8: - cell_max = UINT8_MAX; - break; - case 16: - cell_max = UINT16_MAX; - break; - case 32: - cell_max = UINT32_MAX; - break; - case 64: - cell_max = UINT64_MAX; - break; - default: - assert(0 && "Invalid cell size!"); - } assert(input[0] == '<'); ++input; property_value v; @@ -327,19 +309,12 @@ property::parse_cells(input_buffer &inpu //FIXME: We should support labels in the middle //of these, but we don't. unsigned long long val; - if (!input.consume_integer(val)) + if (!input.consume_integer_expression(val)) { input.parse_error("Expected numbers in array of cells"); valid = false; return; } - if (val > cell_max) - { - fprintf(stderr, "%lld > %lld\n", val, cell_max); - input.parse_error("Value out of range"); - valid = false; - return; - } switch (cell_size) { case 8: @@ -685,6 +660,16 @@ node::parse_name(input_buffer &input, bo return n; } +void +node::visit(std::function fn) +{ + fn(*this); + for (auto &&c : children) + { + c->visit(fn); + } +} + node::node(input_buffer &structs, input_buffer &strings) : valid(true) { const char *name_start = (const char*)structs; @@ -742,7 +727,7 @@ node::node(input_buffer &structs, input_ valid = false; return; } - properties.push_back(prop); + props.push_back(prop); break; } break; @@ -806,7 +791,7 @@ node::node(input_buffer &input, string n } else { - properties.push_back(p); + props.push_back(p); } } else if (!is_property && input[0] == ('{')) @@ -824,7 +809,7 @@ node::node(input_buffer &input, string n } else if (input.consume(';')) { - properties.push_back(property_ptr(new property(child_name, child_label))); + props.push_back(property_ptr(new property(child_name, child_label))); } else { @@ -857,9 +842,9 @@ node::sort() { std::sort(property_begin(), property_end(), cmp_properties); std::sort(child_begin(), child_end(), cmp_children); - for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i) + for (auto &c : child_nodes()) { - (*i)->sort(); + c->sort(); } } @@ -892,7 +877,7 @@ node::parse_dtb(input_buffer &structs, i property_ptr node::get_property(string key) { - for (auto &i : properties) + for (auto &i : props) { if (i->get_key() == key) { @@ -914,14 +899,14 @@ node::merge_node(node_ptr other) // large numbers of properties, but for typical usage the // entire vector will fit (easily) into cache, so iterating // over it repeatedly isn't that expensive. - for (auto &p : other->properties) + for (auto &p : other->properties()) { bool found = false; - for (auto i=property_begin(), e=property_end() ; i!=e ; ++i) + for (auto &mp : properties()) { - if ((*i)->get_key() == p->get_key()) + if (mp->get_key() == p->get_key()) { - *i = p; + mp = p; found = true; break; } @@ -964,13 +949,13 @@ node::write(dtb::output_writer &writer, writer.write_comment(name); writer.write_data(name_buffer); writer.write_data((uint8_t)0); - for (auto i=property_begin(), e=property_end() ; i!=e ; ++i) + for (auto p : properties()) { - (*i)->write(writer, strings); + p->write(writer, strings); } - for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i) + for (auto &c : child_nodes()) { - (*i)->write(writer, strings); + c->write(writer, strings); } writer.write_token(dtb::FDT_END_NODE); } @@ -999,13 +984,13 @@ node::write_dts(FILE *file, int indent) unit_address.print(file); } fputs(" {\n\n", file); - for (auto i=property_begin(), e=property_end() ; i!=e ; ++i) + for (auto p : properties()) { - (*i)->write_dts(file, indent+1); + p->write_dts(file, indent+1); } - for (child_iterator i=child_begin(), e=child_end() ; i!=e ; ++i) + for (auto &c : child_nodes()) { - (*i)->write_dts(file, indent+1); + c->write_dts(file, indent+1); } for (int i=0 ; ichild_begin(), e=n->child_end() ; i!=e ; ++i) + for (auto &c : n->child_nodes()) { - collect_names_recursive(*i, path); + collect_names_recursive(c, path); } path.pop_back(); // Now we collect the phandles and properties that reference // other nodes. - for (auto i=n->property_begin(), e=n->property_end() ; i!=e ; ++i) + for (auto &p : n->properties()) { - for (property::value_iterator p=(*i)->begin(),pe=(*i)->end() ; p!=pe ; ++p) + for (auto &v : *p) { - if (p->is_phandle()) + if (v.is_phandle()) { - phandles.push_back(&*p); + phandles.push_back(&v); } - if (p->is_cross_reference()) + if (v.is_cross_reference()) { - cross_references.push_back(&*p); + cross_references.push_back(&v); } } - if ((*i)->get_key() == string("phandle") || - (*i)->get_key() == string("linux,phandle")) + if (p->get_key() == string("phandle") || + p->get_key() == string("linux,phandle")) { - if ((*i)->begin()->byte_data.size() != 4) + if (p->begin()->byte_data.size() != 4) { fprintf(stderr, "Invalid phandle value for node "); n->name.dump(); @@ -1071,7 +1056,7 @@ device_tree::collect_names_recursive(nod } else { - uint32_t phandle = (*i)->begin()->get_as_uint32(); + uint32_t phandle = p->begin()->get_as_uint32(); used_phandles.insert(std::make_pair(phandle, n.get())); } } @@ -1104,12 +1089,33 @@ device_tree::resolve_cross_references() { pv->byte_data.push_back('@'); p->second.push_to_buffer(pv->byte_data); + pv->byte_data.push_back(0); } } } - uint32_t phandle = 1; + std::unordered_set phandle_set; for (auto &i : phandles) { + phandle_set.insert(i); + } + std::vector sorted_phandles; + root->visit([&](node &n) { + for (auto &p : n.properties()) + { + for (auto &v : *p) + { + if (phandle_set.count(&v)) + { + sorted_phandles.push_back(&v); + } + } + } + }); + assert(sorted_phandles.size() == phandles.size()); + + uint32_t phandle = 1; + for (auto &i : sorted_phandles) + { string target_name = i->string_data; node *target = node_names[target_name]; if (target == 0) @@ -1163,94 +1169,111 @@ device_tree::resolve_cross_references() } } -void -device_tree::parse_file(input_buffer &input, +bool +device_tree::parse_include(input_buffer &input, const std::string &dir, std::vector &roots, FILE *depfile, bool &read_header) { - input.next_token(); - // Read the header - if (input.consume("/dts-v1/;")) + if (!input.consume("/include/")) { - read_header = true; + return false; } - input.next_token(); - while(input.consume("/include/")) + bool reallyInclude = true; + if (input.consume("if ")) { - bool reallyInclude = true; - if (input.consume("if ")) - { - input.next_token(); - string name = string::parse_property_name(input); - // XXX: Error handling - if (defines.find(name) == defines.end()) - { - reallyInclude = false; - } - input.consume('/'); - } input.next_token(); - if (!input.consume('"')) + string name = string::parse_property_name(input); + // XXX: Error handling + if (defines.find(name) == defines.end()) { - input.parse_error("Expected quoted filename"); - valid = false; - return; + reallyInclude = false; } - int length = 0; - while (input[length] != '"') length++; + input.consume('/'); + } + input.next_token(); + if (!input.consume('"')) + { + input.parse_error("Expected quoted filename"); + valid = false; + return false; + } + int length = 0; + while (input[length] != '"') length++; - std::string file((const char*)input, length); - std::string include_file = dir + '/' + file; - assert(input.consume(file.c_str())); + std::string file((const char*)input, length); + std::string include_file = dir + '/' + file; + input.consume(file.c_str()); + if (!reallyInclude) + { input.consume('"'); input.next_token(); - if (!reallyInclude) - { - continue; - } + return true; + } - input_buffer *include_buffer = buffer_for_file(include_file.c_str()); + input_buffer *include_buffer = buffer_for_file(include_file.c_str(), false); - if (include_buffer == 0) + if (include_buffer == 0) + { + for (auto i : include_paths) { - for (auto i : include_paths) + include_file = i + '/' + file; + include_buffer = buffer_for_file(include_file.c_str()); + if (include_buffer != 0) { - include_file = i + '/' + file; - include_buffer = buffer_for_file(include_file.c_str()); - if (include_buffer != 0) - { - break; - } + break; } } - if (depfile != 0) - { - putc(' ', depfile); - fputs(include_file.c_str(), depfile); - } - if (include_buffer == 0) - { - valid = false; - return; - } - parse_file(*include_buffer, dir, roots, depfile, read_header); } + if (depfile != 0) + { + putc(' ', depfile); + fputs(include_file.c_str(), depfile); + } + if (include_buffer == 0) + { + input.parse_error("Unable to locate input file"); + input.consume('"'); + input.next_token(); + valid = false; + return true; + } + input.consume('"'); + input.next_token(); + parse_file(*include_buffer, dir, roots, depfile, read_header); + return true; +} + +void +device_tree::parse_file(input_buffer &input, + const std::string &dir, + std::vector &roots, + FILE *depfile, + bool &read_header) +{ + input.next_token(); + // Read the header + if (input.consume("/dts-v1/;")) + { + read_header = true; + } + input.next_token(); input.next_token(); if (!read_header) { input.parse_error("Expected /dts-v1/; version string"); } + while(parse_include(input, dir, roots, depfile, read_header)) {} // Read any memory reservations while(input.consume("/memreserve/")) { unsigned long long start, len; input.next_token(); // Read the start and length. - if (!(input.consume_integer(start) && + if (!(input.consume_integer_expression(start) && (input.next_token(), - input.consume_integer(len)))) + input.consume_integer_expression(len)))) { input.parse_error("Expected size on /memreserve/ node."); } @@ -1259,6 +1282,7 @@ device_tree::parse_file(input_buffer &in reservations.push_back(reservation(start, len)); } input.next_token(); + while(parse_include(input, dir, roots, depfile, read_header)) {} while (valid && !input.finished()) { node_ptr n; @@ -1287,11 +1311,12 @@ device_tree::parse_file(input_buffer &in valid = false; } input.next_token(); + while(parse_include(input, dir, roots, depfile, read_header)) {} } } input_buffer* -device_tree::buffer_for_file(const char *path) +device_tree::buffer_for_file(const char *path, bool warn) { if (string(path) == string("-")) { @@ -1306,7 +1331,10 @@ device_tree::buffer_for_file(const char int source = open(path, O_RDONLY); if (source == -1) { - fprintf(stderr, "Unable to open file '%s'. %s\n", path, strerror(errno)); + if (warn) + { + fprintf(stderr, "Unable to open file '%s'. %s\n", path, strerror(errno)); + } return 0; } struct stat st; @@ -1447,7 +1475,7 @@ device_tree::write_dts(int fd) } void -device_tree::parse_dtb(const char *fn, FILE *depfile) +device_tree::parse_dtb(const char *fn, FILE *) { input_buffer *in = buffer_for_file(fn); if (in == 0) Modified: head/usr.bin/dtc/fdt.hh ============================================================================== --- head/usr.bin/dtc/fdt.hh Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/fdt.hh Tue Dec 29 16:29:42 2015 (r292876) @@ -36,6 +36,7 @@ #include #include #include +#include #include "util.hh" #include "string.hh" @@ -402,11 +403,37 @@ class node * The type for the property vector. */ typedef std::vector property_vector; + /** + * Iterator type for child nodes. + */ + typedef std::vector::iterator child_iterator; private: /** + * Adaptor to use children in range-based for loops. + */ + struct child_range + { + child_range(node &nd) : n(nd) {} + child_iterator begin() { return n.child_begin(); } + child_iterator end() { return n.child_end(); } + private: + node &n; + }; + /** + * Adaptor to use properties in range-based for loops. + */ + struct property_range + { + property_range(node &nd) : n(nd) {} + property_vector::iterator begin() { return n.property_begin(); } + property_vector::iterator end() { return n.property_end(); } + private: + node &n; + }; + /** * The properties contained within this node. */ - property_vector properties; + property_vector props; /** * The children of this node. */ @@ -458,10 +485,6 @@ class node */ void sort(); /** - * Iterator type for child nodes. - */ - typedef std::vector::iterator child_iterator; - /** * Returns an iterator for the first child of this node. */ inline child_iterator child_begin() @@ -475,19 +498,27 @@ class node { return children.end(); } + inline child_range child_nodes() + { + return child_range(*this); + } + inline property_range properties() + { + return property_range(*this); + } /** * Returns an iterator after the last property of this node. */ inline property_vector::iterator property_begin() { - return properties.begin(); + return props.begin(); } /** * Returns an iterator for the first property of this node. */ inline property_vector::iterator property_end() { - return properties.end(); + return props.end(); } /** * Factory method for constructing a new node. Attempts to parse a @@ -519,7 +550,7 @@ class node */ inline void add_property(property_ptr &p) { - properties.push_back(p); + props.push_back(p); } /** * Merges a node into this one. Any properties present in both are @@ -539,6 +570,10 @@ class node * with this number of tabs. */ void write_dts(FILE *file, int indent); + /** + * Recursively visit this node and then its children. + */ + void visit(std::function); }; /** @@ -683,6 +718,14 @@ class device_tree */ void resolve_cross_references(); /** + * Parse a top-level include directive. + */ + bool parse_include(input_buffer &input, + const std::string &dir, + std::vector &roots, + FILE *depfile, + bool &read_header); + /** * Parses a dts file in the given buffer and adds the roots to the parsed * set. The `read_header` argument indicates whether the header has * already been read. Some dts files place the header in an include, @@ -698,7 +741,7 @@ class device_tree * object then keeps a reference to it, ensuring that it is not * deallocated until the device tree is destroyed. */ - input_buffer *buffer_for_file(const char *path); + input_buffer *buffer_for_file(const char *path, bool warn=true); /** * Template function that writes a dtb blob using the specified writer. * The writer defines the output format (assembly, blob). Modified: head/usr.bin/dtc/input_buffer.cc ============================================================================== --- head/usr.bin/dtc/input_buffer.cc Tue Dec 29 16:11:43 2015 (r292875) +++ head/usr.bin/dtc/input_buffer.cc Tue Dec 29 16:29:42 2015 (r292876) @@ -37,6 +37,10 @@ #include #include #include +#include +#ifndef NDEBUG +#include +#endif #include @@ -49,7 +53,6 @@ namespace dtc { - void input_buffer::skip_spaces() { @@ -131,6 +134,563 @@ input_buffer::consume_integer(unsigned l return true; } +namespace { + +/** + * Convenience typedef for the type that we use for all values. + */ +typedef unsigned long long valty; + +/** + * Expression tree currently being parsed. + */ +struct expression +{ + /** + * Evaluate this node, taking into account operator precedence. + */ + virtual valty operator()() = 0; + /** + * Returns the precedence of this node. Lower values indicate higher + * precedence. + */ + virtual int precedence() = 0; + virtual ~expression() {} +#ifndef NDEBUG + /** + * Dumps this expression to `std::cerr`, appending a newline if `nl` is + * `true`. + */ + void dump(bool nl=false) + { + if (this == nullptr) + { + std::cerr << "{nullptr}\n"; + return; + } + dump_impl(); + if (nl) + { + std::cerr << '\n'; + } + } + private: + /** + * Method that sublcasses override to implement the behaviour of `dump()`. + */ + virtual void dump_impl() = 0; +#endif +}; + +/** + * Expression wrapping a single integer. Leaf nodes in the expression tree. + */ +class terminal_expr : public expression +{ + /** + * The value that this wraps. + */ + valty val; + /** + * Evaluate. Trivially returns the value that this class wraps. + */ + valty operator()() override + { + return val; + } + int precedence() override + { + return 0; + } + public: + /** + * Constructor. + */ + terminal_expr(valty v) : val(v) {} +#ifndef NDEBUG + void dump_impl() override { std::cerr << val; } +#endif +}; + +/** + * Parenthetical expression. Exists to make the contents opaque. + */ +struct paren_expression : public expression +{ + /** + * The expression within the parentheses. + */ + expression_ptr subexpr; + /** + * Constructor. Takes the child expression as the only argument. + */ + paren_expression(expression_ptr p) : subexpr(std::move(p)) {} + int precedence() override + { + return 0; + } + /** + * Evaluate - just forwards to the underlying expression. + */ + valty operator()() override + { + return (*subexpr)(); + } +#ifndef NDEBUG + void dump_impl() override + { + std::cerr << " ("; + subexpr->dump(); + std::cerr << ") "; + } +#endif +}; + +/** + * Template class for unary operators. The `OpChar` template parameter is + * solely for debugging and makes it easy to print the expression. The `Op` + * template parameter is a function object that implements the operator that + * this class provides. Most of these are provided by the `` + * header. + */ +template +class unary_operator : public expression +{ + /** + * The subexpression for this unary operator. + */ + expression_ptr subexpr; + valty operator()() override + { + Op op; + return op((*subexpr)()); + } + /** + * All unary operators have the same precedence. They are all evaluated + * before binary expressions, but after parentheses. + */ + int precedence() override + { + return 3; + } + public: + unary_operator(expression_ptr p) : subexpr(std::move(p)) {} +#ifndef NDEBUG + void dump_impl() override + { + std::cerr << OpChar; + subexpr->dump(); + } +#endif +}; + +/** + * Abstract base class for binary operators. Allows the tree to be modified + * without knowing what the operations actually are. + */ +struct binary_operator_base : public expression +{ + /** + * The left side of the expression. + */ + expression_ptr lhs; + /** + * The right side of the expression. + */ + expression_ptr rhs; + /** + * Insert a node somewhere down the path of left children, until it would + * be preempting something that should execute first. + */ + void insert_left(binary_operator_base *new_left) + { + if (lhs->precedence() < new_left->precedence()) + { + new_left->rhs = std::move(lhs); + lhs.reset(new_left); + } + else + { + static_cast(lhs.get())->insert_left(new_left); + } + } +}; + +/** + * Template class for binary operators. The precedence and the operation are + * provided as template parameters. + */ +template +struct binary_operator : public binary_operator_base +{ + valty operator()() override + { + Op op; + return op((*lhs)(), (*rhs)()); + } + int precedence() override + { + return Precedence; + } +#ifdef NDEBUG + /** + * Constructor. Takes the name of the operator as an argument, for + * debugging. Only stores it in debug mode. + */ + binary_operator(const char *) {} +#else + const char *opName; + binary_operator(const char *o) : opName(o) {} + void dump_impl() override + { + lhs->dump(); + std::cerr << opName; + rhs->dump(); + } +#endif +}; + +/** + * Ternary conditional operators (`cond ? true : false`) are a special case - + * there are no other ternary operators. + */ +class ternary_conditional_operator : public expression +{ + /** + * The condition for the clause. + */ + expression_ptr cond; + /** + * The expression that this evaluates to if the condition is true. + */ + expression_ptr lhs; + /** + * The expression that this evaluates to if the condition is false. + */ + expression_ptr rhs; + valty operator()() override + { + return (*cond)() ? (*lhs)() : (*rhs)(); + } + int precedence() override + { + // The actual precedence of a ternary conditional operator is 15, but + // its associativity is the opposite way around to the other operators, + // so we fudge it slightly. + return 3; + } +#ifndef NDEBUG + void dump_impl() override + { + cond->dump(); + std::cerr << " ? "; + lhs->dump(); + std::cerr << " : "; + rhs->dump(); + } +#endif + public: + ternary_conditional_operator(expression_ptr c, + expression_ptr l, + expression_ptr r) : + cond(std::move(c)), lhs(std::move(l)), rhs(std::move(r)) {} +}; + +template +struct lshift +{ + constexpr T operator()(const T &lhs, const T &rhs) const + { + return lhs << rhs; + } +}; +template +struct rshift +{ + constexpr T operator()(const T &lhs, const T &rhs) const *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 29 16:31: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 7021DA552E2; Tue, 29 Dec 2015 16:31:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3A663145A; Tue, 29 Dec 2015 16:31:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTGVS9C093455; Tue, 29 Dec 2015 16:31:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTGVS6F093454; Tue, 29 Dec 2015 16:31:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201512291631.tBTGVS6F093454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 29 Dec 2015 16:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292877 - head/bin/pax 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, 29 Dec 2015 16:31:29 -0000 Author: pfg Date: Tue Dec 29 16:31:28 2015 New Revision: 292877 URL: https://svnweb.freebsd.org/changeset/base/292877 Log: pax: prevent possible buffer overflow Or at least quiet down some static analyzers about it. CID: 978835 MFC after: 1 week Obtained from: OpenBSD Modified: head/bin/pax/pat_rep.c Modified: head/bin/pax/pat_rep.c ============================================================================== --- head/bin/pax/pat_rep.c Tue Dec 29 16:29:42 2015 (r292876) +++ head/bin/pax/pat_rep.c Tue Dec 29 16:31:28 2015 (r292877) @@ -878,7 +878,7 @@ rep_name(char *name, int *nlen, int prnt * (the user already saw that substitution go by) */ pt = rephead; - (void)strcpy(buf1, name); + (void)strlcpy(buf1, name, sizeof(buf1)); inpt = buf1; outpt = nname; endpt = outpt + PAXPATHLEN; From owner-svn-src-head@freebsd.org Tue Dec 29 17:07: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 79BF4A55FFD; Tue, 29 Dec 2015 17:07:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3B3D81A15; Tue, 29 Dec 2015 17:07:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTH7ShF005434; Tue, 29 Dec 2015 17:07:28 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTH7SvA005433; Tue, 29 Dec 2015 17:07:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512291707.tBTH7SvA005433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 29 Dec 2015 17:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292878 - head/sys/dev/puc 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, 29 Dec 2015 17:07:29 -0000 Author: marius Date: Tue Dec 29 17:07:28 2015 New Revision: 292878 URL: https://svnweb.freebsd.org/changeset/base/292878 Log: - Add entries for the more prominent members of the Digi International Neo series, which are based on Exar PCI chips. - Mark some unused parameters as such. - Fix style MFC after: 3 days Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Tue Dec 29 16:31:28 2015 (r292877) +++ head/sys/dev/puc/pucdata.c Tue Dec 29 17:07:28 2015 (r292878) @@ -64,7 +64,6 @@ static puc_config_f puc_config_timedia; static puc_config_f puc_config_titan; const struct puc_cfg puc_pci_devices[] = { - { 0x0009, 0x7168, 0xffff, 0, "Sunix SUN1889", DEFAULT_RCLK * 8, @@ -179,6 +178,55 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_amc }, + /* + * The following members of the Digi International Neo series are + * based on Exar PCI chips, f. e. the 8 port variants on XR17V258IV. + * Accordingly, the PCIe versions of these cards incorporate a PLX + * PCIe-PCI-bridge. + */ + + { 0x114f, 0x00b0, 0xffff, 0, + "Digi Neo PCI 4 Port", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x114f, 0x00b1, 0xffff, 0, + "Digi Neo PCI 8 Port", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x114f, 0x00f0, 0xffff, 0, + "Digi Neo PCIe 8 Port", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x114f, 0x00f1, 0xffff, 0, + "Digi Neo PCIe 4 Port", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x114f, 0x00f2, 0xffff, 0, + "Digi Neo PCIe 4 Port RJ45", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x114f, 0x00f3, 0xffff, 0, + "Digi Neo PCIe 8 Port RJ45", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + { 0x11fe, 0x8010, 0xffff, 0, "Comtrol RocketPort 550/8 RJ11 part A", DEFAULT_RCLK * 4, @@ -1208,9 +1256,10 @@ const struct puc_cfg puc_pci_devices[] = }; static int -puc_config_amc(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, +puc_config_amc(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, int port, intptr_t *res) { + switch (cmd) { case PUC_CFG_GET_OFS: *res = 8 * (port & 1); @@ -1242,9 +1291,10 @@ puc_config_diva(struct puc_softc *sc, en } static int -puc_config_exar(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, - intptr_t *res) +puc_config_exar(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, + int port, intptr_t *res) { + if (cmd == PUC_CFG_GET_OFS) { *res = port * 0x200; return (0); @@ -1253,9 +1303,10 @@ puc_config_exar(struct puc_softc *sc, en } static int -puc_config_exar_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, - intptr_t *res) +puc_config_exar_pcie(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, + int port, intptr_t *res) { + if (cmd == PUC_CFG_GET_OFS) { *res = port * 0x400; return (0); @@ -1264,9 +1315,10 @@ puc_config_exar_pcie(struct puc_softc *s } static int -puc_config_icbook(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, - intptr_t *res) +puc_config_icbook(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, + int port __unused, intptr_t *res) { + if (cmd == PUC_CFG_GET_ILR) { *res = PUC_ILR_DIGI; return (0); @@ -1278,9 +1330,9 @@ static int puc_config_moxa(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - if (cmd == PUC_CFG_GET_OFS) { - const struct puc_cfg *cfg = sc->sc_cfg; + const struct puc_cfg *cfg = sc->sc_cfg; + if (cmd == PUC_CFG_GET_OFS) { if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144)) port = 7; @@ -1292,8 +1344,8 @@ puc_config_moxa(struct puc_softc *sc, en } static int -puc_config_quatech(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, - intptr_t *res) +puc_config_quatech(struct puc_softc *sc, enum puc_cfg_cmd cmd, + int port __unused, intptr_t *res) { const struct puc_cfg *cfg = sc->sc_cfg; struct puc_bar *bar; @@ -1381,8 +1433,8 @@ puc_config_quatech(struct puc_softc *sc, case PUC_CFG_GET_ILR: v0 = (sc->sc_cfg_data >> 8) & 0xff; v1 = sc->sc_cfg_data & 0xff; - *res = (v0 == 0 && v1 == 0x80 + -cfg->clock) - ? PUC_ILR_NONE : PUC_ILR_QUATECH; + *res = (v0 == 0 && v1 == 0x80 + -cfg->clock) ? + PUC_ILR_NONE : PUC_ILR_QUATECH; return (0); default: break; @@ -1694,9 +1746,10 @@ puc_config_sunix(struct puc_softc *sc, e } static int -puc_config_titan(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, - intptr_t *res) +puc_config_titan(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, + int port, intptr_t *res) { + switch (cmd) { case PUC_CFG_GET_OFS: *res = (port < 3) ? 0 : (port - 2) << 3; From owner-svn-src-head@freebsd.org Tue Dec 29 19:20: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 591CBA550EC; Tue, 29 Dec 2015 19:20:40 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2C4B019BE; Tue, 29 Dec 2015 19:20:40 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTJKdfr046069; Tue, 29 Dec 2015 19:20:39 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTJKdSY046068; Tue, 29 Dec 2015 19:20:39 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201512291920.tBTJKdSY046068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 29 Dec 2015 19:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292881 - 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: Tue, 29 Dec 2015 19:20:40 -0000 Author: jtl Date: Tue Dec 29 19:20:39 2015 New Revision: 292881 URL: https://svnweb.freebsd.org/changeset/base/292881 Log: When checking the inp_ip_minttl restriction for IPv6 packets, don't check the IPv4 header. CID: 1017920 Differential Revision: https://reviews.freebsd.org/D4727 Reviewed by: bz MFC after: 2 weeks Sponsored by: Juniper Networks Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 29 18:33:43 2015 (r292880) +++ head/sys/netinet/tcp_input.c Tue Dec 29 19:20:39 2015 (r292881) @@ -919,9 +919,10 @@ findpcb: */ if (inp->inp_ip_minttl != 0) { #ifdef INET6 - if (isipv6 && inp->inp_ip_minttl > ip6->ip6_hlim) - goto dropunlock; - else + if (isipv6) { + if (inp->inp_ip_minttl > ip6->ip6_hlim) + goto dropunlock; + } else #endif if (inp->inp_ip_minttl > ip->ip_ttl) goto dropunlock; From owner-svn-src-head@freebsd.org Tue Dec 29 20:17: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 48A18A5436B; Tue, 29 Dec 2015 20:17:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 16FC31870; Tue, 29 Dec 2015 20:17:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTKHft8063689; Tue, 29 Dec 2015 20:17:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTKHfrG063688; Tue, 29 Dec 2015 20:17:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512292017.tBTKHfrG063688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 20:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292884 - head/usr.sbin/makefs 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, 29 Dec 2015 20:17:42 -0000 Author: ngie Date: Tue Dec 29 20:17:40 2015 New Revision: 292884 URL: https://svnweb.freebsd.org/changeset/base/292884 Log: Fix getopt(3) argument after r290180; I forgot to change -r to -R by accident MFC after: 3 days Pointyhat to: ngie Reported by: vangyzen Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/makefs/makefs.c Modified: head/usr.sbin/makefs/makefs.c ============================================================================== --- head/usr.sbin/makefs/makefs.c Tue Dec 29 19:56:26 2015 (r292883) +++ head/usr.sbin/makefs/makefs.c Tue Dec 29 20:17:40 2015 (r292884) @@ -116,7 +116,7 @@ main(int argc, char *argv[]) start_time.tv_sec = start.tv_sec; start_time.tv_nsec = start.tv_usec * 1000; - while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != -1) { + while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pR:s:S:t:xZ")) != -1) { switch (ch) { case 'B': From owner-svn-src-head@freebsd.org Tue Dec 29 20:51: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 BFC22A551E3; Tue, 29 Dec 2015 20:51:30 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 97F951CD5; Tue, 29 Dec 2015 20:51:30 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTKpT4p073761; Tue, 29 Dec 2015 20:51:29 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTKpTF8073760; Tue, 29 Dec 2015 20:51:29 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512292051.tBTKpTF8073760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 29 Dec 2015 20:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292887 - head/bin/sh 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, 29 Dec 2015 20:51:30 -0000 Author: jilles Date: Tue Dec 29 20:51:29 2015 New Revision: 292887 URL: https://svnweb.freebsd.org/changeset/base/292887 Log: sh: Split subevalvar() in #/##/%/%% and =/? parts. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Tue Dec 29 20:42:42 2015 (r292886) +++ head/bin/sh/expand.c Tue Dec 29 20:51:29 2015 (r292887) @@ -101,7 +101,8 @@ static char *argstr(char *, int); static char *exptilde(char *, int); static char *expari(char *); static void expbackq(union node *, int, int); -static int subevalvar(char *, char *, int, int, int, int, int); +static int subevalvar_trim(char *, int, int, int, int); +static int subevalvar_misc(char *, const char *, int, int, int); static char *evalvar(char *, int); static int varisset(const char *, int); static void strtodest(const char *, int, int, int); @@ -521,42 +522,23 @@ recordleft(const char *str, const char * } static int -subevalvar(char *p, char *str, int strloc, int subtype, int startloc, - int varflags, int quotes) +subevalvar_trim(char *p, int strloc, int subtype, int startloc, int quotes) { char *startp; char *loc = NULL; char *q; + char *str; int c = 0; struct nodelist *saveargbackq = argbackq; int amount; - argstr(p, (subtype == VSTRIMLEFT || subtype == VSTRIMLEFTMAX || - subtype == VSTRIMRIGHT || subtype == VSTRIMRIGHTMAX ? - EXP_CASE : 0) | EXP_TILDE); + argstr(p, EXP_CASE | EXP_TILDE); STACKSTRNUL(expdest); argbackq = saveargbackq; startp = stackblock() + startloc; - if (str == NULL) - str = stackblock() + strloc; + str = stackblock() + strloc; switch (subtype) { - case VSASSIGN: - setvar(str, startp, 0); - amount = startp - expdest; - STADJUST(amount, expdest); - varflags &= ~VSNUL; - return 1; - - case VSQUESTION: - if (*p != CTLENDVAR) { - outfmt(out2, "%s\n", startp); - error((char *)NULL); - } - error("%.*s: parameter %snot set", (int)(p - str - 1), - str, (varflags & VSNUL) ? "null or " : ""); - return 0; - case VSTRIMLEFT: for (loc = startp; loc < str; loc++) { c = *loc; @@ -630,6 +612,41 @@ subevalvar(char *p, char *str, int strlo } +static int +subevalvar_misc(char *p, const char *var, int subtype, int startloc, + int varflags) +{ + char *startp; + struct nodelist *saveargbackq = argbackq; + int amount; + + argstr(p, EXP_TILDE); + STACKSTRNUL(expdest); + argbackq = saveargbackq; + startp = stackblock() + startloc; + + switch (subtype) { + case VSASSIGN: + setvar(var, startp, 0); + amount = startp - expdest; + STADJUST(amount, expdest); + return 1; + + case VSQUESTION: + if (*p != CTLENDVAR) { + outfmt(out2, "%s\n", startp); + error((char *)NULL); + } + error("%.*s: parameter %snot set", (int)(p - var - 1), + var, (varflags & VSNUL) ? "null or " : ""); + return 0; + + default: + abort(); + } +} + + /* * Expand a variable, and return a pointer to the next character in the * input string. @@ -760,8 +777,8 @@ again: /* jump here after setting a vari */ STPUTC('\0', expdest); patloc = expdest - stackblock(); - if (subevalvar(p, NULL, patloc, subtype, - startloc, varflags, quotes) == 0) { + if (subevalvar_trim(p, patloc, subtype, + startloc, quotes) == 0) { int amount = (expdest - stackblock() - patloc) + 1; STADJUST(-amount, expdest); } @@ -773,8 +790,8 @@ again: /* jump here after setting a vari case VSASSIGN: case VSQUESTION: if (!set) { - if (subevalvar(p, var, 0, subtype, startloc, varflags, - quotes)) { + if (subevalvar_misc(p, var, subtype, startloc, + varflags)) { varflags &= ~VSNUL; /* * Remove any recorded regions beyond From owner-svn-src-head@freebsd.org Tue Dec 29 20:55: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 A4405A553B7; Tue, 29 Dec 2015 20:55:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8F91F15; Tue, 29 Dec 2015 20:55:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 978D4B983; Tue, 29 Dec 2015 15:55:30 -0500 (EST) From: John Baldwin To: Warner Losh Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh Subject: Re: svn commit: r292809 - head/lib/libc/stdio Date: Tue, 29 Dec 2015 11:37:42 -0800 Message-ID: <2345870.SHMMVrpc1D@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 29 Dec 2015 15:55:30 -0500 (EST) 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, 29 Dec 2015 20:55:31 -0000 On Monday, December 28, 2015 01:01:26 PM Warner Losh wrote: > I'll look at that, but I don't think posix_memalign is the right way to go. > The alignment of FILE is more strict than posix_memalign will return. Ian's > idea of __alignof__ is the way to go. We allocate them in one block on > purpose for performance, and posix_memalign would be a one at a time affair. posix_memalign gives you whatever alignment you ask for. Using __alignof__ to determine the alignment instead of hardcoding sizeof(int64_t) would certainly be an improvement. If you move the glue after the FILE objects then you can use posix_memalign() directly as so: void *mem; int error; error = posix_memalign(&mem, MAX(ALIGNBYTES, __alignof__(mbstate_t)), n * sizeof(FILE) + sizeof(*g)); if (error) return (NULL); p = (FILE *)mem; g = (struct glue *)(p + n); g->next = NULL; g->niobs = n; g->iobs = p; ... (This presumes that the requested alignment of 'struct glue' is less than the alignment needed by FILE which should be true.) -- John Baldwin From owner-svn-src-head@freebsd.org Tue Dec 29 20:59: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 9731DA554FF; Tue, 29 Dec 2015 20:59:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F13A1149; Tue, 29 Dec 2015 20:59:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.15.2/8.15.2) with ESMTPS id tBTKxrLX046375 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Dec 2015 23:59:53 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.15.2/8.15.2/Submit) id tBTKxqCM046374; Tue, 29 Dec 2015 23:59:52 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 29 Dec 2015 23:59:52 +0300 From: Gleb Smirnoff To: Konstantin Belousov Cc: Shawn Webb , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292772 - head/sys/vm Message-ID: <20151229205952.GV7277@FreeBSD.org> References: <201512271442.tBREgdRr079655@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201512271442.tBREgdRr079655@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: Tue, 29 Dec 2015 20:59:57 -0000 On Sun, Dec 27, 2015 at 02:42:39PM +0000, Konstantin Belousov wrote: K> Author: kib K> Date: Sun Dec 27 14:42:39 2015 K> New Revision: 292772 K> URL: https://svnweb.freebsd.org/changeset/base/292772 K> K> Log: K> Add missed relpbuf() for a smallfs page-in. K> K> Reported by: Shawn Webb K> Tested by: pho K> Sponsored by: The FreeBSD Foundation K> K> Modified: K> head/sys/vm/vnode_pager.c K> K> Modified: head/sys/vm/vnode_pager.c K> ============================================================================== K> --- head/sys/vm/vnode_pager.c Sun Dec 27 14:39:47 2015 (r292771) K> +++ head/sys/vm/vnode_pager.c Sun Dec 27 14:42:39 2015 (r292772) K> @@ -806,6 +806,7 @@ vnode_pager_generic_getpages(struct vnod K> * than a page size, then use special small filesystem code. K> */ K> if (pagesperblock == 0) { K> + relpbuf(bp, freecnt); K> for (i = 0; i < count; i++) { K> PCPU_INC(cnt.v_vnodein); K> PCPU_INC(cnt.v_vnodepgsin); The reason for this bug is that I tried to move the (pagesperblock == 0) block above the call to getpbuf(). We actually know that filesystem is "small" at the very beginning of the function and we can branch into "small filesystem" pager immediately. Later I moved the block back to its place, simply because new place wasn't tested properly. And forgot to restore relpbuf. What filesystem did you use to show up the bug? I'm about to test the variant with immediate branching. Shawn, would you be able to test a patch if I produce one? -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Tue Dec 29 21:29: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 26E03A55D3F; Tue, 29 Dec 2015 21:29:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E82241D3B; Tue, 29 Dec 2015 21:29:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTLT5Zr085130; Tue, 29 Dec 2015 21:29:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTLT5w7085129; Tue, 29 Dec 2015 21:29:05 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201512292129.tBTLT5w7085129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 29 Dec 2015 21:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292888 - head/sys/boot/uboot/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: Tue, 29 Dec 2015 21:29:07 -0000 Author: ian Date: Tue Dec 29 21:29:05 2015 New Revision: 292888 URL: https://svnweb.freebsd.org/changeset/base/292888 Log: Fix the error checking for the ubenv command. This moves the check for an empty ldvar (which amounts to the varname string starting with '=') into the if block that manipulates ldvar, which avoids later referencing ldvar when it was never initialized. Submitted by: Thomas Skibo Pointy hat: ian Modified: head/sys/boot/uboot/common/main.c Modified: head/sys/boot/uboot/common/main.c ============================================================================== --- head/sys/boot/uboot/common/main.c Tue Dec 29 20:51:29 2015 (r292887) +++ head/sys/boot/uboot/common/main.c Tue Dec 29 21:29:05 2015 (r292888) @@ -585,6 +585,10 @@ handle_uboot_env_var(enum ubenv_action a */ if (action == UBENV_IMPORT) { len = strcspn(var, "="); + if (len == 0) { + printf("name cannot start with '=': '%s'\n", var); + return; + } if (var[len] == 0) { strcpy(ldvar, "uboot."); strncat(ldvar, var, sizeof(ldvar) - 7); @@ -604,9 +608,11 @@ handle_uboot_env_var(enum ubenv_action a var = &var[6]; } - /* If ldvar is malformed or there's no variable name left, punt. */ - if (ldvar[0] == 0 || var[0] == 0) + /* If there is no variable name left, punt. */ + if (var[0] == 0) { + printf("empty variable name\n"); return; + } val = ub_env_get(var); if (action == UBENV_SHOW) { From owner-svn-src-head@freebsd.org Tue Dec 29 21:35: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 99BC0A55FCB for ; Tue, 29 Dec 2015 21:35:22 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::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 2A753123E for ; Tue, 29 Dec 2015 21:35:22 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22c.google.com with SMTP id f206so49674630wmf.0 for ; Tue, 29 Dec 2015 13:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=poDq6psWOTFHrJVg1s4dP53O1uq1c2aNDgunoX4Y1Ts=; b=KGb3l6nw6EVEgOpqMEE1sifaQ76uFJTEtlZD/EhmE6/3YvYMKmtdO67tuQtghUFz9o CW+a4AmDR/J6GCjZM8YRT3o8y3sy/OKyFd2HCr5U1kKsZqiw4XkfCBtwwuKKMX4UPv45 Lrpqjn5PH3BJLjT48/WmYlLtqqK7O57iRqiRx1ZLuAt1zb25ZJZwsasEJ2lD/8WamA0C SupCtTNkSZO7K5yz3k0M6jN/CU05lUeesTTiLmTeVoG1Z0dcJBfq6fngp2eYQx0CTne3 PZ6DKv9XoQy9lM0ZHvjHXKKhkej9gCrHmhkGZXqurb0MQ5veD57YtnuHesyBwd/kcocJ Wqug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=poDq6psWOTFHrJVg1s4dP53O1uq1c2aNDgunoX4Y1Ts=; b=KbcHAJN6YaOQtbHX5BsECyPANbVM2iLinTq4ZQYrLKm9NmV6ad1JJ9A80Ag9VFg+MQ PAMd6wwLNIemiW6JKrhpSrJU1VYSVMx6c7qkxsAFEHRgm1YoW5tXzXz8dpiDVlWMYj4l 5o0/Fj19NOVaolabCJ0JDMISuC8ROKBXRl6jrTqWwWjMMUo5Yy3p5s0xMP+Gz588Y9lU Bv18K1fvP0SqVY6biMl+C3rs7n1hB+6BWAPOJELLl3uFAAiXohVXVwaxYukL0f/pm/DQ M4d3LEDVEKABuXxzd4F7I0er2kOFe1P46BUEm/LBYJsSmd1vNe85kV8uoTNzEtlEgra2 4xOQ== X-Gm-Message-State: ALoCoQl1xamJ/WdlCAamOjZkonwI53exVvx1YZkRF8kvWJeFpE9+rkIABd0tg0DDDzYXr8jbs23cO2AtTnjymNPm3EFnNPt859Aii5b9dqOalshSKUCOu5o= MIME-Version: 1.0 X-Received: by 10.28.171.134 with SMTP id u128mr70122652wme.22.1451424920582; Tue, 29 Dec 2015 13:35:20 -0800 (PST) Received: by 10.194.85.167 with HTTP; Tue, 29 Dec 2015 13:35:20 -0800 (PST) In-Reply-To: <20151229205952.GV7277@FreeBSD.org> References: <201512271442.tBREgdRr079655@repo.freebsd.org> <20151229205952.GV7277@FreeBSD.org> Date: Tue, 29 Dec 2015 22:35:20 +0100 Message-ID: Subject: Re: svn commit: r292772 - head/sys/vm From: Oliver Pinter To: Gleb Smirnoff Cc: Konstantin Belousov , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Shawn Webb 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: Tue, 29 Dec 2015 21:35:22 -0000 On Tuesday, December 29, 2015, Gleb Smirnoff wrote: > On Sun, Dec 27, 2015 at 02:42:39PM +0000, Konstantin Belousov wrote: > K> Author: kib > K> Date: Sun Dec 27 14:42:39 2015 > K> New Revision: 292772 > K> URL: https://svnweb.freebsd.org/changeset/base/292772 > K> > K> Log: > K> Add missed relpbuf() for a smallfs page-in. > K> > K> Reported by: Shawn Webb > K> Tested by: pho > K> Sponsored by: The FreeBSD Foundation > K> > K> Modified: > K> head/sys/vm/vnode_pager.c > K> > K> Modified: head/sys/vm/vnode_pager.c > K> > ============================================================================== > K> --- head/sys/vm/vnode_pager.c Sun Dec 27 14:39:47 2015 > (r292771) > K> +++ head/sys/vm/vnode_pager.c Sun Dec 27 14:42:39 2015 > (r292772) > K> @@ -806,6 +806,7 @@ vnode_pager_generic_getpages(struct vnod > K> * than a page size, then use special small filesystem code. > K> */ > K> if (pagesperblock == 0) { > K> + relpbuf(bp, freecnt); > K> for (i = 0; i < count; i++) { > K> PCPU_INC(cnt.v_vnodein); > K> PCPU_INC(cnt.v_vnodepgsin); > > The reason for this bug is that I tried to move the (pagesperblock == 0) > block above the call to getpbuf(). > > We actually know that filesystem is "small" at the very beginning of the > function and we can branch into "small filesystem" pager immediately. > > Later I moved the block back to its place, simply because new place > wasn't tested properly. And forgot to restore relpbuf. > > What filesystem did you use to show up the bug? I'm about to test the > variant with immediate branching. Shawn, would you be able to test > a patch if I produce one? > > Isofs, and just take the snapshot from Dec. 17. > -- > Totus tuus, Glebius. > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org > " > From owner-svn-src-head@freebsd.org Tue Dec 29 22:14: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 7CFA4A55C6A; Tue, 29 Dec 2015 22:14:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4A9A4174B; Tue, 29 Dec 2015 22:14:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTMEL5f001592; Tue, 29 Dec 2015 22:14:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTMELG1001590; Tue, 29 Dec 2015 22:14:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512292214.tBTMELG1001590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Dec 2015 22:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292890 - in head/sys/x86: include 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: Tue, 29 Dec 2015 22:14:22 -0000 Author: kib Date: Tue Dec 29 22:14:21 2015 New Revision: 292890 URL: https://svnweb.freebsd.org/changeset/base/292890 Log: Add standard extended feature bit 6 from the Intel SDM rev. 57, which indicates that data-pointer in the saved x87 FPU state is only updated on FPU exceptions. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Tue Dec 29 21:54:43 2015 (r292889) +++ head/sys/x86/include/specialreg.h Tue Dec 29 22:14:21 2015 (r292890) @@ -335,6 +335,7 @@ #define CPUID_STDEXT_BMI1 0x00000008 #define CPUID_STDEXT_HLE 0x00000010 #define CPUID_STDEXT_AVX2 0x00000020 +#define CPUID_STDEXT_FDP_EXC 0x00000040 #define CPUID_STDEXT_SMEP 0x00000080 #define CPUID_STDEXT_BMI2 0x00000100 #define CPUID_STDEXT_ERMS 0x00000200 Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Tue Dec 29 21:54:43 2015 (r292889) +++ head/sys/x86/x86/identcpu.c Tue Dec 29 22:14:21 2015 (r292890) @@ -932,6 +932,8 @@ printcpuinfo(void) "\005HLE" /* Advanced Vector Instructions 2 */ "\006AVX2" + /* FDP_EXCPTN_ONLY */ + "\007FDPEXC" /* Supervisor Mode Execution Prot. */ "\010SMEP" /* Bit Manipulation Instructions */ From owner-svn-src-head@freebsd.org Tue Dec 29 22:18: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 E7F5BA55DBA; Tue, 29 Dec 2015 22:18:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BA6BD1A68; Tue, 29 Dec 2015 22:18:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTMIZoD001896; Tue, 29 Dec 2015 22:18:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTMIZQj001895; Tue, 29 Dec 2015 22:18:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201512292218.tBTMIZQj001895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 29 Dec 2015 22:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292891 - head/sys/arm/arm 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, 29 Dec 2015 22:18:37 -0000 Author: ian Date: Tue Dec 29 22:18:35 2015 New Revision: 292891 URL: https://svnweb.freebsd.org/changeset/base/292891 Log: Bring some of the recent locore-v4.S improvements into locore-V6... - Map all 4GB as VA=PA so that args passed in from a bootloader can be accessed regardless of where they are. - Figure out the kernel load address by directly masking the PC rather then by doing pc-relative math on the _start symbol. - For EARLY_PRINTF support, map device memory as uncacheable (no-op for ARM_NEW_PMAP because all TEX types resolve to uncacheable). Modified: head/sys/arm/arm/locore-v6.S Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Tue Dec 29 22:14:21 2015 (r292890) +++ head/sys/arm/arm/locore-v6.S Tue Dec 29 22:18:35 2015 (r292891) @@ -153,46 +153,49 @@ ASENTRY_NP(_start) * Build page table from scratch. */ - /* Calculate the physical address of the startup pagetable. */ + /* + * Figure out the physical address we're loaded at by assuming this + * entry point code is in the first L1 section and so if we clear the + * offset bits of the pc that will give us the section-aligned load + * address, which remains in r5 throughout all the following code. + */ + ldr r2, =(L1_S_OFFSET) + bic r5, pc, r2 + + /* Find the delta between VA and PA, result stays in r0 throughout. */ adr r0, Lpagetable bl translate_va_to_pa - /* Clear boot page table */ - mov r1, r0 - mov r2, L1_TABLE_SIZE - mov r3,#0 -1: str r3, [r1], #4 - subs r2, #4 - bgt 1b - - /* - * Map PA == VA + /* + * First map the entire 4GB address space as VA=PA. It's mapped as + * normal (cached) memory because it's for things like accessing the + * parameters passed in from the bootloader, which might be at any + * physical address, different for every platform. */ - /* Find the start kernels load address */ - adr r5, _start - ldr r2, =(PTE1_OFFSET) - bic r5, r2 - mov r1, r5 - mov r2, r5 - /* Map 64MiB, preserved over calls to build_pagetables */ - mov r3, #64 + mov r1, #0 + mov r2, #0 + mov r3, #4096 bl build_pagetables - /* Create the kernel map to jump to */ + /* + * Next we do 64MiB starting at the physical load address, mapped to + * the VA the kernel is linked for. + */ mov r1, r5 ldr r2, =(KERNVIRTADDR) + mov r3, #64 bl build_pagetables + /* Create a device mapping for early_printf if specified. */ #if defined(SOCDEV_PA) && defined(SOCDEV_VA) - /* Create the custom map (1MB) used for early_printf(). */ ldr r1, =SOCDEV_PA ldr r2, =SOCDEV_VA mov r3, #1 - bl build_pagetables + bl build_device_pagetables #endif bl init_mmu - /* Switch to virtual addresses. */ + /* Transition the PC from physical to virtual addressing. */ ldr pc, =1f 1: @@ -394,6 +397,15 @@ END(reinit_mmu) * * Addresses must be 1MiB aligned */ +build_device_pagetables: +#if defined(ARM_NEW_PMAP) + ldr r4, =PTE1_V|PTE1_A|PTE1_AP_KRW|TEX1_CLASS_0 +#elif defined(SMP) + ldr r4, =(L1_TYPE_S|L1_S_AP(AP_KRW)|L1_SHARED) +#else + ldr r4, =(L1_TYPE_S|L1_S_AP(AP_KRW)) +#endif + b 1f build_pagetables: /* Set the required page attributed */ #if defined(ARM_NEW_PMAP) @@ -403,18 +415,19 @@ build_pagetables: #else ldr r4, =(L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) #endif +1: orr r1, r4 /* Move the virtual address to the correct bit location */ lsr r2, #(PTE1_SHIFT - 2) mov r4, r3 -1: +2: str r1, [r0, r2] add r2, r2, #4 add r1, r1, #(PTE1_SIZE) adds r4, r4, #-1 - bhi 1b + bhi 2b mov pc, lr From owner-svn-src-head@freebsd.org Tue Dec 29 22:51: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 B902FA539CC for ; Tue, 29 Dec 2015 22:51:37 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from erouter6.ore.mailhop.org (erouter6.ore.mailhop.org [54.187.213.119]) (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 9768D18E4 for ; Tue, 29 Dec 2015 22:51:37 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound3.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Tue, 29 Dec 2015 22:50:48 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBTMpTIj017140; Tue, 29 Dec 2015 15:51:29 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451429489.1369.35.camel@freebsd.org> Subject: Re: svn commit: r292809 - head/lib/libc/stdio From: Ian Lepore To: John Baldwin , Warner Losh Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh Date: Tue, 29 Dec 2015 15:51:29 -0700 In-Reply-To: <2345870.SHMMVrpc1D@ralph.baldwin.cx> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> <2345870.SHMMVrpc1D@ralph.baldwin.cx> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Tue, 29 Dec 2015 22:51:37 -0000 On Tue, 2015-12-29 at 11:37 -0800, John Baldwin wrote: > On Monday, December 28, 2015 01:01:26 PM Warner Losh wrote: > > I'll look at that, but I don't think posix_memalign is the right > > way to go. > > The alignment of FILE is more strict than posix_memalign will > > return. Ian's > > idea of __alignof__ is the way to go. We allocate them in one block > > on > > purpose for performance, and posix_memalign would be a one at a > > time affair. > > posix_memalign gives you whatever alignment you ask for. Using > __alignof__ > to determine the alignment instead of hardcoding sizeof(int64_t) > would > certainly be an improvement. If you move the glue after the FILE > objects > then you can use posix_memalign() directly as so: > > void *mem; > int error; > > error = posix_memalign(&mem, MAX(ALIGNBYTES, > __alignof__(mbstate_t)), > n * sizeof(FILE) + sizeof(*g)); > if (error) > return (NULL); > p = (FILE *)mem; > g = (struct glue *)(p + n); > g->next = NULL; > g->niobs = n; > g->iobs = p; > ... > > (This presumes that the requested alignment of 'struct glue' is less > than > the alignment needed by FILE which should be true.) > If there's going to be an assumption that __alignof__(glue) <= __alignof__(FILE), it might be nice to have a static_assert() of that to prevent a future time bomb similar to the one that exploded on arm when it turned out the opposite assumption was wrong. -- Ian From owner-svn-src-head@freebsd.org Tue Dec 29 23:16: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 CC132A5426C; Tue, 29 Dec 2015 23:16:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9A89B1291; Tue, 29 Dec 2015 23:16:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTNGKxA019664; Tue, 29 Dec 2015 23:16:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTNGKhM019663; Tue, 29 Dec 2015 23:16:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201512292316.tBTNGKhM019663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Dec 2015 23:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292892 - 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: Tue, 29 Dec 2015 23:16:21 -0000 Author: jhb Date: Tue Dec 29 23:16:20 2015 New Revision: 292892 URL: https://svnweb.freebsd.org/changeset/base/292892 Log: Call kern_thr_exit() instead of duplicating it. This code is missing the racct_subr() call from kern_thr_exit() and would require further code duplication in future changes. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Dec 29 22:18:35 2015 (r292891) +++ head/sys/kern/kern_thread.c Tue Dec 29 23:16:20 2015 (r292892) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -942,7 +943,6 @@ thread_suspend_check(int return_instead) */ if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { PROC_UNLOCK(p); - tidhash_remove(td); /* * Allow Linux emulation layer to do some work @@ -950,13 +950,8 @@ thread_suspend_check(int return_instead) */ if (__predict_false(p->p_sysent->sv_thread_detach != NULL)) (p->p_sysent->sv_thread_detach)(td); - - PROC_LOCK(p); - tdsigcleanup(td); - umtx_thread_exit(td); - PROC_SLOCK(p); - thread_stopped(p); - thread_exit(); + kern_thr_exit(td); + panic("stopped thread did not exit"); } PROC_SLOCK(p); From owner-svn-src-head@freebsd.org Tue Dec 29 23:22: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 07978A5461C; Tue, 29 Dec 2015 23:22:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCA6419C2; Tue, 29 Dec 2015 23:22:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0CA95B93E; Tue, 29 Dec 2015 18:22:51 -0500 (EST) From: John Baldwin To: Ian Lepore Cc: Warner Losh , src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh Subject: Re: svn commit: r292809 - head/lib/libc/stdio Date: Tue, 29 Dec 2015 15:22:32 -0800 Message-ID: <4400685.QN9T0cbN9C@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <1451429489.1369.35.camel@freebsd.org> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <2345870.SHMMVrpc1D@ralph.baldwin.cx> <1451429489.1369.35.camel@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 29 Dec 2015 18:22:51 -0500 (EST) 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, 29 Dec 2015 23:22:53 -0000 On Tuesday, December 29, 2015 03:51:29 PM Ian Lepore wrote: > On Tue, 2015-12-29 at 11:37 -0800, John Baldwin wrote: > > On Monday, December 28, 2015 01:01:26 PM Warner Losh wrote: > > > I'll look at that, but I don't think posix_memalign is the right > > > way to go. > > > The alignment of FILE is more strict than posix_memalign will > > > return. Ian's > > > idea of __alignof__ is the way to go. We allocate them in one block > > > on > > > purpose for performance, and posix_memalign would be a one at a > > > time affair. > > > > posix_memalign gives you whatever alignment you ask for. Using > > __alignof__ > > to determine the alignment instead of hardcoding sizeof(int64_t) > > would > > certainly be an improvement. If you move the glue after the FILE > > objects > > then you can use posix_memalign() directly as so: > > > > void *mem; > > int error; > > > > error = posix_memalign(&mem, MAX(ALIGNBYTES, > > __alignof__(mbstate_t)), > > n * sizeof(FILE) + sizeof(*g)); > > if (error) > > return (NULL); > > p = (FILE *)mem; > > g = (struct glue *)(p + n); > > g->next = NULL; > > g->niobs = n; > > g->iobs = p; > > ... > > > > (This presumes that the requested alignment of 'struct glue' is less > > than > > the alignment needed by FILE which should be true.) > > > > If there's going to be an assumption that __alignof__(glue) <= > __alignof__(FILE), it might be nice to have a static_assert() of that > to prevent a future time bomb similar to the one that exploded on arm > when it turned out the opposite assumption was wrong. A static assert seems sensible, yes. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Dec 29 23:25: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 D9A92A54749; Tue, 29 Dec 2015 23:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AD4991C47; Tue, 29 Dec 2015 23:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTNPQPi022788; Tue, 29 Dec 2015 23:25:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTNPQd5022781; Tue, 29 Dec 2015 23:25:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201512292325.tBTNPQd5022781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Dec 2015 23:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292894 - in head: sys/kern sys/sys 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: Tue, 29 Dec 2015 23:25:27 -0000 Author: jhb Date: Tue Dec 29 23:25:26 2015 New Revision: 292894 URL: https://svnweb.freebsd.org/changeset/base/292894 Log: Add ptrace(2) reporting for LWP events. Add two new LWPINFO flags: PL_FLAG_BORN and PL_FLAG_EXITED for reporting thread creation and destruction. Newly created threads will stop to report PL_FLAG_BORN before returning to userland and exiting threads will stop to report PL_FLAG_EXIT before exiting completely. Both of these events are only enabled and reported if PT_LWP_EVENTS is enabled on a process. Modified: head/sys/kern/kern_fork.c head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/sys_process.c head/sys/sys/proc.h head/sys/sys/ptrace.h head/tests/sys/kern/ptrace_test.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/kern/kern_fork.c Tue Dec 29 23:25:26 2015 (r292894) @@ -1066,7 +1066,7 @@ fork_return(struct thread *td, struct tr cv_broadcast(&p->p_dbgwait); } PROC_UNLOCK(p); - } else if (p->p_flag & P_TRACED) { + } else if (p->p_flag & P_TRACED || td->td_dbgflags & TDB_BORN) { /* * This is the start of a new thread in a traced * process. Report a system call exit event. @@ -1074,9 +1074,10 @@ fork_return(struct thread *td, struct tr PROC_LOCK(p); td->td_dbgflags |= TDB_SCX; _STOPEVENT(p, S_SCX, td->td_dbg_sc_code); - if ((p->p_stops & S_PT_SCX) != 0) + if ((p->p_stops & S_PT_SCX) != 0 || + (td->td_dbgflags & TDB_BORN) != 0) ptracestop(td, SIGTRAP); - td->td_dbgflags &= ~TDB_SCX; + td->td_dbgflags &= ~(TDB_SCX | TDB_BORN); PROC_UNLOCK(p); } Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/kern/kern_sig.c Tue Dec 29 23:25:26 2015 (r292894) @@ -2501,7 +2501,12 @@ ptracestop(struct thread *td, int sig) td->td_tid, p->p_pid, td->td_dbgflags, sig); PROC_SLOCK(p); while ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_XSIG)) { - if (p->p_flag & P_SINGLE_EXIT) { + if (p->p_flag & P_SINGLE_EXIT && + !(td->td_dbgflags & TDB_EXIT)) { + /* + * Ignore ptrace stops except for thread exit + * events when the process exits. + */ td->td_dbgflags &= ~TDB_XSIG; PROC_SUNLOCK(p); return (sig); Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/kern/kern_thr.c Tue Dec 29 23:25:26 2015 (r292894) @@ -253,6 +253,8 @@ thread_create(struct thread *td, struct thread_unlock(td); if (P_SHOULDSTOP(p)) newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; + if (p->p_flag2 & P2_LWP_EVENTS) + newtd->td_dbgflags |= TDB_BORN; /* * Copy the existing thread VM policy into the new thread. @@ -322,29 +324,54 @@ kern_thr_exit(struct thread *td) p = td->td_proc; - rw_wlock(&tidhash_lock); + /* + * If all of the threads in a process call this routine to + * exit (e.g. all threads call pthread_exit()), exactly one + * thread should return to the caller to terminate the process + * instead of the thread. + * + * Checking p_numthreads alone is not sufficient since threads + * might be committed to terminating while the PROC_LOCK is + * dropped in either ptracestop() or while removing this thread + * from the tidhash. Instead, the p_pendingexits field holds + * the count of threads in either of those states and a thread + * is considered the "last" thread if all of the other threads + * in a process are already terminating. + */ PROC_LOCK(p); - - if (p->p_numthreads != 1) { - racct_sub(p, RACCT_NTHR, 1); - LIST_REMOVE(td, td_hash); - rw_wunlock(&tidhash_lock); - tdsigcleanup(td); - umtx_thread_exit(td); - PROC_SLOCK(p); - thread_stopped(p); - thread_exit(); - /* NOTREACHED */ + if (p->p_numthreads == p->p_pendingexits + 1) { + /* + * Ignore attempts to shut down last thread in the + * proc. This will actually call _exit(2) in the + * usermode trampoline when it returns. + */ + PROC_UNLOCK(p); + return (0); } + p->p_pendingexits++; + td->td_dbgflags |= TDB_EXIT; + if (p->p_flag & P_TRACED && p->p_flag2 & P2_LWP_EVENTS) + ptracestop(td, SIGTRAP); + PROC_UNLOCK(p); + tidhash_remove(td); + PROC_LOCK(p); + p->p_pendingexits--; + /* - * Ignore attempts to shut down last thread in the proc. This - * will actually call _exit(2) in the usermode trampoline when - * it returns. + * The check above should prevent all other threads from this + * process from exiting while the PROC_LOCK is dropped, so + * there must be at least one other thread other than the + * current thread. */ - PROC_UNLOCK(p); - rw_wunlock(&tidhash_lock); - return (0); + KASSERT(p->p_numthreads > 1, ("too few threads")); + racct_sub(p, RACCT_NTHR, 1); + tdsigcleanup(td); + umtx_thread_exit(td); + PROC_SLOCK(p); + thread_stopped(p); + thread_exit(); + /* NOTREACHED */ } int Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/kern/sys_process.c Tue Dec 29 23:25:26 2015 (r292894) @@ -710,6 +710,7 @@ kern_ptrace(struct thread *td, int req, case PT_TO_SCX: case PT_SYSCALL: case PT_FOLLOW_FORK: + case PT_LWP_EVENTS: case PT_DETACH: sx_xlock(&proctree_lock); proctree_locked = 1; @@ -948,6 +949,16 @@ kern_ptrace(struct thread *td, int req, p->p_flag &= ~P_FOLLOWFORK; break; + case PT_LWP_EVENTS: + CTR3(KTR_PTRACE, "PT_LWP_EVENTS: pid %d %s -> %s", p->p_pid, + p->p_flag2 & P2_LWP_EVENTS ? "enabled" : "disabled", + data ? "enabled" : "disabled"); + if (data) + p->p_flag2 |= P2_LWP_EVENTS; + else + p->p_flag2 &= ~P2_LWP_EVENTS; + break; + case PT_STEP: case PT_CONTINUE: case PT_TO_SCE: @@ -1252,6 +1263,10 @@ kern_ptrace(struct thread *td, int req, } if (td2->td_dbgflags & TDB_CHILD) pl->pl_flags |= PL_FLAG_CHILD; + if (td2->td_dbgflags & TDB_BORN) + pl->pl_flags |= PL_FLAG_BORN; + if (td2->td_dbgflags & TDB_EXIT) + pl->pl_flags |= PL_FLAG_EXITED; pl->pl_sigmask = td2->td_sigmask; pl->pl_siglist = td2->td_siglist; strcpy(pl->pl_tdname, td2->td_name); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/sys/proc.h Tue Dec 29 23:25:26 2015 (r292894) @@ -412,6 +412,8 @@ do { \ #define TDB_STOPATFORK 0x00000080 /* Stop at the return from fork (child only) */ #define TDB_CHILD 0x00000100 /* New child indicator for ptrace() */ +#define TDB_BORN 0x00000200 /* New LWP indicator for ptrace() */ +#define TDB_EXIT 0x00000400 /* Exiting LWP indicator for ptrace() */ /* * "Private" flags kept in td_pflags: @@ -577,6 +579,7 @@ struct proc { struct itimers *p_itimers; /* (c) POSIX interval timers. */ struct procdesc *p_procdesc; /* (e) Process descriptor, if any. */ u_int p_treeflag; /* (e) P_TREE flags */ + int p_pendingexits; /* (c) Count of pending thread exits. */ /* End area that is zeroed on creation. */ #define p_endzero p_magic @@ -695,6 +698,7 @@ struct proc { #define P2_NOTRACE 0x00000002 /* No ptrace(2) attach or coredumps. */ #define P2_NOTRACE_EXEC 0x00000004 /* Keep P2_NOPTRACE on exec(2). */ #define P2_AST_SU 0x00000008 /* Handles SU ast for kthreads. */ +#define P2_LWP_EVENTS 0x00000010 /* Report LWP events via ptrace(2). */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ Modified: head/sys/sys/ptrace.h ============================================================================== --- head/sys/sys/ptrace.h Tue Dec 29 23:24:10 2015 (r292893) +++ head/sys/sys/ptrace.h Tue Dec 29 23:25:26 2015 (r292894) @@ -64,6 +64,7 @@ #define PT_SYSCALL 22 #define PT_FOLLOW_FORK 23 +#define PT_LWP_EVENTS 24 /* report LWP birth and exit */ #define PT_GETREGS 33 /* get general-purpose registers */ #define PT_SETREGS 34 /* set general-purpose registers */ @@ -108,6 +109,8 @@ struct ptrace_lwpinfo { #define PL_FLAG_SI 0x20 /* siginfo is valid */ #define PL_FLAG_FORKED 0x40 /* new child */ #define PL_FLAG_CHILD 0x80 /* I am from child */ +#define PL_FLAG_BORN 0x100 /* new LWP */ +#define PL_FLAG_EXITED 0x200 /* exiting LWP */ sigset_t pl_sigmask; /* LWP signal mask */ sigset_t pl_siglist; /* LWP pending signal */ struct __siginfo pl_siginfo; /* siginfo for signal */ Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Tue Dec 29 23:24:10 2015 (r292893) +++ head/tests/sys/kern/ptrace_test.c Tue Dec 29 23:25:26 2015 (r292894) @@ -1094,6 +1094,16 @@ simple_thread(void *arg __unused) pthread_exit(NULL); } +static __dead2 void +simple_thread_main(void) +{ + pthread_t thread; + + CHILD_REQUIRE(pthread_create(&thread, NULL, simple_thread, NULL) == 0); + CHILD_REQUIRE(pthread_join(thread, NULL) == 0); + exit(1); +} + /* * Verify that pl_syscall_code in struct ptrace_lwpinfo for a new * thread reports the correct value. @@ -1108,14 +1118,8 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { - pthread_t thread; - trace_me(); - - CHILD_REQUIRE(pthread_create(&thread, NULL, simple_thread, - NULL) == 0); - CHILD_REQUIRE(pthread_join(thread, NULL) == 0); - exit(1); + simple_thread_main(); } /* The first wait() should report the stop from SIGSTOP. */ @@ -1178,6 +1182,179 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that the expected LWP events are reported for a child thread. + */ +ATF_TC_WITHOUT_HEAD(ptrace__lwp_events); +ATF_TC_BODY(ptrace__lwp_events, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + simple_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + lwps[0] = pl.pl_lwpid; + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The first event should be for the child thread's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next event should be for the child thread's death. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)) == + (PL_FLAG_EXITED | PL_FLAG_SCE)); + ATF_REQUIRE(pl.pl_lwpid == lwps[1]); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +static void * +exec_thread(void *arg __unused) +{ + + execl("/usr/bin/true", "true", NULL); + exit(127); +} + +static __dead2 void +exec_thread_main(void) +{ + pthread_t thread; + + CHILD_REQUIRE(pthread_create(&thread, NULL, exec_thread, NULL) == 0); + for (;;) + sleep(60); + exit(1); +} + +/* + * Verify that the expected LWP events are reported for a multithreaded + * process that calls execve(2). + */ +ATF_TC_WITHOUT_HEAD(ptrace__lwp_events_exec); +ATF_TC_BODY(ptrace__lwp_events_exec, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exec_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + lwps[0] = pl.pl_lwpid; + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The first event should be for the child thread's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* + * The next event should be for the main thread's death due to + * single threading from execve(). + */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)) == + (PL_FLAG_EXITED)); + ATF_REQUIRE(pl.pl_lwpid == lwps[0]); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next event should be for the child process's exec. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)) == + (PL_FLAG_EXEC | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid == lwps[1]); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -1197,6 +1374,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__new_child_pl_syscall_code_fork); ATF_TP_ADD_TC(tp, ptrace__new_child_pl_syscall_code_vfork); ATF_TP_ADD_TC(tp, ptrace__new_child_pl_syscall_code_thread); + ATF_TP_ADD_TC(tp, ptrace__lwp_events); + ATF_TP_ADD_TC(tp, ptrace__lwp_events_exec); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Tue Dec 29 23:28: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 00D27A54824; Tue, 29 Dec 2015 23:28:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D79761DFF; Tue, 29 Dec 2015 23:28:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E86CEB93E; Tue, 29 Dec 2015 18:28:47 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292894 - in head: sys/kern sys/sys tests/sys/kern Date: Tue, 29 Dec 2015 15:28:44 -0800 Message-ID: <1596028.4ekdSm0miH@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201512292325.tBTNPQd5022781@repo.freebsd.org> References: <201512292325.tBTNPQd5022781@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 29 Dec 2015 18:28:48 -0500 (EST) 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, 29 Dec 2015 23:28:49 -0000 On Tuesday, December 29, 2015 11:25:26 PM John Baldwin wrote: > Author: jhb > Date: Tue Dec 29 23:25:26 2015 > New Revision: 292894 > URL: https://svnweb.freebsd.org/changeset/base/292894 > > Log: > Add ptrace(2) reporting for LWP events. > > Add two new LWPINFO flags: PL_FLAG_BORN and PL_FLAG_EXITED for reporting > thread creation and destruction. Newly created threads will stop to report > PL_FLAG_BORN before returning to userland and exiting threads will stop to > report PL_FLAG_EXIT before exiting completely. Both of these events are > only enabled and reported if PT_LWP_EVENTS is enabled on a process. Bah, should have included: Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D4703 I also noticed right after committing that this is missing the manpage updates. Those will come shortly. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Dec 29 23:32: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 A4F1EA54A26 for ; Tue, 29 Dec 2015 23:32:01 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::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 5C60E1074 for ; Tue, 29 Dec 2015 23:32:01 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qg0-x22f.google.com with SMTP id o11so174814992qge.2 for ; Tue, 29 Dec 2015 15:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=+CioRSG98vrrXNB/A4RUnhyspPEIlj6aO9Kr7jVtkfs=; b=0Jpb7hXaZ/oNFk4fynHhJnSp3aGaPF2CPS4WH/Nbt92xzAfqaKQU/7mryeTL7yXQ20 9bFU37XT1loIztADVihzyFlrk16TbLatKaVXJmBm6Bo+EGjRfuXryeA4rCo4bdPLL6Zc 5mn3SGeLSVgJsmKh1huOsAcpGZPBPVcps85WbIsLXJ/sC5MQbj8cGZ/N/LBOSqdMLPOb /v7P18xpI6wqzqiAHGr6Ul+FCNjQvti9oWsgYkZDiLQYoX/2fDAB46rDFIoLmb3Dzkxe cZw+CbZai6jvGXvarF8sf54UyOsC1JdMS1b0gXGfPb+FKEHriJxeWb79F5GynPHuCbeU aUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=+CioRSG98vrrXNB/A4RUnhyspPEIlj6aO9Kr7jVtkfs=; b=JH5Ykuf2P6PLfIYki7MRnwmkmWafu2KTTn8PUjcRARoeeYOeYKkXVvuu+tAmeamMS8 fQLS+6Yh9J0j7jdMa+VLe9RaniazwIICoHrgMDUqeINhh7TyDyQg07RXjtlycsDCItth HiiRu19jxSXxWUecnPIIF+XW83H0vVTaUU/vQXw5Z1eftSoz7zi/hHtLADd5OdJvwq/3 7vKY5OSHLwtsXRhynyKenGUIgJhJuf5trJb18rhYX7vH7KFy8PjlnlzGwTR9EkPYQWUF +DTO83vZaBJapln16KPwZUir6tKGphoPyrW883BE/x2qK2q+e//XAtg2DpiAGGy6EZl7 AQEQ== X-Gm-Message-State: ALoCoQmBUARHxij148gEi+sP2ugAoKSximHnIVeFwNRFFFP5xqyRe35KzOr5qmt717p93czCHVzdni9alkjUhdrz2KCT69Hf9Q== X-Received: by 10.140.165.16 with SMTP id l16mr86704008qhl.101.1451431920430; Tue, 29 Dec 2015 15:32:00 -0800 (PST) Received: from mutt-hardenedbsd (c-73-135-80-144.hsd1.md.comcast.net. [73.135.80.144]) by smtp.gmail.com with ESMTPSA id f7sm29873746qhf.7.2015.12.29.15.31.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2015 15:31:58 -0800 (PST) Date: Tue, 29 Dec 2015 18:31:56 -0500 From: Shawn Webb To: Gleb Smirnoff Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292772 - head/sys/vm Message-ID: <20151229233156.GA4032@mutt-hardenedbsd> References: <201512271442.tBREgdRr079655@repo.freebsd.org> <20151229205952.GV7277@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: <20151229205952.GV7277@FreeBSD.org> X-Operating-System: FreeBSD mutt-hardenedbsd 11.0-CURRENT-HBSD FreeBSD 11.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.5.24 (2015-08-30) 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, 29 Dec 2015 23:32:01 -0000 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 29, 2015 at 11:59:52PM +0300, Gleb Smirnoff wrote: > On Sun, Dec 27, 2015 at 02:42:39PM +0000, Konstantin Belousov wrote: > K> Author: kib > K> Date: Sun Dec 27 14:42:39 2015 > K> New Revision: 292772 > K> URL: https://svnweb.freebsd.org/changeset/base/292772 > K>=20 > K> Log: > K> Add missed relpbuf() for a smallfs page-in. > K> =20 > K> Reported by: Shawn Webb > K> Tested by: pho > K> Sponsored by: The FreeBSD Foundation > K>=20 > K> Modified: > K> head/sys/vm/vnode_pager.c > K>=20 > K> Modified: head/sys/vm/vnode_pager.c > K> =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=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > K> --- head/sys/vm/vnode_pager.c Sun Dec 27 14:39:47 2015 (r292771) > K> +++ head/sys/vm/vnode_pager.c Sun Dec 27 14:42:39 2015 (r292772) > K> @@ -806,6 +806,7 @@ vnode_pager_generic_getpages(struct vnod > K> * than a page size, then use special small filesystem code. > K> */ > K> if (pagesperblock =3D=3D 0) { > K> + relpbuf(bp, freecnt); > K> for (i =3D 0; i < count; i++) { > K> PCPU_INC(cnt.v_vnodein); > K> PCPU_INC(cnt.v_vnodepgsin); >=20 > The reason for this bug is that I tried to move the (pagesperblock =3D=3D= 0) > block above the call to getpbuf(). >=20 > We actually know that filesystem is "small" at the very beginning of the > function and we can branch into "small filesystem" pager immediately. >=20 > Later I moved the block back to its place, simply because new place > wasn't tested properly. And forgot to restore relpbuf. >=20 > What filesystem did you use to show up the bug? I'm about to test the > variant with immediate branching. Shawn, would you be able to test > a patch if I produce one? Definitely. Send me a patch and I can spin up an ISO with it and boot it up in bhyve. Thanks, --=20 Shawn Webb HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWgxfqAAoJEGqEZY9SRW7uutAQAJmqARHqy6hjngzgxktCyGv4 nkZBcGj6UEZKUre3b4jH1Kq7AeD/Ymog+8NUQG5Dusy9JyoEI+ykSLVcZFy5Io6B NflOLVzefbEaJz/dkaWasDgfZHSpFzsAaGgjb1BdRNnD1AVZSQCGHw8uuMPVYhWV /IH/VIxz4eOcrsEDr+rkU5bKkmPmQpPQ9aLPWhxGZ0NNm9pBYhbY6LS/cDrJnP1T fp33rtI1PWB4+ZDuiiiNE44A7mzffUpSm9WH54B2y3BqkfUoD1qducTwMn8lsKbJ NJQWYG/o0DeLVtra/LT/5+OY2mTP+b3vmX1lT/E2wFKHHUjWzMJRHP8E7uQQQ3BB iLJGaO8QGAqjTmHunaGFC9N9qw0/0nXWLhcRq7+4bWkpm9zxQy3YCE8mt2gqFgaW yxqi24658dLejS/WiLhKoPZp9tFwt54EXUxcLZZYge25ckBzAwziJxoKDWKS3PzJ 4ZtzLWlSAT35ff3OmdiTPfoFL7Sxrv9SO6Zgv2MNj1RylwMkvTD/6ewFBQObDGCB q/DIqwmNBB/9lbnTgbO6YusfoZHijhw1qhHijefwSfqeMEZ9BQSh0AIyUHHQ4Mpp MMiFE3uvlZCRjg9u2Er7r8Fw4rTdx31wBS9kBv/CbgCYNqIfpY+WotemlFHEBiEi uEsL8t3BpNU3+fV99aMK =6R4R -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- From owner-svn-src-head@freebsd.org Wed Dec 30 00:04: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 4FD47A5578A; Wed, 30 Dec 2015 00:04:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 092CC10A4; Wed, 30 Dec 2015 00:04:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU04woG037479; Wed, 30 Dec 2015 00:04:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU04wb8037478; Wed, 30 Dec 2015 00:04:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201512300004.tBU04wb8037478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Dec 2015 00:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292896 - head/lib/libc/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: Wed, 30 Dec 2015 00:04:59 -0000 Author: jhb Date: Wed Dec 30 00:04:57 2015 New Revision: 292896 URL: https://svnweb.freebsd.org/changeset/base/292896 Log: Document the recently added support for ptrace(2) LWP events. Modified: head/lib/libc/sys/ptrace.2 Modified: head/lib/libc/sys/ptrace.2 ============================================================================== --- head/lib/libc/sys/ptrace.2 Wed Dec 30 00:04:33 2015 (r292895) +++ head/lib/libc/sys/ptrace.2 Wed Dec 30 00:04:57 2015 (r292896) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd October 20, 2015 +.Dd December 29, 2015 .Dt PTRACE 2 .Os .Sh NAME @@ -372,6 +372,20 @@ The flag is set for first event reported automatically attached due to .Dv PT_FOLLOW_FORK enabled. +.It PL_FLAG_BORN +This flag is set for the first event reported from a new LWP when LWP +events are enabled via +.Dv PT_LWP_EVENTS . +It is reported along with +.Dv PL_FLAG_SCX +and is always reported if LWP events are enabled. +.It PL_FLAG_EXITED +This flag is set for the last event reported by an exiting LWP when +LWP events are enabled via +.Dv PT_LWP_EVENTS . +Note that this event is not reported when the last LWP in a process exits. +The termination of the last thread is reported via a normal process exit +event. .El .It pl_sigmask The current signal mask of the LWP @@ -463,6 +477,29 @@ Child processes do not inherit this prop The traced process will set the .Dv PL_FLAG_FORKED flag upon exit from a system call that creates a new process. +.It PT_LWP_EVENTS +This request controls tracing of LWP creation and destruction. +If +.Fa data +is non-zero, +then LWPs will stop to report creation and destruction events. +If +.Fa data +is zero, +then LWP creation and destruction events will not be reported. +By default, tracing is not enabled for LWP events. +Child processes do not inherit this property. +New LWPs will stop to report an event with +.Dv PL_FLAG_BORN +set before executing their first instruction. +Exiting LWPs will stop to report an event with +.Dv PL_FLAG_EXITED +set before completing their termination. +.Pp +Note that new processes do not report an event for the creation of their +initial thread, +and exiting processes do not report an event for the termination of the +last thread. .It PT_VM_TIMESTAMP This request returns the generation number or timestamp of the memory map of the traced process as the return value from From owner-svn-src-head@freebsd.org Wed Dec 30 00:08: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 B3978A55851; Wed, 30 Dec 2015 00:08:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7B04912AA; Wed, 30 Dec 2015 00:08:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 159E73C7721; Wed, 30 Dec 2015 10:48:16 +1100 (AEDT) Date: Wed, 30 Dec 2015 10:48:15 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: Warner Losh , src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh Subject: Re: svn commit: r292809 - head/lib/libc/stdio In-Reply-To: <2345870.SHMMVrpc1D@ralph.baldwin.cx> Message-ID: <20151230102454.P1079@besplex.bde.org> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> <2345870.SHMMVrpc1D@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=QuU-y7UVB-eSIWs7EHUA:9 a=CjuIK1q_8ugA:10 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, 30 Dec 2015 00:08:27 -0000 On Tue, 29 Dec 2015, John Baldwin wrote: > On Monday, December 28, 2015 01:01:26 PM Warner Losh wrote: >> I'll look at that, but I don't think posix_memalign is the right way to go. >> The alignment of FILE is more strict than posix_memalign will return. Ian's >> idea of __alignof__ is the way to go. We allocate them in one block on >> purpose for performance, and posix_memalign would be a one at a time affair. > > posix_memalign gives you whatever alignment you ask for. Using __alignof__ > to determine the alignment instead of hardcoding sizeof(int64_t) would > certainly be an improvement. If you move the glue after the FILE objects > then you can use posix_memalign() directly as so: > > void *mem; > int error; > > error = posix_memalign(&mem, MAX(ALIGNBYTES, __alignof__(mbstate_t)), > n * sizeof(FILE) + sizeof(*g)); Using __alignof__() involves 2 or 3 layers of style bugs: - it is a gnu-ish spelling (full gnu would also have a space before the left parentheses). The FreeBSD spelling is __alignof(). FreeBSD defines a macro for this, but only for compatiblity with gcc < 2.95. Later versions apparently support both __alignof and __alignof__() - C++ apparently spells this as both _Alignof() and alignof() after 2011/03 - FreeBSD defines _Alignof() unconditionally. The only difference for C++ after 2011/03 is it is less careful about namespaces and depends on alignof() existing and being part of the language. The general definition using __alignof() should work in this case too. So it seems that the correct spelling is _Alignof(). _Alignof(), __alignof() and __alignof__() are all in the implementation namespace except possibly _Alignof() for C++ after 2011/03, so any use of them gives undefined behaviour which might be to do the right thing. But no one knows what that is or when it is done since none of this is documented in a man page. sys/cdefs.h is now about 8.5 times as large and more than that many times as complicated and ugly as an FreeBSD-1 where it only had __P(()) and a few other portability macros to hide the differences between K&R and C90. It should be 8.5 times smaller (11 lines). It contains a mixture of old and new portability macros and perhaps some standard macros for newer C++ and C. I checked that it doesn't define anything without at least 1 leading underscore except for const, inline, signed and volatile in old compatibility modes. Bruce From owner-svn-src-head@freebsd.org Wed Dec 30 00:17: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 5291FA55BFA; Wed, 30 Dec 2015 00:17:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 22C4F184A; Wed, 30 Dec 2015 00:17:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU0HbnQ041601; Wed, 30 Dec 2015 00:17:37 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU0Hb6T041600; Wed, 30 Dec 2015 00:17:37 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512300017.tBU0Hb6T041600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 30 Dec 2015 00:17:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292897 - head/sys/sparc64/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, 30 Dec 2015 00:17:38 -0000 Author: marius Date: Wed Dec 30 00:17:37 2015 New Revision: 292897 URL: https://svnweb.freebsd.org/changeset/base/292897 Log: Adapt CATR() to r283283. Modified: head/sys/sparc64/include/ktr.h Modified: head/sys/sparc64/include/ktr.h ============================================================================== --- head/sys/sparc64/include/ktr.h Wed Dec 30 00:04:57 2015 (r292896) +++ head/sys/sparc64/include/ktr.h Wed Dec 30 00:17:37 2015 (r292897) @@ -74,9 +74,9 @@ l2: add r2, 1, r3 ; \ * NB: this clobbers %y. */ #define CATR(mask, desc, r1, r2, r3, l1, l2, l3) \ - set mask, r1 ; \ - SET(ktr_mask, r3, r2) ; \ - lduw [r2], r2 ; \ + setx mask, r3, r1 ; \ + setx ktr_mask, r3, r2 ; \ + ldx [r2], r2 ; \ and r2, r1, r1 ; \ brz r1, l3 ## f ; \ nop ; \ From owner-svn-src-head@freebsd.org Wed Dec 30 02:15: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 E2FC2A54379; Wed, 30 Dec 2015 02:15:13 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9E9F51624; Wed, 30 Dec 2015 02:15:13 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU2FCSt076921; Wed, 30 Dec 2015 02:15:12 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU2FCAB076920; Wed, 30 Dec 2015 02:15:12 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512300215.tBU2FCAB076920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Wed, 30 Dec 2015 02:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292899 - head/sys/boot/forth 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, 30 Dec 2015 02:15:14 -0000 Author: dteske Date: Wed Dec 30 02:15:12 2015 New Revision: 292899 URL: https://svnweb.freebsd.org/changeset/base/292899 Log: Fix stack leak introduced by SVN r97201 (nextboot_conf support). Fix erroneous error path in error messages when processing boot_conf. Fixup stack comments for functions introduced by SVN r97201. Remove a questioning stack comment introduced by SVN r186789. NB: Comment removed because strdup usage here is correct/not a leak. MFC after: 1 week Modified: head/sys/boot/forth/support.4th Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Wed Dec 30 01:02:22 2015 (r292898) +++ head/sys/boot/forth/support.4th Wed Dec 30 02:15:12 2015 (r292899) @@ -833,7 +833,7 @@ get-current ( -- wid ) previous definiti repeat ; -: peek_file +: peek_file ( addr len -- ) 0 to end_of_file? reset_line_reading O_RDONLY fopen fd ! @@ -844,6 +844,7 @@ get-current ( -- wid ) previous definiti ['] process_assignment catch ['] free_buffers catch fd @ fclose + swap throw throw ; only forth also support-functions definitions @@ -1021,25 +1022,26 @@ string current_file_name_ref \ used to p ; : get_nextboot_conf_file ( -- addr len ) - nextboot_conf_file strget strdup \ XXX is the strdup a leak ? + nextboot_conf_file strget strdup ; : rewrite_nextboot_file ( -- ) get_nextboot_conf_file O_WRONLY fopen fd ! fd @ -1 = if EOPEN throw then - fd @ s' nextboot_enable="NO" ' fwrite + fd @ s' nextboot_enable="NO" ' fwrite ( fd buf len -- nwritten ) drop fd @ fclose ; -: include_nextboot_file +: include_nextboot_file ( -- ) get_nextboot_conf_file - ['] peek_file catch + ['] peek_file catch if 2drop then nextboot? if get_nextboot_conf_file + current_file_name_ref strref ['] load_conf catch process_conf_errors - ['] rewrite_nextboot_file catch + ['] rewrite_nextboot_file catch if 2drop then then ; From owner-svn-src-head@freebsd.org Wed Dec 30 02:23: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 7C5E5A5468D; Wed, 30 Dec 2015 02:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3FE811B05; Wed, 30 Dec 2015 02:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU2NE1P079676; Wed, 30 Dec 2015 02:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU2NEGk079674; Wed, 30 Dec 2015 02:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201512300223.tBU2NEGk079674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 Dec 2015 02:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292900 - head/sys/powerpc/booke 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, 30 Dec 2015 02:23:15 -0000 Author: jhibbits Date: Wed Dec 30 02:23:14 2015 New Revision: 292900 URL: https://svnweb.freebsd.org/changeset/base/292900 Log: Rewrite tid_flush() in C. There's no need for it to be in asm. Also, by writing in C, and marking it static in pmap.c, it saves a branch to the function itself, as it's only used in one location. The generated asm is virtually identical to the handwritten code. Modified: head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Wed Dec 30 02:15:12 2015 (r292899) +++ head/sys/powerpc/booke/locore.S Wed Dec 30 02:23:14 2015 (r292900) @@ -658,77 +658,6 @@ __boot_page_padding: /************************************************************************/ /* - * void tid_flush(tlbtid_t tid); - * - * Invalidate all TLB0 entries which match the given TID. Note this is - * dedicated for cases when invalidation(s) should NOT be propagated to other - * CPUs. - * - * void tid_flush(tlbtid_t tid, int tlb0_ways, int tlb0_entries_per_way); - * - * XXX: why isn't this in C? - */ -ENTRY(tid_flush) - cmpwi %r3, TID_KERNEL - beq tid_flush_end /* don't evict kernel translations */ - - /* Disable interrupts */ - mfmsr %r10 - wrteei 0 - - li %r6, 0 /* ways counter */ -loop_ways: - li %r7, 0 /* entries [per way] counter */ -loop_entries: - /* Select TLB0 and ESEL (way) */ - lis %r8, MAS0_TLBSEL0@h - rlwimi %r8, %r6, 16, 14, 15 - mtspr SPR_MAS0, %r8 - isync - - /* Select EPN (entry within the way) */ - rlwinm %r8, %r7, 12, 13, 19 - mtspr SPR_MAS2, %r8 - isync - tlbre - - /* Check if valid entry */ - mfspr %r8, SPR_MAS1 - andis. %r9, %r8, MAS1_VALID@h - beq next_entry /* invalid entry */ - - /* Check if this is our TID */ - rlwinm %r9, %r8, 16, 24, 31 - - cmplw %r9, %r3 - bne next_entry /* not our TID */ - - /* Clear VALID bit */ - rlwinm %r8, %r8, 0, 1, 31 - mtspr SPR_MAS1, %r8 - isync - tlbwe - isync - msync - -next_entry: - addi %r7, %r7, 1 - cmpw %r7, %r5 - bne loop_entries - - /* Next way */ - addi %r6, %r6, 1 - cmpw %r6, %r4 - bne loop_ways - - /* Restore MSR (possibly re-enable interrupts) */ - mtmsr %r10 - isync - -tid_flush_end: - blr - -/* * Cache disable/enable/inval sequences according * to section 2.16 of E500CORE RM. */ Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Dec 30 02:15:12 2015 (r292899) +++ head/sys/powerpc/booke/pmap.c Wed Dec 30 02:23:14 2015 (r292900) @@ -161,7 +161,6 @@ unsigned int kernel_ptbls; /* Number of #define PMAP_REMOVE_DONE(pmap) \ ((pmap) != kernel_pmap && (pmap)->pm_stats.resident_count == 0) -extern void tid_flush(tlbtid_t tid, int tlb0_ways, int tlb0_entries_per_way); extern int elf32_nxstack; /**************************************************************************/ @@ -195,6 +194,7 @@ static unsigned int tlb1_idx; static vm_offset_t tlb1_map_base = VM_MAX_KERNEL_ADDRESS; static tlbtid_t tid_alloc(struct pmap *); +static void tid_flush(tlbtid_t tid); static void tlb_print_entry(int, uint32_t, uint32_t, uint32_t, uint32_t); @@ -2915,7 +2915,7 @@ tid_alloc(pmap_t pmap) tidbusy[thiscpu][tid]->pm_tid[thiscpu] = TID_NONE; /* Flush all entries from TLB0 matching this TID. */ - tid_flush(tid, tlb0_ways, tlb0_entries_per_way); + tid_flush(tid); } tidbusy[thiscpu][tid] = pmap; @@ -3426,3 +3426,48 @@ tlb1_iomapped(int i, vm_paddr_t pa, vm_s *va = (tlb1[i].mas2 & MAS2_EPN_MASK) + (pa - pa_start); return (0); } + +/* + * Invalidate all TLB0 entries which match the given TID. Note this is + * dedicated for cases when invalidations should NOT be propagated to other + * CPUs. + */ +static void +tid_flush(tlbtid_t tid) +{ + register_t msr; + uint32_t mas0, mas1, mas2; + int entry, way; + + + /* Don't evict kernel translations */ + if (tid == TID_KERNEL) + return; + + msr = mfmsr(); + __asm __volatile("wrteei 0"); + + for (way = 0; way < TLB0_WAYS; way++) + for (entry = 0; entry < TLB0_ENTRIES_PER_WAY; entry++) { + + mas0 = MAS0_TLBSEL(0) | MAS0_ESEL(way); + mtspr(SPR_MAS0, mas0); + __asm __volatile("isync"); + + mas2 = entry << MAS2_TLB0_ENTRY_IDX_SHIFT; + mtspr(SPR_MAS2, mas2); + + __asm __volatile("isync; tlbre"); + + mas1 = mfspr(SPR_MAS1); + + if (!(mas1 & MAS1_VALID)) + continue; + if (((mas1 & MAS1_TID_MASK) >> MAS1_TID_SHIFT) != tid) + continue; + mas1 &= ~MAS1_VALID; + mtspr(SPR_MAS1, mas1); + __asm __volatile("isync; tlbwe; isync; msync"); + } + mtmsr(msr); +} From owner-svn-src-head@freebsd.org Wed Dec 30 02:26: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 8A90AA547F9; Wed, 30 Dec 2015 02:26:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5CB491D0D; Wed, 30 Dec 2015 02:26:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU2Q48k079805; Wed, 30 Dec 2015 02:26:04 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU2Q473079804; Wed, 30 Dec 2015 02:26:04 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201512300226.tBU2Q473079804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 Dec 2015 02:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292901 - head/sys/powerpc/booke 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, 30 Dec 2015 02:26:05 -0000 Author: jhibbits Date: Wed Dec 30 02:26:04 2015 New Revision: 292901 URL: https://svnweb.freebsd.org/changeset/base/292901 Log: Optimize zero_page for book-e mmu. Instead of indirectly calling bzero() through mmu_booke_zero_page_area, zero the full page the same way as the AIM pmap logic does: using dcbz. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Dec 30 02:23:14 2015 (r292900) +++ head/sys/powerpc/booke/pmap.c Wed Dec 30 02:26:04 2015 (r292901) @@ -2235,8 +2235,17 @@ mmu_booke_zero_page_area(mmu_t mmu, vm_p static void mmu_booke_zero_page(mmu_t mmu, vm_page_t m) { + vm_offset_t off, va; - mmu_booke_zero_page_area(mmu, m, 0, PAGE_SIZE); + mtx_lock(&zero_page_mutex); + va = zero_page_va; + + mmu_booke_kenter(mmu, va, VM_PAGE_TO_PHYS(m)); + for (off = 0; off < PAGE_SIZE; off += cacheline_size) + __asm __volatile("dcbzl 0,%0" :: "r"(va + off)); + mmu_booke_kremove(mmu, va); + + mtx_unlock(&zero_page_mutex); } /* From owner-svn-src-head@freebsd.org Wed Dec 30 03:36: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 B8EA4A55B14; Wed, 30 Dec 2015 03:36:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7B4EE173F; Wed, 30 Dec 2015 03:36:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU3aMZN000640; Wed, 30 Dec 2015 03:36:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU3aMQT000639; Wed, 30 Dec 2015 03:36:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201512300336.tBU3aMQT000639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 Dec 2015 03:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292902 - head/lib/libc/stdio 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, 30 Dec 2015 03:36:23 -0000 Author: imp Date: Wed Dec 30 03:36:22 2015 New Revision: 292902 URL: https://svnweb.freebsd.org/changeset/base/292902 Log: Use __alignof__ instead of assuming int64_t to get the right alignment. Differential Revision: https://reviews.freebsd.org/D4708 Modified: head/lib/libc/stdio/findfp.c Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Wed Dec 30 02:26:04 2015 (r292901) +++ head/lib/libc/stdio/findfp.c Wed Dec 30 03:36:22 2015 (r292902) @@ -99,16 +99,7 @@ moreglue(int n) FILE *p; size_t align; - /* - * FILE has a mbstate_t variable. This variable tries to be int64_t - * aligned through its definition. int64_t may be larger than void *, - * which is the size traditionally used for ALIGNBYTES. So, use our own - * rounding instead of the MI ALIGN macros. If for some reason - * ALIGNBYTES is larger than int64_t, respect that too. There appears to - * be no portable way to ask for FILE's alignment requirements other - * than just knowing here. - */ - align = MAX(ALIGNBYTES, sizeof(int64_t)); + align = __alignof__(FILE); g = (struct glue *)malloc(sizeof(*g) + align + n * sizeof(FILE)); if (g == NULL) return (NULL); From owner-svn-src-head@freebsd.org Wed Dec 30 03:43: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 C0742A55DB5; Wed, 30 Dec 2015 03:43:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 82DF11BBE; Wed, 30 Dec 2015 03:43:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU3hQVi003548; Wed, 30 Dec 2015 03:43:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU3hQEt003542; Wed, 30 Dec 2015 03:43:26 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201512300343.tBU3hQEt003542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 Dec 2015 03:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292903 - in head/sys/powerpc: booke mpc85xx 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, 30 Dec 2015 03:43:27 -0000 Author: jhibbits Date: Wed Dec 30 03:43:25 2015 New Revision: 292903 URL: https://svnweb.freebsd.org/changeset/base/292903 Log: Add platform support for QorIQ SoCs. This includes the following changes: * SMP kickoff for QorIQ (tested on P5020) * Errata fixes for some silicon revisions * Enables L2 (and L3 if available) caches Obtained from: Semihalf Sponsored by: Alex Perez/Inertial Computing Modified: head/sys/powerpc/booke/booke_machdep.c head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/machdep_e500.c head/sys/powerpc/mpc85xx/mpc85xx.c head/sys/powerpc/mpc85xx/mpc85xx.h head/sys/powerpc/mpc85xx/platform_mpc85xx.c Modified: head/sys/powerpc/booke/booke_machdep.c ============================================================================== --- head/sys/powerpc/booke/booke_machdep.c Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/booke/booke_machdep.c Wed Dec 30 03:43:25 2015 (r292903) @@ -316,8 +316,20 @@ booke_init(uint32_t arg1, uint32_t arg2) ret = powerpc_init(dtbp, 0, 0, mdp); - /* Enable L1 caches */ + /* Default to 32 byte cache line size. */ + switch ((mfpvr()) >> 16) { + case FSL_E500mc: + case FSL_E5500: + case FSL_E6500: + cacheline_size = 64; + break; + } + + /* Enable caches */ booke_enable_l1_cache(); + booke_enable_l2_cache(); + + booke_enable_bpred(); return (ret); } Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/booke/locore.S Wed Dec 30 03:43:25 2015 (r292903) @@ -301,7 +301,7 @@ bp_ntlb1s: .globl bp_tlb1 bp_tlb1: - .space 4 * 3 * 16 + .space 4 * 3 * 64 .globl bp_tlb1_end bp_tlb1_end: @@ -731,6 +731,113 @@ ENTRY(icache_enable) blr /* + * L2 cache disable/enable/inval sequences for E500mc. + */ + +ENTRY(l2cache_inval) + mfspr %r3, SPR_L2CSR0 + oris %r3, %r3, (L2CSR0_L2FI | L2CSR0_L2LFC)@h + ori %r3, %r3, (L2CSR0_L2FI | L2CSR0_L2LFC)@l + isync + mtspr SPR_L2CSR0, %r3 + isync +1: mfspr %r3, SPR_L2CSR0 + andis. %r3, %r3, L2CSR0_L2FI@h + bne 1b + blr + +ENTRY(l2cache_enable) + mfspr %r3, SPR_L2CSR0 + oris %r3, %r3, (L2CSR0_L2E | L2CSR0_L2PE)@h + isync + mtspr SPR_L2CSR0, %r3 + isync + blr + +/* + * Branch predictor setup. + */ +ENTRY(bpred_enable) + mfspr %r3, SPR_BUCSR + ori %r3, %r3, BUCSR_BBFI + isync + mtspr SPR_BUCSR, %r3 + isync + ori %r3, %r3, BUCSR_BPEN + isync + mtspr SPR_BUCSR, %r3 + isync + blr + +ENTRY(dataloss_erratum_access) + /* Lock two cache lines into I-Cache */ + sync + mfspr %r11, SPR_L1CSR1 + rlwinm %r11, %r11, 0, ~L1CSR1_ICUL + sync + isync + mtspr SPR_L1CSR1, %r11 + isync + + mflr %r9 + bl 1f + .long 2f-. +1: + mflr %r5 + lwz %r8, 0(%r5) + mtlr %r9 + add %r8, %r8, %r5 + icbtls 0, 0, %r8 + addi %r9, %r8, 64 + + sync + mfspr %r11, SPR_L1CSR1 +3: andi. %r11, %r11, L1CSR1_ICUL + bne 3b + + icbtls 0, 0, %r9 + + sync + mfspr %r11, SPR_L1CSR1 +3: andi. %r11, %r11, L1CSR1_ICUL + bne 3b + + b 2f + .align 6 + /* Inside a locked cacheline, wait a while, write, then wait a while */ +2: sync + + mfspr %r5, TBR_TBL +4: addis %r11, %r5, 0x100000@h /* wait around one million timebase ticks */ + mfspr %r5, TBR_TBL + subf. %r5, %r5, %r11 + bgt 4b + + stw %r4, 0(%r3) + + mfspr %r5, TBR_TBL +4: addis %r11, %r5, 0x100000@h /* wait around one million timebase ticks */ + mfspr %r5, TBR_TBL + subf. %r5, %r5, %r11 + bgt 4b + + sync + + /* + * Fill out the rest of this cache line and the next with nops, + * to ensure that nothing outside the locked area will be + * fetched due to a branch. + */ + .rept 19 + nop + .endr + + icblc 0, 0, %r8 + icblc 0, 0, %r9 + + blr + +/* * int setfault() * * Similar to setjmp to setup for handling faults on accesses to user memory. Modified: head/sys/powerpc/booke/machdep_e500.c ============================================================================== --- head/sys/powerpc/booke/machdep_e500.c Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/booke/machdep_e500.c Wed Dec 30 03:43:25 2015 (r292903) @@ -27,9 +27,15 @@ #include __FBSDID("$FreeBSD$"); +#include #include +#include +#include #include +#include +#include + #include #include @@ -42,6 +48,7 @@ extern void icache_enable(void); extern void icache_inval(void); extern void l2cache_enable(void); extern void l2cache_inval(void); +extern void bpred_enable(void); void booke_init_tlb(vm_paddr_t fdt_immr_pa) @@ -79,7 +86,6 @@ booke_enable_l1_cache(void) (csr & L1CSR1_ICE) ? "en" : "dis"); } -#if 0 void booke_enable_l2_cache(void) { @@ -102,55 +108,18 @@ booke_enable_l2_cache(void) } void -booke_enable_l3_cache(void) +booke_enable_bpred(void) { - uint32_t csr, size, ver; - - /* Enable L3 CoreNet Platform Cache (CPC) */ - ver = SVR_VER(mfspr(SPR_SVR)); - if (ver == SVR_P2041 || ver == SVR_P2041E || ver == SVR_P3041 || - ver == SVR_P3041E || ver == SVR_P5020 || ver == SVR_P5020E) { - csr = ccsr_read4(OCP85XX_CPC_CSR0); - if ((csr & OCP85XX_CPC_CSR0_CE) == 0) { - l3cache_inval(); - l3cache_enable(); - } + uint32_t csr; - csr = ccsr_read4(OCP85XX_CPC_CSR0); - if ((boothowto & RB_VERBOSE) != 0 || - (csr & OCP85XX_CPC_CSR0_CE) == 0) { - size = OCP85XX_CPC_CFG0_SZ_K(ccsr_read4(OCP85XX_CPC_CFG0)); - printf("L3 Corenet Platform Cache: %d KB %sabled\n", - size, (csr & OCP85XX_CPC_CSR0_CE) == 0 ? - "dis" : "en"); - } - } + bpred_enable(); + csr = mfspr(SPR_BUCSR); + if ((boothowto & RB_VERBOSE) != 0 || (csr & BUCSR_BPEN) == 0) + printf("Branch Predictor %sabled\n", + (csr & BUCSR_BPEN) ? "en" : "dis"); } void booke_disable_l2_cache(void) { } - -static void -l3cache_inval(void) -{ - - /* Flash invalidate the CPC and clear all the locks */ - ccsr_write4(OCP85XX_CPC_CSR0, OCP85XX_CPC_CSR0_FI | - OCP85XX_CPC_CSR0_LFC); - while (ccsr_read4(OCP85XX_CPC_CSR0) & (OCP85XX_CPC_CSR0_FI | - OCP85XX_CPC_CSR0_LFC)) - ; -} - -static void -l3cache_enable(void) -{ - - ccsr_write4(OCP85XX_CPC_CSR0, OCP85XX_CPC_CSR0_CE | - OCP85XX_CPC_CSR0_PE); - /* Read back to sync write */ - ccsr_read4(OCP85XX_CPC_CSR0); -} -#endif Modified: head/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.c Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/mpc85xx/mpc85xx.c Wed Dec 30 03:43:25 2015 (r292903) @@ -32,18 +32,26 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include +#include #include #include #include +#include +#include +#include +#include + #include @@ -249,3 +257,166 @@ law_pci_target(struct resource *res, int return (rv); } +static void +l3cache_inval(void) +{ + + /* Flash invalidate the CPC and clear all the locks */ + ccsr_write4(OCP85XX_CPC_CSR0, OCP85XX_CPC_CSR0_FI | + OCP85XX_CPC_CSR0_LFC); + while (ccsr_read4(OCP85XX_CPC_CSR0) & (OCP85XX_CPC_CSR0_FI | + OCP85XX_CPC_CSR0_LFC)) + ; +} + +static void +l3cache_enable(void) +{ + + ccsr_write4(OCP85XX_CPC_CSR0, OCP85XX_CPC_CSR0_CE | + OCP85XX_CPC_CSR0_PE); + /* Read back to sync write */ + ccsr_read4(OCP85XX_CPC_CSR0); +} + +void +mpc85xx_enable_l3_cache(void) +{ + uint32_t csr, size, ver; + + /* Enable L3 CoreNet Platform Cache (CPC) */ + ver = SVR_VER(mfspr(SPR_SVR)); + if (ver == SVR_P2041 || ver == SVR_P2041E || ver == SVR_P3041 || + ver == SVR_P3041E || ver == SVR_P5020 || ver == SVR_P5020E) { + csr = ccsr_read4(OCP85XX_CPC_CSR0); + if ((csr & OCP85XX_CPC_CSR0_CE) == 0) { + l3cache_inval(); + l3cache_enable(); + } + + csr = ccsr_read4(OCP85XX_CPC_CSR0); + if ((boothowto & RB_VERBOSE) != 0 || + (csr & OCP85XX_CPC_CSR0_CE) == 0) { + size = OCP85XX_CPC_CFG0_SZ_K(ccsr_read4(OCP85XX_CPC_CFG0)); + printf("L3 Corenet Platform Cache: %d KB %sabled\n", + size, (csr & OCP85XX_CPC_CSR0_CE) == 0 ? + "dis" : "en"); + } + } +} + +static void +mpc85xx_dataloss_erratum_spr976(void) +{ + uint32_t svr = SVR_VER(mfspr(SPR_SVR)); + + /* Ignore whether it's the E variant */ + svr &= ~0x8; + + if (svr != SVR_P3041 && svr != SVR_P4040 && + svr != SVR_P4080 && svr != SVR_P5020) + return; + + mb(); + isync(); + mtspr(976, (mfspr(976) & ~0x1f8) | 0x48); + isync(); +} + +static vm_offset_t +mpc85xx_map_dcsr(void) +{ + phandle_t node; + u_long b, s; + int err; + + /* + * Try to access the dcsr node directly i.e. through /aliases/. + */ + if ((node = OF_finddevice("dcsr")) != -1) + if (fdt_is_compatible_strict(node, "fsl,dcsr")) + goto moveon; + /* + * Find the node the long way. + */ + if ((node = OF_finddevice("/")) == -1) + return (ENXIO); + + if ((node = ofw_bus_find_compatible(node, "fsl,dcsr")) == 0) + return (ENXIO); + +moveon: + err = fdt_get_range(node, 0, &b, &s); + + if (err != 0) + return (err); + +#ifdef QORIQ_DPAA + law_enable(OCP85XX_TGTIF_DCSR, b, 0x400000); +#endif + return pmap_early_io_map(b, 0x400000); +} + + + +void +mpc85xx_fix_errata(vm_offset_t va_ccsr) +{ + uint32_t svr = SVR_VER(mfspr(SPR_SVR)); + vm_offset_t va_dcsr; + + /* Ignore whether it's the E variant */ + svr &= ~0x8; + + if (svr != SVR_P3041 && svr != SVR_P4040 && + svr != SVR_P4080 && svr != SVR_P5020) + return; + + if (mfmsr() & PSL_EE) + return; + + /* + * dcsr region need to be mapped thus patch can refer to. + * Align dcsr right after ccsbar. + */ + va_dcsr = mpc85xx_map_dcsr(); + if (va_dcsr == 0) + goto err; + + /* + * As A004510 errata specify, special purpose register 976 + * SPR976[56:60] = 6'b001001 must be set. e500mc core reference manual + * does not document SPR976 register. + */ + mpc85xx_dataloss_erratum_spr976(); + + /* + * Specific settings in the CCF and core platform cache (CPC) + * are required to reconfigure the CoreNet coherency fabric. + * The register settings that should be updated are described + * in errata and relay on base address, offset and updated value. + * Special conditions must be used to update these registers correctly. + */ + dataloss_erratum_access(va_dcsr + 0xb0e08, 0xe0201800); + dataloss_erratum_access(va_dcsr + 0xb0e18, 0xe0201800); + dataloss_erratum_access(va_dcsr + 0xb0e38, 0xe0400000); + dataloss_erratum_access(va_dcsr + 0xb0008, 0x00900000); + dataloss_erratum_access(va_dcsr + 0xb0e40, 0xe00a0000); + + switch (svr) { + case SVR_P5020: + dataloss_erratum_access(va_ccsr + 0x18600, 0xc0000000); + break; + case SVR_P4040: + case SVR_P4080: + dataloss_erratum_access(va_ccsr + 0x18600, 0xff000000); + break; + case SVR_P3041: + dataloss_erratum_access(va_ccsr + 0x18600, 0xf0000000); + } + dataloss_erratum_access(va_ccsr + 0x10f00, 0x415e5000); + dataloss_erratum_access(va_ccsr + 0x11f00, 0x415e5000); + +err: + return; +} Modified: head/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.h Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/mpc85xx/mpc85xx.h Wed Dec 30 03:43:25 2015 (r292903) @@ -40,6 +40,25 @@ extern vm_offset_t ccsrbar_va; #define OCP85XX_CCSRBAR (CCSRBAR_VA + 0x0) #define OCP85XX_BPTR (CCSRBAR_VA + 0x20) +#define OCP85XX_BSTRH (CCSRBAR_VA + 0x20) +#define OCP85XX_BSTRL (CCSRBAR_VA + 0x24) +#define OCP85XX_BSTAR (CCSRBAR_VA + 0x28) + +#define OCP85XX_COREDISR (CCSRBAR_VA + 0xE0094) +#define OCP85XX_BRR (CCSRBAR_VA + 0xE00E4) + +/* + * Run Control and Power Management registers + */ +#define CCSR_CTBENR (CCSRBAR_VA + 0xE2084) +#define CCSR_CTBCKSELR (CCSRBAR_VA + 0xE208C) +#define CCSR_CTBCHLTCR (CCSRBAR_VA + 0xE2094) + +/* + * DDR Memory controller. + */ +#define OCP85XX_DDR1_CS0_CONFIG (CCSRBAR_VA + 0x8080) + /* * E500 Coherency Module registers */ @@ -68,6 +87,7 @@ extern vm_offset_t ccsrbar_va; #define OCP85XX_TGTIF_RAM1 0x10 #define OCP85XX_TGTIF_RAM2 0x11 #define OCP85XX_TGTIF_BMAN 0x18 +#define OCP85XX_TGTIF_DCSR 0x1D #define OCP85XX_TGTIF_QMAN 0x3C #define OCP85XX_TRGT_SHIFT 20 #else @@ -84,6 +104,20 @@ extern vm_offset_t ccsrbar_va; #define OCP85XX_L2CTL (CCSRBAR_VA + 0x20000) /* + * L3 CoreNet platform cache (CPC) registers + */ +#define OCP85XX_CPC_CSR0 (CCSRBAR_VA + 0x10000) +#define OCP85XX_CPC_CSR0_CE 0x80000000 +#define OCP85XX_CPC_CSR0_PE 0x40000000 +#define OCP85XX_CPC_CSR0_FI 0x00200000 +#define OCP85XX_CPC_CSR0_WT 0x00080000 +#define OCP85XX_CPC_CSR0_FL 0x00000800 +#define OCP85XX_CPC_CSR0_LFC 0x00000400 +#define OCP85XX_CPC_CFG0 (CCSRBAR_VA + 0x10008) +#define OCP85XX_CPC_CFG_SZ_MASK 0x00003fff +#define OCP85XX_CPC_CFG0_SZ_K(x) (((x) & OCP85XX_CPC_CFG_SZ_MASK) << 6) + +/* * Power-On Reset configuration */ #define OCP85XX_PORDEVSR (CCSRBAR_VA + 0xe000c) @@ -110,4 +144,8 @@ int law_pci_target(struct resource *, in DECLARE_CLASS(mpc85xx_platform); int mpc85xx_attach(platform_t); +void mpc85xx_enable_l3_cache(void); +void mpc85xx_fix_errata(vm_offset_t); +void dataloss_erratum_access(vm_offset_t, uint32_t); + #endif /* _MPC85XX_H_ */ Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Dec 30 03:36:22 2015 (r292902) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Dec 30 03:43:25 2015 (r292903) @@ -24,6 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_platform.h" #include __FBSDID("$FreeBSD$"); @@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -175,6 +177,9 @@ mpc85xx_attach(platform_t plat) } ccsrbar_va = pmap_early_io_map(ccsrbar, ccsrsize); + mpc85xx_fix_errata(ccsrbar_va); + mpc85xx_enable_l3_cache(); + /* * Clear local access windows. Skip DRAM entries, so we don't shoot * ourselves in the foot. @@ -182,14 +187,14 @@ mpc85xx_attach(platform_t plat) law_max = law_getmax(); for (i = 0; i < law_max; i++) { sr = ccsr_read4(OCP85XX_LAWSR(i)); - if ((sr & 0x80000000) == 0) + if ((sr & OCP85XX_ENA_MASK) == 0) continue; tgt = (sr & 0x01f00000) >> 20; if (tgt == OCP85XX_TGTIF_RAM1 || tgt == OCP85XX_TGTIF_RAM2 || tgt == OCP85XX_TGTIF_RAM_INTL) continue; - ccsr_write4(OCP85XX_LAWSR(i), sr & 0x7fffffff); + ccsr_write4(OCP85XX_LAWSR(i), sr & OCP85XX_DIS_MASK); } return (0); @@ -256,7 +261,11 @@ mpc85xx_timebase_freq(platform_t plat, s * HID0[SEL_TBCLK] = 0 */ if (freq != 0) +#ifdef QORIQ_DPAA + ticks = freq / 32; +#else ticks = freq / 8; +#endif out: if (ticks <= 0) @@ -309,17 +318,37 @@ mpc85xx_smp_start_cpu(platform_t plat, s { #ifdef SMP uint32_t *tlb1; - uint32_t bptr, eebpcr; + vm_paddr_t bptr; + uint32_t reg; int i, timeout; + uintptr_t brr; + int cpuid; + +#ifdef QORIQ_DPAA + uint32_t tgt; - eebpcr = ccsr_read4(OCP85XX_EEBPCR); - if ((eebpcr & (1 << (pc->pc_cpuid + 24))) != 0) { + reg = ccsr_read4(OCP85XX_COREDISR); + cpuid = pc->pc_cpuid; + + if ((reg & cpuid) != 0) { + printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); + return (-1); + } + + brr = OCP85XX_BRR; +#else /* QORIQ_DPAA */ + brr = OCP85XX_EEBPCR; + cpuid = pc->pc_cpuid + 24; +#endif + reg = ccsr_read4(brr); + if ((reg & (1 << cpuid)) != 0) { printf("SMP: CPU %d already out of hold-off state!\n", pc->pc_cpuid); return (ENXIO); } ap_pcpu = pc; + __asm __volatile("msync; isync"); i = 0; tlb1 = bp_tlb1; @@ -335,24 +364,67 @@ mpc85xx_smp_start_cpu(platform_t plat, s if (i < bp_ntlb1s) bp_ntlb1s = i; + /* Flush caches to have our changes hit DRAM. */ + cpu_flush_dcache(__boot_page, 4096); + + bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; + KASSERT((bptr & 0xfff) == 0, + ("%s: boot page is not aligned (%#jx)", __func__, (uintmax_t)bptr)); +#ifdef QORIQ_DPAA + + /* + * Read DDR controller configuration to select proper BPTR target ID. + * + * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers + * interleaving. If this bit is set, we have to use + * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, + * this bit is reserved and always 0. + */ + + reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); + if (reg & (1 << 29)) + tgt = OCP85XX_TGTIF_RAM_INTL; + else + tgt = OCP85XX_TGTIF_RAM1; + + /* + * Set BSTR to the physical address of the boot page + */ + ccsr_write4(OCP85XX_BSTRH, bptr >> 32); + ccsr_write4(OCP85XX_BSTRL, bptr); + ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | + (tgt << OCP85XX_TRGT_SHIFT) | (ffsl(PAGE_SIZE) - 2)); + + /* Read back OCP85XX_BSTAR to synchronize write */ + ccsr_read4(OCP85XX_BSTAR); + + /* + * Enable and configure time base on new CPU. + */ + + /* Set TB clock source to platform clock / 32 */ + reg = ccsr_read4(CCSR_CTBCKSELR); + ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); + + /* Enable TB */ + reg = ccsr_read4(CCSR_CTBENR); + ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); +#else + /* * Set BPTR to the physical address of the boot page */ - bptr = ((uint32_t)__boot_page - KERNBASE) + kernload; - KASSERT((bptr & 0xfff) == 0, - ("%s: boot page is not aligned (%#x)", __func__, bptr)); bptr = (bptr >> 12) | 0x80000000u; ccsr_write4(OCP85XX_BPTR, bptr); __asm __volatile("isync; msync"); - /* Flush caches to have our changes hit DRAM. */ - cpu_flush_dcache(__boot_page, 4096); +#endif /* QORIQ_DPAA */ /* * Release AP from hold-off state */ - eebpcr |= (1 << (pc->pc_cpuid + 24)); - ccsr_write4(OCP85XX_EEBPCR, eebpcr); + reg = ccsr_read4(brr); + ccsr_write4(brr, reg | (1 << cpuid)); __asm __volatile("isync; msync"); timeout = 500; @@ -364,7 +436,11 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ +#ifdef QORIQ_DPAA + ccsr_write4(OCP85XX_BSTAR, 0); +#else ccsr_write4(OCP85XX_BPTR, 0); +#endif __asm __volatile("isync; msync"); if (!pc->pc_awake) From owner-svn-src-head@freebsd.org Wed Dec 30 05:56: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 B1C92A55503 for ; Wed, 30 Dec 2015 05:56:22 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A5B11808; Wed, 30 Dec 2015 05:56:21 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from pc40.home (ABordeaux-259-1-3-200.w92-162.abo.wanadoo.fr [92.162.178.200]) (authenticated bits=0) by theravensnest.org (8.15.2/8.15.2) with ESMTPSA id tBU5uGpg046680 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Dec 2015 05:56:19 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host ABordeaux-259-1-3-200.w92-162.abo.wanadoo.fr [92.162.178.200] claimed to be pc40.home Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292809 - head/lib/libc/stdio From: David Chisnall In-Reply-To: <20151230102454.P1079@besplex.bde.org> Date: Wed, 30 Dec 2015 06:56:16 +0100 Cc: John Baldwin , Warner Losh , src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Warner Losh Content-Transfer-Encoding: quoted-printable Message-Id: <12F59E6B-137C-4B53-B86C-E111E512CCFF@FreeBSD.org> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> <2345870.SHMMVrpc1D@ralph.baldwin.cx> <20151230102454.P1079@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.2104) 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, 30 Dec 2015 05:56:22 -0000 On 30 Dec 2015, at 00:48, Bruce Evans wrote: >=20 > - C++ apparently spells this as both _Alignof() and alignof() after = 2011/03 This is not correct. C++ spells it alignof. C spells it _Alignof, = unless you include , in which case C spells it alignof and = defines _ _alignof_is_defined. On FreeBSD, we define _Alignof in C++ mode, because it=E2=80=99s in the = reserved identifier space and gives us something that works in C and = C++. David From owner-svn-src-head@freebsd.org Wed Dec 30 06:44:55 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 E333BA532DE; Wed, 30 Dec 2015 06:44:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id A6AD21860; Wed, 30 Dec 2015 06:44:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id DFC783C511D; Wed, 30 Dec 2015 17:44:50 +1100 (AEDT) Date: Wed, 30 Dec 2015 17:44:49 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall cc: Bruce Evans , John Baldwin , Warner Losh , src-committers , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Warner Losh Subject: Re: svn commit: r292809 - head/lib/libc/stdio In-Reply-To: <12F59E6B-137C-4B53-B86C-E111E512CCFF@FreeBSD.org> Message-ID: <20151230172556.R2352@besplex.bde.org> References: <201512272304.tBRN4C5D034464@repo.freebsd.org> <41508412.yspAtSoPCD@ralph.baldwin.cx> <2345870.SHMMVrpc1D@ralph.baldwin.cx> <20151230102454.P1079@besplex.bde.org> <12F59E6B-137C-4B53-B86C-E111E512CCFF@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=XgqxBOR3v6g9Ku1U93UA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE 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: Wed, 30 Dec 2015 06:44:56 -0000 On Wed, 30 Dec 2015, David Chisnall wrote: > On 30 Dec 2015, at 00:48, Bruce Evans wrote: >> >> - C++ apparently spells this as both _Alignof() and alignof() after 2011= /03 > > This is not correct. C++ spells it alignof. C spells it _Alignof, unles= s you include , in which case C spells it alignof and defines _= _alignof_is_defined. > > On FreeBSD, we define _Alignof in C++ mode, because it=E2=80=99s in the r= eserved identifier space and gives us something that works in C and C++. So it is more broken than first appeared :-). Extra spellings are a bug since users don't know which one to use and prefer the worst one unless they are experts in at least 3 versions of 3 standards (C-K&R, C90, C99, C11, C++-mumble, gnu89, gnu99, gnu11) and FreeBSD variations on these. There are also syntactical problems. stdalign.h uses _Alignas and _Alignof= , but FreeBSD only defines _Alignas(x) and _Alignof(x). The former is becaus= e alignof is like sizeof so it doesn't need parentheses. However, alignof(typename) needs the parentheses and 'alignof expression' is=20 apparently only a gnu extension, so it is difficult to construct an example of Standard code without the parentheses. _Alignas is more broken than _Alignof. In the C case, _Alignas(x) is as __aligned(x), but this only works if x is an expression. __aligned(x) is often used in FreeBSD code, but the same code in C++ with __aligned(x) replaced by alignas(x) with any spelling is a syntax error. Bruce From owner-svn-src-head@freebsd.org Wed Dec 30 09:15: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 34BDEA563EC; Wed, 30 Dec 2015 09:15:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0A1CE1068; Wed, 30 Dec 2015 09:15:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU9F34L001704; Wed, 30 Dec 2015 09:15:03 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU9F3LM001703; Wed, 30 Dec 2015 09:15:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201512300915.tBU9F3LM001703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 30 Dec 2015 09:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292911 - head 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, 30 Dec 2015 09:15:04 -0000 Author: dim Date: Wed Dec 30 09:15:02 2015 New Revision: 292911 URL: https://svnweb.freebsd.org/changeset/base/292911 Log: Add some more obsolete files, left over from the clang 3.7.0 -> 3.7.1 upgrade. Noticed by: Nikolai Lifanov , jtl Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Dec 30 09:02:03 2015 (r292910) +++ head/ObsoleteFiles.inc Wed Dec 30 09:15:02 2015 (r292911) @@ -105,6 +105,8 @@ OLD_FILES+=usr/lib/clang/3.7.0/include/x OLD_FILES+=usr/lib/clang/3.7.0/include/xtestintrin.h OLD_DIRS+=usr/lib/clang/3.7.0/include OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan-i386.a +OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan-preinit-i386.a +OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan-preinit-x86_64.a OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan-x86_64.a OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan_cxx-i386.a OLD_FILES+=usr/lib/clang/3.7.0/lib/freebsd/libclang_rt.asan_cxx-x86_64.a From owner-svn-src-head@freebsd.org Wed Dec 30 11:15: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 041C4A5690C; Wed, 30 Dec 2015 11:15:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C12C51448; Wed, 30 Dec 2015 11:15:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUBF8Uc038404; Wed, 30 Dec 2015 11:15:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBF7Wr038402; Wed, 30 Dec 2015 11:15:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512301115.tBUBF7Wr038402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Dec 2015 11:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292914 - in head: tests/sys/kern tools/regression/sockets/unix_passfd 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, 30 Dec 2015 11:15:09 -0000 Author: ngie Date: Wed Dec 30 11:15:07 2015 New Revision: 292914 URL: https://svnweb.freebsd.org/changeset/base/292914 Log: Integrate tools/regression/sockets/unix_passfd into the FreeBSD test suite as tests/sys/kern/unix_passfd_test - Convert testcases to ATF - Fix an alignment issues - Mark rights_creds_payload(..) as an expected failure (see PR # 181741) Based [in part] on the following Differential Revision: https://reviews.freebsd.org/D689 MFC after: 1 week Submitted by: markj Sponsored by: EMC / Isilon Storage Division Added: head/tests/sys/kern/unix_passfd_test.c - copied, changed from r292913, head/tools/regression/sockets/unix_passfd/unix_passfd.c Deleted: head/tools/regression/sockets/unix_passfd/ Modified: head/tests/sys/kern/Makefile Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Wed Dec 30 10:23:25 2015 (r292913) +++ head/tests/sys/kern/Makefile Wed Dec 30 11:15:07 2015 (r292914) @@ -8,6 +8,7 @@ ATF_TESTS_C+= kern_copyin ATF_TESTS_C+= kern_descrip_test ATF_TESTS_C+= ptrace_test ATF_TESTS_C+= unix_seqpacket_test +ATF_TESTS_C+= unix_passfd_test TEST_METADATA.unix_seqpacket_test+= timeout="15" LIBADD.ptrace_test+= pthread Copied and modified: head/tests/sys/kern/unix_passfd_test.c (from r292913, head/tools/regression/sockets/unix_passfd/unix_passfd.c) ============================================================================== --- head/tools/regression/sockets/unix_passfd/unix_passfd.c Wed Dec 30 10:23:25 2015 (r292913, copy source) +++ head/tests/sys/kern/unix_passfd_test.c Wed Dec 30 11:15:07 2015 (r292914) @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -41,6 +41,8 @@ #include #include +#include + /* * UNIX domain sockets allow file descriptors to be passed via "ancillary * data", or control messages. This regression test is intended to exercise @@ -51,11 +53,11 @@ */ static void -domainsocketpair(const char *test, int *fdp) +domainsocketpair(int *fdp) { - if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdp) < 0) - err(-1, "%s: socketpair(PF_UNIX, SOCK_STREAM)", test); + ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, fdp) != -1, + "socketpair(PF_UNIX, SOCK_STREAM) failed: %s", strerror(errno)); } static void @@ -67,51 +69,47 @@ closesocketpair(int *fdp) } static void -devnull(const char *test, int *fdp) +devnull(int *fdp) { int fd; fd = open("/dev/null", O_RDONLY); - if (fd < 0) - err(-1, "%s: open(/dev/null)", test); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); *fdp = fd; } static void -tempfile(const char *test, int *fdp) +tempfile(int *fdp) { char path[PATH_MAX]; int fd; - snprintf(path, PATH_MAX, "/tmp/unix_passfd.XXXXXXXXXXXXXXX"); + snprintf(path, PATH_MAX, "%s/unix_passfd.XXXXXXXXXXXXXXX", + getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")); fd = mkstemp(path); - if (fd < 0) - err(-1, "%s: mkstemp(%s)", test, path); + ATF_REQUIRE_MSG(fd != -1, "mkstemp(%s) failed", path); (void)unlink(path); *fdp = fd; } static void -dofstat(const char *test, int fd, struct stat *sb) +dofstat(int fd, struct stat *sb) { - if (fstat(fd, sb) < 0) - err(-1, "%s: fstat", test); + ATF_REQUIRE_MSG(fstat(fd, sb) == 0, + "fstat failed: %s", strerror(errno)); } static void -samefile(const char *test, struct stat *sb1, struct stat *sb2) +samefile(struct stat *sb1, struct stat *sb2) { - if (sb1->st_dev != sb2->st_dev) - errx(-1, "%s: samefile: different device", test); - if (sb1->st_ino != sb2->st_ino) - errx(-1, "%s: samefile: different inode", test); + ATF_REQUIRE_MSG(sb1->st_dev == sb2->st_dev, "different device"); + ATF_REQUIRE_MSG(sb1->st_ino == sb2->st_ino, "different inode"); } static void -sendfd_payload(const char *test, int sockfd, int sendfd, - void *payload, size_t paylen) +sendfd_payload(int sockfd, int sendfd, void *payload, size_t paylen) { struct iovec iovec; char message[CMSG_SPACE(sizeof(int))]; @@ -131,30 +129,29 @@ sendfd_payload(const char *test, int soc msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - cmsghdr = (struct cmsghdr *)message; + cmsghdr = (struct cmsghdr *)(void*)message; cmsghdr->cmsg_len = CMSG_LEN(sizeof(int)); cmsghdr->cmsg_level = SOL_SOCKET; cmsghdr->cmsg_type = SCM_RIGHTS; - *(int *)CMSG_DATA(cmsghdr) = sendfd; + memcpy(CMSG_DATA(cmsghdr), &sendfd, sizeof(int)); len = sendmsg(sockfd, &msghdr, 0); - if (len < 0) - err(-1, "%s: sendmsg", test); - if ((size_t)len != paylen) - errx(-1, "%s: sendmsg: %zd bytes sent", test, len); + ATF_REQUIRE_MSG(len != -1, "sendmsg failed: %s", strerror(errno)); + ATF_REQUIRE_MSG((size_t)len == paylen, + "sendmsg: %zd messages sent; expected: %zu; %s", len, paylen, + strerror(errno)); } static void -sendfd(const char *test, int sockfd, int sendfd) +sendfd(int sockfd, int sendfd) { char ch = 0; - return (sendfd_payload(test, sockfd, sendfd, &ch, sizeof(ch))); + return (sendfd_payload(sockfd, sendfd, &ch, sizeof(ch))); } static void -recvfd_payload(const char *test, int sockfd, int *recvfd, - void *buf, size_t buflen) +recvfd_payload(int sockfd, int *recvfd, void *buf, size_t buflen) { struct cmsghdr *cmsghdr; char message[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + sizeof(int)]; @@ -174,217 +171,226 @@ recvfd_payload(const char *test, int soc msghdr.msg_iovlen = 1; len = recvmsg(sockfd, &msghdr, 0); - if (len < 0) - err(-1, "%s: recvmsg", test); - if ((size_t)len != buflen) - errx(-1, "%s: recvmsg: %zd bytes received", test, len); + ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); + ATF_REQUIRE_MSG((size_t)len == buflen, + "recvmsg: %zd bytes received; expected %zd", len, buflen); cmsghdr = CMSG_FIRSTHDR(&msghdr); - if (cmsghdr == NULL) - errx(-1, "%s: recvmsg: did not receive control message", test); + ATF_REQUIRE_MSG(cmsghdr != NULL, + "recvmsg: did not receive control message"); *recvfd = -1; for (; cmsghdr != NULL; cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr)) { if (cmsghdr->cmsg_level == SOL_SOCKET && cmsghdr->cmsg_type == SCM_RIGHTS && cmsghdr->cmsg_len == CMSG_LEN(sizeof(int))) { - *recvfd = *(int *)CMSG_DATA(cmsghdr); - if (*recvfd == -1) - errx(-1, "%s: recvmsg: received fd -1", test); + memcpy(recvfd, CMSG_DATA(cmsghdr), sizeof(int)); + ATF_REQUIRE(*recvfd != -1); } } - if (*recvfd == -1) - errx(-1, "%s: recvmsg: did not receive single-fd message", - test); + ATF_REQUIRE_MSG(*recvfd != -1, + "recvmsg: did not receive single-fd message"); } static void -recvfd(const char *test, int sockfd, int *recvfd) +recvfd(int sockfd, int *recvfd) { char ch = 0; - return (recvfd_payload(test, sockfd, recvfd, &ch, sizeof(ch))); + return (recvfd_payload(sockfd, recvfd, &ch, sizeof(ch))); } -int -main(void) +/* + * Put a temporary file into a UNIX domain socket, then take it out and make + * sure it's the same file. First time around, don't close the reference + * after sending. + */ +ATF_TC_WITHOUT_HEAD(simple_send_fd); +ATF_TC_BODY(simple_send_fd, tc) { - struct stat putfd_1_stat, putfd_2_stat, getfd_1_stat, getfd_2_stat; - int fd[2], putfd_1, putfd_2, getfd_1, getfd_2; - const char *test; - - /* - * First test: put a temporary file into a UNIX domain socket, then - * take it out and make sure it's the same file. First time around, - * don't close the reference after sending. - */ - test = "test1-simplesendfd"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - tempfile(test, &putfd_1); - dofstat(test, putfd_1, &putfd_1_stat); - sendfd(test, fd[0], putfd_1); - recvfd(test, fd[1], &getfd_1); - dofstat(test, getfd_1, &getfd_1_stat); - samefile(test, &putfd_1_stat, &getfd_1_stat); - close(putfd_1); - close(getfd_1); + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; + + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + recvfd(fd[1], &getfd); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + close(putfd); + close(getfd); closesocketpair(fd); +} - printf("%s passed\n", test); +/* + * Same as simple_send_fd, only close the file reference after sending, so that + * the only reference is the descriptor in the UNIX domain socket buffer. + */ +ATF_TC_WITHOUT_HEAD(send_and_close); +ATF_TC_BODY(send_and_close, tc) +{ + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; - /* - * Second test: same as first, only close the file reference after - * sending, so that the only reference is the descriptor in the UNIX - * domain socket buffer. - */ - test = "test2-sendandclose"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - tempfile(test, &putfd_1); - dofstat(test, putfd_1, &putfd_1_stat); - sendfd(test, fd[0], putfd_1); - close(putfd_1); - recvfd(test, fd[1], &getfd_1); - dofstat(test, getfd_1, &getfd_1_stat); - samefile(test, &putfd_1_stat, &getfd_1_stat); - close(getfd_1); + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + close(putfd); + recvfd(fd[1], &getfd); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + close(getfd); closesocketpair(fd); +} - printf("%s passed\n", test); +/* + * Put a temporary file into a UNIX domain socket, then close both endpoints + * causing garbage collection to kick off. + */ +ATF_TC_WITHOUT_HEAD(send_and_cancel); +ATF_TC_BODY(send_and_cancel, tc) +{ + int fd[2], putfd; - /* - * Third test: put a temporary file into a UNIX domain socket, then - * close both endpoints causing garbage collection to kick off. - */ - test = "test3-sendandcancel"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - tempfile(test, &putfd_1); - sendfd(test, fd[0], putfd_1); - close(putfd_1); + domainsocketpair(fd); + tempfile(&putfd); + sendfd(fd[0], putfd); + close(putfd); closesocketpair(fd); +} - printf("%s passed\n", test); +/* + * Send two files. Then receive them. Make sure they are returned in the + * right order, and both get there. + */ +ATF_TC_WITHOUT_HEAD(two_files); +ATF_TC_BODY(two_files, tc) +{ + struct stat getfd_1_stat, getfd_2_stat, putfd_1_stat, putfd_2_stat; + int fd[2], getfd_1, getfd_2, putfd_1, putfd_2; - /* - * Send two files. Then receive them. Make sure they are returned - * in the right order, and both get there. - */ - - test = "test4-twofile"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - tempfile(test, &putfd_1); - tempfile(test, &putfd_2); - dofstat(test, putfd_1, &putfd_1_stat); - dofstat(test, putfd_2, &putfd_2_stat); - sendfd(test, fd[0], putfd_1); - sendfd(test, fd[0], putfd_2); + domainsocketpair(fd); + tempfile(&putfd_1); + tempfile(&putfd_2); + dofstat(putfd_1, &putfd_1_stat); + dofstat(putfd_2, &putfd_2_stat); + sendfd(fd[0], putfd_1); + sendfd(fd[0], putfd_2); close(putfd_1); close(putfd_2); - recvfd(test, fd[1], &getfd_1); - recvfd(test, fd[1], &getfd_2); - dofstat(test, getfd_1, &getfd_1_stat); - dofstat(test, getfd_2, &getfd_2_stat); - samefile(test, &putfd_1_stat, &getfd_1_stat); - samefile(test, &putfd_2_stat, &getfd_2_stat); + recvfd(fd[1], &getfd_1); + recvfd(fd[1], &getfd_2); + dofstat(getfd_1, &getfd_1_stat); + dofstat(getfd_2, &getfd_2_stat); + samefile(&putfd_1_stat, &getfd_1_stat); + samefile(&putfd_2_stat, &getfd_2_stat); close(getfd_1); close(getfd_2); closesocketpair(fd); +} - printf("%s passed\n", test); - - /* - * Big bundling test. Send an endpoint of the UNIX domain socket - * over itself, closing the door behind it. - */ - - test = "test5-bundle"; - printf("beginning %s\n", test); +/* + * Big bundling test. Send an endpoint of the UNIX domain socket over itself, + * closing the door behind it. + */ +ATF_TC_WITHOUT_HEAD(bundle); +ATF_TC_BODY(bundle, tc) +{ + int fd[2], getfd; - domainsocketpair(test, fd); + domainsocketpair(fd); - sendfd(test, fd[0], fd[0]); + sendfd(fd[0], fd[0]); close(fd[0]); - recvfd(test, fd[1], &getfd_1); - close(getfd_1); + recvfd(fd[1], &getfd); + close(getfd); close(fd[1]); +} - printf("%s passed\n", test); +/* + * Big bundling test part two: Send an endpoint of the UNIX domain socket over + * itself, close the door behind it, and never remove it from the other end. + */ +ATF_TC_WITHOUT_HEAD(bundle_cancel); +ATF_TC_BODY(bundle_cancel, tc) +{ + int fd[2]; - /* - * Big bundling test part two: Send an endpoint of the UNIX domain - * socket over itself, close the door behind it, and never remove it - * from the other end. - */ - - test = "test6-bundlecancel"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - sendfd(test, fd[0], fd[0]); - sendfd(test, fd[1], fd[0]); + domainsocketpair(fd); + sendfd(fd[0], fd[0]); + sendfd(fd[1], fd[0]); closesocketpair(fd); +} - printf("%s passed\n", test); +/* + * Test for PR 151758: Send an character device over the UNIX domain socket + * and then close both sockets to orphan the device. + */ +ATF_TC_WITHOUT_HEAD(devfs_orphan); +ATF_TC_BODY(devfs_orphan, tc) +{ + int fd[2], putfd; - /* - * Test for PR 151758: Send an character device over the UNIX - * domain socket and then close both sockets to orphan the - * device. - */ - - test = "test7-devfsorphan"; - printf("beginning %s\n", test); - - domainsocketpair(test, fd); - devnull(test, &putfd_1); - sendfd(test, fd[0], putfd_1); - close(putfd_1); + domainsocketpair(fd); + devnull(&putfd); + sendfd(fd[0], putfd); + close(putfd); closesocketpair(fd); +} - printf("%s passed\n", test); +#define LOCAL_SENDSPACE_SYSCTL "net.local.stream.sendspace" - /* - * Test for PR 181741. Receiver sets LOCAL_CREDS, and kernel - * prepends a control message to the data. Sender sends large - * payload. Payload + SCM_RIGHTS + LOCAL_CREDS hit socket buffer - * limit, and receiver receives truncated data. - */ - test = "test8-rights+creds+payload"; - printf("beginning %s\n", test); - - { - const int on = 1; - u_long sendspace; - size_t len; - void *buf; - - len = sizeof(sendspace); - if (sysctlbyname("net.local.stream.sendspace", &sendspace, - &len, NULL, 0) < 0) - err(-1, "%s: sysctlbyname(net.local.stream.sendspace)", - test); - - if ((buf = calloc(1, sendspace)) == NULL) - err(-1, "%s: calloc", test); - - domainsocketpair(test, fd); - if (setsockopt(fd[1], 0, LOCAL_CREDS, &on, sizeof(on)) < 0) - err(-1, "%s: setsockopt(LOCAL_CREDS)", test); - tempfile(test, &putfd_1); - sendfd_payload(test, fd[0], putfd_1, buf, sendspace); - recvfd_payload(test, fd[1], &getfd_1, buf, sendspace); - close(putfd_1); - close(getfd_1); - closesocketpair(fd); - } +/* + * Test for PR 181741. Receiver sets LOCAL_CREDS, and kernel prepends a + * control message to the data. Sender sends large payload. + * Payload + SCM_RIGHTS + LOCAL_CREDS hit socket buffer limit, and receiver + * receives truncated data. + */ +ATF_TC_WITHOUT_HEAD(rights_creds_payload); +ATF_TC_BODY(rights_creds_payload, tc) +{ + const int on = 1; + u_long sendspace; + size_t len; + void *buf; + int fd[2], getfd, putfd, rc; + + atf_tc_expect_fail("PR 181741: Packet loss when 'control' messages " + "are present with large data"); + + len = sizeof(sendspace); + rc = sysctlbyname(LOCAL_SENDSPACE_SYSCTL, &sendspace, + &len, NULL, 0); + ATF_REQUIRE_MSG(rc != -1, + "sysctl %s failed: %s", LOCAL_SENDSPACE_SYSCTL, strerror(errno)); + + buf = calloc(1, sendspace); + ATF_REQUIRE(buf != NULL); + + domainsocketpair(fd); + rc = setsockopt(fd[1], 0, LOCAL_CREDS, &on, sizeof(on)); + ATF_REQUIRE_MSG(rc != -1, "setsockopt(LOCAL_CREDS) failed: %s", + strerror(errno)); + tempfile(&putfd); + sendfd_payload(fd[0], putfd, buf, sendspace); + recvfd_payload(fd[1], &getfd, buf, sendspace); + close(putfd); + close(getfd); + closesocketpair(fd); +} + +ATF_TP_ADD_TCS(tp) +{ - printf("%s passed\n", test); + ATF_TP_ADD_TC(tp, simple_send_fd); + ATF_TP_ADD_TC(tp, send_and_close); + ATF_TP_ADD_TC(tp, send_and_cancel); + ATF_TP_ADD_TC(tp, two_files); + ATF_TP_ADD_TC(tp, bundle); + ATF_TP_ADD_TC(tp, bundle_cancel); + ATF_TP_ADD_TC(tp, devfs_orphan); + ATF_TP_ADD_TC(tp, rights_creds_payload); - return (0); + return (atf_no_error()); } From owner-svn-src-head@freebsd.org Wed Dec 30 12:51: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 124B6A51AA1 for ; Wed, 30 Dec 2015 12:51:09 +0000 (UTC) (envelope-from bounces+73574-9504-svn-src-head=freebsd.org@sendgrid.net) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) (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 CD60217D3 for ; Wed, 30 Dec 2015 12:51:08 +0000 (UTC) (envelope-from bounces+73574-9504-svn-src-head=freebsd.org@sendgrid.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=subject:to:references:from:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=NUhqSNknvDpLOOJptHWGD6wSthg=; b=ugcrDODEhC+ssBjkoL ERCRpeGDetHQpCTULCsddL01V6uPHhZrTGAW9SMcSzCaSsW7+ZzhnR6TnBa2sn5j EnRgMRn9SEQ1HgdaFoVOEceqT9lXGAtVTjqWNIoRq2dB22yDjOXN8Ng2CYxwa0bR VlfuOA1xaMys5aszUGylQRioM= Received: by filter0801p1mdw1.sendgrid.net with SMTP id filter0801p1mdw1.20274.5683D33339 2015-12-30 12:50:59.598845677 +0000 UTC Received: from mail.tarsnap.com (ec2-54-86-246-204.compute-1.amazonaws.com [54.86.246.204]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id j9UwW4T2TIuQX_ssmO1h8w for ; Wed, 30 Dec 2015 12:50:59.420 +0000 (UTC) Received: (qmail 57449 invoked from network); 30 Dec 2015 12:48:51 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 30 Dec 2015 12:48:51 -0000 Received: (qmail 47191 invoked from network); 30 Dec 2015 12:50:45 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 30 Dec 2015 12:50:45 -0000 Subject: Re: svn commit: r289421 - in head/etc: . mtree ntp To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, edwin@freebsd.org, Xin Li References: <201510161404.t9GE4GqM046436@repo.freebsd.org> From: Colin Percival Message-ID: <5683D325.6020409@freebsd.org> Date: Wed, 30 Dec 2015 04:50:45 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201510161404.t9GE4GqM046436@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SG-EID: EvYvoie/qnEezyq2t4eRKjDm9X7ZKbCMt75WvXA+XNG5gIQYvt7vGdzIh7+3rqPW1pg3NtwwJI3Cuw +ptJU2tGC1VTxgIk8oZ7sQ2mBFlZCPJVjIIFYHQ2LVcxRGlCkeSOkk+2XxxKbUgX802NJwHo++w8zU WgKlTCvMLwKy7OYIeJ/WP2oONvGSxtcR6A5xNrFtrPYUOCp//5hkMau/b5fAd1Vpi/A9O/fYu3CoxH U= 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, 30 Dec 2015 12:51:09 -0000 On 10/16/15 07:04, Cy Schubert wrote: > Add default leap-seconds file. This should help ntp networks get the > leap second date correct > > Added: > head/etc/ntp/ > head/etc/ntp/Makefile (contents, props changed) > head/etc/ntp/leap-seconds (contents, props changed) So... is someone going to be keeping this file up to date? We seem to have the same information in contrib/tzdata/leapseconds (which is being kept up to date -- thank you edwin and delphij!) but having this file in /etc/ntp/ being out of date is making ntpd refuse to start. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@freebsd.org Wed Dec 30 13:49: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 3A21AA55CAE; Wed, 30 Dec 2015 13:49:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 11E871489; Wed, 30 Dec 2015 13:49:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUDnLQr086527; Wed, 30 Dec 2015 13:49:21 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUDnKmG086521; Wed, 30 Dec 2015 13:49:20 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512301349.tBUDnKmG086521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 30 Dec 2015 13:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292943 - in head/sys: kern sparc64/include 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: Wed, 30 Dec 2015 13:49:22 -0000 Author: marius Date: Wed Dec 30 13:49:20 2015 New Revision: 292943 URL: https://svnweb.freebsd.org/changeset/base/292943 Log: - (Ab)use udivx for dividing the u_int pc_cpuid when implementing CPU_ISSET(), CPU_SET etc. in sparc64 asm. This approach has the benefit of not clobbering %y, allowing to revert r222827 and partially r222828. - In r222828, CATR() already was changed to use the equivalent of PCPU_GET(cpuid) instead of the MD module ID for KTR_CPU, so belatedly also catch up with the C side of ktr(9). Originally, in r203838 CATR() was moved away from directly reading the module ID or equivalent as that became impractical with other CPU types than USI/II supported. With r222828 in place, per-CPU data generally is set up soon enough, though, that employing PCPU things in ktr(9) also for use during early stages works. - Unfortunately, an exception to the latter is the ktr(9) use in pmap_bootstrap(), which actually is run so early that even checking for bootverbose being set via the loader doesn't work. Consequently, replace the ktr(9) use in pmap_bootstrap() with OF_printf(9) and put it under #ifdef DIAGNOSTIC instead. MFC after: 3 days Modified: head/sys/kern/kern_ktr.c head/sys/sparc64/include/ktr.h head/sys/sparc64/sparc64/exception.S head/sys/sparc64/sparc64/mp_exception.S head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/swtch.S Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/kern/kern_ktr.c Wed Dec 30 13:49:20 2015 (r292943) @@ -55,9 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __sparc64__ -#include -#endif #ifdef DDB #include Modified: head/sys/sparc64/include/ktr.h ============================================================================== --- head/sys/sparc64/include/ktr.h Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/sparc64/include/ktr.h Wed Dec 30 13:49:20 2015 (r292943) @@ -34,14 +34,10 @@ #include -#ifndef LOCORE - -#define KTR_CPU PCPU_GET(mid) - -#else +#ifdef LOCORE /* - * XXX could really use another register... + * XXX could really use another register ... */ #define ATR(desc, r1, r2, r3, l1, l2) \ .sect .rodata ; \ @@ -70,9 +66,6 @@ l2: add r2, 1, r3 ; \ SET(l1 ## b, r3, r2) ; \ stx r2, [r1 + KTR_DESC] -/* - * NB: this clobbers %y. - */ #define CATR(mask, desc, r1, r2, r3, l1, l2, l3) \ setx mask, r3, r1 ; \ setx ktr_mask, r3, r2 ; \ @@ -82,16 +75,14 @@ l2: add r2, 1, r3 ; \ nop ; \ lduw [PCPU(CPUID)], r2 ; \ mov _NCPUBITS, r3 ; \ - mov %g0, %y ; \ - udiv r2, r3, r2 ; \ + udivx r2, r3, r2 ; \ srl r2, 0, r2 ; \ sllx r2, PTR_SHIFT, r2 ; \ SET(ktr_cpumask, r3, r1) ; \ ldx [r1 + r2], r1 ; \ lduw [PCPU(CPUID)], r2 ; \ mov _NCPUBITS, r3 ; \ - mov %g0, %y ; \ - udiv r2, r3, r2 ; \ + udivx r2, r3, r2 ; \ srl r2, 0, r2 ; \ smul r2, r3, r3 ; \ lduw [PCPU(CPUID)], r2 ; \ Modified: head/sys/sparc64/sparc64/exception.S ============================================================================== --- head/sys/sparc64/sparc64/exception.S Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/sparc64/sparc64/exception.S Wed Dec 30 13:49:20 2015 (r292943) @@ -2628,9 +2628,9 @@ ENTRY(tl0_ret) andn %l4, TSTATE_CWP_MASK, %g2 /* - * Save %y in an alternate global. + * Restore %y. Could also be below if we had more alternate globals. */ - mov %l5, %g4 + wr %l5, 0, %y /* * Setup %wstate for return. We need to restore the user window state @@ -2675,8 +2675,8 @@ tl0_ret_fill: * Fixup %tstate so the saved %cwp points to the current window and * restore it. */ - rdpr %cwp, %g1 - wrpr %g2, %g1, %tstate + rdpr %cwp, %g4 + wrpr %g2, %g4, %tstate /* * Restore the user window state. The transition bit was set above @@ -2686,25 +2686,20 @@ tl0_ret_fill: #if KTR_COMPILE & KTR_TRAP CATR(KTR_TRAP, "tl0_ret: td=%#lx pil=%#lx pc=%#lx npc=%#lx sp=%#lx" - , %g1, %g2, %g3, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g2 - stx %g2, [%g1 + KTR_PARM1] - rdpr %pil, %g2 - stx %g2, [%g1 + KTR_PARM2] - rdpr %tpc, %g2 - stx %g2, [%g1 + KTR_PARM3] - rdpr %tnpc, %g2 - stx %g2, [%g1 + KTR_PARM4] - stx %sp, [%g1 + KTR_PARM5] + , %g2, %g3, %g4, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g3 + stx %g3, [%g2 + KTR_PARM1] + rdpr %pil, %g3 + stx %g3, [%g2 + KTR_PARM2] + rdpr %tpc, %g3 + stx %g3, [%g2 + KTR_PARM3] + rdpr %tnpc, %g3 + stx %g3, [%g2 + KTR_PARM4] + stx %sp, [%g2 + KTR_PARM5] 9: #endif /* - * Restore %y. Note that the CATR above clobbered it. - */ - wr %g4, 0, %y - - /* * Return to usermode. */ retry @@ -2718,11 +2713,6 @@ tl0_ret_fill_end: stx %l6, [%l0 + KTR_PARM2] stx %sp, [%l0 + KTR_PARM3] 9: - - /* - * Restore %y clobbered by the CATR. This was saved in %l5 above. - */ - wr %l5, 0, %y #endif /* @@ -2890,36 +2880,34 @@ ENTRY(tl1_ret) andn %l0, TSTATE_CWP_MASK, %g1 mov %l1, %g2 mov %l2, %g3 - mov %l4, %g4 wrpr %l3, 0, %pil + wr %l4, 0, %y restore wrpr %g0, 2, %tl + rdpr %cwp, %g4 + wrpr %g1, %g4, %tstate wrpr %g2, 0, %tpc wrpr %g3, 0, %tnpc - rdpr %cwp, %g2 - wrpr %g1, %g2, %tstate #if KTR_COMPILE & KTR_TRAP CATR(KTR_TRAP, "tl1_ret: td=%#lx pil=%#lx ts=%#lx pc=%#lx sp=%#lx" - , %g1, %g2, %g3, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g2 - stx %g2, [%g1 + KTR_PARM1] - rdpr %pil, %g2 - stx %g2, [%g1 + KTR_PARM2] - rdpr %tstate, %g2 - stx %g2, [%g1 + KTR_PARM3] - rdpr %tpc, %g2 - stx %g2, [%g1 + KTR_PARM4] - stx %sp, [%g1 + KTR_PARM5] + , %g2, %g3, %g4, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g3 + stx %g3, [%g2 + KTR_PARM1] + rdpr %pil, %g3 + stx %g3, [%g2 + KTR_PARM2] + rdpr %tstate, %g3 + stx %g3, [%g2 + KTR_PARM3] + rdpr %tpc, %g3 + stx %g3, [%g2 + KTR_PARM4] + stx %sp, [%g2 + KTR_PARM5] 9: #endif - wr %g4, 0, %y - retry END(tl1_ret) @@ -3020,35 +3008,33 @@ ENTRY(tl1_intr) andn %l0, TSTATE_CWP_MASK, %g1 mov %l1, %g2 mov %l2, %g3 - mov %l4, %g4 wrpr %l3, 0, %pil + wr %l4, 0, %y restore wrpr %g0, 2, %tl + rdpr %cwp, %g4 + wrpr %g1, %g4, %tstate wrpr %g2, 0, %tpc wrpr %g3, 0, %tnpc - rdpr %cwp, %g2 - wrpr %g1, %g2, %tstate #if KTR_COMPILE & KTR_INTR CATR(KTR_INTR, "tl1_intr: td=%#x pil=%#lx ts=%#lx pc=%#lx sp=%#lx" - , %g1, %g2, %g3, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g2 - stx %g2, [%g1 + KTR_PARM1] - rdpr %pil, %g2 - stx %g2, [%g1 + KTR_PARM2] - rdpr %tstate, %g2 - stx %g2, [%g1 + KTR_PARM3] - rdpr %tpc, %g2 - stx %g2, [%g1 + KTR_PARM4] - stx %sp, [%g1 + KTR_PARM5] + , %g2, %g3, %g4, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g3 + stx %g3, [%g2 + KTR_PARM1] + rdpr %pil, %g3 + stx %g3, [%g2 + KTR_PARM2] + rdpr %tstate, %g3 + stx %g3, [%g2 + KTR_PARM3] + rdpr %tpc, %g3 + stx %g3, [%g2 + KTR_PARM4] + stx %sp, [%g2 + KTR_PARM5] 9: #endif - wr %g4, 0, %y - retry END(tl1_intr) Modified: head/sys/sparc64/sparc64/mp_exception.S ============================================================================== --- head/sys/sparc64/sparc64/mp_exception.S Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/sparc64/sparc64/mp_exception.S Wed Dec 30 13:49:20 2015 (r292943) @@ -38,12 +38,10 @@ __FBSDID("$FreeBSD$"); .register %g2, #ignore .register %g3, #ignore -#define IPI_DONE(r1, r2, r3, r4, r5, r6) \ - rd %y, r6 ; \ +#define IPI_DONE(r1, r2, r3, r4, r5) \ lduw [PCPU(CPUID)], r2 ; \ mov _NCPUBITS, r3 ; \ - mov %g0, %y ; \ - udiv r2, r3, r4 ; \ + udivx r2, r3, r4 ; \ srl r4, 0, r5 ; \ sllx r5, PTR_SHIFT, r5 ; \ add r1, r5, r1 ; \ @@ -51,7 +49,6 @@ __FBSDID("$FreeBSD$"); sub r2, r3, r3 ; \ mov 1, r4 ; \ sllx r4, r3, r4 ; \ - wr r6, %y ; \ ATOMIC_CLEAR_LONG(r1, r2, r3, r4) /* @@ -89,7 +86,7 @@ ENTRY(tl_ipi_spitfire_dcache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_spitfire_dcache_page_inval) @@ -129,7 +126,7 @@ ENTRY(tl_ipi_spitfire_icache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_spitfire_icache_page_inval) @@ -160,7 +157,7 @@ ENTRY(tl_ipi_cheetah_dcache_page_inval) blt,a,pt %xcc, 1b nop - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_cheetah_dcache_page_inval) @@ -216,7 +213,7 @@ ENTRY(tl_ipi_tlb_page_demap) stxa %g0, [%g2] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_page_demap) @@ -259,7 +256,7 @@ ENTRY(tl_ipi_tlb_range_demap) blt,a,pt %xcc, 1b sethi %hi(KERNBASE), %g6 - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_range_demap) @@ -283,7 +280,7 @@ ENTRY(tl_ipi_tlb_context_demap) stxa %g0, [%g1] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_context_demap) @@ -295,7 +292,7 @@ ENTRY(tl_ipi_stick_rd) rd %asr24, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_stick_rd) @@ -307,6 +304,6 @@ ENTRY(tl_ipi_tick_rd) rd %tick, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tick_rd) Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/sparc64/sparc64/pmap.c Wed Dec 30 13:49:20 2015 (r292943) @@ -346,14 +346,18 @@ pmap_bootstrap(u_int cpu_impl) if (OF_getprop(pmem, "available", mra, sz) == -1) OF_panic("%s: getprop /memory/available", __func__); sz /= sizeof(*mra); - CTR0(KTR_PMAP, "pmap_bootstrap: physical memory"); +#ifdef DIAGNOSTIC + OF_printf("pmap_bootstrap: physical memory\n"); +#endif qsort(mra, sz, sizeof (*mra), mr_cmp); physsz = 0; getenv_quad("hw.physmem", &physmem); physmem = btoc(physmem); for (i = 0, j = 0; i < sz; i++, j += 2) { - CTR2(KTR_PMAP, "start=%#lx size=%#lx", mra[i].mr_start, +#ifdef DIAGNOSTIC + OF_printf("start=%#lx size=%#lx\n", mra[i].mr_start, mra[i].mr_size); +#endif if (physmem != 0 && btoc(physsz + mra[i].mr_size) >= physmem) { if (btoc(physsz) < physmem) { phys_avail[j] = mra[i].mr_start; @@ -617,13 +621,16 @@ pmap_bootstrap(u_int cpu_impl) __func__); sz /= sizeof(*translations); translations_size = sz; - CTR0(KTR_PMAP, "pmap_bootstrap: translations"); +#ifdef DIAGNOSTIC + OF_printf("pmap_bootstrap: translations\n"); +#endif qsort(translations, sz, sizeof (*translations), om_cmp); for (i = 0; i < sz; i++) { - CTR3(KTR_PMAP, - "translation: start=%#lx size=%#lx tte=%#lx", +#ifdef DIAGNOSTIC + OF_printf("translation: start=%#lx size=%#lx tte=%#lx\n", translations[i].om_start, translations[i].om_size, translations[i].om_tte); +#endif if ((translations[i].om_tte & TD_V) == 0) continue; if (translations[i].om_start < VM_MIN_PROM_ADDRESS || Modified: head/sys/sparc64/sparc64/swtch.S ============================================================================== --- head/sys/sparc64/sparc64/swtch.S Wed Dec 30 13:34:49 2015 (r292942) +++ head/sys/sparc64/sparc64/swtch.S Wed Dec 30 13:49:20 2015 (r292943) @@ -173,8 +173,7 @@ ENTRY(cpu_switch) * active on this CPU. */ mov _NCPUBITS, %l5 - mov %g0, %y - udiv %l3, %l5, %l6 + udivx %l3, %l5, %l6 srl %l6, 0, %l4 sllx %l4, PTR_SHIFT, %l4 add %l4, PM_ACTIVE, %l4 @@ -242,8 +241,7 @@ ENTRY(cpu_switch) * Mark the pmap as active on this CPU. */ mov _NCPUBITS, %l5 - mov %g0, %y - udiv %l3, %l5, %l6 + udivx %l3, %l5, %l6 srl %l6, 0, %l4 sllx %l4, PTR_SHIFT, %l4 add %l4, PM_ACTIVE, %l4 From owner-svn-src-head@freebsd.org Wed Dec 30 14:54: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 E38CDA55580; Wed, 30 Dec 2015 14:54:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B18751EDE; Wed, 30 Dec 2015 14:54:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUEs8dY008319; Wed, 30 Dec 2015 14:54:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUEs8sp008317; Wed, 30 Dec 2015 14:54:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512301454.tBUEs8sp008317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 30 Dec 2015 14:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292946 - head/sys/dev/mlx5/mlx5_en 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, 30 Dec 2015 14:54:10 -0000 Author: hselasky Date: Wed Dec 30 14:54:08 2015 New Revision: 292946 URL: https://svnweb.freebsd.org/changeset/base/292946 Log: 10G ER/LR should present itself as LR. MFC after: 1 week Submitted by: Shahar Klein Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 30 14:06:01 2015 (r292945) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 30 14:54:08 2015 (r292946) @@ -698,7 +698,7 @@ enum mlx5e_link_mode { MLX5E_56GBASE_R4 = 8, MLX5E_10GBASE_CR = 12, MLX5E_10GBASE_SR = 13, - MLX5E_10GBASE_ER = 14, + MLX5E_10GBASE_LR = 14, MLX5E_40GBASE_SR4 = 15, MLX5E_40GBASE_LR4 = 16, MLX5E_100GBASE_CR4 = 20, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 14:06:01 2015 (r292945) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 14:54:08 2015 (r292946) @@ -106,8 +106,8 @@ static const struct { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER] = { - .subtype = IFM_10G_ER, + [MLX5E_10GBASE_LR] = { + .subtype = IFM_10G_LR, .baudrate = IF_Gbps(10ULL), }, [MLX5E_40GBASE_SR4] = { From owner-svn-src-head@freebsd.org Wed Dec 30 14:57: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 2897DA55623; Wed, 30 Dec 2015 14:57:44 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EB3C5108C; Wed, 30 Dec 2015 14:57:43 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUEvha8008480; Wed, 30 Dec 2015 14:57:43 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUEvhIJ008479; Wed, 30 Dec 2015 14:57:43 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512301457.tBUEvhIJ008479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 30 Dec 2015 14:57:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292947 - head/sbin/reboot 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, 30 Dec 2015 14:57:44 -0000 Author: smh Date: Wed Dec 30 14:57:42 2015 New Revision: 292947 URL: https://svnweb.freebsd.org/changeset/base/292947 Log: Fix use of uninitialised Nflag Initialise Nflag to 0 preventing use of uninitialised value. Reported by: uqs MFC after: 1 week X-MFC-With: r292266 Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D4449 Modified: head/sbin/reboot/reboot.c Modified: head/sbin/reboot/reboot.c ============================================================================== --- head/sbin/reboot/reboot.c Wed Dec 30 14:54:08 2015 (r292946) +++ head/sbin/reboot/reboot.c Wed Dec 30 14:57:42 2015 (r292947) @@ -76,7 +76,7 @@ main(int argc, char *argv[]) howto = RB_HALT; } else howto = 0; - lflag = nflag = qflag = 0; + lflag = nflag = qflag = Nflag = 0; while ((ch = getopt(argc, argv, "dk:lNnpqr")) != -1) switch(ch) { case 'd': From owner-svn-src-head@freebsd.org Wed Dec 30 14:58: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 0C0A1A5569D; Wed, 30 Dec 2015 14:58:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B67601251; Wed, 30 Dec 2015 14:58:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUEwtKV008562; Wed, 30 Dec 2015 14:58:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUEwtoJ008561; Wed, 30 Dec 2015 14:58:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512301458.tBUEwtoJ008561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 30 Dec 2015 14:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292948 - head/sys/dev/mlx5/mlx5_en 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, 30 Dec 2015 14:58:57 -0000 Author: hselasky Date: Wed Dec 30 14:58:55 2015 New Revision: 292948 URL: https://svnweb.freebsd.org/changeset/base/292948 Log: Allow I2C to read address 0x51 as well as address 0x50. MFC after: 1 week Submitted by: Shahar Klein Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 14:57:42 2015 (r292947) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 14:58:55 2015 (r292948) @@ -2298,6 +2298,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co int size_read = 0; int module_num; int max_mtu; + uint8_t read_addr; priv = ifp->if_softc; @@ -2484,11 +2485,21 @@ out: } /* - * Note that we ignore i2c.addr here. The driver hardcodes - * the address to 0x50, while standard expects it to be 0xA0. + * Currently 0XA0 and 0xA2 are the only addresses permitted. + * The internal conversion is as follows: */ + if (i2c.dev_addr == 0xA0) + read_addr = MLX5E_I2C_ADDR_LOW; + else if (i2c.dev_addr == 0xA2) + read_addr = MLX5E_I2C_ADDR_HIGH; + else { + if_printf(ifp, "Query eeprom failed, " + "Invalid Address: %X\n", i2c.dev_addr); + error = EINVAL; + goto err_i2c; + } error = mlx5_query_eeprom(priv->mdev, - MLX5E_I2C_ADDR_LOW, MLX5E_EEPROM_LOW_PAGE, + read_addr, MLX5E_EEPROM_LOW_PAGE, (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num, (uint32_t *)i2c.data, &size_read); if (error) { @@ -2499,7 +2510,7 @@ out: if (i2c.len > MLX5_EEPROM_MAX_BYTES) { error = mlx5_query_eeprom(priv->mdev, - MLX5E_I2C_ADDR_LOW, MLX5E_EEPROM_LOW_PAGE, + read_addr, MLX5E_EEPROM_LOW_PAGE, (uint32_t)(i2c.offset + size_read), (uint32_t)(i2c.len - size_read), module_num, (uint32_t *)(i2c.data + size_read), &size_read); From owner-svn-src-head@freebsd.org Wed Dec 30 15:01: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 65915A55853; Wed, 30 Dec 2015 15:01:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 41825184D; Wed, 30 Dec 2015 15:01:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUF1lxO010778; Wed, 30 Dec 2015 15:01:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUF1lef010775; Wed, 30 Dec 2015 15:01:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512301501.tBUF1lef010775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 30 Dec 2015 15:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292949 - head/sys/dev/mlx5/mlx5_en 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, 30 Dec 2015 15:01:48 -0000 Author: hselasky Date: Wed Dec 30 15:01:47 2015 New Revision: 292949 URL: https://svnweb.freebsd.org/changeset/base/292949 Log: Add support for modifying coalescing parameters runtime. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 30 14:58:55 2015 (r292948) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 30 15:01:47 2015 (r292949) @@ -787,5 +787,6 @@ void mlx5e_create_stats(struct sysctl_ct struct sysctl_oid_list *, const char *, const char **, unsigned, u64 *); void mlx5e_send_nop(struct mlx5e_sq *, u32, bool); +int mlx5e_refresh_channel_params(struct mlx5e_priv *); #endif /* _MLX5_EN_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 30 14:58:55 2015 (r292948) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 30 15:01:47 2015 (r292949) @@ -69,12 +69,49 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG } else { error = 0; } - /* check if device is gone */ if (priv->gone) { error = ENXIO; goto done; } + /* import RX coal time */ + if (priv->params_ethtool.rx_coalesce_usecs < 1) + priv->params_ethtool.rx_coalesce_usecs = 0; + else if (priv->params_ethtool.rx_coalesce_usecs > + MLX5E_FLD_MAX(cqc, cq_period)) { + priv->params_ethtool.rx_coalesce_usecs = + MLX5E_FLD_MAX(cqc, cq_period); + } + priv->params.rx_cq_moderation_usec = priv->params_ethtool.rx_coalesce_usecs; + + /* import RX coal pkts */ + if (priv->params_ethtool.rx_coalesce_pkts < 1) + priv->params_ethtool.rx_coalesce_pkts = 0; + else if (priv->params_ethtool.rx_coalesce_pkts > + MLX5E_FLD_MAX(cqc, cq_max_count)) { + priv->params_ethtool.rx_coalesce_pkts = + MLX5E_FLD_MAX(cqc, cq_max_count); + } + priv->params.rx_cq_moderation_pkts = priv->params_ethtool.rx_coalesce_pkts; + + /* import TX coal time */ + if (priv->params_ethtool.tx_coalesce_usecs < 1) + priv->params_ethtool.tx_coalesce_usecs = 0; + else if (priv->params_ethtool.tx_coalesce_usecs > + MLX5E_FLD_MAX(cqc, cq_period)) { + priv->params_ethtool.tx_coalesce_usecs = + MLX5E_FLD_MAX(cqc, cq_period); + } + priv->params.tx_cq_moderation_usec = priv->params_ethtool.tx_coalesce_usecs; + + /* import TX coal pkts */ + if (priv->params_ethtool.tx_coalesce_pkts < 1) + priv->params_ethtool.tx_coalesce_pkts = 0; + else if (priv->params_ethtool.tx_coalesce_pkts > + MLX5E_FLD_MAX(cqc, cq_max_count)) { + priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, cq_max_count); + } + priv->params.tx_cq_moderation_pkts = priv->params_ethtool.tx_coalesce_pkts; if (&priv->params_ethtool.arg[arg2] == &priv->params_ethtool.rx_pauseframe_control || &priv->params_ethtool.arg[arg2] == &priv->params_ethtool.tx_pauseframe_control) { @@ -92,9 +129,19 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG } was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); - if (was_opened) - mlx5e_close_locked(priv->ifp); + if (was_opened) { + u64 *xarg = priv->params_ethtool.arg + arg2; + if (xarg == &priv->params_ethtool.tx_coalesce_pkts || + xarg == &priv->params_ethtool.rx_coalesce_pkts || + xarg == &priv->params_ethtool.tx_coalesce_usecs || + xarg == &priv->params_ethtool.rx_coalesce_usecs) { + /* avoid downing and upping the network interface */ + error = mlx5e_refresh_channel_params(priv); + goto done; + } + mlx5e_close_locked(priv->ifp); + } /* import TX queue size */ if (priv->params_ethtool.tx_queue_size < (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) { @@ -145,45 +192,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG priv->params_ethtool.tx_coalesce_mode = 1; priv->params.tx_cq_moderation_mode = priv->params_ethtool.tx_coalesce_mode; - /* import RX coal time */ - if (priv->params_ethtool.rx_coalesce_usecs < 1) - priv->params_ethtool.rx_coalesce_usecs = 0; - else if (priv->params_ethtool.rx_coalesce_usecs > - MLX5E_FLD_MAX(cqc, cq_period)) { - priv->params_ethtool.rx_coalesce_usecs = - MLX5E_FLD_MAX(cqc, cq_period); - } - priv->params.rx_cq_moderation_usec = priv->params_ethtool.rx_coalesce_usecs; - - /* import RX coal pkts */ - if (priv->params_ethtool.rx_coalesce_pkts < 1) - priv->params_ethtool.rx_coalesce_pkts = 0; - else if (priv->params_ethtool.rx_coalesce_pkts > - MLX5E_FLD_MAX(cqc, cq_max_count)) { - priv->params_ethtool.rx_coalesce_pkts = - MLX5E_FLD_MAX(cqc, cq_max_count); - } - priv->params.rx_cq_moderation_pkts = priv->params_ethtool.rx_coalesce_pkts; - - /* import TX coal time */ - if (priv->params_ethtool.tx_coalesce_usecs < 1) - priv->params_ethtool.tx_coalesce_usecs = 0; - else if (priv->params_ethtool.tx_coalesce_usecs > - MLX5E_FLD_MAX(cqc, cq_period)) { - priv->params_ethtool.tx_coalesce_usecs = - MLX5E_FLD_MAX(cqc, cq_period); - } - priv->params.tx_cq_moderation_usec = priv->params_ethtool.tx_coalesce_usecs; - - /* import TX coal pkts */ - if (priv->params_ethtool.tx_coalesce_pkts < 1) - priv->params_ethtool.tx_coalesce_pkts = 0; - else if (priv->params_ethtool.tx_coalesce_pkts > - MLX5E_FLD_MAX(cqc, cq_max_count)) { - priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, cq_max_count); - } - priv->params.tx_cq_moderation_pkts = priv->params_ethtool.tx_coalesce_pkts; - /* we always agree to turn off HW LRO - but not always to turn on */ if (priv->params_ethtool.hw_lro) { if (priv->params_ethtool.hw_lro != 1) { Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 14:58:55 2015 (r292948) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 30 15:01:47 2015 (r292949) @@ -1712,6 +1712,62 @@ mlx5e_close_channels(struct mlx5e_priv * } static int +mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struct mlx5e_sq *sq) +{ + return (mlx5_core_modify_cq_moderation(priv->mdev, &sq->cq.mcq, + priv->params.tx_cq_moderation_usec, + priv->params.tx_cq_moderation_pkts)); +} + +static int +mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struct mlx5e_rq *rq) +{ + return (mlx5_core_modify_cq_moderation(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts)); +} + +static int +mlx5e_refresh_channel_params_sub(struct mlx5e_priv *priv, struct mlx5e_channel *c) +{ + int err; + int i; + + if (c == NULL) + return (EINVAL); + + err = mlx5e_refresh_rq_params(priv, &c->rq); + if (err) + goto done; + + for (i = 0; i != c->num_tc; i++) { + err = mlx5e_refresh_sq_params(priv, &c->sq[i]); + if (err) + goto done; + } +done: + return (err); +} + +int +mlx5e_refresh_channel_params(struct mlx5e_priv *priv) +{ + int i; + + if (priv->channel == NULL) + return (EINVAL); + + for (i = 0; i < priv->params.num_channels; i++) { + int err; + + err = mlx5e_refresh_channel_params_sub(priv, priv->channel[i]); + if (err) + return (err); + } + return (0); +} + +static int mlx5e_open_tis(struct mlx5e_priv *priv, int tc) { struct mlx5_core_dev *mdev = priv->mdev; From owner-svn-src-head@freebsd.org Wed Dec 30 16:04: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 98EC2A56F71 for ; Wed, 30 Dec 2015 16:04:59 +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 7CEDB194D for ; Wed, 30 Dec 2015 16:04:59 +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; Wed, 30 Dec 2015 16:05:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id tBUG4oxO018923; Wed, 30 Dec 2015 09:04:50 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451491490.1369.41.camel@freebsd.org> Subject: Re: svn commit: r289421 - in head/etc: . mtree ntp From: Ian Lepore To: Colin Percival , Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, edwin@freebsd.org, Xin Li Date: Wed, 30 Dec 2015 09:04:50 -0700 In-Reply-To: <5683D325.6020409@freebsd.org> References: <201510161404.t9GE4GqM046436@repo.freebsd.org> <5683D325.6020409@freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Wed, 30 Dec 2015 16:04:59 -0000 On Wed, 2015-12-30 at 04:50 -0800, Colin Percival wrote: > On 10/16/15 07:04, Cy Schubert wrote: > > Add default leap-seconds file. This should help ntp networks get > > the > > leap second date correct > > > > Added: > > head/etc/ntp/ > > head/etc/ntp/Makefile (contents, props changed) > > head/etc/ntp/leap-seconds (contents, props changed) > > So... is someone going to be keeping this file up to date? We seem > to have > the same information in contrib/tzdata/leapseconds (which is being > kept up > to date -- thank you edwin and delphij!) but having this file in > /etc/ntp/ > being out of date is making ntpd refuse to start. > I vaguely remember warning that something like this was likely to happen. Turning on leapfile processing by default without an already -in-place mechanism to keep the file up to date was a bad idea. There was some mumbling about a mechanism, but nobody wrote any code. Even if the mechanism existed, I think defaulting to using the leapfile is wrong. It's a thing that needs care and feeding or it causes problems, and thus it's a thing that should only be enabled by admins who know about the care and feeding aspect (an automatic fetch mechanism doesn't help much if there are firewalls blocking the fetch, for example). -- Ian From owner-svn-src-head@freebsd.org Wed Dec 30 16:14:32 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 82A7DA552C5; Wed, 30 Dec 2015 16:14:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3957E1E39; Wed, 30 Dec 2015 16:14:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUGEVgu032286; Wed, 30 Dec 2015 16:14:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUGEVJm032283; Wed, 30 Dec 2015 16:14:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201512301614.tBUGEVJm032283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 30 Dec 2015 16:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292950 - in head: contrib/llvm/patches contrib/llvm/tools/clang/tools/driver usr.bin/clang/clang 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, 30 Dec 2015 16:14:32 -0000 Author: dim Date: Wed Dec 30 16:14:30 2015 New Revision: 292950 URL: https://svnweb.freebsd.org/changeset/base/292950 Log: Drop the clang patch which adds recognition of 'CC' suffixes as aliases for --driver-mode=g++, since this was never upstreamed. For backwards compatibility, add a wrapper shell script. MFC after: 1 week Added: head/usr.bin/clang/clang/CC.sh (contents, props changed) Deleted: head/contrib/llvm/patches/patch-02-add-CC-aliases.diff Modified: head/contrib/llvm/tools/clang/tools/driver/driver.cpp head/usr.bin/clang/clang/Makefile Modified: head/contrib/llvm/tools/clang/tools/driver/driver.cpp ============================================================================== --- head/contrib/llvm/tools/clang/tools/driver/driver.cpp Wed Dec 30 15:01:47 2015 (r292949) +++ head/contrib/llvm/tools/clang/tools/driver/driver.cpp Wed Dec 30 16:14:30 2015 (r292950) @@ -214,13 +214,11 @@ static const DriverSuffix *FindDriverSuf {"clang", nullptr}, {"clang++", "--driver-mode=g++"}, {"clang-c++", "--driver-mode=g++"}, - {"clang-CC", "--driver-mode=g++"}, {"clang-cc", nullptr}, {"clang-cpp", "--driver-mode=cpp"}, {"clang-g++", "--driver-mode=g++"}, {"clang-gcc", nullptr}, {"clang-cl", "--driver-mode=cl"}, - {"CC", "--driver-mode=g++"}, {"cc", nullptr}, {"cpp", "--driver-mode=cpp"}, {"cl", "--driver-mode=cl"}, Added: head/usr.bin/clang/clang/CC.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/clang/CC.sh Wed Dec 30 16:14:30 2015 (r292950) @@ -0,0 +1,4 @@ +#!/bin/sh +# $FreeBSD$ +# This file is in the public domain. +exec /usr/bin/c++ "$@" Modified: head/usr.bin/clang/clang/Makefile ============================================================================== --- head/usr.bin/clang/clang/Makefile Wed Dec 30 15:01:47 2015 (r292949) +++ head/usr.bin/clang/clang/Makefile Wed Dec 30 16:14:30 2015 (r292950) @@ -18,9 +18,11 @@ LINKS= ${BINDIR}/clang ${BINDIR}/clang++ MLINKS= clang.1 clang++.1 \ clang.1 clang-cpp.1 .if ${MK_CLANG_IS_CC} != "no" +SCRIPTS=CC.sh +SCRIPTSNAME=CC + LINKS+= ${BINDIR}/clang ${BINDIR}/cc \ ${BINDIR}/clang ${BINDIR}/c++ \ - ${BINDIR}/clang ${BINDIR}/CC \ ${BINDIR}/clang ${BINDIR}/cpp MLINKS+= clang.1 cc.1 \ clang.1 c++.1 \ From owner-svn-src-head@freebsd.org Wed Dec 30 16:31: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 B502BA5597F; Wed, 30 Dec 2015 16:31:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 78AE11CCD; Wed, 30 Dec 2015 16:31:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5F48025D385E; Wed, 30 Dec 2015 16:31:37 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 041B4C76FE4; Wed, 30 Dec 2015 16:31:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id azXkCb3Q7dwa; Wed, 30 Dec 2015 16:31:35 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:6cc9:8940:35c:d8d5] (unknown [IPv6:fde9:577b:c1a9:4410:6cc9:8940:35c:d8d5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id B5146C76FD8; Wed, 30 Dec 2015 16:31:34 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292914 - in head: tests/sys/kern tools/regression/sockets/unix_passfd From: "Bjoern A. Zeeb" In-Reply-To: <201512301115.tBUBF7Wr038402@repo.freebsd.org> Date: Wed, 30 Dec 2015 16:31:14 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <9CE6F38D-FD5A-4EF0-BFA8-4002ED3519A2@FreeBSD.org> References: <201512301115.tBUBF7Wr038402@repo.freebsd.org> To: Garrett Cooper X-Mailer: Apple Mail (2.2104) 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, 30 Dec 2015 16:31:41 -0000 > On 30 Dec 2015, at 11:15 , Garrett Cooper wrote: >=20 > Author: ngie > Date: Wed Dec 30 11:15:07 2015 > New Revision: 292914 > URL: https://svnweb.freebsd.org/changeset/base/292914 >=20 > Log: > Integrate tools/regression/sockets/unix_passfd into the FreeBSD test > suite as tests/sys/kern/unix_passfd_test >=20 > - Convert testcases to ATF > - Fix an alignment issues > - Mark rights_creds_payload(..) as an expected failure (see PR # = 181741) >=20 > Based [in part] on the following Differential Revision: > https://reviews.freebsd.org/D689 >=20 > MFC after: 1 week > Submitted by: markj > Sponsored by: EMC / Isilon Storage Division n all gcc platforms this fails: /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c: In function = 'sendfd': /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:146: warning: = declaration of 'sendfd' shadows a global declaration /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:147: warning: = shadowed declaration is here /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c: In function = 'recvfd': /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:195: warning: = declaration of 'recvfd' shadows a global declaration /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:196: warning: = shadowed declaration is here From owner-svn-src-head@freebsd.org Wed Dec 30 17:10: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 20728A565D6; Wed, 30 Dec 2015 17:10:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DBF791D41; Wed, 30 Dec 2015 17:10:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUHA4Bd047626; Wed, 30 Dec 2015 17:10:04 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUHA4pO047625; Wed, 30 Dec 2015 17:10:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201512301710.tBUHA4pO047625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 30 Dec 2015 17:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292953 - 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: Wed, 30 Dec 2015 17:10:05 -0000 Author: bz Date: Wed Dec 30 17:10:03 2015 New Revision: 292953 URL: https://svnweb.freebsd.org/changeset/base/292953 Log: This code is not in modules that need KPI stability so no need to use the wrapper functions as used in r252511. We can directly use the locking macros. Reviewed by: jtl, rwatson MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4731 Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Dec 30 16:42:09 2015 (r292952) +++ head/sys/netinet6/in6.c Wed Dec 30 17:10:03 2015 (r292953) @@ -1552,7 +1552,7 @@ in6ifa_llaonifp(struct ifnet *ifp) if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) return (NULL); - if_addr_rlock(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1562,7 +1562,7 @@ in6ifa_llaonifp(struct ifnet *ifp) IN6_IS_ADDR_MC_NODELOCAL(&sin6->sin6_addr)) break; } - if_addr_runlock(ifp); + IF_ADDR_RUNLOCK(ifp); return ((struct in6_ifaddr *)ifa); } From owner-svn-src-head@freebsd.org Wed Dec 30 17:18: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 349B4A56833 for ; Wed, 30 Dec 2015 17:18:34 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 C2343130E for ; Wed, 30 Dec 2015 17:18:33 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x234.google.com with SMTP id f206so72291422wmf.0 for ; Wed, 30 Dec 2015 09:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=CBYO4LPWiVWT1JMw+DCcmXayAchdn7rY1LjjZ3bPQoE=; b=Z5HPilHB9JSOIaR8Eo66YtBrrGzdPuWlbqJvVLC2/6J6FYT3V6drh5K3B4Q0v33xSE AVMol32T1V/7QiqoW3toiCTfwLwDWlNq/b/U+++f5WpRnai29wgFiKih69OmcG6F6B5Y 42WliyxGY+nbbltIWsJZA48HKOmUqLJGu1kOFFm3FQXjom0x4fQZF+atoOPhK6a9BOpx X2rBHyH7t3bNsLOrhHoIwz5NxgvcG6py/ptLf+22z/Vprj/FzqKSGZhr9t87gsyaYnuA ncdqka3+GWuL95XWHrNPEu3Ni4Drao/+ZVtKdlKxorLkr9XZcDWusBHxIREPOwnSK9S3 7vsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=CBYO4LPWiVWT1JMw+DCcmXayAchdn7rY1LjjZ3bPQoE=; b=OB3hF+2VtfSJkw2PBx7kwQhixsBc0HT5id4XRVGBlXdstxvbi8IO0ZWj0h8V9EMgw5 eCwEV4igKm0ZVbr0HQreCMe1OL/3IusjC+9+Pf/4+fIxo0+TnSjONcscYVNsn5N7WmTW umfeWSt4G4Tcaa2qk305lpyUjxhSiltyhLMaoyA0HjjwpJTSvIJnpSdRJogH1DYMVARw tWkYvvFbFHqxYtnYctpRFIJfTjHt278EKnmwHDECYYeAUk1SN3XjwxVQzOBIHQ6wglHx TNAxAtht3AhKvgjldttPfPSMJLSRLKmozsRqDvIGuyBxMy13cFsxTDj2a/b3EyNig13A 7BFQ== X-Gm-Message-State: ALoCoQnJTQelw427d/NrR01Mcck/tyOGISNqEywAemeZR+kUxoBBNCV2s7mCfSFbHMFJYthePt28e9b+BoCP19cLkxZ/w/mWhfNsR93bMXahQQ3PJI1i+Zk= MIME-Version: 1.0 X-Received: by 10.194.202.163 with SMTP id kj3mr68176181wjc.93.1451495911246; Wed, 30 Dec 2015 09:18:31 -0800 (PST) Received: by 10.194.85.167 with HTTP; Wed, 30 Dec 2015 09:18:31 -0800 (PST) In-Reply-To: <201512271733.tBRHXxgN031823@repo.freebsd.org> References: <201512271733.tBRHXxgN031823@repo.freebsd.org> Date: Wed, 30 Dec 2015 18:18:31 +0100 Message-ID: Subject: Re: svn commit: r292782 - in head: lib/libcrypt lib/libmd sbin/gbde sbin/geom/class/eli sbin/md5 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/conf sys/crypto/sha2 sys/dev/random sys/geom/bde sys/... From: Oliver Pinter To: Allan Jude 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, 30 Dec 2015 17:18:34 -0000 On 12/27/15, Allan Jude wrote: > Author: allanjude > Date: Sun Dec 27 17:33:59 2015 > New Revision: 292782 > URL: https://svnweb.freebsd.org/changeset/base/292782 > > Log: > Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c > > cperciva's libmd implementation is 5-30% faster > > The same was done for SHA256 previously in r263218 > > cperciva's implementation was lacking SHA-384 which I implemented, > validated against OpenSSL and the NIST documentation > > Extend sbin/md5 to create sha384(1) > > Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with > sha512{c.c,.h} > > Reviewed by: cperciva, des, delphij > Approved by: secteam, bapt (mentor) > MFC after: 2 weeks > Sponsored by: ScaleEngine Inc. > Differential Revision: https://reviews.freebsd.org/D3929 > > Added: > head/sys/crypto/sha2/sha384.h (contents, props changed) > head/sys/crypto/sha2/sha512.h > - copied, changed from r292757, head/lib/libmd/sha512.h > head/sys/crypto/sha2/sha512c.c > - copied, changed from r289398, head/lib/libmd/sha512c.c > Deleted: > head/lib/libmd/sha512.h > head/lib/libmd/sha512c.c > head/sys/crypto/sha2/sha2.c > head/sys/crypto/sha2/sha2.h > Modified: > head/lib/libcrypt/Makefile > head/lib/libmd/Makefile > head/lib/libmd/sha512.3 > head/lib/libmd/shadriver.c > head/sbin/gbde/Makefile > head/sbin/gbde/gbde.c > head/sbin/geom/class/eli/Makefile > head/sbin/md5/Makefile > head/sbin/md5/md5.1 > head/sbin/md5/md5.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c > head/sys/conf/files > head/sys/crypto/sha2/sha256.h > head/sys/dev/random/build.sh > head/sys/dev/random/fortuna.c > head/sys/dev/random/hash.c > head/sys/dev/random/other_algorithm.c > head/sys/dev/random/randomdev.c > head/sys/dev/random/unit_test.c > head/sys/dev/random/yarrow.c > head/sys/geom/bde/g_bde.c > head/sys/geom/bde/g_bde_crypt.c > head/sys/geom/bde/g_bde_lock.c > head/sys/geom/bde/g_bde_work.c > head/sys/geom/eli/g_eli.h > head/sys/modules/crypto/Makefile > head/sys/modules/geom/geom_bde/Makefile > head/sys/modules/zfs/Makefile > head/sys/netinet/sctp_os_bsd.h > head/sys/opencrypto/xform.h > > Modified: head/lib/libcrypt/Makefile > Hi Allan! Could you please bump __FreeBSD_version after this change? This breaks the building of some external module, whose use the crypto/sha2/sha2.h file. From owner-svn-src-head@freebsd.org Wed Dec 30 17:36: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 4FC77A56CFF; Wed, 30 Dec 2015 17:36:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1BD0C1AE9; Wed, 30 Dec 2015 17:36:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUHaZuR056140; Wed, 30 Dec 2015 17:36:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUHaZlp056136; Wed, 30 Dec 2015 17:36:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201512301736.tBUHaZlp056136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Dec 2015 17:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292954 - in head/sys/arm64: arm64 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, 30 Dec 2015 17:36:36 -0000 Author: andrew Date: Wed Dec 30 17:36:34 2015 New Revision: 292954 URL: https://svnweb.freebsd.org/changeset/base/292954 Log: Decode and print the ID_AA64* registers on boot. These registers hold information on what the core supports. In most cases these will be identical across most CPUs in the SoC, however there may be the case where, with a big.LITTLE setup they may differ. In this case we print the decoded data on all CPUs. Reviewed by: kib Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D4725 Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/armreg.h head/sys/arm64/include/cpu.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Dec 30 17:10:03 2015 (r292953) +++ head/sys/arm64/arm64/identcpu.c Wed Dec 30 17:36:34 2015 (r292954) @@ -37,9 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include +static int ident_lock; + char machine[] = "arm64"; SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, @@ -56,6 +59,7 @@ SYSCTL_STRING(_hw, HW_MACHINE, machine, * Aff0 - CPU number in Aff1 cluster */ uint64_t __cpu_affinity[MAXCPU]; +static u_int cpu_aff_levels; struct cpu_desc { u_int cpu_impl; @@ -64,9 +68,32 @@ struct cpu_desc { u_int cpu_revision; const char *cpu_impl_name; const char *cpu_part_name; + + uint64_t mpidr; + uint64_t id_aa64afr0; + uint64_t id_aa64afr1; + uint64_t id_aa64dfr0; + uint64_t id_aa64dfr1; + uint64_t id_aa64isar0; + uint64_t id_aa64isar1; + uint64_t id_aa64mmfr0; + uint64_t id_aa64mmfr1; + uint64_t id_aa64pfr0; + uint64_t id_aa64pfr1; }; struct cpu_desc cpu_desc[MAXCPU]; +static u_int cpu_print_regs; +#define PRINT_ID_AA64_AFR0 0x00000001 +#define PRINT_ID_AA64_AFR1 0x00000002 +#define PRINT_ID_AA64_DFR0 0x00000004 +#define PRINT_ID_AA64_DFR1 0x00000008 +#define PRINT_ID_AA64_ISAR0 0x00000010 +#define PRINT_ID_AA64_ISAR1 0x00000020 +#define PRINT_ID_AA64_MMFR0 0x00000040 +#define PRINT_ID_AA64_MMFR1 0x00000080 +#define PRINT_ID_AA64_PFR0 0x00000100 +#define PRINT_ID_AA64_PFR1 0x00000200 struct cpu_parts { u_int part_id; @@ -124,7 +151,398 @@ const struct cpu_implementers cpu_implem CPU_IMPLEMENTER_NONE, }; -void identify_cpu(void); +void +print_cpu_features(u_int cpu) +{ + int printed; + + printf("CPU%3d: %s %s r%dp%d", cpu, cpu_desc[cpu].cpu_impl_name, + cpu_desc[cpu].cpu_part_name, cpu_desc[cpu].cpu_variant, + cpu_desc[cpu].cpu_revision); + + printf(" affinity:"); + switch(cpu_aff_levels) { + default: + case 4: + printf(" %2d", CPU_AFF3(cpu_desc[cpu].mpidr)); + /* FALLTHROUGH */ + case 3: + printf(" %2d", CPU_AFF2(cpu_desc[cpu].mpidr)); + /* FALLTHROUGH */ + case 2: + printf(" %2d", CPU_AFF1(cpu_desc[cpu].mpidr)); + /* FALLTHROUGH */ + case 1: + case 0: /* On UP this will be zero */ + printf(" %2d", CPU_AFF0(cpu_desc[cpu].mpidr)); + break; + } + printf("\n"); + + if (cpu != 0 && cpu_print_regs == 0) + return; + +#define SEP_STR ((printed++) == 0) ? "" : "," + + /* AArch64 Instruction Set Attribute Register 0 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR0) != 0) { + printed = 0; + printf(" Instruction Set Attributes 0 = <"); + switch (ID_AA64ISAR0_AES(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_AES_NONE: + break; + case ID_AA64ISAR0_AES_BASE: + printf("%sAES", SEP_STR); + break; + case ID_AA64ISAR0_AES_PMULL: + printf("%sAES+PMULL", SEP_STR); + break; + default: + printf("%sUnknown AES", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_SHA1(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_SHA1_NONE: + break; + case ID_AA64ISAR0_SHA1_BASE: + printf("%sSHA1", SEP_STR); + break; + default: + printf("%sUnknown SHA1", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_SHA2(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_SHA2_NONE: + break; + case ID_AA64ISAR0_SHA2_BASE: + printf("%sSHA2", SEP_STR); + break; + default: + printf("%sUnknown SHA2", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_CRC32(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_CRC32_NONE: + break; + case ID_AA64ISAR0_CRC32_BASE: + printf("%sCRC32", SEP_STR); + break; + default: + printf("%sUnknown CRC32", SEP_STR); + break; + } + + if ((cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK) != 0) + printf("%s%#lx", SEP_STR, + cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK); + + printf(">\n"); + } + + /* AArch64 Instruction Set Attribute Register 1 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR1) != 0) { + printf(" Instruction Set Attributes 1 = <%#lx>\n", + cpu_desc[cpu].id_aa64isar1); + } + + /* AArch64 Processor Feature Register 0 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR0) != 0) { + printed = 0; + printf(" Processor Features 0 = <"); + switch (ID_AA64PFR0_GIC(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_GIC_CPUIF_NONE: + break; + case ID_AA64PFR0_GIC_CPUIF_EN: + printf("%sGIC", SEP_STR); + break; + default: + printf("%sUnknown GIC interface", SEP_STR); + break; + } + + switch (ID_AA64PFR0_ADV_SIMD(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_ADV_SIMD_NONE: + break; + case ID_AA64PFR0_ADV_SIMD_IMPL: + printf("%sAdvSIMD", SEP_STR); + break; + default: + printf("%sUnknown AdvSIMD", SEP_STR); + break; + } + + switch (ID_AA64PFR0_FP(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_FP_NONE: + break; + case ID_AA64PFR0_FP_IMPL: + printf("%sFloat", SEP_STR); + break; + default: + printf("%sUnknown Float", SEP_STR); + break; + } + + switch (ID_AA64PFR0_EL3(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_EL3_NONE: + printf("%sNo EL3", SEP_STR); + break; + case ID_AA64PFR0_EL3_64: + printf("%sEL3", SEP_STR); + break; + case ID_AA64PFR0_EL3_64_32: + printf("%sEL3 32", SEP_STR); + break; + default: + printf("%sUnknown EL3", SEP_STR); + break; + } + + switch (ID_AA64PFR0_EL2(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_EL2_NONE: + printf("%sNo EL2", SEP_STR); + break; + case ID_AA64PFR0_EL2_64: + printf("%sEL2", SEP_STR); + break; + case ID_AA64PFR0_EL2_64_32: + printf("%sEL2 32", SEP_STR); + break; + default: + printf("%sUnknown EL2", SEP_STR); + break; + } + + switch (ID_AA64PFR0_EL1(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_EL1_64: + printf("%sEL1", SEP_STR); + break; + case ID_AA64PFR0_EL1_64_32: + printf("%sEL1 32", SEP_STR); + break; + default: + printf("%sUnknown EL1", SEP_STR); + break; + } + + switch (ID_AA64PFR0_EL0(cpu_desc[cpu].id_aa64pfr0)) { + case ID_AA64PFR0_EL0_64: + printf("%sEL0", SEP_STR); + break; + case ID_AA64PFR0_EL0_64_32: + printf("%sEL0 32", SEP_STR); + break; + default: + printf("%sUnknown EL0", SEP_STR); + break; + } + + if ((cpu_desc[cpu].id_aa64pfr0 & ~ID_AA64PFR0_MASK) != 0) + printf("%s%#lx", SEP_STR, + cpu_desc[cpu].id_aa64pfr0 & ~ID_AA64PFR0_MASK); + + printf(">\n"); + } + + /* AArch64 Processor Feature Register 1 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR1) != 0) { + printf(" Processor Features 1 = <%#lx>\n", + cpu_desc[cpu].id_aa64pfr1); + } + + /* AArch64 Memory Model Feature Register 0 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_MMFR0) != 0) { + printed = 0; + printf(" Memory Model Features 0 = <"); + switch (ID_AA64MMFR0_TGRAN4(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_TGRAN4_NONE: + break; + case ID_AA64MMFR0_TGRAN4_IMPL: + printf("%s4k Granule", SEP_STR); + break; + default: + printf("%sUnknown 4k Granule", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_TGRAN16(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_TGRAN16_NONE: + break; + case ID_AA64MMFR0_TGRAN16_IMPL: + printf("%s16k Granule", SEP_STR); + break; + default: + printf("%sUnknown 16k Granule", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_TGRAN64(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_TGRAN64_NONE: + break; + case ID_AA64MMFR0_TGRAN64_IMPL: + printf("%s64k Granule", SEP_STR); + break; + default: + printf("%sUnknown 64k Granule", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_BIGEND(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_BIGEND_FIXED: + break; + case ID_AA64MMFR0_BIGEND_MIXED: + printf("%sMixedEndian", SEP_STR); + break; + default: + printf("%sUnknown Endian switching", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_BIGEND_EL0(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_BIGEND_EL0_FIXED: + break; + case ID_AA64MMFR0_BIGEND_EL0_MIXED: + printf("%sEL0 MixEndian", SEP_STR); + break; + default: + printf("%sUnknown EL0 Endian switching", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_S_NS_MEM(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_S_NS_MEM_NONE: + break; + case ID_AA64MMFR0_S_NS_MEM_DISTINCT: + printf("%sS/NS Mem", SEP_STR); + break; + default: + printf("%sUnknown S/NS Mem", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_ASID_BITS(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_ASID_BITS_8: + printf("%s8bit ASID", SEP_STR); + break; + case ID_AA64MMFR0_ASID_BITS_16: + printf("%s16bit ASID", SEP_STR); + break; + default: + printf("%sUnknown ASID", SEP_STR); + break; + } + + switch (ID_AA64MMFR0_PA_RANGE(cpu_desc[cpu].id_aa64mmfr0)) { + case ID_AA64MMFR0_PA_RANGE_4G: + printf("%s4GB PA", SEP_STR); + break; + case ID_AA64MMFR0_PA_RANGE_64G: + printf("%s64GB PA", SEP_STR); + break; + case ID_AA64MMFR0_PA_RANGE_1T: + printf("%s1TB PA", SEP_STR); + break; + case ID_AA64MMFR0_PA_RANGE_4T: + printf("%s4TB PA", SEP_STR); + break; + case ID_AA64MMFR0_PA_RANGE_16T: + printf("%s16TB PA", SEP_STR); + break; + case ID_AA64MMFR0_PA_RANGE_256T: + printf("%s256TB PA", SEP_STR); + break; + default: + printf("%sUnknown PA Range", SEP_STR); + break; + } + + if ((cpu_desc[cpu].id_aa64mmfr0 & ~ID_AA64MMFR0_MASK) != 0) + printf("%s%#lx", SEP_STR, + cpu_desc[cpu].id_aa64mmfr0 & ~ID_AA64MMFR0_MASK); + printf(">\n"); + } + + /* AArch64 Memory Model Feature Register 1 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_MMFR1) != 0) { + printf(" Memory Model Features 1 = <%#lx>\n", + cpu_desc[cpu].id_aa64mmfr1); + } + + /* AArch64 Debug Feature Register 0 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_DFR0) != 0) { + printed = 0; + printf(" Debug Features 0 = <"); + printf("%s%lu CTX Breakpoints", SEP_STR, + ID_AA64DFR0_CTX_CMPS(cpu_desc[cpu].id_aa64dfr0)); + + printf("%s%lu Watchpoints", SEP_STR, + ID_AA64DFR0_WRPS(cpu_desc[cpu].id_aa64dfr0)); + + printf("%s%lu Breakpoints", SEP_STR, + ID_AA64DFR0_BRPS(cpu_desc[cpu].id_aa64dfr0)); + + switch (ID_AA64DFR0_PMU_VER(cpu_desc[cpu].id_aa64dfr0)) { + case ID_AA64DFR0_PMU_VER_NONE: + break; + case ID_AA64DFR0_PMU_VER_3: + printf("%sPMUv3", SEP_STR); + break; + case ID_AA64DFR0_PMU_VER_IMPL: + printf("%sImplementation defined PMU", SEP_STR); + break; + default: + printf("%sUnknown PMU", SEP_STR); + break; + } + + switch (ID_AA64DFR0_TRACE_VER(cpu_desc[cpu].id_aa64dfr0)) { + case ID_AA64DFR0_TRACE_VER_NONE: + break; + case ID_AA64DFR0_TRACE_VER_IMPL: + printf("%sTrace", SEP_STR); + break; + default: + printf("%sUnknown Trace", SEP_STR); + break; + } + + switch (ID_AA64DFR0_DEBUG_VER(cpu_desc[cpu].id_aa64dfr0)) { + case ID_AA64DFR0_DEBUG_VER_8: + printf("%sDebug v8", SEP_STR); + break; + default: + printf("%sUnknown Debug", SEP_STR); + break; + } + + if (cpu_desc[cpu].id_aa64dfr0 & ~ID_AA64DFR0_MASK) + printf("%s%#lx", SEP_STR, + cpu_desc[cpu].id_aa64dfr0 & ~ID_AA64DFR0_MASK); + printf(">\n"); + } + + /* AArch64 Memory Model Feature Register 1 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_DFR1) != 0) { + printf(" Debug Features 1 = <%#lx>\n", + cpu_desc[cpu].id_aa64dfr1); + } + + /* AArch64 Auxiliary Feature Register 0 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_AFR0) != 0) { + printf(" Auxiliary Features 0 = <%#lx>\n", + cpu_desc[cpu].id_aa64afr0); + } + + /* AArch64 Auxiliary Feature Register 1 */ + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_AFR1) != 0) { + printf(" Auxiliary Features 1 = <%#lx>\n", + cpu_desc[cpu].id_aa64afr1); + } + +#undef SEP_STR +} void identify_cpu(void) @@ -133,7 +551,6 @@ identify_cpu(void) u_int impl_id; u_int part_id; u_int cpu; - uint64_t mpidr; size_t i; const struct cpu_parts *cpu_partsp = NULL; @@ -171,19 +588,77 @@ identify_cpu(void) cpu_desc[cpu].cpu_variant = CPU_VAR(midr); /* Save affinity for current CPU */ - mpidr = get_mpidr(); - CPU_AFFINITY(cpu) = mpidr & CPU_AFF_MASK; + cpu_desc[cpu].mpidr = get_mpidr(); + CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; - /* Print details for boot CPU or if we want verbose output */ - if (cpu == 0 || bootverbose) { - printf("CPU(%d): %s %s r%dp%d\n", cpu, - cpu_desc[cpu].cpu_impl_name, - cpu_desc[cpu].cpu_part_name, - cpu_desc[cpu].cpu_variant, - cpu_desc[cpu].cpu_revision); - } + cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); + cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(id_aa64dfr1_el1); + cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1); + cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1); + cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); + cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1); + cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1); + + if (cpu != 0) { + /* + * This code must run on one cpu at a time, but we are + * not scheduling on the current core so implement a + * simple spinlock. + */ + while (atomic_cmpset_acq_int(&ident_lock, 0, 1) == 0) + __asm __volatile("wfe" ::: "memory"); + + switch (cpu_aff_levels) { + case 0: + if (CPU_AFF0(cpu_desc[cpu].mpidr) != + CPU_AFF0(cpu_desc[0].mpidr)) + cpu_aff_levels = 1; + /* FALLTHROUGH */ + case 1: + if (CPU_AFF1(cpu_desc[cpu].mpidr) != + CPU_AFF1(cpu_desc[0].mpidr)) + cpu_aff_levels = 2; + /* FALLTHROUGH */ + case 2: + if (CPU_AFF2(cpu_desc[cpu].mpidr) != + CPU_AFF2(cpu_desc[0].mpidr)) + cpu_aff_levels = 3; + /* FALLTHROUGH */ + case 3: + if (CPU_AFF3(cpu_desc[cpu].mpidr) != + CPU_AFF3(cpu_desc[0].mpidr)) + cpu_aff_levels = 4; + break; + } - if (bootverbose) - printf("CPU%u affinity: %u.%u.%u.%u\n", 0, CPU_AFF0(mpidr), - CPU_AFF1(mpidr), CPU_AFF2(mpidr), CPU_AFF3(mpidr)); + if (cpu_desc[cpu].id_aa64afr0 != cpu_desc[0].id_aa64afr0) + cpu_print_regs |= PRINT_ID_AA64_AFR0; + if (cpu_desc[cpu].id_aa64afr1 != cpu_desc[0].id_aa64afr1) + cpu_print_regs |= PRINT_ID_AA64_AFR1; + + if (cpu_desc[cpu].id_aa64dfr0 != cpu_desc[0].id_aa64dfr0) + cpu_print_regs |= PRINT_ID_AA64_DFR0; + if (cpu_desc[cpu].id_aa64dfr1 != cpu_desc[0].id_aa64dfr1) + cpu_print_regs |= PRINT_ID_AA64_DFR1; + + if (cpu_desc[cpu].id_aa64isar0 != cpu_desc[0].id_aa64isar0) + cpu_print_regs |= PRINT_ID_AA64_ISAR0; + if (cpu_desc[cpu].id_aa64isar1 != cpu_desc[0].id_aa64isar1) + cpu_print_regs |= PRINT_ID_AA64_ISAR1; + + if (cpu_desc[cpu].id_aa64mmfr0 != cpu_desc[0].id_aa64mmfr0) + cpu_print_regs |= PRINT_ID_AA64_MMFR0; + if (cpu_desc[cpu].id_aa64mmfr1 != cpu_desc[0].id_aa64mmfr1) + cpu_print_regs |= PRINT_ID_AA64_MMFR1; + + if (cpu_desc[cpu].id_aa64pfr0 != cpu_desc[0].id_aa64pfr0) + cpu_print_regs |= PRINT_ID_AA64_PFR0; + if (cpu_desc[cpu].id_aa64pfr1 != cpu_desc[0].id_aa64pfr1) + cpu_print_regs |= PRINT_ID_AA64_PFR1; + + /* Wake up the other CPUs */ + atomic_store_rel_int(&ident_lock, 0); + __asm __volatile("sev" ::: "memory"); + } } Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Wed Dec 30 17:10:03 2015 (r292953) +++ head/sys/arm64/arm64/mp_machdep.c Wed Dec 30 17:36:34 2015 (r292954) @@ -175,7 +175,7 @@ arm64_cpu_attach(device_t dev) static void release_aps(void *dummy __unused) { - int i; + int cpu, i; /* Setup the IPI handler */ for (i = 0; i < COUNT_IPI; i++) @@ -188,8 +188,14 @@ release_aps(void *dummy __unused) printf("Release APs\n"); for (i = 0; i < 2000; i++) { - if (smp_started) + if (smp_started) { + for (cpu = 0; cpu <= mp_maxid; cpu++) { + if (CPU_ABSENT(cpu)) + continue; + print_cpu_features(cpu); + } return; + } DELAY(1000); } Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Dec 30 17:10:03 2015 (r292953) +++ head/sys/arm64/include/armreg.h Wed Dec 30 17:36:34 2015 (r292954) @@ -121,19 +121,147 @@ /* ICC_SRE_EL2 */ #define ICC_SRE_EL2_EN (1U << 3) +/* ID_AA64DFR0_EL1 */ +#define ID_AA64DFR0_MASK 0xf0f0ffff +#define ID_AA64DFR0_DEBUG_VER_SHIFT 0 +#define ID_AA64DFR0_DEBUG_VER_MASK (0xf << ID_AA64DFR0_DEBUG_VER_SHIFT) +#define ID_AA64DFR0_DEBUG_VER(x) ((x) & ID_AA64DFR0_DEBUG_VER_MASK) +#define ID_AA64DFR0_DEBUG_VER_8 (0x6 << ID_AA64DFR0_DEBUG_VER_SHIFT) +#define ID_AA64DFR0_TRACE_VER_SHIFT 4 +#define ID_AA64DFR0_TRACE_VER_MASK (0xf << ID_AA64DFR0_TRACE_VER_SHIFT) +#define ID_AA64DFR0_TRACE_VER(x) ((x) & ID_AA64DFR0_TRACE_VER_MASK) +#define ID_AA64DFR0_TRACE_VER_NONE (0x0 << ID_AA64DFR0_TRACE_VER_SHIFT) +#define ID_AA64DFR0_TRACE_VER_IMPL (0x1 << ID_AA64DFR0_TRACE_VER_SHIFT) +#define ID_AA64DFR0_PMU_VER_SHIFT 8 +#define ID_AA64DFR0_PMU_VER_MASK (0xf << ID_AA64DFR0_PMU_VER_SHIFT) +#define ID_AA64DFR0_PMU_VER(x) ((x) & ID_AA64DFR0_PMU_VER_MASK) +#define ID_AA64DFR0_PMU_VER_NONE (0x0 << ID_AA64DFR0_PMU_VER_SHIFT) +#define ID_AA64DFR0_PMU_VER_3 (0x1 << ID_AA64DFR0_PMU_VER_SHIFT) +#define ID_AA64DFR0_PMU_VER_IMPL (0xf << ID_AA64DFR0_PMU_VER_SHIFT) +#define ID_AA64DFR0_BRPS_SHIFT 12 +#define ID_AA64DFR0_BRPS_MASK (0xf << ID_AA64DFR0_BRPS_SHIFT) +#define ID_AA64DFR0_BRPS(x) \ + ((((x) >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) + 1) +#define ID_AA64DFR0_WRPS_SHIFT 20 +#define ID_AA64DFR0_WRPS_MASK (0xf << ID_AA64DFR0_WRPS_SHIFT) +#define ID_AA64DFR0_WRPS(x) \ + ((((x) >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) + 1) +#define ID_AA64DFR0_CTX_CMPS_SHIFT 28 +#define ID_AA64DFR0_CTX_CMPS_MASK (0xf << ID_AA64DFR0_CTX_CMPS_SHIFT) +#define ID_AA64DFR0_CTX_CMPS(x) \ + ((((x) >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) + 1) + +/* ID_AA64ISAR0_EL1 */ +#define ID_AA64ISAR0_MASK 0x000ffff0 +#define ID_AA64ISAR0_AES_SHIFT 4 +#define ID_AA64ISAR0_AES_MASK (0xf << ID_AA64ISAR0_AES_SHIFT) +#define ID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK) +#define ID_AA64ISAR0_AES_NONE (0x0 << ID_AA64ISAR0_AES_SHIFT) +#define ID_AA64ISAR0_AES_BASE (0x1 << ID_AA64ISAR0_AES_SHIFT) +#define ID_AA64ISAR0_AES_PMULL (0x2 << ID_AA64ISAR0_AES_SHIFT) +#define ID_AA64ISAR0_SHA1_SHIFT 8 +#define ID_AA64ISAR0_SHA1_MASK (0xf << ID_AA64ISAR0_SHA1_SHIFT) +#define ID_AA64ISAR0_SHA1(x) ((x) & ID_AA64ISAR0_SHA1_MASK) +#define ID_AA64ISAR0_SHA1_NONE (0x0 << ID_AA64ISAR0_SHA1_SHIFT) +#define ID_AA64ISAR0_SHA1_BASE (0x1 << ID_AA64ISAR0_SHA1_SHIFT) +#define ID_AA64ISAR0_SHA2_SHIFT 12 +#define ID_AA64ISAR0_SHA2_MASK (0xf << ID_AA64ISAR0_SHA2_SHIFT) +#define ID_AA64ISAR0_SHA2(x) ((x) & ID_AA64ISAR0_SHA2_MASK) +#define ID_AA64ISAR0_SHA2_NONE (0x0 << ID_AA64ISAR0_SHA2_SHIFT) +#define ID_AA64ISAR0_SHA2_BASE (0x1 << ID_AA64ISAR0_SHA2_SHIFT) +#define ID_AA64ISAR0_CRC32_SHIFT 16 +#define ID_AA64ISAR0_CRC32_MASK (0xf << ID_AA64ISAR0_CRC32_SHIFT) +#define ID_AA64ISAR0_CRC32(x) ((x) & ID_AA64ISAR0_CRC32_MASK) +#define ID_AA64ISAR0_CRC32_NONE (0x0 << ID_AA64ISAR0_CRC32_SHIFT) +#define ID_AA64ISAR0_CRC32_BASE (0x1 << ID_AA64ISAR0_CRC32_SHIFT) + +/* ID_AA64MMFR0_EL1 */ +#define ID_AA64MMFR0_MASK 0xffffffff +#define ID_AA64MMFR0_PA_RANGE_SHIFT 0 +#define ID_AA64MMFR0_PA_RANGE_MASK (0xf << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE(x) ((x) & ID_AA64MMFR0_PA_RANGE_MASK) +#define ID_AA64MMFR0_PA_RANGE_4G (0x0 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE_64G (0x1 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE_1T (0x2 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE_4T (0x3 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE_16T (0x4 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_PA_RANGE_256T (0x5 << ID_AA64MMFR0_PA_RANGE_SHIFT) +#define ID_AA64MMFR0_ASID_BITS_SHIFT 4 +#define ID_AA64MMFR0_ASID_BITS_MASK (0xf << ID_AA64MMFR0_ASID_BITS_SHIFT) +#define ID_AA64MMFR0_ASID_BITS(x) ((x) & ID_AA64MMFR0_ASID_BITS_MASK) +#define ID_AA64MMFR0_ASID_BITS_8 (0x0 << ID_AA64MMFR0_ASID_BITS_SHIFT) +#define ID_AA64MMFR0_ASID_BITS_16 (0x2 << ID_AA64MMFR0_ASID_BITS_SHIFT) +#define ID_AA64MMFR0_BIGEND_SHIFT 8 +#define ID_AA64MMFR0_BIGEND_MASK (0xf << ID_AA64MMFR0_BIGEND_SHIFT) +#define ID_AA64MMFR0_BIGEND(x) ((x) & ID_AA64MMFR0_BIGEND_MASK) +#define ID_AA64MMFR0_BIGEND_FIXED (0x0 << ID_AA64MMFR0_BIGEND_SHIFT) +#define ID_AA64MMFR0_BIGEND_MIXED (0x1 << ID_AA64MMFR0_BIGEND_SHIFT) +#define ID_AA64MMFR0_S_NS_MEM_SHIFT 12 +#define ID_AA64MMFR0_S_NS_MEM_MASK (0xf << ID_AA64MMFR0_S_NS_MEM_SHIFT) +#define ID_AA64MMFR0_S_NS_MEM(x) ((x) & ID_AA64MMFR0_S_NS_MEM_MASK) +#define ID_AA64MMFR0_S_NS_MEM_NONE (0x0 << ID_AA64MMFR0_S_NS_MEM_SHIFT) +#define ID_AA64MMFR0_S_NS_MEM_DISTINCT (0x1 << ID_AA64MMFR0_S_NS_MEM_SHIFT) +#define ID_AA64MMFR0_BIGEND_EL0_SHIFT 16 +#define ID_AA64MMFR0_BIGEND_EL0_MASK (0xf << ID_AA64MMFR0_BIGEND_EL0_SHIFT) +#define ID_AA64MMFR0_BIGEND_EL0(x) ((x) & ID_AA64MMFR0_BIGEND_EL0_MASK) +#define ID_AA64MMFR0_BIGEND_EL0_FIXED (0x0 << ID_AA64MMFR0_BIGEND_EL0_SHIFT) +#define ID_AA64MMFR0_BIGEND_EL0_MIXED (0x1 << ID_AA64MMFR0_BIGEND_EL0_SHIFT) +#define ID_AA64MMFR0_TGRAN16_SHIFT 20 +#define ID_AA64MMFR0_TGRAN16_MASK (0xf << ID_AA64MMFR0_TGRAN16_SHIFT) +#define ID_AA64MMFR0_TGRAN16(x) ((x) & ID_AA64MMFR0_TGRAN16_MASK) +#define ID_AA64MMFR0_TGRAN16_NONE (0x0 << ID_AA64MMFR0_TGRAN16_SHIFT) +#define ID_AA64MMFR0_TGRAN16_IMPL (0x1 << ID_AA64MMFR0_TGRAN16_SHIFT) +#define ID_AA64MMFR0_TGRAN64_SHIFT 24 +#define ID_AA64MMFR0_TGRAN64_MASK (0xf << ID_AA64MMFR0_TGRAN64_SHIFT) +#define ID_AA64MMFR0_TGRAN64(x) ((x) & ID_AA64MMFR0_TGRAN64_MASK) +#define ID_AA64MMFR0_TGRAN64_IMPL (0x0 << ID_AA64MMFR0_TGRAN64_SHIFT) +#define ID_AA64MMFR0_TGRAN64_NONE (0xf << ID_AA64MMFR0_TGRAN64_SHIFT) +#define ID_AA64MMFR0_TGRAN4_SHIFT 28 +#define ID_AA64MMFR0_TGRAN4_MASK (0xf << ID_AA64MMFR0_TGRAN4_SHIFT) +#define ID_AA64MMFR0_TGRAN4(x) ((x) & ID_AA64MMFR0_TGRAN4_MASK) +#define ID_AA64MMFR0_TGRAN4_IMPL (0x0 << ID_AA64MMFR0_TGRAN4_SHIFT) +#define ID_AA64MMFR0_TGRAN4_NONE (0xf << ID_AA64MMFR0_TGRAN4_SHIFT) + /* ID_AA64PFR0_EL1 */ -#define ID_AA64PFR0_EL0_MASK (0xf << 0) -#define ID_AA64PFR0_EL1_MASK (0xf << 4) -#define ID_AA64PFR0_EL2_MASK (0xf << 8) -#define ID_AA64PFR0_EL3_MASK (0xf << 12) -#define ID_AA64PFR0_FP_MASK (0xf << 16) -#define ID_AA64PFR0_FP_IMPL (0x0 << 16) /* Floating-point implemented */ -#define ID_AA64PFR0_FP_NONE (0xf << 16) /* Floating-point not implemented */ -#define ID_AA64PFR0_ADV_SIMD_MASK (0xf << 20) -#define ID_AA64PFR0_GIC_SHIFT (24) -#define ID_AA64PFR0_GIC_BITS (0x4) /* Number of bits in GIC field */ -#define ID_AA64PFR0_GIC_MASK (0xf << ID_AA64PFR0_GIC_SHIFT) -#define ID_AA64PFR0_GIC_CPUIF_EN (0x1 << ID_AA64PFR0_GIC_SHIFT) +#define ID_AA64PFR0_MASK 0x0fffffff +#define ID_AA64PFR0_EL0_SHIFT 0 +#define ID_AA64PFR0_EL0_MASK (0xf << ID_AA64PFR0_EL0_SHIFT) +#define ID_AA64PFR0_EL0(x) ((x) & ID_AA64PFR0_EL0_MASK) +#define ID_AA64PFR0_EL0_64 (1 << ID_AA64PFR0_EL0_SHIFT) +#define ID_AA64PFR0_EL0_64_32 (2 << ID_AA64PFR0_EL0_SHIFT) +#define ID_AA64PFR0_EL1_SHIFT 4 +#define ID_AA64PFR0_EL1_MASK (0xf << ID_AA64PFR0_EL1_SHIFT) +#define ID_AA64PFR0_EL1(x) ((x) & ID_AA64PFR0_EL1_MASK) +#define ID_AA64PFR0_EL1_64 (1 << ID_AA64PFR0_EL1_SHIFT) +#define ID_AA64PFR0_EL1_64_32 (2 << ID_AA64PFR0_EL1_SHIFT) +#define ID_AA64PFR0_EL2_SHIFT 8 +#define ID_AA64PFR0_EL2_MASK (0xf << ID_AA64PFR0_EL2_SHIFT) +#define ID_AA64PFR0_EL2(x) ((x) & ID_AA64PFR0_EL2_MASK) +#define ID_AA64PFR0_EL2_NONE (0 << ID_AA64PFR0_EL2_SHIFT) +#define ID_AA64PFR0_EL2_64 (1 << ID_AA64PFR0_EL2_SHIFT) +#define ID_AA64PFR0_EL2_64_32 (2 << ID_AA64PFR0_EL2_SHIFT) +#define ID_AA64PFR0_EL3_SHIFT 12 +#define ID_AA64PFR0_EL3_MASK (0xf << ID_AA64PFR0_EL3_SHIFT) +#define ID_AA64PFR0_EL3(x) ((x) & ID_AA64PFR0_EL3_MASK) +#define ID_AA64PFR0_EL3_NONE (0 << ID_AA64PFR0_EL3_SHIFT) +#define ID_AA64PFR0_EL3_64 (1 << ID_AA64PFR0_EL3_SHIFT) +#define ID_AA64PFR0_EL3_64_32 (2 << ID_AA64PFR0_EL3_SHIFT) +#define ID_AA64PFR0_FP_SHIFT 16 +#define ID_AA64PFR0_FP_MASK (0xf << ID_AA64PFR0_FP_SHIFT) +#define ID_AA64PFR0_FP(x) ((x) & ID_AA64PFR0_FP_MASK) +#define ID_AA64PFR0_FP_IMPL (0x0 << ID_AA64PFR0_FP_SHIFT) +#define ID_AA64PFR0_FP_NONE (0xf << ID_AA64PFR0_FP_SHIFT) +#define ID_AA64PFR0_ADV_SIMD_SHIFT 20 +#define ID_AA64PFR0_ADV_SIMD_MASK (0xf << ID_AA64PFR0_ADV_SIMD_SHIFT) +#define ID_AA64PFR0_ADV_SIMD(x) ((x) & ID_AA64PFR0_ADV_SIMD_MASK) +#define ID_AA64PFR0_ADV_SIMD_IMPL (0x0 << ID_AA64PFR0_ADV_SIMD_SHIFT) +#define ID_AA64PFR0_ADV_SIMD_NONE (0xf << ID_AA64PFR0_ADV_SIMD_SHIFT) +#define ID_AA64PFR0_GIC_BITS 0x4 /* Number of bits in GIC field */ +#define ID_AA64PFR0_GIC_SHIFT 24 +#define ID_AA64PFR0_GIC_MASK (0xf << ID_AA64PFR0_GIC_SHIFT) +#define ID_AA64PFR0_GIC(x) ((x) & ID_AA64PFR0_GIC_MASK) +#define ID_AA64PFR0_GIC_CPUIF_NONE (0x0 << ID_AA64PFR0_GIC_SHIFT) +#define ID_AA64PFR0_GIC_CPUIF_EN (0x1 << ID_AA64PFR0_GIC_SHIFT) /* MAIR_EL1 - Memory Attribute Indirection Register */ #define MAIR_ATTR_MASK(idx) (0xff << ((n)* 8)) Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Wed Dec 30 17:10:03 2015 (r292953) +++ head/sys/arm64/include/cpu.h Wed Dec 30 17:36:34 2015 (r292954) @@ -145,6 +145,7 @@ void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cpu(void); +void print_cpu_features(u_int); void swi_vm(void *v); #define CPU_AFFINITY(cpu) __cpu_affinity[(cpu)] From owner-svn-src-head@freebsd.org Wed Dec 30 18: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 6B62BA5568A; Wed, 30 Dec 2015 18:04:51 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3CA341B43; Wed, 30 Dec 2015 18:04:51 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUI4oar065467; Wed, 30 Dec 2015 18:04:50 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUI4oGp065466; Wed, 30 Dec 2015 18:04:50 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201512301804.tBUI4oGp065466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Wed, 30 Dec 2015 18:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292955 - head/lib/libmd 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, 30 Dec 2015 18:04:51 -0000 Author: jtl Date: Wed Dec 30 18:04:50 2015 New Revision: 292955 URL: https://svnweb.freebsd.org/changeset/base/292955 Log: Fix a file descriptor leak in mdXhl.c (which is used by numerous hashing algorithms. CID: 1305669,1305611,1305663,1305603,1305584,1305639,1346865,1305601 Differential Revision: https://reviews.freebsd.org/D4732 Reviewed by: allanjude, delphij MFC after: 2 weeks Sponsored by: Juniper Networks Modified: head/lib/libmd/mdXhl.c Modified: head/lib/libmd/mdXhl.c ============================================================================== --- head/lib/libmd/mdXhl.c Wed Dec 30 17:36:34 2015 (r292954) +++ head/lib/libmd/mdXhl.c Wed Dec 30 18:04:50 2015 (r292955) @@ -59,14 +59,18 @@ MDXFileChunk(const char *filename, char f = open(filename, O_RDONLY); if (f < 0) return 0; - if (fstat(f, &stbuf) < 0) - return 0; + if (fstat(f, &stbuf) < 0) { + i = -1; + goto error; + } if (ofs > stbuf.st_size) ofs = stbuf.st_size; if ((len == 0) || (len > stbuf.st_size - ofs)) len = stbuf.st_size - ofs; - if (lseek(f, ofs, SEEK_SET) < 0) - return 0; + if (lseek(f, ofs, SEEK_SET) < 0) { + i = -1; + goto error; + } n = len; i = 0; while (n > 0) { @@ -79,6 +83,7 @@ MDXFileChunk(const char *filename, char MDXUpdate(&ctx, buffer, i); n -= i; } +error: e = errno; close(f); errno = e; From owner-svn-src-head@freebsd.org Wed Dec 30 18:08: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 E717DA5576B; Wed, 30 Dec 2015 18:08:06 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B475F1D18; Wed, 30 Dec 2015 18:08:06 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUI85fT065640; Wed, 30 Dec 2015 18:08:05 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUI85EJ065639; Wed, 30 Dec 2015 18:08:05 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201512301808.tBUI85EJ065639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Wed, 30 Dec 2015 18:08:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292956 - 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: Wed, 30 Dec 2015 18:08:07 -0000 Author: jtl Date: Wed Dec 30 18:08:05 2015 New Revision: 292956 URL: https://svnweb.freebsd.org/changeset/base/292956 Log: Add the appropriate case statement for IPV6_BINDMULTI so the option can be retrieved with getsockopt(). CID: 1229928 Differential Revision: https://reviews.freebsd.org/D4737 Reviewed by: adrian Sponsored by: Juniper Networks Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Dec 30 18:04:50 2015 (r292955) +++ head/sys/netinet6/ip6_output.c Wed Dec 30 18:08:05 2015 (r292956) @@ -1830,6 +1830,7 @@ do { \ case IPV6_RSSBUCKETID: case IPV6_RECVRSSBUCKETID: #endif + case IPV6_BINDMULTI: switch (optname) { case IPV6_RECVHOPOPTS: From owner-svn-src-head@freebsd.org Wed Dec 30 18:13: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 53835A55A32; Wed, 30 Dec 2015 18:13:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 16BF61154; Wed, 30 Dec 2015 18:13:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUIDhJn068426; Wed, 30 Dec 2015 18:13:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUIDhjS068425; Wed, 30 Dec 2015 18:13:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512301813.tBUIDhjS068425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Dec 2015 18:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292957 - 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, 30 Dec 2015 18:13:44 -0000 Author: ngie Date: Wed Dec 30 18:13:43 2015 New Revision: 292957 URL: https://svnweb.freebsd.org/changeset/base/292957 Log: Rename `recvfd` and `sendfd` variables in recvfd/sendfd functions to avoid -Wshadow issues with gcc MFC after: 1 week Reported by: bz, jenkins Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/kern/unix_passfd_test.c Modified: head/tests/sys/kern/unix_passfd_test.c ============================================================================== --- head/tests/sys/kern/unix_passfd_test.c Wed Dec 30 18:08:05 2015 (r292956) +++ head/tests/sys/kern/unix_passfd_test.c Wed Dec 30 18:13:43 2015 (r292957) @@ -109,7 +109,7 @@ samefile(struct stat *sb1, struct stat * } static void -sendfd_payload(int sockfd, int sendfd, void *payload, size_t paylen) +sendfd_payload(int sockfd, int send_fd, void *payload, size_t paylen) { struct iovec iovec; char message[CMSG_SPACE(sizeof(int))]; @@ -133,7 +133,7 @@ sendfd_payload(int sockfd, int sendfd, v cmsghdr->cmsg_len = CMSG_LEN(sizeof(int)); cmsghdr->cmsg_level = SOL_SOCKET; cmsghdr->cmsg_type = SCM_RIGHTS; - memcpy(CMSG_DATA(cmsghdr), &sendfd, sizeof(int)); + memcpy(CMSG_DATA(cmsghdr), &send_fd, sizeof(int)); len = sendmsg(sockfd, &msghdr, 0); ATF_REQUIRE_MSG(len != -1, "sendmsg failed: %s", strerror(errno)); @@ -143,15 +143,15 @@ sendfd_payload(int sockfd, int sendfd, v } static void -sendfd(int sockfd, int sendfd) +sendfd(int sockfd, int send_fd) { char ch = 0; - return (sendfd_payload(sockfd, sendfd, &ch, sizeof(ch))); + return (sendfd_payload(sockfd, send_fd, &ch, sizeof(ch))); } static void -recvfd_payload(int sockfd, int *recvfd, void *buf, size_t buflen) +recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen) { struct cmsghdr *cmsghdr; char message[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + sizeof(int)]; @@ -178,25 +178,25 @@ recvfd_payload(int sockfd, int *recvfd, cmsghdr = CMSG_FIRSTHDR(&msghdr); ATF_REQUIRE_MSG(cmsghdr != NULL, "recvmsg: did not receive control message"); - *recvfd = -1; + *recv_fd = -1; for (; cmsghdr != NULL; cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr)) { if (cmsghdr->cmsg_level == SOL_SOCKET && cmsghdr->cmsg_type == SCM_RIGHTS && cmsghdr->cmsg_len == CMSG_LEN(sizeof(int))) { - memcpy(recvfd, CMSG_DATA(cmsghdr), sizeof(int)); - ATF_REQUIRE(*recvfd != -1); + memcpy(recv_fd, CMSG_DATA(cmsghdr), sizeof(int)); + ATF_REQUIRE(*recv_fd != -1); } } - ATF_REQUIRE_MSG(*recvfd != -1, + ATF_REQUIRE_MSG(*recv_fd != -1, "recvmsg: did not receive single-fd message"); } static void -recvfd(int sockfd, int *recvfd) +recvfd(int sockfd, int *recv_fd) { char ch = 0; - return (recvfd_payload(sockfd, recvfd, &ch, sizeof(ch))); + return (recvfd_payload(sockfd, recv_fd, &ch, sizeof(ch))); } /* From owner-svn-src-head@freebsd.org Wed Dec 30 18:15: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 414D3A55AD8; Wed, 30 Dec 2015 18:15:05 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-ob0-x234.google.com (mail-ob0-x234.google.com [IPv6:2607:f8b0:4003:c01::234]) (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 0CE0D1304; Wed, 30 Dec 2015 18:15:05 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-ob0-x234.google.com with SMTP id ba1so182551413obb.3; Wed, 30 Dec 2015 10:15:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8UCpr7FKkny5b+NRxvugHITkpKuNRF2/PfUWc3d8l3Y=; b=nzwSVsasACcol3L6+VgBxkRVAcLpV9ANmwptFQRaHcocrGARmREEIEOmzHb3VuBVi4 OGtFkAgc6XvbMKa1JQHSWi/QygOaQdJ9iXXkEFikJ/lM2RqBTa4Ml6kQrSZteBBnDnV6 WTE0MLHQqX2nny4QR0T0Upsmmefrq7CB0ql+EndhH7PiMHKYc8K3ks4tRhxS821R407s 0Z0UC5/o537mJglBLqrflJj9UqSIuzlXDrazySad3hrVynEU+SMHVFo7NZ6a9PreYGJb IC1PQGwQkNK1rlc/hO9XrlhVYOnnM5Nl5nJ92H8ws25naZIShv0CU1+93HLh2hWlCxvB tPnQ== X-Received: by 10.182.108.229 with SMTP id hn5mr43540337obb.75.1451499304412; Wed, 30 Dec 2015 10:15:04 -0800 (PST) Received: from ?IPv6:2601:601:800:126d:9910:6b8e:28b:6700? ([2601:601:800:126d:9910:6b8e:28b:6700]) by smtp.gmail.com with ESMTPSA id px4sm10031942oec.7.2015.12.30.10.15.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 10:15:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292914 - in head: tests/sys/kern tools/regression/sockets/unix_passfd From: NGie Cooper In-Reply-To: <9CE6F38D-FD5A-4EF0-BFA8-4002ED3519A2@FreeBSD.org> Date: Wed, 30 Dec 2015 10:15:00 -0800 Cc: Garrett Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <02D10D41-F768-4463-BAE7-8E395C0986B8@gmail.com> References: <201512301115.tBUBF7Wr038402@repo.freebsd.org> <9CE6F38D-FD5A-4EF0-BFA8-4002ED3519A2@FreeBSD.org> To: "Bjoern A. Zeeb" X-Mailer: Apple Mail (2.2104) 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, 30 Dec 2015 18:15:05 -0000 > On Dec 30, 2015, at 08:31, Bjoern A. Zeeb wrote: >=20 >>=20 >> On 30 Dec 2015, at 11:15 , Garrett Cooper wrote: >>=20 >> Author: ngie >> Date: Wed Dec 30 11:15:07 2015 >> New Revision: 292914 >> URL: https://svnweb.freebsd.org/changeset/base/292914 >>=20 >> Log: >> Integrate tools/regression/sockets/unix_passfd into the FreeBSD test >> suite as tests/sys/kern/unix_passfd_test >>=20 >> - Convert testcases to ATF >> - Fix an alignment issues >> - Mark rights_creds_payload(..) as an expected failure (see PR # = 181741) >>=20 >> Based [in part] on the following Differential Revision: >> https://reviews.freebsd.org/D689 >>=20 >> MFC after: 1 week >> Submitted by: markj >> Sponsored by: EMC / Isilon Storage Division >=20 > n all gcc platforms this fails: >=20 > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c: In = function 'sendfd': > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:146: = warning: declaration of 'sendfd' shadows a global declaration > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:147: = warning: shadowed declaration is here > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c: In = function 'recvfd': > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:195: = warning: declaration of 'recvfd' shadows a global declaration > /scratch/tmp/bz/head.svn/tests/sys/kern/unix_passfd_test.c:196: = warning: shadowed declaration is here Ugh=E2=80=A6 yeah... I forgot about that (I did this work before = in a different branch, but it got wiped out). Thanks for the report! I=E2=80=99ve fixed it in r292957. -NGie= From owner-svn-src-head@freebsd.org Wed Dec 30 18:57: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 A9262A5675C; Wed, 30 Dec 2015 18:57:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 72977137F; Wed, 30 Dec 2015 18:57:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUIvTJd079988; Wed, 30 Dec 2015 18:57:29 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUIvT8C079987; Wed, 30 Dec 2015 18:57:29 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512301857.tBUIvT8C079987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 30 Dec 2015 18:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292960 - head/sys/sparc64/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, 30 Dec 2015 18:57:30 -0000 Author: marius Date: Wed Dec 30 18:57:29 2015 New Revision: 292960 URL: https://svnweb.freebsd.org/changeset/base/292960 Log: Change the - hopefully - last piece of ktr(9) to use PCPU_GET(cpuid) instead of the MD module ID for KTR_CPU. Modified: head/sys/sparc64/include/ktr.h Modified: head/sys/sparc64/include/ktr.h ============================================================================== --- head/sys/sparc64/include/ktr.h Wed Dec 30 18:52:29 2015 (r292959) +++ head/sys/sparc64/include/ktr.h Wed Dec 30 18:57:29 2015 (r292960) @@ -59,7 +59,7 @@ l2: add r2, 1, r3 ; \ add r1, r2, r1 ; \ rd %tick, r2 ; \ stx r2, [r1 + KTR_TIMESTAMP] ; \ - lduw [PCPU(MID)], r2 ; \ + lduw [PCPU(CPUID)], r2 ; \ stw r2, [r1 + KTR_CPU] ; \ stw %g0, [r1 + KTR_LINE] ; \ stx %g0, [r1 + KTR_FILE] ; \ From owner-svn-src-head@freebsd.org Wed Dec 30 19:49: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 E7041A554E1; Wed, 30 Dec 2015 19:49:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A92091C21; Wed, 30 Dec 2015 19:49:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUJnMH3094444; Wed, 30 Dec 2015 19:49:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUJnMWa094443; Wed, 30 Dec 2015 19:49:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512301949.tBUJnMWa094443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 Dec 2015 19:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292961 - head/sys/fs/nullfs 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, 30 Dec 2015 19:49:24 -0000 Author: kib Date: Wed Dec 30 19:49:22 2015 New Revision: 292961 URL: https://svnweb.freebsd.org/changeset/base/292961 Log: Force nullfs vnode reclaim after unlinking, to potentially unlink lower vnode. Otherwise, reference to the lower vnode from the upper one prevents final unlink. PR: 178238 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Wed Dec 30 18:57:29 2015 (r292960) +++ head/sys/fs/nullfs/null_vnops.c Wed Dec 30 19:49:22 2015 (r292961) @@ -568,14 +568,16 @@ static int null_remove(struct vop_remove_args *ap) { int retval, vreleit; - struct vnode *lvp; + struct vnode *lvp, *vp; - if (vrefcnt(ap->a_vp) > 1) { - lvp = NULLVPTOLOWERVP(ap->a_vp); + vp = ap->a_vp; + if (vrefcnt(vp) > 1) { + lvp = NULLVPTOLOWERVP(vp); VREF(lvp); vreleit = 1; } else vreleit = 0; + VTONULL(vp)->null_flags |= NULLV_DROP; retval = null_bypass(&ap->a_gen); if (vreleit != 0) vrele(lvp); From owner-svn-src-head@freebsd.org Wed Dec 30 20:19: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 DBA1CA55E93; Wed, 30 Dec 2015 20:19:20 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) by mx1.freebsd.org (Postfix) with ESMTP id 30B381AAC; Wed, 30 Dec 2015 20:19:20 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id ENDEauUzydBaTENDFaF4Xp; Wed, 30 Dec 2015 13:19:14 -0700 X-Authority-Analysis: v=2.1 cv=He60Nnw8 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=BWvPGDcYAAAA:8 a=VxmjJ2MpAAAA:8 a=kj9zAlcOel0A:10 a=wUQvQvOEmiQA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=awknIvsCzPwG_4OrAGYA:9 a=CjuIK1q_8ugA:10 a=oappaISLdyUA:10 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 70A27138A4; Wed, 30 Dec 2015 12:19:12 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id tBUKJ9It008305; Wed, 30 Dec 2015 12:19:09 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201512302019.tBUKJ9It008305@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: Ian Lepore cc: Colin Percival , Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, edwin@freebsd.org, Xin Li , dwmalone@freebsd.org, roberto@freebsd.org, des@freebsd.org Subject: Re: svn commit: r289421 - in head/etc: . mtree ntp In-Reply-To: Message from Ian Lepore of "Wed, 30 Dec 2015 09:04:50 -0700." <1451491490.1369.41.camel@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 30 Dec 2015 12:19:09 -0800 X-CMAE-Envelope: MS4wfDYtsnsTwzCB0FPxnXM3EheltHTKzNTJTz45mnlFihRfyFRUvs2RS3wB7OcUuHHe50yd7dMK0t6iofITFO/35NgWLoe1dall+6n2u2UoKB+Cp7dqy5b4 LjX/93RUKAdm8SqmMmBik90x3NUCxCSNcIms0ruooZpwRRNJzU5uapjn9VjXUiwI8I42b3DO14NSfs50JVsiO6KpW4MMSIG1vwquVc7Q1KeOXdWs/iHk2UCO Eh6x9Cuz1eFfkzwJBD+eTtMc9PeyqlsSyEIcaBCSPlcB4qq7/+w3p498Wjg+Bf95Mqpj5dRMVRFLQ+I8xvvBizk7QSuU4dlM9mpQbysx4CFWRiclY+a3dnMa q9+FaO+tBGs4lr+y7HkcBnGBS2U+Y8NV1oGm3cir8CSF56/fIkajp7XbXAIA2rtfzM91xVFWFyvhDMv0ZVhOtPeJgQv8WtAEu/ya5eDJBQGVu+5Xvp8Jjatc YpInjOJcegtTeoN7 X-Mailman-Approved-At: Wed, 30 Dec 2015 20:46:36 +0000 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, 30 Dec 2015 20:19:21 -0000 In message <1451491490.1369.41.camel@freebsd.org>, Ian Lepore writes: > On Wed, 2015-12-30 at 04:50 -0800, Colin Percival wrote: > > On 10/16/15 07:04, Cy Schubert wrote: > > > Add default leap-seconds file. This should help ntp networks get > > > the > > > leap second date correct > > > > > > Added: > > > head/etc/ntp/ > > > head/etc/ntp/Makefile (contents, props changed) > > > head/etc/ntp/leap-seconds (contents, props changed) > > > > So... is someone going to be keeping this file up to date? We seem > > to have > > the same information in contrib/tzdata/leapseconds (which is being > > kept up > > to date -- thank you edwin and delphij!) but having this file in > > /etc/ntp/ > > being out of date is making ntpd refuse to start. > > > > I vaguely remember warning that something like this was likely to > happen. Turning on leapfile processing by default without an already > -in-place mechanism to keep the file up to date was a bad idea. There > was some mumbling about a mechanism, but nobody wrote any code. > > Even if the mechanism existed, I think defaulting to using the leapfile > is wrong. It's a thing that needs care and feeding or it causes > problems, and thus it's a thing that should only be enabled by admins > who know about the care and feeding aspect (an automatic fetch > mechanism doesn't help much if there are firewalls blocking the fetch, > for example). The original idea was to update the file twice a year. Just before Christmas des@ suggested an alternative approach of fetching an update weekly or monthly because some upstream ntp servers not using the correct leap seconds and hosting the file locally would be more reliable. I've cc'd you on my last reply to des@ this morning. -- 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 Wed Dec 30 22:43: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 AE6AFA56802; Wed, 30 Dec 2015 22:43:09 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 50236117E; Wed, 30 Dec 2015 22:43:09 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUMh8Zk046095; Wed, 30 Dec 2015 22:43:08 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUMh8cx046090; Wed, 30 Dec 2015 22:43:08 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512302243.tBUMh8cx046090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 30 Dec 2015 22:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292963 - in head/sys: crypto opencrypto 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, 30 Dec 2015 22:43:09 -0000 Author: allanjude Date: Wed Dec 30 22:43:07 2015 New Revision: 292963 URL: https://svnweb.freebsd.org/changeset/base/292963 Log: Break up opencrypto/xform.c so it can be reused piecemeal Keep xform.c as a meta-file including the broken out bits existing code that includes xform.c continues to work as normal Individual algorithms can now be reused elsewhere, including outside of the kernel Reviewed by: bapt (previous version), gnn, delphij Approved by: secteam MFC after: 1 week Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D4674 Added: head/sys/opencrypto/xform_aes_icm.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_aes_xts.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_auth.h - copied, changed from r292837, head/sys/opencrypto/xform.h head/sys/opencrypto/xform_blf.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_cast5.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_cml.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_comp.h - copied, changed from r292837, head/sys/opencrypto/xform.h head/sys/opencrypto/xform_deflate.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_des1.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_des3.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_enc.h - copied, changed from r292837, head/sys/opencrypto/xform.h head/sys/opencrypto/xform_gmac.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_md5.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_null.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_rijndael.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_rmd160.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_sha1.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_sha2.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_skipjack.c - copied, changed from r292238, head/sys/opencrypto/xform.c head/sys/opencrypto/xform_userland.h (contents, props changed) Modified: head/sys/crypto/sha1.h head/sys/opencrypto/skipjack.h head/sys/opencrypto/xform.c head/sys/opencrypto/xform.h Modified: head/sys/crypto/sha1.h ============================================================================== --- head/sys/crypto/sha1.h Wed Dec 30 20:15:29 2015 (r292962) +++ head/sys/crypto/sha1.h Wed Dec 30 22:43:07 2015 (r292963) @@ -53,6 +53,7 @@ struct sha1_ctxt { } m; u_int8_t count; }; +typedef struct sha1_ctxt SHA1_CTX; #ifdef _KERNEL extern void sha1_init(struct sha1_ctxt *); @@ -61,7 +62,6 @@ extern void sha1_loop(struct sha1_ctxt * extern void sha1_result(struct sha1_ctxt *, caddr_t); /* compatibilty with other SHA1 source codes */ -typedef struct sha1_ctxt SHA1_CTX; #define SHA1Init(x) sha1_init((x)) #define SHA1Update(x, y, z) sha1_loop((x), (y), (z)) #define SHA1Final(x, y) sha1_result((y), (x)) Modified: head/sys/opencrypto/skipjack.h ============================================================================== --- head/sys/opencrypto/skipjack.h Wed Dec 30 20:15:29 2015 (r292962) +++ head/sys/opencrypto/skipjack.h Wed Dec 30 22:43:07 2015 (r292963) @@ -14,6 +14,11 @@ * 29 May 1998 */ +#ifndef _SKIPJACK_H_ +#define _SKIPJACK_H_ + extern void skipjack_forwards(u_int8_t *plain, u_int8_t *cipher, u_int8_t **key); extern void skipjack_backwards(u_int8_t *cipher, u_int8_t *plain, u_int8_t **key); extern void subkey_table_gen(u_int8_t *key, u_int8_t **key_tables); + +#endif Modified: head/sys/opencrypto/xform.c ============================================================================== --- head/sys/opencrypto/xform.c Wed Dec 30 20:15:29 2015 (r292962) +++ head/sys/opencrypto/xform.c Wed Dec 30 22:43:07 2015 (r292963) @@ -75,196 +75,9 @@ __FBSDID("$FreeBSD$"); #include #include -static int null_setkey(u_int8_t **, u_int8_t *, int); -static int des1_setkey(u_int8_t **, u_int8_t *, int); -static int des3_setkey(u_int8_t **, u_int8_t *, int); -static int blf_setkey(u_int8_t **, u_int8_t *, int); -static int cast5_setkey(u_int8_t **, u_int8_t *, int); -static int skipjack_setkey(u_int8_t **, u_int8_t *, int); -static int rijndael128_setkey(u_int8_t **, u_int8_t *, int); -static int aes_icm_setkey(u_int8_t **, u_int8_t *, int); -static int aes_xts_setkey(u_int8_t **, u_int8_t *, int); -static int cml_setkey(u_int8_t **, u_int8_t *, int); - -static void null_encrypt(caddr_t, u_int8_t *); -static void des1_encrypt(caddr_t, u_int8_t *); -static void des3_encrypt(caddr_t, u_int8_t *); -static void blf_encrypt(caddr_t, u_int8_t *); -static void cast5_encrypt(caddr_t, u_int8_t *); -static void skipjack_encrypt(caddr_t, u_int8_t *); -static void rijndael128_encrypt(caddr_t, u_int8_t *); -static void aes_xts_encrypt(caddr_t, u_int8_t *); -static void cml_encrypt(caddr_t, u_int8_t *); - -static void null_decrypt(caddr_t, u_int8_t *); -static void des1_decrypt(caddr_t, u_int8_t *); -static void des3_decrypt(caddr_t, u_int8_t *); -static void blf_decrypt(caddr_t, u_int8_t *); -static void cast5_decrypt(caddr_t, u_int8_t *); -static void skipjack_decrypt(caddr_t, u_int8_t *); -static void rijndael128_decrypt(caddr_t, u_int8_t *); -static void aes_xts_decrypt(caddr_t, u_int8_t *); -static void cml_decrypt(caddr_t, u_int8_t *); - -static void aes_icm_crypt(caddr_t, u_int8_t *); - -static void null_zerokey(u_int8_t **); -static void des1_zerokey(u_int8_t **); -static void des3_zerokey(u_int8_t **); -static void blf_zerokey(u_int8_t **); -static void cast5_zerokey(u_int8_t **); -static void skipjack_zerokey(u_int8_t **); -static void rijndael128_zerokey(u_int8_t **); -static void aes_icm_zerokey(u_int8_t **); -static void aes_xts_zerokey(u_int8_t **); -static void cml_zerokey(u_int8_t **); - -static void aes_icm_reinit(caddr_t, u_int8_t *); -static void aes_xts_reinit(caddr_t, u_int8_t *); -static void aes_gcm_reinit(caddr_t, u_int8_t *); - -static void null_init(void *); -static void null_reinit(void *ctx, const u_int8_t *buf, u_int16_t len); -static int null_update(void *, const u_int8_t *, u_int16_t); -static void null_final(u_int8_t *, void *); -static int MD5Update_int(void *, const u_int8_t *, u_int16_t); -static void SHA1Init_int(void *); -static int SHA1Update_int(void *, const u_int8_t *, u_int16_t); -static void SHA1Final_int(u_int8_t *, void *); -static int RMD160Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA256Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA384Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA512Update_int(void *, const u_int8_t *, u_int16_t); - -static u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **); -static u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **); - -#define AESICM_BLOCKSIZE AES_BLOCK_LEN - -struct aes_icm_ctx { - u_int32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)]; - /* ac_block is initalized to IV */ - u_int8_t ac_block[AESICM_BLOCKSIZE]; - int ac_nr; -}; - MALLOC_DEFINE(M_XDATA, "xform", "xform data buffers"); /* Encryption instances */ -struct enc_xform enc_xform_null = { - CRYPTO_NULL_CBC, "NULL", - /* NB: blocksize of 4 is to generate a properly aligned ESP header */ - NULL_BLOCK_LEN, 0, NULL_MIN_KEY, NULL_MAX_KEY, - null_encrypt, - null_decrypt, - null_setkey, - null_zerokey, - NULL, -}; - -struct enc_xform enc_xform_des = { - CRYPTO_DES_CBC, "DES", - DES_BLOCK_LEN, DES_BLOCK_LEN, DES_MIN_KEY, DES_MAX_KEY, - des1_encrypt, - des1_decrypt, - des1_setkey, - des1_zerokey, - NULL, -}; - -struct enc_xform enc_xform_3des = { - CRYPTO_3DES_CBC, "3DES", - DES3_BLOCK_LEN, DES3_BLOCK_LEN, TRIPLE_DES_MIN_KEY, - TRIPLE_DES_MAX_KEY, - des3_encrypt, - des3_decrypt, - des3_setkey, - des3_zerokey, - NULL, -}; - -struct enc_xform enc_xform_blf = { - CRYPTO_BLF_CBC, "Blowfish", - BLOWFISH_BLOCK_LEN, BLOWFISH_BLOCK_LEN, BLOWFISH_MIN_KEY, - BLOWFISH_MAX_KEY, - blf_encrypt, - blf_decrypt, - blf_setkey, - blf_zerokey, - NULL, -}; - -struct enc_xform enc_xform_cast5 = { - CRYPTO_CAST_CBC, "CAST-128", - CAST128_BLOCK_LEN, CAST128_BLOCK_LEN, CAST_MIN_KEY, CAST_MAX_KEY, - cast5_encrypt, - cast5_decrypt, - cast5_setkey, - cast5_zerokey, - NULL, -}; - -struct enc_xform enc_xform_skipjack = { - CRYPTO_SKIPJACK_CBC, "Skipjack", - SKIPJACK_BLOCK_LEN, SKIPJACK_BLOCK_LEN, SKIPJACK_MIN_KEY, - SKIPJACK_MAX_KEY, - skipjack_encrypt, - skipjack_decrypt, skipjack_setkey, - skipjack_zerokey, - NULL, -}; - -struct enc_xform enc_xform_rijndael128 = { - CRYPTO_RIJNDAEL128_CBC, "Rijndael-128/AES", - RIJNDAEL128_BLOCK_LEN, RIJNDAEL128_BLOCK_LEN, RIJNDAEL_MIN_KEY, - RIJNDAEL_MAX_KEY, - rijndael128_encrypt, - rijndael128_decrypt, - rijndael128_setkey, - rijndael128_zerokey, - NULL, -}; - -struct enc_xform enc_xform_aes_icm = { - CRYPTO_AES_ICM, "AES-ICM", - AES_BLOCK_LEN, AES_BLOCK_LEN, AES_MIN_KEY, AES_MAX_KEY, - aes_icm_crypt, - aes_icm_crypt, - aes_icm_setkey, - rijndael128_zerokey, - aes_icm_reinit, -}; - -struct enc_xform enc_xform_aes_nist_gcm = { - CRYPTO_AES_NIST_GCM_16, "AES-GCM", - AES_ICM_BLOCK_LEN, AES_GCM_IV_LEN, AES_MIN_KEY, AES_MAX_KEY, - aes_icm_crypt, - aes_icm_crypt, - aes_icm_setkey, - aes_icm_zerokey, - aes_gcm_reinit, -}; - -struct enc_xform enc_xform_aes_nist_gmac = { - CRYPTO_AES_NIST_GMAC, "AES-GMAC", - AES_ICM_BLOCK_LEN, AES_GCM_IV_LEN, AES_MIN_KEY, AES_MAX_KEY, - NULL, - NULL, - NULL, - NULL, - NULL, -}; - -struct enc_xform enc_xform_aes_xts = { - CRYPTO_AES_XTS, "AES-XTS", - AES_BLOCK_LEN, AES_XTS_IV_LEN, AES_XTS_MIN_KEY, AES_XTS_MAX_KEY, - aes_xts_encrypt, - aes_xts_decrypt, - aes_xts_setkey, - aes_xts_zerokey, - aes_xts_reinit -}; - struct enc_xform enc_xform_arc4 = { CRYPTO_ARC4, "ARC4", ARC4_BLOCK_LEN, ARC4_IV_LEN, ARC4_MIN_KEY, ARC4_MAX_KEY, @@ -275,711 +88,26 @@ struct enc_xform enc_xform_arc4 = { NULL, }; -struct enc_xform enc_xform_camellia = { - CRYPTO_CAMELLIA_CBC, "Camellia", - CAMELLIA_BLOCK_LEN, CAMELLIA_BLOCK_LEN, CAMELLIA_MIN_KEY, - CAMELLIA_MAX_KEY, - cml_encrypt, - cml_decrypt, - cml_setkey, - cml_zerokey, - NULL, -}; - -/* Authentication instances */ -struct auth_hash auth_hash_null = { /* NB: context isn't used */ - CRYPTO_NULL_HMAC, "NULL-HMAC", - NULL_HMAC_KEY_LEN, NULL_HASH_LEN, sizeof(int), NULL_HMAC_BLOCK_LEN, - null_init, null_reinit, null_reinit, null_update, null_final -}; - -struct auth_hash auth_hash_hmac_md5 = { - CRYPTO_MD5_HMAC, "HMAC-MD5", - MD5_HMAC_KEY_LEN, MD5_HASH_LEN, sizeof(MD5_CTX), MD5_HMAC_BLOCK_LEN, - (void (*) (void *)) MD5Init, NULL, NULL, MD5Update_int, - (void (*) (u_int8_t *, void *)) MD5Final -}; - -struct auth_hash auth_hash_hmac_sha1 = { - CRYPTO_SHA1_HMAC, "HMAC-SHA1", - SHA1_HMAC_KEY_LEN, SHA1_HASH_LEN, sizeof(SHA1_CTX), SHA1_HMAC_BLOCK_LEN, - SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int -}; - -struct auth_hash auth_hash_hmac_ripemd_160 = { - CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160", - RIPEMD160_HMAC_KEY_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX), - RIPEMD160_HMAC_BLOCK_LEN, - (void (*)(void *)) RMD160Init, NULL, NULL, RMD160Update_int, - (void (*)(u_int8_t *, void *)) RMD160Final -}; - -struct auth_hash auth_hash_key_md5 = { - CRYPTO_MD5_KPDK, "Keyed MD5", - NULL_HMAC_KEY_LEN, MD5_KPDK_HASH_LEN, sizeof(MD5_CTX), 0, - (void (*)(void *)) MD5Init, NULL, NULL, MD5Update_int, - (void (*)(u_int8_t *, void *)) MD5Final -}; - -struct auth_hash auth_hash_key_sha1 = { - CRYPTO_SHA1_KPDK, "Keyed SHA1", - NULL_HMAC_KEY_LEN, SHA1_KPDK_HASH_LEN, sizeof(SHA1_CTX), 0, - SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int -}; - -struct auth_hash auth_hash_hmac_sha2_256 = { - CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", - SHA2_256_HMAC_KEY_LEN, SHA2_256_HASH_LEN, sizeof(SHA256_CTX), - SHA2_256_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA256_Init, NULL, NULL, SHA256Update_int, - (void (*)(u_int8_t *, void *)) SHA256_Final -}; - -struct auth_hash auth_hash_hmac_sha2_384 = { - CRYPTO_SHA2_384_HMAC, "HMAC-SHA2-384", - SHA2_384_HMAC_KEY_LEN, SHA2_384_HASH_LEN, sizeof(SHA384_CTX), - SHA2_384_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA384_Init, NULL, NULL, SHA384Update_int, - (void (*)(u_int8_t *, void *)) SHA384_Final -}; - -struct auth_hash auth_hash_hmac_sha2_512 = { - CRYPTO_SHA2_512_HMAC, "HMAC-SHA2-512", - SHA2_512_HMAC_KEY_LEN, SHA2_512_HASH_LEN, sizeof(SHA512_CTX), - SHA2_512_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA512_Init, NULL, NULL, SHA512Update_int, - (void (*)(u_int8_t *, void *)) SHA512_Final -}; - -struct auth_hash auth_hash_nist_gmac_aes_128 = { - CRYPTO_AES_128_NIST_GMAC, "GMAC-AES-128", - AES_128_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final -}; - -struct auth_hash auth_hash_nist_gmac_aes_192 = { - CRYPTO_AES_192_NIST_GMAC, "GMAC-AES-192", - AES_192_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final -}; - -struct auth_hash auth_hash_nist_gmac_aes_256 = { - CRYPTO_AES_256_NIST_GMAC, "GMAC-AES-256", - AES_256_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final -}; - -/* Compression instance */ -struct comp_algo comp_algo_deflate = { - CRYPTO_DEFLATE_COMP, "Deflate", - 90, deflate_compress, - deflate_decompress -}; - -/* - * Encryption wrapper routines. - */ -static void -null_encrypt(caddr_t key, u_int8_t *blk) -{ -} -static void -null_decrypt(caddr_t key, u_int8_t *blk) -{ -} -static int -null_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - *sched = NULL; - return 0; -} -static void -null_zerokey(u_int8_t **sched) -{ - *sched = NULL; -} - -static void -des1_encrypt(caddr_t key, u_int8_t *blk) -{ - des_cblock *cb = (des_cblock *) blk; - des_key_schedule *p = (des_key_schedule *) key; - - des_ecb_encrypt(cb, cb, p[0], DES_ENCRYPT); -} - -static void -des1_decrypt(caddr_t key, u_int8_t *blk) -{ - des_cblock *cb = (des_cblock *) blk; - des_key_schedule *p = (des_key_schedule *) key; - - des_ecb_encrypt(cb, cb, p[0], DES_DECRYPT); -} - -static int -des1_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - des_key_schedule *p; - int err; - - p = malloc(sizeof (des_key_schedule), - M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (p != NULL) { - des_set_key((des_cblock *) key, p[0]); - err = 0; - } else - err = ENOMEM; - *sched = (u_int8_t *) p; - return err; -} - -static void -des1_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof (des_key_schedule)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -des3_encrypt(caddr_t key, u_int8_t *blk) -{ - des_cblock *cb = (des_cblock *) blk; - des_key_schedule *p = (des_key_schedule *) key; - - des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_ENCRYPT); -} - -static void -des3_decrypt(caddr_t key, u_int8_t *blk) -{ - des_cblock *cb = (des_cblock *) blk; - des_key_schedule *p = (des_key_schedule *) key; - - des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_DECRYPT); -} - -static int -des3_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - des_key_schedule *p; - int err; - - p = malloc(3*sizeof (des_key_schedule), - M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (p != NULL) { - des_set_key((des_cblock *)(key + 0), p[0]); - des_set_key((des_cblock *)(key + 8), p[1]); - des_set_key((des_cblock *)(key + 16), p[2]); - err = 0; - } else - err = ENOMEM; - *sched = (u_int8_t *) p; - return err; -} - -static void -des3_zerokey(u_int8_t **sched) -{ - bzero(*sched, 3*sizeof (des_key_schedule)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -blf_encrypt(caddr_t key, u_int8_t *blk) -{ - BF_LONG t[2]; - - memcpy(t, blk, sizeof (t)); - t[0] = ntohl(t[0]); - t[1] = ntohl(t[1]); - /* NB: BF_encrypt expects the block in host order! */ - BF_encrypt(t, (BF_KEY *) key); - t[0] = htonl(t[0]); - t[1] = htonl(t[1]); - memcpy(blk, t, sizeof (t)); -} - -static void -blf_decrypt(caddr_t key, u_int8_t *blk) -{ - BF_LONG t[2]; - - memcpy(t, blk, sizeof (t)); - t[0] = ntohl(t[0]); - t[1] = ntohl(t[1]); - /* NB: BF_decrypt expects the block in host order! */ - BF_decrypt(t, (BF_KEY *) key); - t[0] = htonl(t[0]); - t[1] = htonl(t[1]); - memcpy(blk, t, sizeof (t)); -} - -static int -blf_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - int err; - - *sched = malloc(sizeof(BF_KEY), - M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (*sched != NULL) { - BF_set_key((BF_KEY *) *sched, len, key); - err = 0; - } else - err = ENOMEM; - return err; -} - -static void -blf_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof(BF_KEY)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -cast5_encrypt(caddr_t key, u_int8_t *blk) -{ - cast_encrypt((cast_key *) key, blk, blk); -} - -static void -cast5_decrypt(caddr_t key, u_int8_t *blk) -{ - cast_decrypt((cast_key *) key, blk, blk); -} - -static int -cast5_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - int err; - - *sched = malloc(sizeof(cast_key), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (*sched != NULL) { - cast_setkey((cast_key *)*sched, key, len); - err = 0; - } else - err = ENOMEM; - return err; -} - -static void -cast5_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof(cast_key)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -skipjack_encrypt(caddr_t key, u_int8_t *blk) -{ - skipjack_forwards(blk, blk, (u_int8_t **) key); -} - -static void -skipjack_decrypt(caddr_t key, u_int8_t *blk) -{ - skipjack_backwards(blk, blk, (u_int8_t **) key); -} - -static int -skipjack_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - int err; - - /* NB: allocate all the memory that's needed at once */ - *sched = malloc(10 * (sizeof(u_int8_t *) + 0x100), - M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (*sched != NULL) { - u_int8_t** key_tables = (u_int8_t**) *sched; - u_int8_t* table = (u_int8_t*) &key_tables[10]; - int k; - - for (k = 0; k < 10; k++) { - key_tables[k] = table; - table += 0x100; - } - subkey_table_gen(key, (u_int8_t **) *sched); - err = 0; - } else - err = ENOMEM; - return err; -} - -static void -skipjack_zerokey(u_int8_t **sched) -{ - bzero(*sched, 10 * (sizeof(u_int8_t *) + 0x100)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -rijndael128_encrypt(caddr_t key, u_int8_t *blk) -{ - rijndael_encrypt((rijndael_ctx *) key, (u_char *) blk, (u_char *) blk); -} - -static void -rijndael128_decrypt(caddr_t key, u_int8_t *blk) -{ - rijndael_decrypt(((rijndael_ctx *) key), (u_char *) blk, - (u_char *) blk); -} - -static int -rijndael128_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - int err; - - if (len != 16 && len != 24 && len != 32) - return (EINVAL); - *sched = malloc(sizeof(rijndael_ctx), M_CRYPTO_DATA, - M_NOWAIT|M_ZERO); - if (*sched != NULL) { - rijndael_set_key((rijndael_ctx *) *sched, (u_char *) key, - len * 8); - err = 0; - } else - err = ENOMEM; - return err; -} - -static void -rijndael128_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof(rijndael_ctx)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -void -aes_icm_reinit(caddr_t key, u_int8_t *iv) -{ - struct aes_icm_ctx *ctx; - - ctx = (struct aes_icm_ctx *)key; - bcopy(iv, ctx->ac_block, AESICM_BLOCKSIZE); -} - -void -aes_gcm_reinit(caddr_t key, u_int8_t *iv) -{ - struct aes_icm_ctx *ctx; - - aes_icm_reinit(key, iv); - - ctx = (struct aes_icm_ctx *)key; - /* GCM starts with 2 as counter 1 is used for final xor of tag. */ - bzero(&ctx->ac_block[AESICM_BLOCKSIZE - 4], 4); - ctx->ac_block[AESICM_BLOCKSIZE - 1] = 2; -} - -void -aes_icm_crypt(caddr_t key, u_int8_t *data) -{ - struct aes_icm_ctx *ctx; - u_int8_t keystream[AESICM_BLOCKSIZE]; - int i; - - ctx = (struct aes_icm_ctx *)key; - rijndaelEncrypt(ctx->ac_ek, ctx->ac_nr, ctx->ac_block, keystream); - for (i = 0; i < AESICM_BLOCKSIZE; i++) - data[i] ^= keystream[i]; - explicit_bzero(keystream, sizeof(keystream)); - - /* increment counter */ - for (i = AESICM_BLOCKSIZE - 1; - i >= 0; i--) - if (++ctx->ac_block[i]) /* continue on overflow */ - break; -} - -int -aes_icm_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - struct aes_icm_ctx *ctx; - - if (len != 16 && len != 24 && len != 32) - return EINVAL; - - *sched = malloc(sizeof(struct aes_icm_ctx), M_CRYPTO_DATA, - M_NOWAIT | M_ZERO); - if (*sched == NULL) - return ENOMEM; - - ctx = (struct aes_icm_ctx *)*sched; - ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, (u_char *)key, len * 8); - return 0; -} - -void -aes_icm_zerokey(u_int8_t **sched) -{ - - bzero(*sched, sizeof(struct aes_icm_ctx)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -#define AES_XTS_BLOCKSIZE 16 -#define AES_XTS_IVSIZE 8 -#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ - -struct aes_xts_ctx { - rijndael_ctx key1; - rijndael_ctx key2; - u_int8_t tweak[AES_XTS_BLOCKSIZE]; -}; - -void -aes_xts_reinit(caddr_t key, u_int8_t *iv) -{ - struct aes_xts_ctx *ctx = (struct aes_xts_ctx *)key; - u_int64_t blocknum; - u_int i; - - /* - * Prepare tweak as E_k2(IV). IV is specified as LE representation - * of a 64-bit block number which we allow to be passed in directly. - */ - bcopy(iv, &blocknum, AES_XTS_IVSIZE); - for (i = 0; i < AES_XTS_IVSIZE; i++) { - ctx->tweak[i] = blocknum & 0xff; - blocknum >>= 8; - } - /* Last 64 bits of IV are always zero */ - bzero(ctx->tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); - - rijndael_encrypt(&ctx->key2, ctx->tweak, ctx->tweak); -} - -static void -aes_xts_crypt(struct aes_xts_ctx *ctx, u_int8_t *data, u_int do_encrypt) -{ - u_int8_t block[AES_XTS_BLOCKSIZE]; - u_int i, carry_in, carry_out; - - for (i = 0; i < AES_XTS_BLOCKSIZE; i++) - block[i] = data[i] ^ ctx->tweak[i]; - - if (do_encrypt) - rijndael_encrypt(&ctx->key1, block, data); - else - rijndael_decrypt(&ctx->key1, block, data); - - for (i = 0; i < AES_XTS_BLOCKSIZE; i++) - data[i] ^= ctx->tweak[i]; - - /* Exponentiate tweak */ - carry_in = 0; - for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { - carry_out = ctx->tweak[i] & 0x80; - ctx->tweak[i] = (ctx->tweak[i] << 1) | (carry_in ? 1 : 0); - carry_in = carry_out; - } - if (carry_in) - ctx->tweak[0] ^= AES_XTS_ALPHA; - bzero(block, sizeof(block)); -} - -void -aes_xts_encrypt(caddr_t key, u_int8_t *data) -{ - aes_xts_crypt((struct aes_xts_ctx *)key, data, 1); -} - -void -aes_xts_decrypt(caddr_t key, u_int8_t *data) -{ - aes_xts_crypt((struct aes_xts_ctx *)key, data, 0); -} - -int -aes_xts_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - struct aes_xts_ctx *ctx; - - if (len != 32 && len != 64) - return EINVAL; - - *sched = malloc(sizeof(struct aes_xts_ctx), M_CRYPTO_DATA, - M_NOWAIT | M_ZERO); - if (*sched == NULL) - return ENOMEM; - ctx = (struct aes_xts_ctx *)*sched; - - rijndael_set_key(&ctx->key1, key, len * 4); - rijndael_set_key(&ctx->key2, key + (len / 2), len * 4); - - return 0; -} - -void -aes_xts_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof(struct aes_xts_ctx)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -static void -cml_encrypt(caddr_t key, u_int8_t *blk) -{ - camellia_encrypt((camellia_ctx *) key, (u_char *) blk, (u_char *) blk); -} - -static void -cml_decrypt(caddr_t key, u_int8_t *blk) -{ - camellia_decrypt(((camellia_ctx *) key), (u_char *) blk, - (u_char *) blk); -} - -static int -cml_setkey(u_int8_t **sched, u_int8_t *key, int len) -{ - int err; - - if (len != 16 && len != 24 && len != 32) - return (EINVAL); - *sched = malloc(sizeof(camellia_ctx), M_CRYPTO_DATA, - M_NOWAIT|M_ZERO); - if (*sched != NULL) { - camellia_set_key((camellia_ctx *) *sched, (u_char *) key, - len * 8); - err = 0; - } else - err = ENOMEM; - return err; -} - -static void -cml_zerokey(u_int8_t **sched) -{ - bzero(*sched, sizeof(camellia_ctx)); - free(*sched, M_CRYPTO_DATA); - *sched = NULL; -} - -/* - * And now for auth. - */ - -static void -null_init(void *ctx) -{ -} - -static void -null_reinit(void *ctx, const u_int8_t *buf, u_int16_t len) -{ -} - -static int -null_update(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - return 0; -} - -static void -null_final(u_int8_t *buf, void *ctx) -{ - if (buf != (u_int8_t *) 0) - bzero(buf, 12); -} - -static int -RMD160Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - RMD160Update(ctx, buf, len); - return 0; -} - -static int -MD5Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - MD5Update(ctx, buf, len); - return 0; -} - -static void -SHA1Init_int(void *ctx) -{ - SHA1Init(ctx); -} - -static int -SHA1Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - SHA1Update(ctx, buf, len); - return 0; -} - -static void -SHA1Final_int(u_int8_t *blk, void *ctx) -{ - SHA1Final(blk, ctx); -} - -static int -SHA256Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - SHA256_Update(ctx, buf, len); - return 0; -} - -static int -SHA384Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - SHA384_Update(ctx, buf, len); - return 0; -} - -static int -SHA512Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) -{ - SHA512_Update(ctx, buf, len); - return 0; -} -/* - * And compression - */ +/* Include the encryption algorithms */ +#include "xform_null.c" +#include "xform_des1.c" +#include "xform_des3.c" +#include "xform_blf.c" +#include "xform_cast5.c" +#include "xform_skipjack.c" +#include "xform_rijndael.c" +#include "xform_aes_icm.c" +#include "xform_aes_xts.c" +#include "xform_cml.c" + +/* Include the authentication and hashing algorithms */ +#include "xform_gmac.c" +#include "xform_md5.c" +#include "xform_rmd160.c" +#include "xform_sha1.c" +#include "xform_sha2.c" -static u_int32_t -deflate_compress(data, size, out) - u_int8_t *data; - u_int32_t size; - u_int8_t **out; -{ - return deflate_global(data, size, 0, out); -} +/* Include the compression algorithms */ +#include "xform_deflate.c" -static u_int32_t -deflate_decompress(data, size, out) - u_int8_t *data; - u_int32_t size; - u_int8_t **out; -{ - return deflate_global(data, size, 1, out); -} Modified: head/sys/opencrypto/xform.h ============================================================================== --- head/sys/opencrypto/xform.h Wed Dec 30 20:15:29 2015 (r292962) +++ head/sys/opencrypto/xform.h Wed Dec 30 22:43:07 2015 (r292963) @@ -39,83 +39,9 @@ #include #include -/* Declarations */ -struct auth_hash { - int type; - char *name; - u_int16_t keysize; - u_int16_t hashsize; - u_int16_t ctxsize; - u_int16_t blocksize; - void (*Init) (void *); - void (*Setkey) (void *, const u_int8_t *, u_int16_t); - void (*Reinit) (void *, const u_int8_t *, u_int16_t); - int (*Update) (void *, const u_int8_t *, u_int16_t); - void (*Final) (u_int8_t *, void *); -}; - -/* XXX use a define common with other hash stuff ! */ -#define AH_ALEN_MAX 64 /* max authenticator hash length */ - -struct enc_xform { - int type; - char *name; - u_int16_t blocksize; - u_int16_t ivsize; - u_int16_t minkey, maxkey; - void (*encrypt) (caddr_t, u_int8_t *); - void (*decrypt) (caddr_t, u_int8_t *); - int (*setkey) (u_int8_t **, u_int8_t *, int len); - void (*zerokey) (u_int8_t **); - void (*reinit) (caddr_t, u_int8_t *); -}; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Dec 30 23:04: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 7E2F5A56DCB; Wed, 30 Dec 2015 23:04:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 50B501C87; Wed, 30 Dec 2015 23:04:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUN48XR052425; Wed, 30 Dec 2015 23:04:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUN48JY052424; Wed, 30 Dec 2015 23:04:08 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201512302304.tBUN48JY052424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 30 Dec 2015 23:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292964 - head/contrib/binutils/bfd 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, 30 Dec 2015 23:04:09 -0000 Author: ian Date: Wed Dec 30 23:04:08 2015 New Revision: 292964 URL: https://svnweb.freebsd.org/changeset/base/292964 Log: Add the MOVT/MOVW types to the list of relocs which do not generate .plt entries. This fixes the segfaults in arm userland code compiled with -march= or -mcpu= values that allow the compiler to generate movw/movt sequences to load 32-bit constants. Modified: head/contrib/binutils/bfd/elf32-arm.c Modified: head/contrib/binutils/bfd/elf32-arm.c ============================================================================== --- head/contrib/binutils/bfd/elf32-arm.c Wed Dec 30 22:43:07 2015 (r292963) +++ head/contrib/binutils/bfd/elf32-arm.c Wed Dec 30 23:04:08 2015 (r292964) @@ -7720,12 +7720,26 @@ elf32_arm_check_relocs (bfd *abfd, struc refers to is in a different object. We can't tell for sure yet, because something later might force the symbol local. */ - if (r_type != R_ARM_ABS32 - && r_type != R_ARM_REL32 - && r_type != R_ARM_ABS32_NOI - && r_type != R_ARM_REL32_NOI - && r_type != R_ARM_ABS12) - h->needs_plt = 1; + switch (r_type) + { + case R_ARM_ABS12: + case R_ARM_ABS32: + case R_ARM_ABS32_NOI: + case R_ARM_REL32: + case R_ARM_REL32_NOI: + case R_ARM_MOVW_ABS_NC: + case R_ARM_MOVT_ABS: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_THM_MOVW_ABS_NC: + case R_ARM_THM_MOVT_ABS: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: + break; + default: + h->needs_plt = 1; + break; + } /* If we create a PLT entry, this relocation will reference it, even if it's an ABS32 relocation. */ From owner-svn-src-head@freebsd.org Wed Dec 30 23:27: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 0B7ECA564AB; Wed, 30 Dec 2015 23:27:26 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 CEC991645; Wed, 30 Dec 2015 23:27:25 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUNROZp059146; Wed, 30 Dec 2015 23:27:24 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUNROQ4059145; Wed, 30 Dec 2015 23:27:24 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512302327.tBUNROQ4059145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 30 Dec 2015 23:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292966 - head/sys/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: Wed, 30 Dec 2015 23:27:26 -0000 Author: allanjude Date: Wed Dec 30 23:27:24 2015 New Revision: 292966 URL: https://svnweb.freebsd.org/changeset/base/292966 Log: Bump __FreeBSD_version because r292782 removes sys/crypto/sha2.h Submitted by: Oliver Pinter Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Dec 30 23:25:45 2015 (r292965) +++ head/sys/sys/param.h Wed Dec 30 23:27:24 2015 (r292966) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100092 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100093 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Wed Dec 30 23:34:32 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 27AC7A56824 for ; Wed, 30 Dec 2015 23:34:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::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 B73601C9F for ; Wed, 30 Dec 2015 23:34:31 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22a.google.com with SMTP id b14so65900222wmb.1 for ; Wed, 30 Dec 2015 15:34:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eLSk17Y2MdxsWm/lZPu2yny0v5haA9oKOOzab5AyI5k=; b=BRGQPKvrW8XEtuIvs+6A2FAfk4E1XuIpq77Hj2xwymfkpulP1uRVc07Q/ZHyLrQcxg 60to9v82JTIc9lq6EPObFB3vk++/MLbHegjhk/LrU416OtNol8JVW8UFJtLKuu9vc0f0 loYoq+gfAS3mAcolsA5AnuX6DkND2pW5pP1eDyChdB28rzKsilRkNabw3iVmsGHyACNZ FyR5SnCpyUYI+h+Y+2NFSd0NOAoDaDGWbmNNrxq0+hHumy4KQHyhxVjUt1mqKQx/3PSN ezwXvmgGCWaIniv5MI3NDaaaIgP4V0zYRyKALFuixRaRZuKKCXw2r7ooWs3c/wlzZn2z orHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=eLSk17Y2MdxsWm/lZPu2yny0v5haA9oKOOzab5AyI5k=; b=MYKVXT3lJQW4C/w2NiTUQbAi5glxqZn2guRLsO8wZbb/3GRs7ua8kJlQi09ptRpcqi jlE9ucUI6f1cV3GTLV3IPgkGj07GrPJv0F4YffvZRHunDKk2YyGVQYWO4edpj4B5+yMh 2jXDvmSqYADIb1sh+yhSrgdEjH2FPyMm7CE3hnncLdVIdJe31plflSO3K3XjKKeNa6Nl ff6QQ6ZD5QR64XL89Nlsuey1/IzZPrqEmSHWNTOpgvItvGHSPoyMW+DJOtGeR8QpJLtB OdHRPGAyaGFx91yM5fYLuAsBh5usmppXKVj03GXLucsY6OSea7d7dICUTKYqKHpInc1j R64g== X-Gm-Message-State: ALoCoQnlVM9O1oeXv6Sz+isFWgtsAlu/sHRa/Plu3LPD8rIC+mXw78g5BHT+VTNLkkz08LfLbQg5t3NqeKEs0iie21oZU4EaSekUwoUt1Zuc2t9OKsXNfGY= MIME-Version: 1.0 X-Received: by 10.28.146.145 with SMTP id u139mr11512932wmd.81.1451518470144; Wed, 30 Dec 2015 15:34:30 -0800 (PST) Received: by 10.194.85.167 with HTTP; Wed, 30 Dec 2015 15:34:30 -0800 (PST) In-Reply-To: <201512302327.tBUNROQ4059145@repo.freebsd.org> References: <201512302327.tBUNROQ4059145@repo.freebsd.org> Date: Thu, 31 Dec 2015 00:34:30 +0100 Message-ID: Subject: Re: svn commit: r292966 - head/sys/sys From: Oliver Pinter To: Allan Jude 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, 30 Dec 2015 23:34:32 -0000 On 12/31/15, Allan Jude wrote: > Author: allanjude > Date: Wed Dec 30 23:27:24 2015 > New Revision: 292966 > URL: https://svnweb.freebsd.org/changeset/base/292966 > > Log: > Bump __FreeBSD_version because r292782 removes sys/crypto/sha2.h > > Submitted by: Oliver Pinter > > Modified: > head/sys/sys/param.h > > Modified: head/sys/sys/param.h > ============================================================================== > --- head/sys/sys/param.h Wed Dec 30 23:25:45 2015 (r292965) > +++ head/sys/sys/param.h Wed Dec 30 23:27:24 2015 (r292966) > @@ -58,7 +58,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1100092 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1100093 /* Master, propagated to newvers */ > > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of > FreeBSD, Cool! Thank you! > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Thu Dec 31 01:08: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 4853BA56428 for ; Thu, 31 Dec 2015 01:08:58 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::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 D57FD1F2F for ; Thu, 31 Dec 2015 01:08:57 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22a.google.com with SMTP id u188so54081769wmu.1 for ; Wed, 30 Dec 2015 17:08:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=486WYNOrelc+SUlWNAfyIMtwSPb6tgMYlStgZQFD7BM=; b=2SnK4BPXIXi8UMlGkCfArIdI4xvMLs2v77CLwwMReS4my+hpSanJCfC7uGxC7xl9A4 t7oQ6wB2ZxWULps5roTpDeVVQ/uRnYEONo5By7FGeJr3+SaRKoOnLnIqApyXNHn/e6Xq J64lcqrpKCMyXFMnWswe0B8KrpE96FLqzllm3SWT3t50vthJmFZ2B7mQVNWxbLJ+uq26 +q/FjBVlzPp2G7GgI/DeGMG9PZmF/BMjGJgU5aDJgyW/JpYnBb3oL99EiNXYa3MFthbR soLN1Ju8lkpemmlBjS9PYAj28fZR9NxJH1wWIaDpBoPR+ir/u6vAjv5QS9SYHvR+2w7m 096A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=486WYNOrelc+SUlWNAfyIMtwSPb6tgMYlStgZQFD7BM=; b=l55Rgp9PZdHF4mjRzFTSelZ8HZ3//4EM0rniOQpBpt76tTgfZNbZDiwHRCjgMpJepj mPr7YepquGGTr+mkwc5O/PfHtFzmJWp9sNQCepsFUnFAZ+Iz45RDMoDlGjj0SI21fd3P vtekJkocHX/COlz7km4y1xrPZiJdKxgwwuhqRtzt5zk7ogfW6jkffzGyp6ZCsyk7PUQX jrIwDqCZV2/YhzXpJQi9vC2WGpFPOawredi95trWqo+JCxhi39WDPJDp+fmkMtCPbpts Rt0OIsll2Qsrgho88f4KwnP9YdVp9YrqTu1C2IbknCZ63D0z9Pl0S04btBLBB6nD55rx j5WQ== X-Gm-Message-State: ALoCoQmW+tY36oP0E2mB8plWl3Rjh5TnCrnDqFs2b8mGVle1ErAoM3er3jMkXnb52AagE/mwbh68T3n6vzQMpj4ns3XqOU0y8jWtsz16cA5DK/yiFaUEWBE= MIME-Version: 1.0 X-Received: by 10.194.178.70 with SMTP id cw6mr72662380wjc.73.1451524135067; Wed, 30 Dec 2015 17:08:55 -0800 (PST) Received: by 10.194.85.167 with HTTP; Wed, 30 Dec 2015 17:08:54 -0800 (PST) In-Reply-To: <201512181633.tBIGXFff046683@repo.freebsd.org> References: <201512181633.tBIGXFff046683@repo.freebsd.org> Date: Thu, 31 Dec 2015 02:08:54 +0100 Message-ID: Subject: Re: svn commit: r292440 - in head/sys: kern sys From: Oliver Pinter To: Mateusz Guzik 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, 31 Dec 2015 01:08:58 -0000 On 12/18/15, Mateusz Guzik wrote: > Author: mjg > Date: Fri Dec 18 16:33:15 2015 > New Revision: 292440 > URL: https://svnweb.freebsd.org/changeset/base/292440 > > Log: > proc: fix a race which could result in dereference of bad p_pgrp pointer > on fork > > During fork p_starcopy - p_endcopy area of a process is populated with > bcopy > with only proc lock held. Another forking thread can find such a process > and > proceed to access p_pgrp included in said area. > > Fix the problem by moving the field outside. It is being properly > assigned > later. > > Reviewed by: kib > Diagnosed by: kib > Tested by: Fabian Keil > MFC after: 10 days Hi mjg@! Just an MFC reminder and question: This patch is still needs on 10-STABLE? > > Modified: > head/sys/kern/kern_proc.c > head/sys/sys/proc.h > > Modified: head/sys/kern/kern_proc.c > From owner-svn-src-head@freebsd.org Thu Dec 31 01: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 A41EFA5676A; Thu, 31 Dec 2015 01:54:08 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 78066106D; Thu, 31 Dec 2015 01:54:08 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV1s7Q6004166; Thu, 31 Dec 2015 01:54:07 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV1s7sj004165; Thu, 31 Dec 2015 01:54:07 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310154.tBV1s7sj004165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 01:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292969 - head/sys/xen/xenbus 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, 31 Dec 2015 01:54:08 -0000 Author: araujo Date: Thu Dec 31 01:54:07 2015 New Revision: 292969 URL: https://svnweb.freebsd.org/changeset/base/292969 Log: Clean up unused-but-set-variable spotted by gcc-4.9. Reviewed by: royger Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4733 Modified: head/sys/xen/xenbus/xenbusb.c Modified: head/sys/xen/xenbus/xenbusb.c ============================================================================== --- head/sys/xen/xenbus/xenbusb.c Thu Dec 31 01:26:43 2015 (r292968) +++ head/sys/xen/xenbus/xenbusb.c Thu Dec 31 01:54:07 2015 (r292969) @@ -561,7 +561,6 @@ xenbusb_devices_changed(struct xs_watch struct xenbusb_softc *xbs; device_t dev; char *node; - char *bus; char *type; char *id; char *p; @@ -580,7 +579,6 @@ xenbusb_devices_changed(struct xs_watch p = strchr(node, '/'); if (p == NULL) goto out; - bus = node; *p = 0; type = p + 1; From owner-svn-src-head@freebsd.org Thu Dec 31 01:55: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 21837A56893; Thu, 31 Dec 2015 01:55:53 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E70E8125A; Thu, 31 Dec 2015 01:55:52 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV1tq7X004277; Thu, 31 Dec 2015 01:55:52 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV1tqcr004276; Thu, 31 Dec 2015 01:55:52 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310155.tBV1tqcr004276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 01:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292970 - head/usr.sbin/bhyve 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, 31 Dec 2015 01:55:53 -0000 Author: araujo Date: Thu Dec 31 01:55:51 2015 New Revision: 292970 URL: https://svnweb.freebsd.org/changeset/base/292970 Log: Clean up unused-but-set-variable spotted by gcc-4.9. Reviewed by: grehan Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D4735 Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Dec 31 01:54:07 2015 (r292969) +++ head/usr.sbin/bhyve/pci_emul.c Thu Dec 31 01:55:51 2015 (r292970) @@ -863,10 +863,9 @@ msixcap_cfgwrite(struct pci_devinst *pi, int bytes, uint32_t val) { uint16_t msgctrl, rwmask; - int off, table_bar; + int off; off = offset - capoff; - table_bar = pi->pi_msix.table_bar; /* Message Control Register */ if (off == 2 && bytes == 2) { rwmask = PCIM_MSIXCTRL_MSIX_ENABLE | PCIM_MSIXCTRL_FUNCTION_MASK; From owner-svn-src-head@freebsd.org Thu Dec 31 01:57: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 E5421A569BA; Thu, 31 Dec 2015 01:57:56 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B9550146A; Thu, 31 Dec 2015 01:57:56 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV1vtfK004380; Thu, 31 Dec 2015 01:57:55 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV1vtdP004379; Thu, 31 Dec 2015 01:57:55 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310157.tBV1vtdP004379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 01:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292971 - head/usr.sbin/camdd 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, 31 Dec 2015 01:57:57 -0000 Author: araujo Date: Thu Dec 31 01:57:55 2015 New Revision: 292971 URL: https://svnweb.freebsd.org/changeset/base/292971 Log: Clean up unused-but-set-variable spotted by gcc-4.9. Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D4736 Modified: head/usr.sbin/camdd/camdd.c Modified: head/usr.sbin/camdd/camdd.c ============================================================================== --- head/usr.sbin/camdd/camdd.c Thu Dec 31 01:55:51 2015 (r292970) +++ head/usr.sbin/camdd/camdd.c Thu Dec 31 01:57:55 2015 (r292971) @@ -1276,7 +1276,6 @@ camdd_probe_pass(struct cam_device *cam_ struct camdd_dev_pass *pass_dev; struct kevent ke; int scsi_dev_type; - int retval; dev = NULL; @@ -1336,7 +1335,6 @@ camdd_probe_pass(struct cam_device *cam_ if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -1371,11 +1369,8 @@ camdd_probe_pass(struct cam_device *cam_ if (cam_send_ccb(cam_dev, ccb) < 0) { warn("error sending READ CAPACITY (16) command"); - cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - - retval = 1; goto bailout; } From owner-svn-src-head@freebsd.org Thu Dec 31 02:01: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 4B131A56B86; Thu, 31 Dec 2015 02:01:22 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1AB501814; Thu, 31 Dec 2015 02:01:22 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV21LH7004894; Thu, 31 Dec 2015 02:01:21 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV21L0C004893; Thu, 31 Dec 2015 02:01:21 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310201.tBV21L0C004893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 02:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292972 - head/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, 31 Dec 2015 02:01:22 -0000 Author: araujo Date: Thu Dec 31 02:01:20 2015 New Revision: 292972 URL: https://svnweb.freebsd.org/changeset/base/292972 Log: Wrap using #ifdef 'notyet' those variables and statements not yet implemented to lower the compiler warnings. It fix the case of unused-but-set-variable spotted by gcc4.9. Reviewed by: ngie, ae Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D4720 Modified: head/sys/net/if_gre.c Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Thu Dec 31 01:57:55 2015 (r292971) +++ head/sys/net/if_gre.c Thu Dec 31 02:01:20 2015 (r292972) @@ -682,7 +682,10 @@ gre_input(struct mbuf **mp, int *offp, i struct grehdr *gh; struct ifnet *ifp; struct mbuf *m; - uint32_t *opts, key; + uint32_t *opts; +#ifdef notyet + uint32_t key; +#endif uint16_t flags; int hlen, isr, af; @@ -715,17 +718,28 @@ gre_input(struct mbuf **mp, int *offp, i opts++; } if (flags & GRE_FLAGS_KP) { +#ifdef notyet + /* + * XXX: The current implementation uses the key only for outgoing + * packets. But we can check the key value here, or even in the + * encapcheck function. + */ key = ntohl(*opts); +#endif hlen += sizeof(uint32_t); opts++; + } +#ifdef notyet } else key = 0; - /* + if (sc->gre_key != 0 && (key != sc->gre_key || key != 0)) goto drop; - */ +#endif if (flags & GRE_FLAGS_SP) { - /* seq = ntohl(*opts); */ +#ifdef notyet + seq = ntohl(*opts); +#endif hlen += sizeof(uint32_t); } switch (ntohs(gh->gre_proto)) { From owner-svn-src-head@freebsd.org Thu Dec 31 03:20: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 DFC8CA56966; Thu, 31 Dec 2015 03:20:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-oi0-x235.google.com (mail-oi0-x235.google.com [IPv6:2607:f8b0:4003: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 AC5641EEA; Thu, 31 Dec 2015 03:20:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-oi0-x235.google.com with SMTP id o62so205639296oif.3; Wed, 30 Dec 2015 19:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2nP8Aip1BNXULJjuNOS5g+QfQqy6biP/MdZYegnRtLc=; b=UF6Sz4syaysYC47LPOD+IePLcU/7Pl+FQ713X3fbjRAkLKe0ndrgN/lc4Eu8dia0qK uFcivvnOqc972awqsjSOMn6Fm3auGfPbhZeg8dlyTHxENCFYgiOg1FWDo7oy0GDsH1zh fKGgnS1iAEYxJO/GIrYcHIkdyBi+2dghuH3RlWJfM4yg/HDrcQYuAzZP9SO6C3q19d7/ 1CKOtltg04cRjJuk4sZhTMILkxf8T7l5r3u+INNtonfoIOWOW4sTFACCfHtYoCN+XUV7 SJ9To6gV+5TkNJBJq2ZgYfOrmmvQU/8+Ubn60hORlJiGNevEac7Z+YY639FIis1ym/wX gOfQ== X-Received: by 10.202.176.66 with SMTP id z63mr42779692oie.61.1451532056913; Wed, 30 Dec 2015 19:20:56 -0800 (PST) Received: from ?IPv6:2601:601:800:126d:9910:6b8e:28b:6700? ([2601:601:800:126d:9910:6b8e:28b:6700]) by smtp.gmail.com with ESMTPSA id ur2sm24626736obc.11.2015.12.30.19.20.54 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 19:20:55 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292969 - head/sys/xen/xenbus From: NGie Cooper In-Reply-To: <201512310154.tBV1s7sj004165@repo.freebsd.org> Date: Wed, 30 Dec 2015 19:20:53 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201512310154.tBV1s7sj004165@repo.freebsd.org> To: Marcelo Araujo X-Mailer: Apple Mail (2.2104) 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, 31 Dec 2015 03:20:58 -0000 > On Dec 30, 2015, at 17:54, Marcelo Araujo wrote: > > Author: araujo > Date: Thu Dec 31 01:54:07 2015 > New Revision: 292969 > URL: https://svnweb.freebsd.org/changeset/base/292969 > > Log: > Clean up unused-but-set-variable spotted by gcc-4.9. > > Reviewed by: royger > Approved by: rodrigc (mentor) > Differential Revision: https://reviews.freebsd.org/D4733 Hi Marcelo! Do you plan on MFCing these changes (MFC after: XXX)? Thanks! -NGie From owner-svn-src-head@freebsd.org Thu Dec 31 03:24: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 4DB49A56B59; Thu, 31 Dec 2015 03:24:47 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x22f.google.com (mail-ob0-x22f.google.com [IPv6:2607:f8b0:4003:c01::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 1A3E813DC; Thu, 31 Dec 2015 03:24:47 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-ob0-x22f.google.com with SMTP id 18so282825016obc.2; Wed, 30 Dec 2015 19:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=3iDLvfNrrv2MjPkdXFS9sW1AH2t9qidnRk026S4JzKs=; b=FwfoyEOqAW70bTfDRSLazF6y1d6Z2gH56zqLYrmwWKfdwQA/Whs0wOu15Z500QyMoF BAlxaCC01KOGzbfh7RMdUrRTR9dtSkFK8WMXmoeurrqN7NUoP7hpQVow9Pnjf2ba10DR 7hC0tcovoFBAuE41DMnvUJePyXV5qjgF8vnnPP2aMBFKVt7qYMBurZlAWO/JEoe3asvZ xhelF+ZUDEkRXPRn89NvCdyNWOgJncbL75d++jaoCpNOFYyF8RIL4epmZiO8DqpK+jCs Tgceuq3a7n4nS4CHlUxVSS+/Z20JwF4wiNKSvtlplMOMoLd6kgwCwzvDXoajnNVnrn1N sALw== MIME-Version: 1.0 X-Received: by 10.182.153.35 with SMTP id vd3mr19655520obb.16.1451532286422; Wed, 30 Dec 2015 19:24:46 -0800 (PST) Received: by 10.182.7.33 with HTTP; Wed, 30 Dec 2015 19:24:46 -0800 (PST) Reply-To: araujo@FreeBSD.org In-Reply-To: References: <201512310154.tBV1s7sj004165@repo.freebsd.org> Date: Thu, 31 Dec 2015 11:24:46 +0800 Message-ID: Subject: Re: svn commit: r292969 - head/sys/xen/xenbus From: Marcelo Araujo To: NGie Cooper 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: Thu, 31 Dec 2015 03:24:47 -0000 2015-12-31 11:20 GMT+08:00 NGie Cooper : > > > On Dec 30, 2015, at 17:54, Marcelo Araujo wrote: > > > > Author: araujo > > Date: Thu Dec 31 01:54:07 2015 > > New Revision: 292969 > > URL: https://svnweb.freebsd.org/changeset/base/292969 > > > > Log: > > Clean up unused-but-set-variable spotted by gcc-4.9. > > > > Reviewed by: royger > > Approved by: rodrigc (mentor) > > Differential Revision: https://reviews.freebsd.org/D4733 > > Hi Marcelo! > Do you plan on MFCing these changes (MFC after: XXX)? > Thanks! > -NGie > > Hi Ngie, I didn't make any plan to MFC these changes, because I saw in the latest weeks you are doing all of this job. Thanks for that! But, yes, I can do the MFC in case you don't want do it by yourself as you have been doing. Just let me know and I will schedule it to be MFC after couple weeks. Best, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@freebsd.org Thu Dec 31 03:29: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 295D5A56D53; Thu, 31 Dec 2015 03:29:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id E1D8119C0; Thu, 31 Dec 2015 03:29:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 3C6081044973; Thu, 31 Dec 2015 14:03:44 +1100 (AEDT) Date: Thu, 31 Dec 2015 14:03:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Jonathan T. Looney" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292955 - head/lib/libmd In-Reply-To: <201512301804.tBUI4oGp065466@repo.freebsd.org> Message-ID: <20151231115651.R995@besplex.bde.org> References: <201512301804.tBUI4oGp065466@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=n6x23ePlt3Etblb9PaIA:9 a=W7bupkRa8C25QxS4:21 a=arsscFRyo2p6TkLc:21 a=CjuIK1q_8ugA:10 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, 31 Dec 2015 03:29:22 -0000 On Wed, 30 Dec 2015, Jonathan T. Looney wrote: > Log: > Fix a file descriptor leak in mdXhl.c (which is used by numerous hashing > algorithms. This code had amazingly low quality and is still especially broken near the main leak fixed. > Modified: head/lib/libmd/mdXhl.c > ============================================================================== > --- head/lib/libmd/mdXhl.c Wed Dec 30 17:36:34 2015 (r292954) > +++ head/lib/libmd/mdXhl.c Wed Dec 30 18:04:50 2015 (r292955) > @@ -59,14 +59,18 @@ MDXFileChunk(const char *filename, char > f = open(filename, O_RDONLY); > if (f < 0) > return 0; > - if (fstat(f, &stbuf) < 0) > - return 0; > + if (fstat(f, &stbuf) < 0) { > + i = -1; > + goto error; > + } > if (ofs > stbuf.st_size) > ofs = stbuf.st_size; st_size is only valid for regular files. The first bug is using it here. Usually it is 0 when it is invalid. This code sets the offset to 0 then. I think this is just to avoid a false negative in the buggy seek test. > if ((len == 0) || (len > stbuf.st_size - ofs)) > len = stbuf.st_size - ofs; Style bugs (extra parentheses) and second use of the invalid st_size. > - if (lseek(f, ofs, SEEK_SET) < 0) > - return 0; > + if (lseek(f, ofs, SEEK_SET) < 0) { > + i = -1; > + goto error; > + } md5 is very broken by using this function for non-seekable files. The main case of a non-seekable file is a pipe. This case works for at least md5(1) by not using this function -- it uses MDFilter() which uses stdio's fread() which works. (stdio knows better than to use st_size, but it naively trusts st_blksize and uses it to give a pessimized small block size for read() called from fread(). This code handles buffer sizing and allocation worse using its low quality methods: - its buffer used to have size BUFSIZ. This size is not usable for anything except possibly buffering keyboard input and stderr. It is mainly part of the broken setbuf() API. Its value is 1024, perhaps to avoid changing this API. 1024 large enough for more uses in 1980. - its buffer now has size 16*1024 (spelled with a style bug like that). This sometimes matches and sometimes exceeds the size used by stdio. stdio at least attempts to choose the best size, but is defeated by stat() putting useless sizes in st_blksize. - it also tries to pessimize the i/o by asking for a misaligned buffer. Its buffer is just a local char[] variable. Compilers usally mostly foil this attempt by aligning large variables on the stack. Misaligned usr buffers should only pessimize the i/o, but last time I looked they cause DMA errors in ahci. This breaks bsdlabel(8). bsdlabel ask for a misaligned buffer and gets it at least when statically linked because its buffer is a global char [] variable and the neither the compiler nor the linker gives more alignment than requested. The DMA error would break md5 (or just cat) similarly if the buffer were misaligend. But the main bug here breaks md5 on disks without trying any i/o. Back to the main bug. This seek test detects some cases of non-regular files. These files indeed cannot be handled by this code. But the error handling is broken -- it is just to set errno and return 0 (EOF). 0 means no error and errno is no set. So all non-seekable files are treated as empty regular files. E.g., md5 /proc/0/* gives: md5: /proc/0/ctl: Permission denied MD5 (/proc/0/cmdline) = d41d8cd98f00b204e9800998ecf8427e MD5 (/proc/0/etype) = d41d8cd98f00b204e9800998ecf8427e MD5 (/proc/0/rlimit) = d41d8cd98f00b204e9800998ecf8427e MD5 (/proc/0/status) = d41d8cd98f00b204e9800998ecf8427e (/proc gives my favourite examples of irregular regular files. It doesn't work to use S_ISREG(&stbuf) to determine if st_size can be trusted, since too many irregular files claim to be regular: e.g., file /proc/0/* gives: /proc/0/cmdline: empty /proc/0/ctl: empty /proc/0/etype: empty /proc/0/rlimit: empty /proc/0/status: empty wc /proc/0/* works. md5 works like wc using a hack to avoid calling this broken function. E.g., for i in $(ls /proc/0/*); do echo -n "$i: "; md5 <$i; done # gives /proc/0/cmdline: 3c5896b1ac441f4998f052e2126e8d20 /proc/0/ctl: d41d8cd98f00b204e9800998ecf8427e /proc/0/etype: 674441960ca1ba2de08ad4e50c9fde98 /proc/0/rlimit: 67d6ad67b412e1bceb7cb508a3492197 /proc/0/status: 3ccc3067b97c3232ea2dbcb64c458fd4 > n = len; > i = 0; > while (n > 0) { Disk device files are seekable, so the lseek test doesn't result in mishandling them. Instead, they are treated as empty files since their st_size is 0. E.g., md5 /dev/ad* gives: MD5 (/dev/ad0) = d41d8cd98f00b204e9800998ecf8427e MD5 (/dev/ad0s1) = d41d8cd98f00b204e9800998ecf8427e MD5 (/dev/ad0s2) = d41d8cd98f00b204e9800998ecf8427e MD5 (/dev/ad0s2a) = d41d8cd98f00b204e9800998ecf8427e ... The workarounds are much the same as for non-seekable files: for i in /dev/ad0s2a; do echo -n "$i: "; md5 <$i; done # gives /dev/ad0s2a: 3b4c134a41615cbc60ef778acd188ed4 Most disk devices are too large to run md5 on, but this partition has size 64MB. I sometimes run md5 and other utilities like cmp on partitions or USB disks of size up to 10GB and get annoyed by the i/o pessimizations. It is faster to copy everything to a regular file and check that. cp has reasonably good i/o buffer sizes and the disk cache works well. However, copying a disk to a regular file and looking at its partitions there using md(4) works even worse. md(4) defeats the disk cache using IO_DIRECT. > @@ -79,6 +83,7 @@ MDXFileChunk(const char *filename, char > MDXUpdate(&ctx, buffer, i); > n -= i; > } > +error: > e = errno; > close(f); > errno = e; I don't understand the plumbing for MDXFileChunk(). Usually the whole file is wanted. MDXFileChunk() cannot work with a nonzero offset on non-seekable files. But it is preferred to the working MDFilter() even in the usual case of a zero offset. MDFilter() is actually a static function in md5(1). libmd apparently has no working input function, since MDXFileChunk() is its only function that uses *read(). MDXFile() is just a wrapper around MDXFileChunk(). The seek test is also broken for certain offsets. FreeBSD supports kseeking to negative offsets on device files. Such offsets occur for high addresses in /dev/kmem on 64-bit systems. errno should be set to 0 before the call and used instead of the return value to determine if the syscall failed. See dd/dd.c for a seek test that is closer to working. dd checks for EPIPE. It also messes around with S_ISCHR(), S_ISBLK() and FIODTYPE. Its algorithm is: - trust S_ISCHR() and S_ISBLK() and don't do the general lseek test for these cases. These can be trusted more than S_ISREG(). - for device files according to this classification, abort the whole program if FDIOTYPE fails. Trust it for setting ISSEEK and ISTAPE flags if it succeeds. - otherwise, do a general lseek test with an EPIPE. MD shouldn't try as hard as dd since there are probably bugs in the complications. But it should try to fail safe since it is more security-related than dd. That means bailing out on any detected error and not trusting st_size unless it is nonzero even if the file is regular. MDXFileChunk()'s error handling seems to be to return 0 on all errors. This is undocumented, and is ambiguous since 0 is also returned for empty files and for files misclassified as empty. The ambiguity can sometimes be resolved by checking errno, but libmd and md5 never check errno. md5 ends up never checking the error and printing d41d8cd98f00b204e9800998ecf8427e for both empty files and for all errors that occur before any bytes are handled. Bruce From owner-svn-src-head@freebsd.org Thu Dec 31 04:10: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 9BAD2A57ADC; Thu, 31 Dec 2015 04:10:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 671BD1F08; Thu, 31 Dec 2015 04:10:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 70938422065; Thu, 31 Dec 2015 15:10:32 +1100 (AEDT) Date: Thu, 31 Dec 2015 15:10:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292955 - head/lib/libmd In-Reply-To: <20151231115651.R995@besplex.bde.org> Message-ID: <20151231143314.Y1520@besplex.bde.org> References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=R4L+YolX c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=9cW_t1CCXrUA:10 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=nkSGdXzS_FKU9MRdIc0A:9 a=CjuIK1q_8ugA:10 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, 31 Dec 2015 04:10:42 -0000 On Thu, 31 Dec 2015, Bruce Evans wrote: > > wc /proc/0/* works. md5 works like wc using a hack to avoid calling this > broken function. E.g., > > for i in $(ls /proc/0/*); do echo -n "$i: "; md5 <$i; done # gives > > /proc/0/cmdline: 3c5896b1ac441f4998f052e2126e8d20 > /proc/0/ctl: d41d8cd98f00b204e9800998ecf8427e > /proc/0/etype: 674441960ca1ba2de08ad4e50c9fde98 > /proc/0/rlimit: 67d6ad67b412e1bceb7cb508a3492197 > /proc/0/status: 3ccc3067b97c3232ea2dbcb64c458fd4 Further examples: md5 # on terminal input works correctly by not using MDXFileChunk(). md5 /dev/stdin # on the same terminal input produces the d41d8cd98f00b204e9800998ecf8427e garbage using MDXFileChunk(). truss shows that lseek() is broken too -- MDXFileChunk() tries it and it succeeds on the unseekable file /dev/stdin. Bugs in this area are common. E.g., lseek() on named pipes was broken so that it succeeded, by rearranging the plumbing use fileops more or less and not attaching lseek right. cat | md5 # on the same terminal input works correctly by not using MDXFileChunk(). cat | md5 /dev/stdin # on the same terminal input doesn't work correctly, but it fails better than without the pipe. Now a seek error occurs and is reported as "md5: /dev/stdin: Illegal seek" (I can't see where it is reported). Then md5 exits. Then cat waits to read input. Then cat fails to write output and is killed by SIGPIPE. So md5 handled the seek error in a fail-safe though incorrect way. One correct way is to fall back to the working code, but it is better to just use that without an lseek check. It is a bug that [l]stat() on /dev/stdin sees the device file and not the actual stdin file. md5 can't work around this except by not using stat(). Bruce From owner-svn-src-head@freebsd.org Thu Dec 31 05:03: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 D70C1A55C47; Thu, 31 Dec 2015 05:03:29 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6D33B1756; Thu, 31 Dec 2015 05:03:29 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV53Sna061511; Thu, 31 Dec 2015 05:03:28 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV53RkI061498; Thu, 31 Dec 2015 05:03:27 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201512310503.tBV53RkI061498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 31 Dec 2015 05:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292978 - in head/sys: dev/cxgb/ulp/tom dev/cxgbe/tom net netinet netinet6 ofed/drivers/infiniband/ulp/ipoib 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, 31 Dec 2015 05:03:30 -0000 Author: melifaro Date: Thu Dec 31 05:03:27 2015 New Revision: 292978 URL: https://svnweb.freebsd.org/changeset/base/292978 Log: Implement interface link header precomputation API. Add if_requestencap() interface method which is capable of calculating various link headers for given interface. Right now there is support for INET/INET6/ARP llheader calculation (IFENCAP_LL type request). Other types are planned to support more complex calculation (L2 multipath lagg nexthops, tunnel encap nexthops, etc..). Reshape 'struct route' to be able to pass additional data (with is length) to prepend to mbuf. These two changes permits routing code to pass pre-calculated nexthop data (like L2 header for route w/gateway) down to the stack eliminating the need for other lookups. It also brings us closer to more complex scenarios like transparently handling MPLS nexthops and tunnel interfaces. Last, but not least, it removes layering violation introduced by flowtable code (ro_lle) and simplifies handling of existing if_output consumers. ARP/ND changes: Make arp/ndp stack pre-calculate link header upon installing/updating lle record. Interface link address change are handled by re-calculating headers for all lles based on if_lladdr event. After these changes, arpresolve()/nd6_resolve() returns full pre-calculated header for supported interfaces thus simplifying if_output(). Move these lookups to separate ether_resolve_addr() function which ether returs error or fully-prepared link header. Add resolve_addr() compat versions to return link addresses instead of pre-calculated data. BPF changes: Raw bpf writes occupied _two_ cases: AF_UNSPEC and pseudo_AF_HDRCMPLT. Despite the naming, both of there have ther header "complete". The only difference is that interface source mac has to be filled by OS for AF_UNSPEC (controlled via BIOCGHDRCMPLT). This logic has to stay inside BPF and not pollute if_output() routines. Convert BPF to pass prepend data via new 'struct route' mechanism. Note that it does not change non-optimized if_output(): ro_prepend handling is purely optional. Side note: hackish pseudo_AF_HDRCMPLT is supported for ethernet and FDDI. It is not needed for ethernet anymore. The only remaining FDDI user is dev/pdq mostly untouched since 2007. FDDI support was eliminated from OpenBSD in 2013 (sys/net/if_fddisubr.c rev 1.65). Flowtable changes: Flowtable violates layering by saving (and not correctly managing) rtes/lles. Instead of passing lle pointer, pass pointer to pre-calculated header data from that lle. Differential Revision: https://reviews.freebsd.org/D4102 Modified: head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c head/sys/dev/cxgbe/tom/t4_tom_l2t.c head/sys/net/bpf.c head/sys/net/flowtable.c head/sys/net/if.c head/sys/net/if_ethersubr.c head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/net/if_var.h head/sys/net/route.h head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h head/sys/netinet/in.c head/sys/netinet/ip_output.c head/sys/netinet/toecore.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_nbr.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Thu Dec 31 05:03:27 2015 (r292978) @@ -215,7 +215,7 @@ resolve_entry(struct adapter *sc, struct struct tom_data *td = sc->tom_softc; struct toedev *tod = &td->tod; struct sockaddr_in sin = {0}; - uint8_t dmac[ETHER_ADDR_LEN]; + uint8_t dmac[ETHER_HDR_LEN]; uint16_t vtag = EVL_VLID_MASK; int rc; Modified: head/sys/dev/cxgbe/tom/t4_tom_l2t.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom_l2t.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/dev/cxgbe/tom/t4_tom_l2t.c Thu Dec 31 05:03:27 2015 (r292978) @@ -233,7 +233,7 @@ resolve_entry(struct adapter *sc, struct struct sockaddr_in sin = {0}; struct sockaddr_in6 sin6 = {0}; struct sockaddr *sa; - uint8_t dmac[ETHER_ADDR_LEN]; + uint8_t dmac[ETHER_HDR_LEN]; uint16_t vtag = VLAN_NONE; int rc; Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/bpf.c Thu Dec 31 05:03:27 2015 (r292978) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef BPF_JITTER @@ -76,6 +77,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include #include @@ -164,7 +166,7 @@ static void bpf_detachd(struct bpf_d *); static void bpf_detachd_locked(struct bpf_d *); static void bpf_freed(struct bpf_d *); static int bpf_movein(struct uio *, int, struct ifnet *, struct mbuf **, - struct sockaddr *, int *, struct bpf_insn *); + struct sockaddr *, int *, struct bpf_d *); static int bpf_setif(struct bpf_d *, struct ifreq *); static void bpf_timed_out(void *); static __inline void @@ -454,7 +456,7 @@ bpf_ioctl_setzbuf(struct thread *td, str */ static int bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp, - struct sockaddr *sockp, int *hdrlen, struct bpf_insn *wfilter) + struct sockaddr *sockp, int *hdrlen, struct bpf_d *d) { const struct ieee80211_bpf_params *p; struct ether_header *eh; @@ -549,7 +551,7 @@ bpf_movein(struct uio *uio, int linktype if (error) goto bad; - slen = bpf_filter(wfilter, mtod(m, u_char *), len, len); + slen = bpf_filter(d->bd_wfilter, mtod(m, u_char *), len, len); if (slen == 0) { error = EPERM; goto bad; @@ -566,6 +568,10 @@ bpf_movein(struct uio *uio, int linktype else m->m_flags |= M_MCAST; } + if (d->bd_hdrcmplt == 0) { + memcpy(eh->ether_shost, IF_LLADDR(ifp), + sizeof(eh->ether_shost)); + } break; } @@ -1088,6 +1094,7 @@ bpfwrite(struct cdev *dev, struct uio *u struct ifnet *ifp; struct mbuf *m, *mc; struct sockaddr dst; + struct route ro; int error, hlen; error = devfs_get_cdevpriv((void **)&d); @@ -1119,7 +1126,7 @@ bpfwrite(struct cdev *dev, struct uio *u hlen = 0; /* XXX: bpf_movein() can sleep */ error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp, - &m, &dst, &hlen, d->bd_wfilter); + &m, &dst, &hlen, d); if (error) { d->bd_wdcount++; return (error); @@ -1151,7 +1158,14 @@ bpfwrite(struct cdev *dev, struct uio *u BPFD_UNLOCK(d); #endif - error = (*ifp->if_output)(ifp, m, &dst, NULL); + bzero(&ro, sizeof(ro)); + if (hlen != 0) { + ro.ro_prepend = (u_char *)&dst.sa_data; + ro.ro_plen = hlen; + ro.ro_flags = RT_HAS_HEADER; + } + + error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) d->bd_wdcount++; Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/flowtable.c Thu Dec 31 05:03:27 2015 (r292978) @@ -665,6 +665,7 @@ int flowtable_lookup(sa_family_t sa, struct mbuf *m, struct route *ro) { struct flentry *fle; + struct llentry *lle; if (V_flowtable_enable == 0) return (ENXIO); @@ -693,8 +694,15 @@ flowtable_lookup(sa_family_t sa, struct } ro->ro_rt = fle->f_rt; - ro->ro_lle = fle->f_lle; ro->ro_flags |= RT_NORTREF; + lle = fle->f_lle; + if (lle != NULL && (lle->la_flags & LLE_VALID)) { + ro->ro_prepend = lle->r_linkdata; + ro->ro_plen = lle->r_hdrlen; + ro->ro_flags |= RT_MAY_LOOP; + if (lle->la_flags & LLE_IFADDR) + ro->ro_flags |= RT_L2_ME; + } return (0); } Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/if.c Thu Dec 31 05:03:27 2015 (r292978) @@ -161,6 +161,7 @@ static int ifconf(u_long, caddr_t); static void if_freemulti(struct ifmultiaddr *); static void if_grow(void); static void if_input_default(struct ifnet *, struct mbuf *); +static int if_requestencap_default(struct ifnet *, struct if_encap_req *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); static int if_transmit(struct ifnet *ifp, struct mbuf *m); @@ -673,6 +674,9 @@ if_attach_internal(struct ifnet *ifp, in if (ifp->if_input == NULL) ifp->if_input = if_input_default; + if (ifp->if_requestencap == NULL) + ifp->if_requestencap = if_requestencap_default; + if (!vmove) { #ifdef MAC mac_ifnet_create(ifp); @@ -3398,6 +3402,43 @@ if_setlladdr(struct ifnet *ifp, const u_ } /* + * Compat function for handling basic encapsulation requests. + * Not converted stacks (FDDI, IB, ..) supports traditional + * output model: ARP (and other similar L2 protocols) are handled + * inside output routine, arpresolve/nd6_resolve() returns MAC + * address instead of full prepend. + * + * This function creates calculated header==MAC for IPv4/IPv6 and + * returns EAFNOSUPPORT (which is then handled in ARP code) for other + * address families. + */ +static int +if_requestencap_default(struct ifnet *ifp, struct if_encap_req *req) +{ + + if (req->rtype != IFENCAP_LL) + return (EOPNOTSUPP); + + if (req->bufsize < req->lladdr_len) + return (ENOMEM); + + switch (req->family) { + case AF_INET: + case AF_INET6: + break; + default: + return (EAFNOSUPPORT); + } + + /* Copy lladdr to storage as is */ + memmove(req->buf, req->lladdr, req->lladdr_len); + req->bufsize = req->lladdr_len; + req->lladdr_off = 0; + + return (0); +} + +/* * The name argument must be a pointer to storage which will last as * long as the interface does. For physical devices, the result of * device_get_name(dev) is a good choice and for pseudo-devices a Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/if_ethersubr.c Thu Dec 31 05:03:27 2015 (r292978) @@ -113,6 +113,7 @@ static int ether_resolvemulti(struct ifn #ifdef VIMAGE static void ether_reassign(struct ifnet *, struct vnet *, char *); #endif +static int ether_requestencap(struct ifnet *, struct if_encap_req *); #define ETHER_IS_BROADCAST(addr) \ (bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0) @@ -136,6 +137,138 @@ update_mbuf_csumflags(struct mbuf *src, } /* + * Handle link-layer encapsulation requests. + */ +static int +ether_requestencap(struct ifnet *ifp, struct if_encap_req *req) +{ + struct ether_header *eh; + struct arphdr *ah; + uint16_t etype; + const u_char *lladdr; + + if (req->rtype != IFENCAP_LL) + return (EOPNOTSUPP); + + if (req->bufsize < ETHER_HDR_LEN) + return (ENOMEM); + + eh = (struct ether_header *)req->buf; + lladdr = req->lladdr; + req->lladdr_off = 0; + + switch (req->family) { + case AF_INET: + etype = htons(ETHERTYPE_IP); + break; + case AF_INET6: + etype = htons(ETHERTYPE_IPV6); + break; + case AF_ARP: + ah = (struct arphdr *)req->hdata; + ah->ar_hrd = htons(ARPHRD_ETHER); + + switch(ntohs(ah->ar_op)) { + case ARPOP_REVREQUEST: + case ARPOP_REVREPLY: + etype = htons(ETHERTYPE_REVARP); + break; + case ARPOP_REQUEST: + case ARPOP_REPLY: + default: + etype = htons(ETHERTYPE_ARP); + break; + } + + if (req->flags & IFENCAP_FLAG_BROADCAST) + lladdr = ifp->if_broadcastaddr; + break; + default: + return (EAFNOSUPPORT); + } + + memcpy(&eh->ether_type, &etype, sizeof(eh->ether_type)); + memcpy(eh->ether_dhost, lladdr, ETHER_ADDR_LEN); + memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN); + req->bufsize = sizeof(struct ether_header); + + return (0); +} + + +static int +ether_resolve_addr(struct ifnet *ifp, struct mbuf *m, + const struct sockaddr *dst, struct route *ro, u_char *phdr, + uint32_t *pflags) +{ + struct ether_header *eh; + struct rtentry *rt; + uint32_t lleflags = 0; + int error = 0; +#if defined(INET) || defined(INET6) + uint16_t etype; +#endif + + eh = (struct ether_header *)phdr; + + switch (dst->sa_family) { +#ifdef INET + case AF_INET: + if ((m->m_flags & (M_BCAST | M_MCAST)) == 0) + error = arpresolve(ifp, 0, m, dst, phdr, &lleflags); + else { + if (m->m_flags & M_BCAST) + memcpy(eh->ether_dhost, ifp->if_broadcastaddr, + ETHER_ADDR_LEN); + else { + const struct in_addr *a; + a = &(((const struct sockaddr_in *)dst)->sin_addr); + ETHER_MAP_IP_MULTICAST(a, eh->ether_dhost); + } + etype = htons(ETHERTYPE_IP); + memcpy(&eh->ether_type, &etype, sizeof(etype)); + memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + if ((m->m_flags & M_MCAST) == 0) + error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags); + else { + const struct in6_addr *a6; + a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr); + ETHER_MAP_IPV6_MULTICAST(a6, eh->ether_dhost); + etype = htons(ETHERTYPE_IPV6); + memcpy(&eh->ether_type, &etype, sizeof(etype)); + memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN); + } + break; +#endif + default: + if_printf(ifp, "can't handle af%d\n", dst->sa_family); + if (m != NULL) + m_freem(m); + return (EAFNOSUPPORT); + } + + if (error == EHOSTDOWN) { + rt = (ro != NULL) ? ro->ro_rt : NULL; + if (rt != NULL && (rt->rt_flags & RTF_GATEWAY) != 0) + error = EHOSTUNREACH; + } + + if (error != 0) + return (error); + + *pflags = RT_MAY_LOOP; + if (lleflags & LLE_IFADDR) + *pflags |= RT_L2_ME; + + return (0); +} + +/* * Ethernet output routine. * Encapsulate a packet of type family for the local net. * Use trailer local net encapsulation if enough data in first @@ -145,27 +278,20 @@ int ether_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro) { - short type; - int error = 0, hdrcmplt = 0; - u_char edst[ETHER_ADDR_LEN]; - struct llentry *lle = NULL; - struct rtentry *rt0 = NULL; + int error = 0; + char linkhdr[ETHER_HDR_LEN], *phdr; struct ether_header *eh; struct pf_mtag *t; int loop_copy = 1; int hlen; /* link layer header length */ - int is_gw = 0; - uint32_t pflags = 0; + uint32_t pflags; + phdr = NULL; + pflags = 0; if (ro != NULL) { - if (!(m->m_flags & (M_BCAST | M_MCAST))) { - lle = ro->ro_lle; - if (lle != NULL) - pflags = lle->la_flags; - } - rt0 = ro->ro_rt; - if (rt0 != NULL && (rt0->rt_flags & RTF_GATEWAY) != 0) - is_gw = 1; + phdr = ro->ro_prepend; + hlen = ro->ro_plen; + pflags = ro->ro_flags; } #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -180,94 +306,31 @@ ether_output(struct ifnet *ifp, struct m (ifp->if_drv_flags & IFF_DRV_RUNNING))) senderr(ENETDOWN); - hlen = ETHER_HDR_LEN; - switch (dst->sa_family) { -#ifdef INET - case AF_INET: - if (lle != NULL && (pflags & LLE_VALID) != 0) - memcpy(edst, &lle->ll_addr.mac16, sizeof(edst)); - else - error = arpresolve(ifp, is_gw, m, dst, edst, &pflags); - if (error) + if (phdr == NULL) { + /* No prepend data supplied. Try to calculate ourselves. */ + phdr = linkhdr; + hlen = ETHER_HDR_LEN; + error = ether_resolve_addr(ifp, m, dst, ro, phdr, &pflags); + if (error != 0) return (error == EWOULDBLOCK ? 0 : error); - type = htons(ETHERTYPE_IP); - break; - case AF_ARP: - { - struct arphdr *ah; - ah = mtod(m, struct arphdr *); - ah->ar_hrd = htons(ARPHRD_ETHER); - - loop_copy = 0; /* if this is for us, don't do it */ - - switch(ntohs(ah->ar_op)) { - case ARPOP_REVREQUEST: - case ARPOP_REVREPLY: - type = htons(ETHERTYPE_REVARP); - break; - case ARPOP_REQUEST: - case ARPOP_REPLY: - default: - type = htons(ETHERTYPE_ARP); - break; - } - - if (m->m_flags & M_BCAST) - bcopy(ifp->if_broadcastaddr, edst, ETHER_ADDR_LEN); - else - bcopy(ar_tha(ah), edst, ETHER_ADDR_LEN); - - } - break; -#endif -#ifdef INET6 - case AF_INET6: - if (lle != NULL && (pflags & LLE_VALID)) - memcpy(edst, &lle->ll_addr.mac16, sizeof(edst)); - else - error = nd6_resolve(ifp, is_gw, m, dst, (u_char *)edst, - &pflags); - if (error) - return (error == EWOULDBLOCK ? 0 : error); - type = htons(ETHERTYPE_IPV6); - break; -#endif - case pseudo_AF_HDRCMPLT: - { - const struct ether_header *eh; - - hdrcmplt = 1; - /* FALLTHROUGH */ - - case AF_UNSPEC: - loop_copy = 0; /* if this is for us, don't do it */ - eh = (const struct ether_header *)dst->sa_data; - (void)memcpy(edst, eh->ether_dhost, sizeof (edst)); - type = eh->ether_type; - break; - } - default: - if_printf(ifp, "can't handle af%d\n", dst->sa_family); - senderr(EAFNOSUPPORT); } - if ((pflags & LLE_IFADDR) != 0) { + if ((pflags & RT_L2_ME) != 0) { update_mbuf_csumflags(m, m); return (if_simloop(ifp, m, dst->sa_family, 0)); } + loop_copy = pflags & RT_MAY_LOOP; /* * Add local net header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, ETHER_HDR_LEN, M_NOWAIT); + M_PREPEND(m, hlen, M_NOWAIT); if (m == NULL) senderr(ENOBUFS); - eh = mtod(m, struct ether_header *); - if (hdrcmplt == 0) { - memcpy(&eh->ether_type, &type, sizeof(eh->ether_type)); - memcpy(eh->ether_dhost, edst, sizeof (edst)); - memcpy(eh->ether_shost, IF_LLADDR(ifp),sizeof(eh->ether_shost)); + if ((pflags & RT_HAS_HEADER) == 0) { + eh = mtod(m, struct ether_header *); + memcpy(eh, phdr, hlen); } /* @@ -279,34 +342,27 @@ ether_output(struct ifnet *ifp, struct m * on the wire). However, we don't do that here for security * reasons and compatibility with the original behavior. */ - if ((ifp->if_flags & IFF_SIMPLEX) && loop_copy && + if ((m->m_flags & M_BCAST) && loop_copy && (ifp->if_flags & IFF_SIMPLEX) && ((t = pf_find_mtag(m)) == NULL || !t->routed)) { - if (m->m_flags & M_BCAST) { - struct mbuf *n; + struct mbuf *n; - /* - * Because if_simloop() modifies the packet, we need a - * writable copy through m_dup() instead of a readonly - * one as m_copy[m] would give us. The alternative would - * be to modify if_simloop() to handle the readonly mbuf, - * but performancewise it is mostly equivalent (trading - * extra data copying vs. extra locking). - * - * XXX This is a local workaround. A number of less - * often used kernel parts suffer from the same bug. - * See PR kern/105943 for a proposed general solution. - */ - if ((n = m_dup(m, M_NOWAIT)) != NULL) { - update_mbuf_csumflags(m, n); - (void)if_simloop(ifp, n, dst->sa_family, hlen); - } else - if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); - } else if (bcmp(eh->ether_dhost, eh->ether_shost, - ETHER_ADDR_LEN) == 0) { - update_mbuf_csumflags(m, m); - (void) if_simloop(ifp, m, dst->sa_family, hlen); - return (0); /* XXX */ - } + /* + * Because if_simloop() modifies the packet, we need a + * writable copy through m_dup() instead of a readonly + * one as m_copy[m] would give us. The alternative would + * be to modify if_simloop() to handle the readonly mbuf, + * but performancewise it is mostly equivalent (trading + * extra data copying vs. extra locking). + * + * XXX This is a local workaround. A number of less + * often used kernel parts suffer from the same bug. + * See PR kern/105943 for a proposed general solution. + */ + if ((n = m_dup(m, M_NOWAIT)) != NULL) { + update_mbuf_csumflags(m, n); + (void)if_simloop(ifp, n, dst->sa_family, hlen); + } else + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); } /* @@ -798,6 +854,7 @@ ether_ifattach(struct ifnet *ifp, const ifp->if_output = ether_output; ifp->if_input = ether_input; ifp->if_resolvemulti = ether_resolvemulti; + ifp->if_requestencap = ether_requestencap; #ifdef VIMAGE ifp->if_reassign = ether_reassign; #endif Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/if_llatbl.c Thu Dec 31 05:03:27 2015 (r292978) @@ -278,10 +278,12 @@ lltable_drop_entry_queue(struct llentry void lltable_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *lladdr) + const char *linkhdr, size_t linkhdrsize, int lladdr_off) { - bcopy(lladdr, &lle->ll_addr, ifp->if_addrlen); + memcpy(lle->r_linkdata, linkhdr, linkhdrsize); + lle->r_hdrlen = linkhdrsize; + lle->ll_addr = &lle->r_linkdata[lladdr_off]; lle->la_flags |= LLE_VALID; lle->r_flags |= RLLE_VALID; } @@ -296,7 +298,7 @@ lltable_set_entry_addr(struct ifnet *ifp */ int lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *lladdr) + const char *linkhdr, size_t linkhdrsize, int lladdr_off) { /* Perform real LLE update */ @@ -318,7 +320,7 @@ lltable_try_set_entry_addr(struct ifnet } /* Update data */ - lltable_set_entry_addr(ifp, lle, lladdr); + lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); IF_AFDATA_WUNLOCK(ifp); @@ -327,6 +329,84 @@ lltable_try_set_entry_addr(struct ifnet return (1); } + /* + * Helper function used to pre-compute full/partial link-layer + * header data suitable for feeding into if_output(). + */ +int +lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, + char *buf, size_t *bufsize, int *lladdr_off) +{ + struct if_encap_req ereq; + int error; + + bzero(buf, *bufsize); + bzero(&ereq, sizeof(ereq)); + ereq.buf = buf; + ereq.bufsize = *bufsize; + ereq.rtype = IFENCAP_LL; + ereq.family = family; + ereq.lladdr = lladdr; + ereq.lladdr_len = ifp->if_addrlen; + error = ifp->if_requestencap(ifp, &ereq); + if (error == 0) { + *bufsize = ereq.bufsize; + *lladdr_off = ereq.lladdr_off; + } + + return (error); +} + +/* + * Update link-layer header for given @lle after + * interface lladdr was changed. + */ +static int +llentry_update_ifaddr(struct lltable *llt, struct llentry *lle, void *farg) +{ + struct ifnet *ifp; + u_char linkhdr[LLE_MAX_LINKHDR]; + size_t linkhdrsize; + u_char *lladdr; + int lladdr_off; + + ifp = (struct ifnet *)farg; + + lladdr = lle->ll_addr; + + LLE_WLOCK(lle); + if ((lle->la_flags & LLE_VALID) == 0) { + LLE_WUNLOCK(lle); + return (0); + } + + if ((lle->la_flags & LLE_IFADDR) != 0) + lladdr = IF_LLADDR(ifp); + + linkhdrsize = sizeof(linkhdr); + lltable_calc_llheader(ifp, llt->llt_af, lladdr, linkhdr, &linkhdrsize, + &lladdr_off); + memcpy(lle->r_linkdata, linkhdr, linkhdrsize); + LLE_WUNLOCK(lle); + + return (0); +} + +/* + * Update all calculated headers for given @llt + */ +void +lltable_update_ifaddr(struct lltable *llt) +{ + + if (llt->llt_ifp->if_flags & IFF_LOOPBACK) + return; + + IF_AFDATA_WLOCK(llt->llt_ifp); + lltable_foreach_lle(llt, llentry_update_ifaddr, llt->llt_ifp); + IF_AFDATA_WUNLOCK(llt->llt_ifp); +} + /* * * Performes generic cleanup routines and frees lle. @@ -642,6 +722,9 @@ lla_rt_output(struct rt_msghdr *rtm, str struct ifnet *ifp; struct lltable *llt; struct llentry *lle, *lle_tmp; + uint8_t linkhdr[LLE_MAX_LINKHDR]; + size_t linkhdrsize; + int lladdr_off; u_int laflags = 0; int error; @@ -677,11 +760,14 @@ lla_rt_output(struct rt_msghdr *rtm, str if (lle == NULL) return (ENOMEM); - bcopy(LLADDR(dl), &lle->ll_addr, ifp->if_addrlen); + linkhdrsize = sizeof(linkhdr); + if (lltable_calc_llheader(ifp, dst->sa_family, LLADDR(dl), + linkhdr, &linkhdrsize, &lladdr_off) != 0) + return (EINVAL); + lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, + lladdr_off); if ((rtm->rtm_flags & RTF_ANNOUNCE)) lle->la_flags |= LLE_PUB; - lle->la_flags |= LLE_VALID; - lle->r_flags |= RLLE_VALID; lle->la_expire = rtm->rtm_rmx.rmx_expire; laflags = lle->la_flags; @@ -767,7 +853,7 @@ llatbl_lle_show(struct llentry_sa *la) db_printf(" ln_router=%u\n", lle->ln_router); db_printf(" ln_ntick=%ju\n", (uintmax_t)lle->ln_ntick); db_printf(" lle_refcnt=%d\n", lle->lle_refcnt); - bcopy(&lle->ll_addr.mac16, octet, sizeof(octet)); + bcopy(lle->ll_addr, octet, sizeof(octet)); db_printf(" ll_addr=%02x:%02x:%02x:%02x:%02x:%02x\n", octet[0], octet[1], octet[2], octet[3], octet[4], octet[5]); db_printf(" lle_timer=%p\n", &lle->lle_timer); Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/if_llatbl.h Thu Dec 31 05:03:27 2015 (r292978) @@ -48,6 +48,7 @@ extern struct rwlock lltable_rwlock; #define LLTABLE_WUNLOCK() rw_wunlock(&lltable_rwlock) #define LLTABLE_LOCK_ASSERT() rw_assert(&lltable_rwlock, RA_LOCKED) +#define LLE_MAX_LINKHDR 24 /* Full IB header */ /* * Code referencing llentry must at least hold * a shared lock @@ -58,14 +59,11 @@ struct llentry { struct in_addr addr4; struct in6_addr addr6; } r_l3addr; - union { - uint64_t mac_aligned; - uint16_t mac16[3]; - uint8_t mac8[20]; /* IB needs 20 bytes. */ - } ll_addr; + char r_linkdata[LLE_MAX_LINKHDR]; /* L2 data */ + uint8_t r_hdrlen; /* length for LL header */ + uint8_t spare0[3]; uint16_t r_flags; /* LLE runtime flags */ uint16_t r_skip_req; /* feedback from fast path */ - uint64_t spare1; struct lltable *lle_tbl; struct llentries *lle_head; @@ -82,6 +80,7 @@ struct llentry { time_t lle_remtime; /* Real time remaining */ time_t lle_hittime; /* Time when r_skip_req was unset */ int lle_refcnt; + char *ll_addr; /* link-layer address */ LIST_ENTRY(llentry) lle_chain; /* chain of deleted items */ struct callout lle_timer; @@ -198,6 +197,8 @@ MALLOC_DECLARE(M_LLTABLE); /* LLE request flags */ #define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_UNLOCKED 0x4000 /* return lle unlocked */ +#define LLE_ADDRONLY 0x4000 /* return lladdr instead of full header */ +#define LLE_CREATE 0x8000 /* hint to avoid lle lookup */ /* LLE flags used by fastpath code */ #define RLLE_VALID 0x0001 /* entry is valid */ @@ -223,10 +224,13 @@ struct llentry *llentry_alloc(struct if /* helper functions */ size_t lltable_drop_entry_queue(struct llentry *); void lltable_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *lladdr); + const char *linkhdr, size_t linkhdrsize, int lladdr_off); int lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *lladdr); + const char *linkhdr, size_t linkhdrsize, int lladdr_off); +int lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, + char *buf, size_t *bufsize, int *lladdr_off); +void lltable_update_ifaddr(struct lltable *llt); struct llentry *lltable_alloc_entry(struct lltable *llt, u_int flags, const struct sockaddr *l4addr); void lltable_free_entry(struct lltable *llt, struct llentry *lle); Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/if_var.h Thu Dec 31 05:03:27 2015 (r292978) @@ -134,6 +134,48 @@ struct ifnet_hw_tsomax { u_int tsomaxsegsize; /* TSO maximum segment size in bytes */ }; +/* Interface encap request types */ +typedef enum { + IFENCAP_LL = 1 /* pre-calculate link-layer header */ +} ife_type; + +/* + * The structure below allows to request various pre-calculated L2/L3 headers + * for different media. Requests varies by type (rtype field). + * + * IFENCAP_LL type: pre-calculates link header based on address family + * and destination lladdr. + * + * Input data fields: + * buf: pointer to destination buffer + * bufsize: buffer size + * flags: IFENCAP_FLAG_BROADCAST if destination is broadcast + * family: address family defined by AF_ constant. + * lladdr: pointer to link-layer address + * lladdr_len: length of link-layer address + * hdata: pointer to L3 header (optional, used for ARP requests). + * Output data fields: + * buf: encap data is stored here + * bufsize: resulting encap length is stored here + * lladdr_off: offset of link-layer address from encap hdr start + * hdata: L3 header may be altered if necessary + */ + +struct if_encap_req { + u_char *buf; /* Destination buffer (w) */ + size_t bufsize; /* size of provided buffer (r) */ + ife_type rtype; /* request type (r) */ + uint32_t flags; /* Request flags (r) */ + int family; /* Address family AF_* (r) */ + int lladdr_off; /* offset from header start (w) */ + int lladdr_len; /* lladdr length (r) */ + char *lladdr; /* link-level address pointer (r) */ + char *hdata; /* Upper layer header data (rw) */ +}; + +#define IFENCAP_FLAG_BROADCAST 0x02 /* Destination is broadcast */ + + /* * Structure defining a network interface. * @@ -235,6 +277,8 @@ struct ifnet { void (*if_reassign) /* reassign to vnet routine */ (struct ifnet *, struct vnet *, char *); if_get_counter_t if_get_counter; /* get counter values */ + int (*if_requestencap) /* make link header from request */ + (struct ifnet *, struct if_encap_req *); /* Statistics. */ counter_u64_t if_counters[IFCOUNTERS]; Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/net/route.h Thu Dec 31 05:03:27 2015 (r292978) @@ -51,14 +51,21 @@ */ struct route { struct rtentry *ro_rt; - struct llentry *ro_lle; - struct in_ifaddr *ro_ia; - int ro_flags; + char *ro_prepend; + uint16_t ro_plen; + uint16_t ro_flags; struct sockaddr ro_dst; }; +#define RT_L2_ME_BIT 2 /* dst L2 addr is our address */ +#define RT_MAY_LOOP_BIT 3 /* dst may require loop copy */ +#define RT_HAS_HEADER_BIT 4 /* mbuf already have its header prepended */ + #define RT_CACHING_CONTEXT 0x1 /* XXX: not used anywhere */ #define RT_NORTREF 0x2 /* doesn't hold reference on ro_rt */ +#define RT_L2_ME (1 << RT_L2_ME_BIT) +#define RT_MAY_LOOP (1 << RT_MAY_LOOP_BIT) +#define RT_HAS_HEADER (1 << RT_HAS_HEADER_BIT) struct rt_metrics { u_long rmx_locks; /* Kernel must leave these values alone */ Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Dec 31 04:14:05 2015 (r292977) +++ head/sys/netinet/if_ether.c Thu Dec 31 05:03:27 2015 (r292978) @@ -282,6 +282,37 @@ arptimer(void *arg) } /* + * Stores link-layer header for @ifp in format suitable for if_output() + * into buffer @buf. Resulting header length is stored in @bufsize. + * + * Returns 0 on success. + */ +static int +arp_fillheader(struct ifnet *ifp, struct arphdr *ah, int bcast, u_char *buf, + size_t *bufsize) +{ + struct if_encap_req ereq; + int error; + + bzero(buf, *bufsize); + bzero(&ereq, sizeof(ereq)); + ereq.buf = buf; + ereq.bufsize = *bufsize; + ereq.rtype = IFENCAP_LL; + ereq.family = AF_ARP; + ereq.lladdr = ar_tha(ah); + ereq.hdata = (u_char *)ah; + if (bcast) + ereq.flags = IFENCAP_FLAG_BROADCAST; + error = ifp->if_requestencap(ifp, &ereq); + if (error == 0) + *bufsize = ereq.bufsize; + + return (error); +} + + +/* * Broadcast an ARP request. Caller specifies: * - arp header source ip address * - arp header target ip address @@ -295,6 +326,10 @@ arprequest(struct ifnet *ifp, const stru struct arphdr *ah; struct sockaddr sa; u_char *carpaddr = NULL; + uint8_t linkhdr[LLE_MAX_LINKHDR]; + size_t linkhdrsize; + struct route ro; + int error; if (sip == NULL) { /* @@ -350,12 +385,28 @@ arprequest(struct ifnet *ifp, const stru bcopy(tip, ar_tpa(ah), ah->ar_pln); sa.sa_family = AF_ARP; sa.sa_len = 2; + + /* Calculate link header for sending frame */ + bzero(&ro, sizeof(ro)); + linkhdrsize = sizeof(linkhdr); + error = arp_fillheader(ifp, ah, 1, linkhdr, &linkhdrsize); + if (error != 0 && error != EAFNOSUPPORT) { + ARP_LOG(LOG_ERR, "Failed to calculate ARP header on %s: %d\n", + if_name(ifp), error); + return; + } + + ro.ro_prepend = linkhdr; + ro.ro_plen = linkhdrsize; + ro.ro_flags = 0; + m->m_flags |= M_BCAST; m_clrprotoflags(m); /* Avoid confusing lower layers. */ - (*ifp->if_output)(ifp, m, &sa, NULL); + (*ifp->if_output)(ifp, m, &sa, &ro); ARPSTAT_INC(txrequests); } + /* * Resolve an IP address into an ethernet address - heavy version. * Used internally by arpresolve(). @@ -368,18 +419,20 @@ arprequest(struct ifnet *ifp, const stru * Note that m_freem() handles NULL. */ static int -arpresolve_full(struct ifnet *ifp, int is_gw, int create, struct mbuf *m, +arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, const struct sockaddr *dst, u_char *desten, uint32_t *pflags) { struct llentry *la = NULL, *la_tmp; struct mbuf *curr = NULL; struct mbuf *next = NULL; int error, renew; + char *lladdr; + int ll_len; if (pflags != NULL) *pflags = 0; - if (create == 0) { + if ((flags & LLE_CREATE) == 0) { IF_AFDATA_RLOCK(ifp); la = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, dst); IF_AFDATA_RUNLOCK(ifp); @@ -413,7 +466,14 @@ arpresolve_full(struct ifnet *ifp, int i if ((la->la_flags & LLE_VALID) && ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { - bcopy(&la->ll_addr, desten, ifp->if_addrlen); + if (flags & LLE_ADDRONLY) { + lladdr = la->ll_addr; + ll_len = ifp->if_addrlen; + } else { + lladdr = la->r_linkdata; + ll_len = la->r_hdrlen; + } + bcopy(lladdr, desten, ll_len); /* Check if we have feedback request from arptimer() */ if (la->r_skip_req != 0) { @@ -485,15 +545,31 @@ arpresolve_full(struct ifnet *ifp, int i /* * Resolve an IP address into an ethernet address. + */ +int +arpresolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, + char *desten, uint32_t *pflags) +{ + int error; + + flags |= LLE_ADDRONLY; + error = arpresolve_full(ifp, 0, flags, NULL, dst, desten, pflags); + return (error); +} + + +/* + * Lookups link header based on an IP address. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 31 07:03: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 BAA11A57C99; Thu, 31 Dec 2015 07:03:42 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8836113CC; Thu, 31 Dec 2015 07:03:42 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV73fnh096125; Thu, 31 Dec 2015 07:03:41 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV73fqr096124; Thu, 31 Dec 2015 07:03:41 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310703.tBV73fqr096124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 07:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292980 - head/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, 31 Dec 2015 07:03:42 -0000 Author: araujo Date: Thu Dec 31 07:03:41 2015 New Revision: 292980 URL: https://svnweb.freebsd.org/changeset/base/292980 Log: Clean up unused-but-set-variable spotted by gcc4.9. Reviewed by: ngie Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4719 Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Thu Dec 31 06:01:07 2015 (r292979) +++ head/sys/net/if_gif.c Thu Dec 31 07:03:41 2015 (r292980) @@ -529,7 +529,6 @@ gif_input(struct mbuf *m, struct ifnet * struct gif_softc *sc; struct ether_header *eh; struct ifnet *oldifp; - uint32_t gif_options; int isr, n, af; if (ifp == NULL) { @@ -538,7 +537,6 @@ gif_input(struct mbuf *m, struct ifnet * return; } sc = ifp->if_softc; - gif_options = sc->gif_options; m->m_pkthdr.rcvif = ifp; m_clrprotoflags(m); switch (proto) { From owner-svn-src-head@freebsd.org Thu Dec 31 07:08: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 3677FA57E26; Thu, 31 Dec 2015 07:08:23 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F3E801635; Thu, 31 Dec 2015 07:08:22 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV78MKr096315; Thu, 31 Dec 2015 07:08:22 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV78MCR096314; Thu, 31 Dec 2015 07:08:22 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201512310708.tBV78MCR096314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Dec 2015 07:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292981 - head/usr.sbin/bhyve 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, 31 Dec 2015 07:08:23 -0000 Author: araujo Date: Thu Dec 31 07:08:21 2015 New Revision: 292981 URL: https://svnweb.freebsd.org/changeset/base/292981 Log: Clean up unused-but-set-variable spotted by gcc-4.9. Reviewed by: grehan Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4734 Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 07:03:41 2015 (r292980) +++ head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 07:08:21 2015 (r292981) @@ -310,14 +310,13 @@ static int vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { int error; - int bytes, port, in, out, string; + int bytes, port, in, out; int vcpu; vcpu = *pvcpu; port = vme->u.inout.port; bytes = vme->u.inout.bytes; - string = vme->u.inout.string; in = vme->u.inout.in; out = !in; @@ -620,8 +619,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uin if (error != 0) break; - prevcpu = vcpu; - exitcode = vmexit[vcpu].exitcode; if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", @@ -629,7 +626,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uin exit(1); } - rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); + rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); switch (rc) { case VMEXIT_CONTINUE: From owner-svn-src-head@freebsd.org Thu Dec 31 07:15: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 70502A56061; Thu, 31 Dec 2015 07:15:05 +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 323321AF2; Thu, 31 Dec 2015 07:15:04 +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 B2FBCD2AA; Thu, 31 Dec 2015 07:15:03 +0000 (UTC) Subject: Re: svn commit: r292955 - head/lib/libmd To: Bruce Evans References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Allan Jude X-Enigmail-Draft-Status: N1110 Message-ID: <5684D606.3080609@freebsd.org> Date: Thu, 31 Dec 2015 02:15:18 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20151231143314.Y1520@besplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cefVxOIBD2vm4RApBE5O4tQ0lfigJF2Qm" 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, 31 Dec 2015 07:15:05 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cefVxOIBD2vm4RApBE5O4tQ0lfigJF2Qm Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2015-12-30 23:10, Bruce Evans wrote: > On Thu, 31 Dec 2015, Bruce Evans wrote: >=20 >> >> wc /proc/0/* works. md5 works like wc using a hack to avoid calling t= his >> broken function. E.g., >> >> for i in $(ls /proc/0/*); do echo -n "$i: "; md5 <$i; done # gives= >> >> /proc/0/cmdline: 3c5896b1ac441f4998f052e2126e8d20 >> /proc/0/ctl: d41d8cd98f00b204e9800998ecf8427e >> /proc/0/etype: 674441960ca1ba2de08ad4e50c9fde98 >> /proc/0/rlimit: 67d6ad67b412e1bceb7cb508a3492197 >> /proc/0/status: 3ccc3067b97c3232ea2dbcb64c458fd4 >=20 > Further examples: >=20 > md5 # on terminal input >=20 > works correctly by not using MDXFileChunk(). >=20 > md5 /dev/stdin # on the same terminal input >=20 > produces the d41d8cd98f00b204e9800998ecf8427e garbage using > MDXFileChunk(). truss shows that lseek() is broken too -- MDXFileChunk= () > tries it and it succeeds on the unseekable file /dev/stdin. Bugs in th= is > area are common. E.g., lseek() on named pipes was broken so that it > succeeded, by rearranging the plumbing use fileops more or less and not= > attaching lseek right. >=20 > cat | md5 # on the same terminal input >=20 > works correctly by not using MDXFileChunk(). >=20 > cat | md5 /dev/stdin # on the same terminal input >=20 > doesn't work correctly, but it fails better than without the pipe. Now= > a seek error occurs and is reported as "md5: /dev/stdin: Illegal seek" > (I can't see where it is reported). Then md5 exits. Then cat waits to= > read input. Then cat fails to write output and is killed by SIGPIPE. > So md5 handled the seek error in a fail-safe though incorrect way. One= > correct way is to fall back to the working code, but it is better to > just use that without an lseek check. >=20 > It is a bug that [l]stat() on /dev/stdin sees the device file and not t= he > actual stdin file. md5 can't work around this except by not using stat= (). >=20 > Bruce >=20 It seems these problems also slow things down, a lot: # time md5 /media/md5test/bigdata MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w # time env LD_PRELOAD=3D/usr/obj/media/svn/md5/head/tmp/lib/libmd.so /usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w (file is fully cached in ZFS ARC, dd reads it at 11GB/s) Will investigate more tomorrow. char * MDXFile(const char *filename, char *buf) { unsigned char buffer[16*1024]; MDX_CTX ctx; int f, i; MDXInit(&ctx); f =3D open(filename, O_RDONLY); if (f < 0) return 0; i =3D 0; while (1) { i =3D read(f, buffer, sizeof(buffer)); if (i <=3D 0) break; MDXUpdate(&ctx, buffer, i); } close(f); return (MDXEnd(&ctx, buf)); } --=20 Allan Jude --cefVxOIBD2vm4RApBE5O4tQ0lfigJF2Qm 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) iQIcBAEBAgAGBQJWhNYKAAoJEBmVNT4SmAt+E8cP/3R383YXkUdn1jV4haIADU/r SiVvOgU6eNOlrPv7koeL7A7qrkb23/Hs+D+ucXChaTx5cu8EBMdLgRrL4dKnu/tW CyXMpq8k1i2h9PLdFiAM+SybVJ5FFkZdMwYvc17DxWkIGRyGuYteOE6QTB4IE2IW V8FM7I372IpDGWzTyBzPhg7kO83WYrN3MfisC9PYuwQN2JoEg5TY5sjp84qiIJzl OQjf6ZAQ2wBXqhF90L97Wz2dzP+IqJ8RovfP6yajGjC432aLQMoEEd/lb8OS6ftd Fr68jJhmjGSCtSU0Ix+SFhofDe8p3AJuodU+XAaXIpMl/m0jNqW3TDsjyopHBY2L +W4QjIbx1IZ4a9v8q33hPnFmY+WMhrhD7I/g6cqAFK81Ahfi9NfKhidDosjvHJVl rFn/hxyv+qy7mvGhYFd/FkyNmXFKTfv3ZQC+C6x9hVE2jg4gC6zA4yCsNq1tSN40 50Nt2wCo2m5Zr+QyFx6o9JyRP0Z2FNW0DBy9hloUASg3+LgJ7dpCFKVvwsJR/h7h /Odz1hYe3kHR9Zo2Zh+6PE21FMA2OzcrT6XLPbiLbRqLHhuGKBSt08XZEa2pm50m yMG5SwYLKfB1kkqHKAScvZB65Cnq11t60xBHB1Al1HySGawwVib9tZSc5ehu8Ss9 yKFYIitpyPSRnpBV3WIh =S8Jb -----END PGP SIGNATURE----- --cefVxOIBD2vm4RApBE5O4tQ0lfigJF2Qm-- From owner-svn-src-head@freebsd.org Thu Dec 31 10:55: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 3766FA56B5C; Thu, 31 Dec 2015 10:55:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 04A3C1D70; Thu, 31 Dec 2015 10:55:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVAtpD1065588; Thu, 31 Dec 2015 10:55:51 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVAtpLE065587; Thu, 31 Dec 2015 10:55:51 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201512311055.tBVAtpLE065587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 31 Dec 2015 10:55:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292982 - head/usr.sbin/bhyve 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, 31 Dec 2015 10:55:52 -0000 Author: bz Date: Thu Dec 31 10:55:50 2015 New Revision: 292982 URL: https://svnweb.freebsd.org/changeset/base/292982 Log: Remove unused variable after r292981 to unbreak the build. Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 07:08:21 2015 (r292981) +++ head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 10:55:50 2015 (r292982) @@ -598,7 +598,7 @@ static vmexit_handler_t handler[VM_EXITC static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) { - int error, rc, prevcpu; + int error, rc; enum vm_exitcode exitcode; cpuset_t active_cpus; From owner-svn-src-head@freebsd.org Thu Dec 31 11:02: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 25150A56FDE; Thu, 31 Dec 2015 11:02:59 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (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 E30ED1E19; Thu, 31 Dec 2015 11:02:58 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-ob0-x22d.google.com with SMTP id bx1so168243469obb.0; Thu, 31 Dec 2015 03:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=BBCN3MAKQ8ON1pSPMngAI2y7iky++GNy/Y7WUMQ5xXQ=; b=ap2Gb7T8z62Xg57Kia+zEIokmZLNllf51d6oSL4Dq37BYD6l0VcB2fhydR/gaVpiXp jCmvTgoXtrSB7c8gJH9gbGXZgsdLf4oH+L06Kr78IIp2UjC/lA3Z1TMlNi9YM7mIZuG3 S+FLa67neH9pHZpDsn9A2x9CW8E7cDktxF6r4mfFGzm0qU7zt0em99yzx+6Ofb58knGO hxQBXlEJyePdLa1IT6xr7tdHCcdeOlYSh3aCVVHtsaHizfcjxxAHJV8Azlw6BwfbIIOc 7kl2p1G79Vyxf6LGSMXxSNcdrsPbiphNNzfXKcJ3ObVpPEpOTSl/AVfO9R81+cvA4fXe OxBA== MIME-Version: 1.0 X-Received: by 10.182.236.3 with SMTP id uq3mr44102412obc.25.1451559778122; Thu, 31 Dec 2015 03:02:58 -0800 (PST) Received: by 10.182.7.33 with HTTP; Thu, 31 Dec 2015 03:02:58 -0800 (PST) Reply-To: araujo@FreeBSD.org In-Reply-To: <201512311055.tBVAtpLE065587@repo.freebsd.org> References: <201512311055.tBVAtpLE065587@repo.freebsd.org> Date: Thu, 31 Dec 2015 19:02:58 +0800 Message-ID: Subject: Re: svn commit: r292982 - head/usr.sbin/bhyve From: Marcelo Araujo To: "Bjoern A. Zeeb" 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: Thu, 31 Dec 2015 11:02:59 -0000 2015-12-31 18:55 GMT+08:00 Bjoern A. Zeeb : > Author: bz > Date: Thu Dec 31 10:55:50 2015 > New Revision: 292982 > URL: https://svnweb.freebsd.org/changeset/base/292982 > > Log: > Remove unused variable after r292981 to unbreak the build. > > Modified: > head/usr.sbin/bhyve/bhyverun.c > > Modified: head/usr.sbin/bhyve/bhyverun.c > > ============================================================================== > --- head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 07:08:21 2015 > (r292981) > +++ head/usr.sbin/bhyve/bhyverun.c Thu Dec 31 10:55:50 2015 > (r292982) > @@ -598,7 +598,7 @@ static vmexit_handler_t handler[VM_EXITC > static void > vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) > { > - int error, rc, prevcpu; > + int error, rc; > enum vm_exitcode exitcode; > cpuset_t active_cpus; > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > Sorry and thank you! Best, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@freebsd.org Thu Dec 31 11:21: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 B4E60A576ED; Thu, 31 Dec 2015 11:21:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 87C9E17CA; Thu, 31 Dec 2015 11:21:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVBLj9r074303; Thu, 31 Dec 2015 11:21:45 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVBLjuA074109; Thu, 31 Dec 2015 11:21:45 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201512311121.tBVBLjuA074109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 31 Dec 2015 11:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292983 - in head: . sys/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: Thu, 31 Dec 2015 11:21:46 -0000 Author: bz Date: Thu Dec 31 11:21:45 2015 New Revision: 292983 URL: https://svnweb.freebsd.org/changeset/base/292983 Log: Bump copyright year. Happy New Year 2016! Modified: head/COPYRIGHT head/sys/sys/copyright.h Modified: head/COPYRIGHT ============================================================================== --- head/COPYRIGHT Thu Dec 31 10:55:50 2015 (r292982) +++ head/COPYRIGHT Thu Dec 31 11:21:45 2015 (r292983) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2015 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2016 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Thu Dec 31 10:55:50 2015 (r292982) +++ head/sys/sys/copyright.h Thu Dec 31 11:21:45 2015 (r292983) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2015 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2016 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2015 The FreeBSD Project.\n" + "Copyright (c) 1992-2016 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ From owner-svn-src-head@freebsd.org Thu Dec 31 11:27: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 8C4EBA5787D; Thu, 31 Dec 2015 11:27:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4629E1D2E; Thu, 31 Dec 2015 11:27:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVBRaCQ076298; Thu, 31 Dec 2015 11:27:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVBRasi076295; Thu, 31 Dec 2015 11:27:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512311127.tBVBRasi076295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 Dec 2015 11:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292986 - in head/sys/compat/linuxkpi/common: include/linux src 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, 31 Dec 2015 11:27:37 -0000 Author: hselasky Date: Thu Dec 31 11:27:36 2015 New Revision: 292986 URL: https://svnweb.freebsd.org/changeset/base/292986 Log: Make the kobject refcounting compliant with Linux. Refcounting on the parent kobject cannot be factored out and must be done by the kobject consumers. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Thu Dec 31 11:25:45 2015 (r292985) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Thu Dec 31 11:27:36 2015 (r292986) @@ -54,21 +54,27 @@ static inline void cdev_release(struct kobject *kobj) { struct linux_cdev *cdev; + struct kobject *parent; cdev = container_of(kobj, struct linux_cdev, kobj); + parent = kobj->parent; if (cdev->cdev) destroy_dev(cdev->cdev); kfree(cdev); + kobject_put(parent); } static inline void cdev_static_release(struct kobject *kobj) { struct linux_cdev *cdev; + struct kobject *parent; cdev = container_of(kobj, struct linux_cdev, kobj); + parent = kobj->parent; if (cdev->cdev) destroy_dev(cdev->cdev); + kobject_put(parent); } static struct kobj_type cdev_ktype = { @@ -114,6 +120,7 @@ cdev_add(struct linux_cdev *cdev, dev_t cdev->dev = dev; cdev->cdev->si_drv1 = cdev; + kobject_get(cdev->kobj.parent); return (0); } Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Dec 31 11:25:45 2015 (r292985) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Dec 31 11:27:36 2015 (r292986) @@ -157,7 +157,7 @@ kobject_add_complete(struct kobject *kob struct kobj_type *t; int error; - kobj->parent = kobject_get(parent); + kobj->parent = parent; error = sysfs_create_dir(kobj); if (error == 0 && kobj->ktype && kobj->ktype->default_attrs) { struct attribute **attr; @@ -198,9 +198,6 @@ kobject_release(struct kref *kref) kobj = container_of(kref, struct kobject, kref); sysfs_remove_dir(kobj); - if (kobj->parent) - kobject_put(kobj->parent); - kobj->parent = NULL; name = kobj->name; if (kobj->ktype && kobj->ktype->release) kobj->ktype->release(kobj); From owner-svn-src-head@freebsd.org Thu Dec 31 12:30: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 0146AA57363; Thu, 31 Dec 2015 12:30:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B99591E38; Thu, 31 Dec 2015 12:30:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVCUJ5A094029; Thu, 31 Dec 2015 12:30:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVCUJB7094023; Thu, 31 Dec 2015 12:30:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512311230.tBVCUJB7094023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 Dec 2015 12:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292987 - in head/sys/compat/linuxkpi/common: include/linux src 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, 31 Dec 2015 12:30:21 -0000 Author: hselasky Date: Thu Dec 31 12:30:19 2015 New Revision: 292987 URL: https://svnweb.freebsd.org/changeset/base/292987 Log: Minor LinuxKPI code cleanup: - Declare some static functions in linux_compat.c instead if inside various header files. - Prefix FreeBSD local functions in the LinuxKPI with "linux_" to avoid symbol name conflicts in the future and to make debugging easier. - Make the "struct kobj_ktype" declaractions constant to shave off a few bytes from the data segment. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/kobject.h head/sys/compat/linuxkpi/common/include/linux/miscdevice.h head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Thu Dec 31 12:30:19 2015 (r292987) @@ -41,6 +41,8 @@ struct inode; struct module; extern struct cdevsw linuxcdevsw; +extern const struct kobj_type linux_cdev_ktype; +extern const struct kobj_type linux_cdev_static_ktype; struct linux_cdev { struct kobject kobj; @@ -51,45 +53,10 @@ struct linux_cdev { }; static inline void -cdev_release(struct kobject *kobj) -{ - struct linux_cdev *cdev; - struct kobject *parent; - - cdev = container_of(kobj, struct linux_cdev, kobj); - parent = kobj->parent; - if (cdev->cdev) - destroy_dev(cdev->cdev); - kfree(cdev); - kobject_put(parent); -} - -static inline void -cdev_static_release(struct kobject *kobj) -{ - struct linux_cdev *cdev; - struct kobject *parent; - - cdev = container_of(kobj, struct linux_cdev, kobj); - parent = kobj->parent; - if (cdev->cdev) - destroy_dev(cdev->cdev); - kobject_put(parent); -} - -static struct kobj_type cdev_ktype = { - .release = cdev_release, -}; - -static struct kobj_type cdev_static_ktype = { - .release = cdev_static_release, -}; - -static inline void cdev_init(struct linux_cdev *cdev, const struct file_operations *ops) { - kobject_init(&cdev->kobj, &cdev_static_ktype); + kobject_init(&cdev->kobj, &linux_cdev_static_ktype); cdev->ops = ops; } @@ -100,7 +67,7 @@ cdev_alloc(void) cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK); if (cdev) - kobject_init(&cdev->kobj, &cdev_ktype); + kobject_init(&cdev->kobj, &linux_cdev_ktype); return (cdev); } Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Thu Dec 31 12:30:19 2015 (r292987) @@ -73,8 +73,10 @@ struct device { unsigned int msix_max; }; -extern struct device linux_rootdev; -extern struct kobject class_root; +extern struct device linux_root_device; +extern struct kobject linux_class_root; +extern const struct kobj_type linux_dev_ktype; +extern const struct kobj_type linux_class_ktype; struct class_attribute { struct attribute attr; @@ -170,62 +172,14 @@ put_device(struct device *dev) kobject_put(&dev->kobj); } -static inline ssize_t -class_show(struct kobject *kobj, struct attribute *attr, char *buf) -{ - struct class_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct class_attribute, attr); - error = -EIO; - if (dattr->show) - error = dattr->show(container_of(kobj, struct class, kobj), - dattr, buf); - return (error); -} - -static inline ssize_t -class_store(struct kobject *kobj, struct attribute *attr, const char *buf, - size_t count) -{ - struct class_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct class_attribute, attr); - error = -EIO; - if (dattr->store) - error = dattr->store(container_of(kobj, struct class, kobj), - dattr, buf, count); - return (error); -} - -static inline void -class_release(struct kobject *kobj) -{ - struct class *class; - - class = container_of(kobj, struct class, kobj); - if (class->class_release) - class->class_release(class); -} - -static struct sysfs_ops class_sysfs = { - .show = class_show, - .store = class_store, -}; -static struct kobj_type class_ktype = { - .release = class_release, - .sysfs_ops = &class_sysfs -}; - static inline int class_register(struct class *class) { class->bsdclass = devclass_create(class->name); - kobject_init(&class->kobj, &class_ktype); + kobject_init(&class->kobj, &linux_class_ktype); kobject_set_name(&class->kobj, class->name); - kobject_add(&class->kobj, &class_root, class->name); + kobject_add(&class->kobj, &linux_class_root, class->name); return (0); } @@ -237,54 +191,6 @@ class_unregister(struct class *class) kobject_put(&class->kobj); } -static inline void -device_release(struct kobject *kobj) -{ - struct device *dev; - - dev = container_of(kobj, struct device, kobj); - /* This is the precedence defined by linux. */ - if (dev->release) - dev->release(dev); - else if (dev->class && dev->class->dev_release) - dev->class->dev_release(dev); -} - -static inline ssize_t -dev_show(struct kobject *kobj, struct attribute *attr, char *buf) -{ - struct device_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct device_attribute, attr); - error = -EIO; - if (dattr->show) - error = dattr->show(container_of(kobj, struct device, kobj), - dattr, buf); - return (error); -} - -static inline ssize_t -dev_store(struct kobject *kobj, struct attribute *attr, const char *buf, - size_t count) -{ - struct device_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct device_attribute, attr); - error = -EIO; - if (dattr->store) - error = dattr->store(container_of(kobj, struct device, kobj), - dattr, buf, count); - return (error); -} - -static struct sysfs_ops dev_sysfs = { .show = dev_show, .store = dev_store, }; -static struct kobj_type dev_ktype = { - .release = device_release, - .sysfs_ops = &dev_sysfs -}; - /* * Devices are registered and created for exporting to sysfs. create * implies register and register assumes the device fields have been @@ -311,7 +217,7 @@ device_register(struct device *dev) device_set_softc(bsddev, dev); } dev->bsddev = bsddev; - kobject_init(&dev->kobj, &dev_ktype); + kobject_init(&dev->kobj, &linux_dev_ktype); kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); return (0); @@ -346,7 +252,7 @@ device_destroy(struct class *class, dev_ } static inline void -class_kfree(struct class *class) +linux_class_kfree(struct class *class) { kfree(class); @@ -361,7 +267,7 @@ class_create(struct module *owner, const class = kzalloc(sizeof(*class), M_WAITOK); class->owner = owner; class->name= name; - class->class_release = class_kfree; + class->class_release = linux_class_kfree; error = class_register(class); if (error) { kfree(class); @@ -414,7 +320,8 @@ class_remove_file(struct class *class, c sysfs_remove_file(&class->kobj, &attr->attr); } -static inline int dev_to_node(struct device *dev) +static inline int +dev_to_node(struct device *dev) { return -1; } Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kobject.h Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/include/linux/kobject.h Thu Dec 31 12:30:19 2015 (r292987) @@ -46,13 +46,13 @@ struct kobj_type { struct attribute **default_attrs; }; -extern struct kobj_type kfree_type; +extern const struct kobj_type linux_kfree_type; struct kobject { struct kobject *parent; char *name; struct kref kref; - struct kobj_type *ktype; + const struct kobj_type *ktype; struct list_head entry; struct sysctl_oid *oidp; }; @@ -74,7 +74,7 @@ struct kobj_attribute { }; static inline void -kobject_init(struct kobject *kobj, struct kobj_type *ktype) +kobject_init(struct kobject *kobj, const struct kobj_type *ktype) { kref_init(&kobj->kref); @@ -83,15 +83,14 @@ kobject_init(struct kobject *kobj, struc kobj->oidp = NULL; } -static inline void kobject_put(struct kobject *kobj); -void kobject_release(struct kref *kref); +void linux_kobject_release(struct kref *kref); static inline void kobject_put(struct kobject *kobj) { if (kobj) - kref_put(&kobj->kref, kobject_release); + kref_put(&kobj->kref, linux_kobject_release); } static inline struct kobject * @@ -115,7 +114,7 @@ kobject_create(void) kobj = kzalloc(sizeof(*kobj), GFP_KERNEL); if (kobj == NULL) return (NULL); - kobject_init(kobj, &kfree_type); + kobject_init(kobj, &linux_kfree_type); return (kobj); } @@ -135,7 +134,6 @@ kobject_create_and_add(const char *name, return (NULL); } - static inline char * kobject_name(const struct kobject *kobj) { @@ -144,7 +142,7 @@ kobject_name(const struct kobject *kobj) } int kobject_set_name(struct kobject *kobj, const char *fmt, ...); -int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, +int kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...); #endif /* _LINUX_KOBJECT_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/miscdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Thu Dec 31 12:30:19 2015 (r292987) @@ -46,13 +46,13 @@ struct miscdevice { umode_t mode; }; -extern struct class miscclass; +extern struct class linux_class_misc; static inline int misc_register(struct miscdevice *misc) { - misc->this_device = device_create(&miscclass, &linux_rootdev, 0, misc, - misc->name); + misc->this_device = device_create(&linux_class_misc, + &linux_root_device, 0, misc, misc->name); misc->cdev = cdev_alloc(); if (misc->cdev == NULL) return -ENOMEM; @@ -67,7 +67,7 @@ misc_register(struct miscdevice *misc) static inline int misc_deregister(struct miscdevice *misc) { - device_destroy(&miscclass, misc->this_device->devt); + device_destroy(&linux_class_misc, misc->this_device->devt); cdev_del(misc->cdev); return (0); Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Dec 31 12:30:19 2015 (r292987) @@ -77,9 +77,9 @@ MALLOC_DEFINE(M_KMALLOC, "linux", "Linux #undef cdev #define RB_ROOT(head) (head)->rbh_root -struct kobject class_root; -struct device linux_rootdev; -struct class miscclass; +struct kobject linux_class_root; +struct device linux_root_device; +struct class linux_class_misc; struct list_head pci_drivers; struct list_head pci_devices; struct net init_net; @@ -151,10 +151,10 @@ kobject_set_name(struct kobject *kobj, c return (error); } -static inline int +static int kobject_add_complete(struct kobject *kobj, struct kobject *parent) { - struct kobj_type *t; + const struct kobj_type *t; int error; kobj->parent = parent; @@ -191,7 +191,7 @@ kobject_add(struct kobject *kobj, struct } void -kobject_release(struct kref *kref) +linux_kobject_release(struct kref *kref) { struct kobject *kobj; char *name; @@ -205,28 +205,131 @@ kobject_release(struct kref *kref) } static void -kobject_kfree(struct kobject *kobj) +linux_kobject_kfree(struct kobject *kobj) { kfree(kobj); } static void -kobject_kfree_name(struct kobject *kobj) +linux_kobject_kfree_name(struct kobject *kobj) { if (kobj) { kfree(kobj->name); } } -struct kobj_type kfree_type = { .release = kobject_kfree }; +const struct kobj_type linux_kfree_type = { + .release = linux_kobject_kfree +}; static void -dev_release(struct device *dev) +linux_device_release(struct device *dev) { - pr_debug("dev_release: %s\n", dev_name(dev)); + pr_debug("linux_device_release: %s\n", dev_name(dev)); kfree(dev); } +static ssize_t +linux_class_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct class_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct class_attribute, attr); + error = -EIO; + if (dattr->show) + error = dattr->show(container_of(kobj, struct class, kobj), + dattr, buf); + return (error); +} + +static ssize_t +linux_class_store(struct kobject *kobj, struct attribute *attr, const char *buf, + size_t count) +{ + struct class_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct class_attribute, attr); + error = -EIO; + if (dattr->store) + error = dattr->store(container_of(kobj, struct class, kobj), + dattr, buf, count); + return (error); +} + +static void +linux_class_release(struct kobject *kobj) +{ + struct class *class; + + class = container_of(kobj, struct class, kobj); + if (class->class_release) + class->class_release(class); +} + +static const struct sysfs_ops linux_class_sysfs = { + .show = linux_class_show, + .store = linux_class_store, +}; + +const struct kobj_type linux_class_ktype = { + .release = linux_class_release, + .sysfs_ops = &linux_class_sysfs +}; + +static void +linux_dev_release(struct kobject *kobj) +{ + struct device *dev; + + dev = container_of(kobj, struct device, kobj); + /* This is the precedence defined by linux. */ + if (dev->release) + dev->release(dev); + else if (dev->class && dev->class->dev_release) + dev->class->dev_release(dev); +} + +static ssize_t +linux_dev_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct device_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct device_attribute, attr); + error = -EIO; + if (dattr->show) + error = dattr->show(container_of(kobj, struct device, kobj), + dattr, buf); + return (error); +} + +static ssize_t +linux_dev_store(struct kobject *kobj, struct attribute *attr, const char *buf, + size_t count) +{ + struct device_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct device_attribute, attr); + error = -EIO; + if (dattr->store) + error = dattr->store(container_of(kobj, struct device, kobj), + dattr, buf, count); + return (error); +} + +static const struct sysfs_ops linux_dev_sysfs = { + .show = linux_dev_show, + .store = linux_dev_store, +}; + +const struct kobj_type linux_dev_ktype = { + .release = linux_dev_release, + .sysfs_ops = &linux_dev_sysfs +}; + struct device * device_create(struct class *class, struct device *parent, dev_t devt, void *drvdata, const char *fmt, ...) @@ -239,7 +342,7 @@ device_create(struct class *class, struc dev->class = class; dev->devt = devt; dev->driver_data = drvdata; - dev->release = dev_release; + dev->release = linux_device_release; va_start(args, fmt); kobject_set_name_vargs(&dev->kobj, fmt, args); va_end(args); @@ -249,7 +352,7 @@ device_create(struct class *class, struc } int -kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, +kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...) { va_list args; @@ -999,6 +1102,41 @@ destroy_workqueue(struct workqueue_struc } static void +linux_cdev_release(struct kobject *kobj) +{ + struct linux_cdev *cdev; + struct kobject *parent; + + cdev = container_of(kobj, struct linux_cdev, kobj); + parent = kobj->parent; + if (cdev->cdev) + destroy_dev(cdev->cdev); + kfree(cdev); + kobject_put(parent); +} + +static void +linux_cdev_static_release(struct kobject *kobj) +{ + struct linux_cdev *cdev; + struct kobject *parent; + + cdev = container_of(kobj, struct linux_cdev, kobj); + parent = kobj->parent; + if (cdev->cdev) + destroy_dev(cdev->cdev); + kobject_put(parent); +} + +const struct kobj_type linux_cdev_ktype = { + .release = linux_cdev_release, +}; + +const struct kobj_type linux_cdev_static_ktype = { + .release = linux_cdev_static_release, +}; + +static void linux_compat_init(void *arg) { struct sysctl_oid *rootoid; @@ -1006,18 +1144,18 @@ linux_compat_init(void *arg) rootoid = SYSCTL_ADD_ROOT_NODE(NULL, OID_AUTO, "sys", CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "sys"); - kobject_init(&class_root, &class_ktype); - kobject_set_name(&class_root, "class"); - class_root.oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(rootoid), + kobject_init(&linux_class_root, &linux_class_ktype); + kobject_set_name(&linux_class_root, "class"); + linux_class_root.oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(rootoid), OID_AUTO, "class", CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "class"); - kobject_init(&linux_rootdev.kobj, &dev_ktype); - kobject_set_name(&linux_rootdev.kobj, "device"); - linux_rootdev.kobj.oidp = SYSCTL_ADD_NODE(NULL, + kobject_init(&linux_root_device.kobj, &linux_dev_ktype); + kobject_set_name(&linux_root_device.kobj, "device"); + linux_root_device.kobj.oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(rootoid), OID_AUTO, "device", CTLFLAG_RD, NULL, "device"); - linux_rootdev.bsddev = root_bus; - miscclass.name = "misc"; - class_register(&miscclass); + linux_root_device.bsddev = root_bus; + linux_class_misc.name = "misc"; + class_register(&linux_class_misc); INIT_LIST_HEAD(&pci_drivers); INIT_LIST_HEAD(&pci_devices); spin_lock_init(&pci_lock); @@ -1030,9 +1168,9 @@ SYSINIT(linux_compat, SI_SUB_DRIVERS, SI static void linux_compat_uninit(void *arg) { - kobject_kfree_name(&class_root); - kobject_kfree_name(&linux_rootdev.kobj); - kobject_kfree_name(&miscclass.kobj); + linux_kobject_kfree_name(&linux_class_root); + linux_kobject_kfree_name(&linux_root_device.kobj); + linux_kobject_kfree_name(&linux_class_misc.kobj); } SYSUNINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_uninit, NULL); Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Dec 31 11:27:36 2015 (r292986) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Dec 31 12:30:19 2015 (r292987) @@ -119,16 +119,16 @@ linux_pci_attach(device_t dev) pdrv = linux_pci_find(dev, &id); pdev = device_get_softc(dev); - pdev->dev.parent = &linux_rootdev; + pdev->dev.parent = &linux_root_device; pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); pdev->device = id->device; pdev->vendor = id->vendor; pdev->dev.dma_mask = &pdev->dma_mask; pdev->pdrv = pdrv; - kobject_init(&pdev->dev.kobj, &dev_ktype); + kobject_init(&pdev->dev.kobj, &linux_dev_ktype); kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); - kobject_add(&pdev->dev.kobj, &linux_rootdev.kobj, + kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, kobject_name(&pdev->dev.kobj)); rle = _pci_get_rle(pdev, SYS_RES_IRQ, 0); if (rle) From owner-svn-src-head@freebsd.org Thu Dec 31 14: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 7F803A579C9; Thu, 31 Dec 2015 14:47:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 44A9D1D59; Thu, 31 Dec 2015 14:47:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVEljSN035689; Thu, 31 Dec 2015 14:47:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVEljHv035688; Thu, 31 Dec 2015 14:47:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512311447.tBVEljHv035688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 Dec 2015 14:47:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292989 - head/sys/compat/linuxkpi/common/include/linux 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, 31 Dec 2015 14:47:46 -0000 Author: hselasky Date: Thu Dec 31 14:47:45 2015 New Revision: 292989 URL: https://svnweb.freebsd.org/changeset/base/292989 Log: Handle when filedescriptors are closed before initialized. An early fdclose() call can cause fget_unlocked() to fail. Found by: mjg @ MFC after: 1 week Reviewed by: Mark Block Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4351 Modified: head/sys/compat/linuxkpi/common/include/linux/file.h Modified: head/sys/compat/linuxkpi/common/include/linux/file.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/file.h Thu Dec 31 14:39:45 2015 (r292988) +++ head/sys/compat/linuxkpi/common/include/linux/file.h Thu Dec 31 14:47:45 2015 (r292989) @@ -101,10 +101,11 @@ fd_install(unsigned int fd, struct linux if (fget_unlocked(curthread->td_proc->p_fd, fd, cap_rights_init(&rights), &file, NULL) != 0) { - file = NULL; + filp->_file = NULL; + } else { + filp->_file = file; + finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); } - filp->_file = file; - finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); /* drop the extra reference */ fput(filp); From owner-svn-src-head@freebsd.org Thu Dec 31 17:51: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 048FBA57CF6; Thu, 31 Dec 2015 17:51:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C8E261B7E; Thu, 31 Dec 2015 17:51:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVHpGaE089521; Thu, 31 Dec 2015 17:51:16 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVHpGBE089520; Thu, 31 Dec 2015 17:51:16 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512311751.tBVHpGBE089520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 31 Dec 2015 17:51:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292991 - head/bin/sh 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, 31 Dec 2015 17:51:17 -0000 Author: jilles Date: Thu Dec 31 17:51:15 2015 New Revision: 292991 URL: https://svnweb.freebsd.org/changeset/base/292991 Log: sh: Perform IFS splitting during the first expansion phases. This simplifies the code and should be faster in some cases. Side effect: the order of operations is different so that the value of IFS used when IFS is modified during expansion (${IFS:=...}, ${IFS=...} or $((...IFS=...))) may be different. Note that this order is highly unportable between shells. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Dec 31 17:37:35 2015 (r292990) +++ head/bin/sh/expand.c Thu Dec 31 17:51:15 2015 (r292991) @@ -3,6 +3,8 @@ * The Regents of the University of California. All rights reserved. * Copyright (c) 1997-2005 * Herbert Xu . All rights reserved. + * Copyright (c) 2010-2015 + * Jilles Tjoelker . All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. @@ -79,42 +81,32 @@ __FBSDID("$FreeBSD$"); #include "show.h" #include "builtins.h" -/* - * Structure specifying which parts of the string should be searched - * for IFS characters. - */ +enum wordstate { WORD_IDLE, WORD_WS_DELIMITED, WORD_QUOTEMARK }; -struct ifsregion { - struct ifsregion *next; /* next region in list */ - int begoff; /* offset of start of region */ - int endoff; /* offset of end of region */ - int inquotes; /* search for nul bytes only */ +struct worddest { + struct arglist list; + enum wordstate state; }; - static char *expdest; /* output of current string */ static struct nodelist *argbackq; /* list of back quote expressions */ -static struct ifsregion ifsfirst; /* first struct in list of ifs regions */ -static struct ifsregion *ifslastp; /* last struct in list */ -static char *argstr(char *, int); +static char *argstr(char *, int, struct worddest *); static char *exptilde(char *, int); -static char *expari(char *); -static void expbackq(union node *, int, int); -static int subevalvar_trim(char *, int, int, int, int); +static char *expari(char *, int, struct worddest *); +static void expbackq(union node *, int, int, struct worddest *); +static void subevalvar_trim(char *, int, int, int); static int subevalvar_misc(char *, const char *, int, int, int); -static char *evalvar(char *, int); +static char *evalvar(char *, int, struct worddest *); static int varisset(const char *, int); -static void strtodest(const char *, int, int, int); -static void varvalue(const char *, int, int, int); -static void recordregion(int, int, int); -static void removerecordregions(int); -static void ifsbreakup(char *, struct arglist *); +static void strtodest(const char *, int, int, int, struct worddest *); +static void reprocess(int, int, int, int, struct worddest *); +static void varvalue(const char *, int, int, int, struct worddest *); static void expandmeta(struct arglist *, struct arglist *); static void expmeta(char *, char *, struct arglist *); static int expsortcmp(const void *, const void *); -static int patmatch(const char *, const char *, int); -static char *cvtnum(int, char *); +static int patmatch(const char *, const char *); +static void cvtnum(int, char *); static int collate_range_cmp(wchar_t, wchar_t); void @@ -169,6 +161,50 @@ stputs_quotes(const char *data, const ch } #define STPUTS_QUOTES(data, syntax, p) p = stputs_quotes((data), syntax, p) +static char * +nextword(char c, char *p, struct worddest *dst) +{ + int is_ws; + + is_ws = c == '\t' || c == '\n' || c == ' '; + if (p != stackblock() || (is_ws ? dst->state == WORD_QUOTEMARK : + dst->state != WORD_WS_DELIMITED) || c == '\0') { + STPUTC('\0', p); + appendarglist(&dst->list, grabstackstr(p)); + dst->state = is_ws ? WORD_WS_DELIMITED : WORD_IDLE; + } else if (!is_ws && dst->state == WORD_WS_DELIMITED) + dst->state = WORD_IDLE; + /* Reserve space while the stack string is empty. */ + appendarglist(&dst->list, NULL); + dst->list.count--; + STARTSTACKSTR(p); + return p; +} +#define NEXTWORD(c, p, dstlist) p = nextword(c, p, dstlist) + +static char * +stputs_split(const char *data, const char *syntax, char *p, + struct worddest *dst) +{ + const char *ifs; + char c; + + ifs = ifsset() ? ifsval() : " \t\n"; + while (*data) { + CHECKSTRSPACE(2, p); + c = *data++; + if (strchr(ifs, c) != NULL) { + NEXTWORD(c, p, dst); + continue; + } + if (syntax[(int)c] == CCTL) + USTPUTC(CTLESC, p); + USTPUTC(c, p); + } + return (p); +} +#define STPUTS_SPLIT(data, syntax, p, dst) p = stputs_split((data), syntax, p, dst) + /* * Perform expansions on an argument, placing the resulting list of arguments * in arglist. Parameter expansion, command substitution and arithmetic @@ -184,34 +220,27 @@ stputs_quotes(const char *data, const ch void expandarg(union node *arg, struct arglist *arglist, int flag) { - struct arglist exparg; - char *p; + struct worddest exparg; argbackq = arg->narg.backquote; + emptyarglist(&exparg.list); + exparg.state = WORD_IDLE; STARTSTACKSTR(expdest); - ifsfirst.next = NULL; - ifslastp = NULL; - argstr(arg->narg.text, flag); + argstr(arg->narg.text, flag, &exparg); if (arglist == NULL) { STACKSTRNUL(expdest); return; /* here document expanded */ } - STPUTC('\0', expdest); - p = grabstackstr(expdest); - emptyarglist(&exparg); - if (flag & EXP_FULL) { - ifsbreakup(p, &exparg); - expandmeta(&exparg, arglist); - } else - appendarglist(arglist, p); - while (ifsfirst.next != NULL) { - struct ifsregion *ifsp; - INTOFF; - ifsp = ifsfirst.next->next; - ckfree(ifsfirst.next); - ifsfirst.next = ifsp; - INTON; + if ((flag & EXP_FULL) == 0 || expdest != stackblock() || + exparg.state == WORD_QUOTEMARK) { + STPUTC('\0', expdest); + if (flag & EXP_FULL) + appendarglist(&exparg.list, grabstackstr(expdest)); } + if (flag & EXP_FULL) + expandmeta(&exparg.list, arglist); + else + appendarglist(arglist, grabstackstr(expdest)); } @@ -223,10 +252,11 @@ expandarg(union node *arg, struct arglis * This is used to expand word in ${var+word} etc. * If EXP_FULL or EXP_CASE are set, keep and/or generate CTLESC * characters to allow for further processing. - * If EXP_FULL is set, also preserve CTLQUOTEMARK characters. + * + * If EXP_FULL is set, dst receives any complete words produced. */ static char * -argstr(char *p, int flag) +argstr(char *p, int flag, struct worddest *dst) { char c; int quotes = flag & (EXP_FULL | EXP_CASE); /* do CTLESC */ @@ -253,32 +283,33 @@ argstr(char *p, int flag) if (p[0] == CTLVAR && (p[1] & VSQUOTE) != 0 && p[2] == '@' && p[3] == '=') break; - if ((flag & EXP_FULL) != 0) - USTPUTC(c, expdest); + if ((flag & EXP_FULL) != 0 && expdest == stackblock()) + dst->state = WORD_QUOTEMARK; break; case CTLQUOTEEND: lit_quoted = 0; break; case CTLESC: - if (quotes) - USTPUTC(c, expdest); c = *p++; + if (split_lit && !lit_quoted && + strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { + NEXTWORD(c, expdest, dst); + break; + } + if (quotes) + USTPUTC(CTLESC, expdest); USTPUTC(c, expdest); - if (split_lit && !lit_quoted) - recordregion(expdest - stackblock() - - (quotes ? 2 : 1), - expdest - stackblock(), 0); break; case CTLVAR: - p = evalvar(p, flag); + p = evalvar(p, flag, dst); break; case CTLBACKQ: case CTLBACKQ|CTLQUOTE: - expbackq(argbackq->n, c & CTLQUOTE, flag); + expbackq(argbackq->n, c & CTLQUOTE, flag, dst); argbackq = argbackq->next; break; case CTLARI: - p = expari(p); + p = expari(p, flag, dst); break; case ':': case '=': @@ -286,10 +317,12 @@ argstr(char *p, int flag) * sort of a hack - expand tildes in variable * assignments (after the first '=' and after ':'s). */ + if (split_lit && !lit_quoted && + strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { + NEXTWORD(c, expdest, dst); + break; + } USTPUTC(c, expdest); - if (split_lit && !lit_quoted) - recordregion(expdest - stackblock() - 1, - expdest - stackblock(), 0); if (flag & EXP_VARTILDE && *p == '~' && (c != '=' || firsteq)) { if (c == '=') @@ -298,10 +331,12 @@ argstr(char *p, int flag) } break; default: + if (split_lit && !lit_quoted && + strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { + NEXTWORD(c, expdest, dst); + break; + } USTPUTC(c, expdest); - if (split_lit && !lit_quoted) - recordregion(expdest - stackblock() - 1, - expdest - stackblock(), 0); } } } @@ -345,7 +380,7 @@ exptilde(char *p, int flag) *p = c; if (home == NULL || *home == '\0') return (startp); - strtodest(home, flag, VSNORMAL, 1); + strtodest(home, flag, VSNORMAL, 1, NULL); return (p); } p++; @@ -353,51 +388,11 @@ exptilde(char *p, int flag) } -static void -removerecordregions(int endoff) -{ - if (ifslastp == NULL) - return; - - if (ifsfirst.endoff > endoff) { - while (ifsfirst.next != NULL) { - struct ifsregion *ifsp; - INTOFF; - ifsp = ifsfirst.next->next; - ckfree(ifsfirst.next); - ifsfirst.next = ifsp; - INTON; - } - if (ifsfirst.begoff > endoff) - ifslastp = NULL; - else { - ifslastp = &ifsfirst; - ifsfirst.endoff = endoff; - } - return; - } - - ifslastp = &ifsfirst; - while (ifslastp->next && ifslastp->next->begoff < endoff) - ifslastp=ifslastp->next; - while (ifslastp->next != NULL) { - struct ifsregion *ifsp; - INTOFF; - ifsp = ifslastp->next->next; - ckfree(ifslastp->next); - ifslastp->next = ifsp; - INTON; - } - if (ifslastp->endoff > endoff) - ifslastp->endoff = endoff; -} - /* * Expand arithmetic expression. - * Note that flag is not required as digits never require CTLESC characters. */ static char * -expari(char *p) +expari(char *p, int flag, struct worddest *dst) { char *q, *start; arith_t result; @@ -407,8 +402,7 @@ expari(char *p) quoted = *p++ == '"'; begoff = expdest - stackblock(); - p = argstr(p, 0); - removerecordregions(begoff); + p = argstr(p, 0, NULL); STPUTC('\0', expdest); start = stackblock() + begoff; @@ -425,7 +419,7 @@ expari(char *p) adj = strlen(expdest); STADJUST(adj, expdest); if (!quoted) - recordregion(begoff, expdest - stackblock(), 0); + reprocess(expdest - adj - stackblock(), flag, VSNORMAL, 0, dst); return p; } @@ -434,35 +428,34 @@ expari(char *p) * Perform command substitution. */ static void -expbackq(union node *cmd, int quoted, int flag) +expbackq(union node *cmd, int quoted, int flag, struct worddest *dst) { struct backcmd in; int i; char buf[128]; char *p; char *dest = expdest; - struct ifsregion saveifs, *savelastp; struct nodelist *saveargbackq; char lastc; - int startloc = dest - stackblock(); char const *syntax = quoted? DQSYNTAX : BASESYNTAX; int quotes = flag & (EXP_FULL | EXP_CASE); size_t nnl; + const char *ifs; INTOFF; - saveifs = ifsfirst; - savelastp = ifslastp; saveargbackq = argbackq; p = grabstackstr(dest); evalbackcmd(cmd, &in); ungrabstackstr(p, dest); - ifsfirst = saveifs; - ifslastp = savelastp; argbackq = saveargbackq; p = in.buf; lastc = '\0'; nnl = 0; + if (!quoted && flag & EXP_FULL) + ifs = ifsset() ? ifsval() : " \t\n"; + else + ifs = ""; /* Don't copy trailing newlines */ for (;;) { if (--in.nleft < 0) { @@ -476,15 +469,27 @@ expbackq(union node *cmd, int quoted, in in.nleft = i - 1; } lastc = *p++; - if (lastc != '\0') { - if (lastc == '\n') { - nnl++; - } else { - CHECKSTRSPACE(nnl + 2, dest); - while (nnl > 0) { - nnl--; - USTPUTC('\n', dest); + if (lastc == '\0') + continue; + if (lastc == '\n') { + nnl++; + } else { + if (nnl > 0) { + if (strchr(ifs, '\n') != NULL) { + NEXTWORD('\n', dest, dst); + nnl = 0; + } else { + CHECKSTRSPACE(nnl + 2, dest); + while (nnl > 0) { + nnl--; + USTPUTC('\n', dest); + } } + } + if (strchr(ifs, lastc) != NULL) + NEXTWORD(lastc, dest, dst); + else { + CHECKSTRSPACE(2, dest); if (quotes && syntax[(int)lastc] == CCTL) USTPUTC(CTLESC, dest); USTPUTC(lastc, dest); @@ -498,8 +503,6 @@ expbackq(union node *cmd, int quoted, in ckfree(in.buf); if (in.jp) exitstatus = waitforjob(in.jp, (int *)NULL); - if (quoted == 0) - recordregion(startloc, dest - stackblock(), 0); TRACE(("expbackq: size=%td: \"%.*s\"\n", ((dest - stackblock()) - startloc), (int)((dest - stackblock()) - startloc), @@ -521,18 +524,17 @@ recordleft(const char *str, const char * *startp++ = *loc++; } -static int -subevalvar_trim(char *p, int strloc, int subtype, int startloc, int quotes) +static void +subevalvar_trim(char *p, int strloc, int subtype, int startloc) { char *startp; char *loc = NULL; - char *q; char *str; int c = 0; struct nodelist *saveargbackq = argbackq; int amount; - argstr(p, EXP_CASE | EXP_TILDE); + argstr(p, EXP_CASE | EXP_TILDE, NULL); STACKSTRNUL(expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -543,72 +545,56 @@ subevalvar_trim(char *p, int strloc, int for (loc = startp; loc < str; loc++) { c = *loc; *loc = '\0'; - if (patmatch(str, startp, quotes)) { + if (patmatch(str, startp)) { *loc = c; recordleft(str, loc, startp); - return 1; + return; } *loc = c; - if (quotes && *loc == CTLESC) - loc++; } - return 0; + break; case VSTRIMLEFTMAX: for (loc = str - 1; loc >= startp;) { c = *loc; *loc = '\0'; - if (patmatch(str, startp, quotes)) { + if (patmatch(str, startp)) { *loc = c; recordleft(str, loc, startp); - return 1; + return; } *loc = c; loc--; - if (quotes && loc > startp && *(loc - 1) == CTLESC) { - for (q = startp; q < loc; q++) - if (*q == CTLESC) - q++; - if (q > loc) - loc--; - } } - return 0; + break; case VSTRIMRIGHT: for (loc = str - 1; loc >= startp;) { - if (patmatch(str, loc, quotes)) { + if (patmatch(str, loc)) { amount = loc - expdest; STADJUST(amount, expdest); - return 1; + return; } loc--; - if (quotes && loc > startp && *(loc - 1) == CTLESC) { - for (q = startp; q < loc; q++) - if (*q == CTLESC) - q++; - if (q > loc) - loc--; - } } - return 0; + break; case VSTRIMRIGHTMAX: for (loc = startp; loc < str - 1; loc++) { - if (patmatch(str, loc, quotes)) { + if (patmatch(str, loc)) { amount = loc - expdest; STADJUST(amount, expdest); - return 1; + return; } - if (quotes && *loc == CTLESC) - loc++; } - return 0; + break; default: abort(); } + amount = (expdest - stackblock() - strloc) + 1; + STADJUST(-amount, expdest); } @@ -620,7 +606,7 @@ subevalvar_misc(char *p, const char *var struct nodelist *saveargbackq = argbackq; int amount; - argstr(p, EXP_TILDE); + argstr(p, EXP_TILDE, NULL); STACKSTRNUL(expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -653,7 +639,7 @@ subevalvar_misc(char *p, const char *var */ static char * -evalvar(char *p, int flag) +evalvar(char *p, int flag, struct worddest *dst) { int subtype; int varflags; @@ -666,9 +652,7 @@ evalvar(char *p, int flag) int startloc; int varlen; int varlenb; - int easy; - int quotes = flag & (EXP_FULL | EXP_CASE); - int record = 0; + char buf[21]; varflags = (unsigned char)*p++; subtype = varflags & VSTYPE; @@ -710,10 +694,16 @@ again: /* jump here after setting a vari if (set && subtype != VSPLUS) { /* insert the value of the variable */ if (special) { - if (varflags & VSLINENO) - STPUTBIN(var, p - var - 1, expdest); - else - varvalue(var, varflags & VSQUOTE, subtype, flag); + if (varflags & VSLINENO) { + if (p - var > (ptrdiff_t)sizeof(buf)) + abort(); + memcpy(buf, var, p - var - 1); + buf[p - var - 1] = '\0'; + strtodest(buf, flag, subtype, + varflags & VSQUOTE, dst); + } else + varvalue(var, varflags & VSQUOTE, subtype, flag, + dst); if (subtype == VSLENGTH) { varlenb = expdest - stackblock() - startloc; varlen = varlenb; @@ -734,35 +724,29 @@ again: /* jump here after setting a vari } else strtodest(val, flag, subtype, - varflags & VSQUOTE); + varflags & VSQUOTE, dst); } } if (subtype == VSPLUS) set = ! set; - easy = ((varflags & VSQUOTE) == 0 || - (*var == '@' && shellparam.nparam != 1)); - - switch (subtype) { case VSLENGTH: - expdest = cvtnum(varlen, expdest); - record = 1; + cvtnum(varlen, buf); + strtodest(buf, flag, VSNORMAL, varflags & VSQUOTE, dst); break; case VSNORMAL: - record = easy; break; case VSPLUS: case VSMINUS: if (!set) { argstr(p, flag | (flag & EXP_FULL ? EXP_SPLIT_LIT : 0) | - (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0)); + (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0), dst); break; } - record = easy; break; case VSTRIMLEFT: @@ -777,14 +761,10 @@ again: /* jump here after setting a vari */ STPUTC('\0', expdest); patloc = expdest - stackblock(); - if (subevalvar_trim(p, patloc, subtype, - startloc, quotes) == 0) { - int amount = (expdest - stackblock() - patloc) + 1; - STADJUST(-amount, expdest); - } - /* Remove any recorded regions beyond start of variable */ - removerecordregions(startloc); - record = 1; + subevalvar_trim(p, patloc, subtype, startloc); + reprocess(startloc, flag, VSNORMAL, varflags & VSQUOTE, dst); + if (flag & EXP_FULL && *var == '@' && varflags & VSQUOTE) + dst->state = WORD_QUOTEMARK; break; case VSASSIGN: @@ -793,16 +773,10 @@ again: /* jump here after setting a vari if (subevalvar_misc(p, var, subtype, startloc, varflags)) { varflags &= ~VSNUL; - /* - * Remove any recorded regions beyond - * start of variable - */ - removerecordregions(startloc); goto again; } break; } - record = easy; break; case VSERROR: @@ -814,11 +788,6 @@ again: /* jump here after setting a vari abort(); } - if (record) - recordregion(startloc, expdest - stackblock(), - varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' && - (*var == '@' || *var == '*'))); - if (subtype != VSNORMAL) { /* skip to end of alternative */ int nesting = 1; for (;;) { @@ -884,26 +853,80 @@ varisset(const char *name, int nulok) } static void -strtodest(const char *p, int flag, int subtype, int quoted) +strtodest(const char *p, int flag, int subtype, int quoted, + struct worddest *dst) { - if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH) + if (subtype == VSLENGTH || subtype == VSTRIMLEFT || + subtype == VSTRIMLEFTMAX || subtype == VSTRIMRIGHT || + subtype == VSTRIMRIGHTMAX) + STPUTS(p, expdest); + else if (flag & EXP_FULL && !quoted && dst != NULL) + STPUTS_SPLIT(p, BASESYNTAX, expdest, dst); + else if (flag & (EXP_FULL | EXP_CASE)) STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest); else STPUTS(p, expdest); } +static void +reprocess(int startloc, int flag, int subtype, int quoted, + struct worddest *dst) +{ + static char *buf = NULL; + static size_t buflen = 0; + char *startp; + size_t len, zpos, zlen; + + startp = stackblock() + startloc; + len = expdest - startp; + if (len >= SIZE_MAX / 2) + abort(); + INTOFF; + if (len >= buflen) { + ckfree(buf); + buf = NULL; + } + if (buflen < 128) + buflen = 128; + while (len >= buflen) + buflen <<= 1; + if (buf == NULL) + buf = ckmalloc(buflen); + INTON; + memcpy(buf, startp, len); + buf[len] = '\0'; + STADJUST(-len, expdest); + for (zpos = 0;;) { + zlen = strlen(buf + zpos); + strtodest(buf + zpos, flag, subtype, quoted, dst); + zpos += zlen + 1; + if (zpos == len + 1) + break; + if (flag & EXP_FULL && (quoted || (zlen > 0 && zpos < len))) + NEXTWORD('\0', expdest, dst); + } +} + /* * Add the value of a specialized variable to the stack string. */ static void -varvalue(const char *name, int quoted, int subtype, int flag) +varvalue(const char *name, int quoted, int subtype, int flag, + struct worddest *dst) { int num; char *p; int i; + int splitlater; char sep[2]; char **ap; + char buf[(NSHORTOPTS > 10 ? NSHORTOPTS : 10) + 1]; + + if (subtype == VSLENGTH) + flag &= ~EXP_FULL; + splitlater = subtype == VSTRIMLEFT || subtype == VSTRIMLEFTMAX || + subtype == VSTRIMRIGHT || subtype == VSTRIMRIGHTMAX; switch (*name) { case '$': @@ -919,18 +942,27 @@ varvalue(const char *name, int quoted, i num = backgndpidval(); break; case '-': + p = buf; for (i = 0 ; i < NSHORTOPTS ; i++) { if (optlist[i].val) - STPUTC(optlist[i].letter, expdest); + *p++ = optlist[i].letter; } + *p = '\0'; + strtodest(buf, flag, subtype, quoted, dst); return; case '@': if (flag & EXP_FULL && quoted) { for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { - strtodest(p, flag, subtype, quoted); - if (*ap) - STPUTC('\0', expdest); + strtodest(p, flag, subtype, quoted, dst); + if (*ap) { + if (splitlater) + STPUTC('\0', expdest); + else + NEXTWORD('\0', expdest, dst); + } } + if (shellparam.nparam > 0) + dst->state = WORD_QUOTEMARK; return; } /* FALLTHROUGH */ @@ -941,13 +973,17 @@ varvalue(const char *name, int quoted, i sep[0] = ' '; sep[1] = '\0'; for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { - strtodest(p, flag, subtype, quoted); + strtodest(p, flag, subtype, quoted, dst); if (!*ap) break; if (sep[0]) - strtodest(sep, flag, subtype, quoted); - else if (flag & EXP_FULL && !quoted && **ap != '\0') - STPUTC('\0', expdest); + strtodest(sep, flag, subtype, quoted, dst); + else if (flag & EXP_FULL && !quoted && **ap != '\0') { + if (splitlater) + STPUTC('\0', expdest); + else + NEXTWORD('\0', expdest, dst); + } } return; default: @@ -959,149 +995,16 @@ varvalue(const char *name, int quoted, i p = shellparam.p[num - 1]; else return; - strtodest(p, flag, subtype, quoted); + strtodest(p, flag, subtype, quoted, dst); } return; } - expdest = cvtnum(num, expdest); + cvtnum(num, buf); + strtodest(buf, flag, subtype, quoted, dst); } -/* - * Record the fact that we have to scan this region of the - * string for IFS characters. - */ - -static void -recordregion(int start, int end, int inquotes) -{ - struct ifsregion *ifsp; - - INTOFF; - if (ifslastp == NULL) { - ifsp = &ifsfirst; - } else { - if (ifslastp->endoff == start - && ifslastp->inquotes == inquotes) { - /* extend previous area */ - ifslastp->endoff = end; - INTON; - return; - } - ifsp = (struct ifsregion *)ckmalloc(sizeof (struct ifsregion)); - ifslastp->next = ifsp; - } - ifslastp = ifsp; - ifslastp->next = NULL; - ifslastp->begoff = start; - ifslastp->endoff = end; - ifslastp->inquotes = inquotes; - INTON; -} - - - -/* - * Break the argument string into pieces based upon IFS and add the - * strings to the argument list. The regions of the string to be - * searched for IFS characters have been stored by recordregion. - * CTLESC characters are preserved but have little effect in this pass - * other than escaping CTL* characters. In particular, they do not escape - * IFS characters: that should be done with the ifsregion mechanism. - * CTLQUOTEMARK characters are used to preserve empty quoted strings. - * This pass treats them as a regular character, making the string non-empty. - * Later, they are removed along with the other CTL* characters. - */ -static void -ifsbreakup(char *string, struct arglist *arglist) -{ - struct ifsregion *ifsp; - char *start; - char *p; - char *q; - const char *ifs; - const char *ifsspc; - int had_param_ch = 0; - - start = string; - - if (ifslastp == NULL) { - /* Return entire argument, IFS doesn't apply to any of it */ - appendarglist(arglist, start); - return; - } - - ifs = ifsset() ? ifsval() : " \t\n"; - - for (ifsp = &ifsfirst; ifsp != NULL; ifsp = ifsp->next) { - p = string + ifsp->begoff; - while (p < string + ifsp->endoff) { - q = p; - if (*p == CTLESC) - p++; - if (ifsp->inquotes) { - /* Only NULs (should be from "$@") end args */ - had_param_ch = 1; - if (*p != 0) { - p++; - continue; - } - ifsspc = NULL; - } else { - if (!strchr(ifs, *p)) { - had_param_ch = 1; - p++; - continue; - } - ifsspc = strchr(" \t\n", *p); - - /* Ignore IFS whitespace at start */ - if (q == start && ifsspc != NULL) { - p++; - start = p; - continue; - } - had_param_ch = 0; - } - - /* Save this argument... */ - *q = '\0'; - appendarglist(arglist, start); - p++; - - if (ifsspc != NULL) { - /* Ignore further trailing IFS whitespace */ - for (; p < string + ifsp->endoff; p++) { - q = p; - if (*p == CTLESC) - p++; - if (strchr(ifs, *p) == NULL) { - p = q; - break; - } - if (strchr(" \t\n", *p) == NULL) { - p++; - break; - } - } - } - start = p; - } - } - - /* - * Save anything left as an argument. - * Traditionally we have treated 'IFS=':'; set -- x$IFS' as - * generating 2 arguments, the second of which is empty. - * Some recent clarification of the Posix spec say that it - * should only generate one.... - */ - if (had_param_ch || *start != 0) - appendarglist(arglist, start); -} - - static char expdir[PATH_MAX]; #define expdir_end (expdir + sizeof(expdir)) @@ -1264,7 +1167,7 @@ expmeta(char *enddir, char *name, struct while (! int_pending() && (dp = readdir(dirp)) != NULL) { if (dp->d_name[0] == '.' && ! matchdot) continue; - if (patmatch(start, dp->d_name, 0)) { + if (patmatch(start, dp->d_name)) { namlen = dp->d_namlen; if (enddir + namlen + 1 > expdir_end) continue; @@ -1354,7 +1257,7 @@ match_charclass(const char *p, wchar_t c */ static int -patmatch(const char *pattern, const char *string, int squoted) +patmatch(const char *pattern, const char *string) { const char *p, *q, *end; const char *bt_p, *bt_q; @@ -1372,16 +1275,12 @@ patmatch(const char *pattern, const char goto backtrack; return 1; case CTLESC: - if (squoted && *q == CTLESC) - q++; if (*q++ != *p++) goto backtrack; break; case CTLQUOTEMARK: continue; case '?': - if (squoted && *q == CTLESC) - q++; if (*q == '\0') return 0; if (localeisutf8) { @@ -1426,8 +1325,6 @@ patmatch(const char *pattern, const char *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 31 18:12: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 5F161A56424; Thu, 31 Dec 2015 18:12:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2C098178B; Thu, 31 Dec 2015 18:12:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVICapF097499; Thu, 31 Dec 2015 18:12:36 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVICaUp097497; Thu, 31 Dec 2015 18:12:36 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201512311812.tBVICaUp097497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 31 Dec 2015 18:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292992 - in head/sys/dev/usb: . 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, 31 Dec 2015 18:12:37 -0000 Author: kp Date: Thu Dec 31 18:12:35 2015 New Revision: 292992 URL: https://svnweb.freebsd.org/changeset/base/292992 Log: Add suppoort for the Sitecom LN-031 This is an AX88178 chip, which we already support so all we have to do is add the USB product and vendor ID. Modified: head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Thu Dec 31 17:51:15 2015 (r292991) +++ head/sys/dev/usb/net/if_axe.c Thu Dec 31 18:12:35 2015 (r292992) @@ -175,6 +175,7 @@ static const STRUCT_USB_HOST_ID axe_devs AXE_DEV(PLANEX3, GU1000T, AXE_FLAG_178), AXE_DEV(SITECOM, LN029, 0), AXE_DEV(SITECOMEU, LN028, AXE_FLAG_178), + AXE_DEV(SITECOMEU, LN031, AXE_FLAG_178), AXE_DEV(SYSTEMTALKS, SGCX2UL, 0), #undef AXE_DEV }; Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Dec 31 17:51:15 2015 (r292991) +++ head/sys/dev/usb/usbdevs Thu Dec 31 18:12:35 2015 (r292992) @@ -4203,6 +4203,7 @@ product SITECOMEU RTL8188CU_1 0x0052 RTL product SITECOMEU RTL8188CU_2 0x005c RTL8188CU product SITECOMEU RTL8192CU 0x0061 RTL8192CU product SITECOMEU LN032 0x0072 LN-032 +product SITECOMEU LN031 0x0056 LN-031 product SITECOMEU LN028 0x061c LN-028 product SITECOMEU WL113 0x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B From owner-svn-src-head@freebsd.org Thu Dec 31 18:16: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 AE168A56524; Thu, 31 Dec 2015 18:16:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 14B81198B; Thu, 31 Dec 2015 18:16:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 9DD1025D37D1; Thu, 31 Dec 2015 18:16:01 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id C0F09C76FE0; Thu, 31 Dec 2015 18:16:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id Jj_M4QoVjdDs; Thu, 31 Dec 2015 18:15:57 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:6d48:e7a2:24b8:358e] (unknown [IPv6:fde9:577b:c1a9:4410:6d48:e7a2:24b8:358e]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id E51C2C76FD4; Thu, 31 Dec 2015 18:15:56 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292987 - in head/sys/compat/linuxkpi/common: include/linux src From: "Bjoern A. Zeeb" In-Reply-To: <201512311230.tBVCUJB7094023@repo.freebsd.org> Date: Thu, 31 Dec 2015 18:15:37 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1F2A43B0-6A36-4C8C-B09C-5BA66B3BFE6C@FreeBSD.org> References: <201512311230.tBVCUJB7094023@repo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.2104) 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, 31 Dec 2015 18:16:05 -0000 > On 31 Dec 2015, at 12:30 , Hans Petter Selasky = wrote: >=20 > Author: hselasky > Date: Thu Dec 31 12:30:19 2015 > New Revision: 292987 > URL: https://svnweb.freebsd.org/changeset/base/292987 >=20 > Log: > Minor LinuxKPI code cleanup: > - Declare some static functions in linux_compat.c instead if inside > various header files. > - Prefix FreeBSD local functions in the LinuxKPI with "linux_" to > avoid symbol name conflicts in the future and to make debugging > easier. > - Make the "struct kobj_ktype" declaractions constant to shave off a > few bytes from the data segment. >=20 > MFC after: 1 week > Sponsored by: Mellanox Technologies >=20 > Modified: > head/sys/compat/linuxkpi/common/include/linux/cdev.h > head/sys/compat/linuxkpi/common/include/linux/device.h > head/sys/compat/linuxkpi/common/include/linux/kobject.h > head/sys/compat/linuxkpi/common/include/linux/miscdevice.h > head/sys/compat/linuxkpi/common/src/linux_compat.c > head/sys/compat/linuxkpi/common/src/linux_pci.c I can only guess if it was this commit? This is i386.LINT* erroring = (but there might be other kernels as well; don=E2=80=99t know yet): linking kernel cm.o: In function `ib_cm_init': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x81= f5): undefined reference to `class_root' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x82= 7d): undefined reference to `kobject_release' cm.o: In function `cm_add_one': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x86= 4f): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x86= 8f): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x88= 5c): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text+0x88= 93): undefined reference to `kobject_release' = cm.o:/scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/cm.c:(.text= +0x88d3): more undefined references to `kobject_release' follow sysfs.o: In function `ib_device_register_sysfs': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x489): undefined reference to `kfree_type' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x4e5): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x5f5): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x63b): undefined reference to `kobject_release' sysfs.o: In function `add_port': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= xf3e): undefined reference to `kobject_release' sysfs.o: In function `device_unregister': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x1051): undefined reference to `kobject_release' = sysfs.o:/scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:= (.text+0x1254): more undefined references to `kobject_release' follow sysfs.o: In function `ib_sysfs_setup': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x145a): undefined reference to `class_root' sysfs.o: In function `ib_sysfs_cleanup': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/sysfs.c:(.text+0= x14be): undefined reference to `kobject_release' ucm.o: In function `ib_ucm_remove_one': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucm.c:(.text+0x7= e4): undefined reference to `kobject_release' ucm.o: In function `ib_ucm_release_dev': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucm.c:(.text+0x8= 6c): undefined reference to `kobject_release' ucma.o: In function `ucma_init': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucma.c:(.text+0x= 140): undefined reference to `linux_rootdev' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucma.c:(.text+0x= 147): undefined reference to `miscclass' ucma.o: In function `misc_deregister': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucma.c:(.text+0x= 301): undefined reference to `miscclass' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucma.c:(.text+0x= 3bc): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/ucma.c:(.text+0x= 40b): undefined reference to `kobject_release' user_mad.o: In function `ib_umad_init': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0x1d7): undefined reference to `class_root' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0x2fd): undefined reference to `kobject_release' user_mad.o: In function `ib_umad_add_one': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0xf6e): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0xfd0): undefined reference to `kobject_release' user_mad.o: In function `put_umad_dev': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0x1458): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_mad.c:(.tex= t+0x14a8): undefined reference to `kobject_release' = user_mad.o:/scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/user_= mad.c:(.text+0x15f2): more undefined references to `kobject_release' = follow uverbs_main.o: In function `ib_uverbs_init': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x10de): undefined reference to `class_root' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x1204): undefined reference to `kobject_release' uverbs_main.o: In function `ib_uverbs_add_one': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x1b0f): undefined reference to `kobject_release' uverbs_main.o: In function `ib_uverbs_remove_one': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x1cc2): undefined reference to `kobject_release' uverbs_main.o: In function `device_destroy': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x1e92): undefined reference to `kobject_release' uverbs_main.o: In function `ib_uverbs_cleanup': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/core/uverbs_main.c:(.= text+0x32a6): undefined reference to `kobject_release' = mlx4ib_sysfs.o:/scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx= 4/sysfs.c:(.text+0x755): more undefined references to `kobject_release' = follow mlx4ib_sysfs.o: In function `kobject_create_and_add': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x1417): undefined reference to `kfree_type' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x146a): undefined reference to `kobject_release' mlx4ib_sysfs.o: In function `mlx4_ib_device_unregister_sysfs': = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x1635): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x166e): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x16a7): undefined reference to `kobject_release' = /scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c:(.tex= t+0x16df): undefined reference to `kobject_release' = mlx4ib_sysfs.o:/scratch/tmp/bz/head.svn/sys/ofed/drivers/infiniband/hw/mlx= 4/sysfs.c:(.text+0x1718): more undefined references to `kobject_release' = follow --- kernel --- *** [kernel] Error code 1 =E2=80=94=20 Bjoern A. Zeeb Charles Haddon Spurgeon: "Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend." From owner-svn-src-head@freebsd.org Thu Dec 31 18:29: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 1E6B9A56893; Thu, 31 Dec 2015 18:29:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E46781E1C; Thu, 31 Dec 2015 18:29:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVITPZw000866; Thu, 31 Dec 2015 18:29:25 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVITP0V000865; Thu, 31 Dec 2015 18:29:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201512311829.tBVITP0V000865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 31 Dec 2015 18:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292993 - head/lib/libstand 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, 31 Dec 2015 18:29:26 -0000 Author: ian Date: Thu Dec 31 18:29:24 2015 New Revision: 292993 URL: https://svnweb.freebsd.org/changeset/base/292993 Log: When building libstand for arm, don't emit instructions that require relocation fixups unsupported by the self_reloc() code, and don't optimize memcpy/memset using floating point registers, because in a standalone environment nothing has initialized the fpu hardware. Modified: head/lib/libstand/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Thu Dec 31 18:12:35 2015 (r292992) +++ head/lib/libstand/Makefile Thu Dec 31 18:29:24 2015 (r292993) @@ -44,6 +44,12 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memc .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC_SRC}/arm/gen +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +CFLAGS.clang+= -mllvm -arm-use-movt=0 +CFLAGS.clang+= -mfpu=none + # Compiler support functions .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/ # __clzsi2 and ctzsi2 for various builtin functions From owner-svn-src-head@freebsd.org Thu Dec 31 18:45: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 BB9FEA56EB7; Thu, 31 Dec 2015 18:45:03 +0000 (UTC) (envelope-from jtl@freebsd.org) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0119.outbound.protection.outlook.com [207.46.100.119]) (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 39400180C; Thu, 31 Dec 2015 18:45:02 +0000 (UTC) (envelope-from jtl@freebsd.org) Received: from BY2PR05CA047.namprd05.prod.outlook.com (10.141.250.37) by BY1PR0501MB1381.namprd05.prod.outlook.com (10.160.107.139) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 31 Dec 2015 18:29:20 +0000 Received: from BL2FFO11OLC008.protection.gbl (2a01:111:f400:7c09::168) by BY2PR05CA047.outlook.office365.com (2a01:111:e400:2c5f::37) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Thu, 31 Dec 2015 18:29:20 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.19) smtp.mailfrom=freebsd.org; freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=freebsd.org; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning freebsd.org discourages use of 66.129.239.19 as permitted sender) Received: from p-emfe01b-sac.jnpr.net (66.129.239.19) by BL2FFO11OLC008.mail.protection.outlook.com (10.173.160.143) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Thu, 31 Dec 2015 18:29:20 +0000 Received: from magenta.juniper.net (172.17.27.123) by p-emfe01b-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 31 Dec 2015 10:29:16 -0800 Received: from [172.29.33.31] ([172.29.33.31]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id tBVITCD93990; Thu, 31 Dec 2015 10:29:13 -0800 (PST) (envelope-from jtl@freebsd.org) User-Agent: Microsoft-MacOutlook/14.5.9.151119 Date: Thu, 31 Dec 2015 13:29:12 -0500 Subject: Re: svn commit: r292955 - head/lib/libmd From: "Jonathan T. Looney" Sender: Jonathan Looney To: Bruce Evans CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: Thread-Topic: svn commit: r292955 - head/lib/libmd References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> In-Reply-To: <20151231115651.R995@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC008; 1:gGOwnbLeHJ6myRWB98EeJ/7TK3S8wkVOWi2a6sOQifKptR0qskfde/v38xlmP5LuA+FklAVhRGzPXRyywmyq9aI7JbhXAhmOshPOlJ3cuIDHLsj6IkMKSYXJJknmuySE5gXejf4l3k0jlL7/xp9uphN0TDcZtn1Js8QfxPmJzc2pRNiblXOwCJN3HsyMY84dqtSmQH0jL5IjpPztcm/1rdWYhTqcw4qoCVmbtNGhYJh/iyY2ikRjbn742OnVbiii8Ul/2iw+O0tsaNUikn2V5CHzndhTBHlvufuLGOh0kJD1D/Fy5qpf4uBAy+DOucA5X/9HQ+h98lMgUXoCIv8YpiwQTODaY3OJ7eciSQLAMeB92ZA7f1QQxyCA0q+OgdDuRJaWJ+MK+9mW7ohwj8R6pQ== X-Forefront-Antispam-Report: CIP:66.129.239.19; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(377454003)(189002)(24454002)(199003)(479174004)(4001350100001)(47776003)(2950100001)(230700001)(92566002)(97736004)(46406003)(6806005)(50986999)(50466002)(16796002)(4326007)(586003)(54356999)(69596002)(23726003)(81156007)(76176999)(5001960100002)(1220700001)(83506001)(1096002)(11100500001)(36756003)(189998001)(87936001)(105596002)(86362001)(106466001)(77096005)(19580405001)(19580395003)(110136002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0501MB1381; H:p-emfe01b-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 2:8EaYlhfaKUgz5DWjhg54OH3rbwt8JLAJlnq712yKZ4ItjY86HVWhYOxDgVhjJyaEkeRNC3a3DVykoHvSurtb4KiUTUCmzGYO71z8N2TbKK2FgjK9rtMgRirK0sU0GsIdYlbOKwIf+i2ZxxA9TF5sew==; 3:7fT/18wvYl7ibSToH//cKrlobKZv4OqIIKFnI5QfFbRiu4zslMUs4o1RY/fHuIElb8bNVyXVNldUZKxrDaAbSdTD43XovxqeZgtSwSCpu6k564O5tlZW3wApDUYL84i/Kmvp4ft/hC0phPve66kAR126d3exB8TDx5Ql+qm6dJ8VbBRXZDd6XIU0tTf+P1Hb4QIs3FkRJpiJjSo/5kbYQT2CsHTdhQ91wmJOb0ls+j0=; 25:fI0I8Ws7fxxbf4b9ZV5hcUSQyH/M2qoRCz9RgILc25AnYYRBUUVSrzKxxrTJhTUeJAyIiRPV8rsCi5S4ZN5fzUvsZfozacXDIFDLX3ebHrW29QeIQS+Vw79n9MHlQqIclL27DVL2V1wylKHh3fSfzlEHUohQu2agp2XUDlSwFNBbLAIVH58zl/W5iU0clm9iI5tlKpxyoEpxFBSGyggK6ONDTVyI4BeoT23XjopLCyudsvWw5brN2Vo9LWL13Jya6Av2qmHPIyPkcmP/ARdjjg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0501MB1381; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 20:2M7brepewhJZRi2iTKwaGoThHbiNmd9cN36X7agXt9Sc/TrDO9p7iZDnssWyEXUOa8tNpouZPJrM29uesdTI8R4X7aHpv6/kCyJNqjmg7H42N5qcVm8DPm3NRA/bvv7dWaAXoqONCMrd3WIFHwfIxK/4QGz+92AjdBQmzAQzoPXXhzM02POy99bs+VAb8XGsobuKthiVtl0/356haLeVRmBBFDR59Kw1MXmmx3wD0i1lr9SVrBs6d3aksMivETmsLq4VeN/gcSedQtA97cSwij+eZW/cc19krkVej+Q0V5BZdRUn7GoUg6zjQ+DPWQvw4XGWDrW7vS43SDTHz0m70/69ozY9Kdc9JOXdM5/BeHW8AKNyr1534IfHaReaidsTE+RoK1bdmUmAEsB7tzpdcEGRdcSHmeqCTSMTN4pso3oJnu4ZqfriBwnU+Wl2/tXKbmlEg+3uMhvvUGfuBxTkrEtib3MJXxqxay9MS3zrTIo5oQyQILfd5thbUmEOcDGC; 4:h16YszazFTe0n1loUyfB7nBwPERl6+rG4xLIK7PjKKO+LFjyO+JCs4PXb2fgYqgg1b4Sf6EsZ/abC9dhDzPPtjerwYmjrf7iuN2PuqAdYoxBlm4g24t7m3B/He2P52KoLGdFYNktS8mUQUvj0mSyKxQ0nxeVyiPMgsxxd4A80qPiI2E1Y6/1v7ql+d0r2OLGxG0VW4rRjwXMehAC07McGvEWL8yu4W9Vear8VppXZ7fl9OlEllTDq13BxvlXOwoL+3J5ow6Nv2oqXNZUghKJWjkFMo6KeG+5SBn/CW9qmfkc94qE69v1oAbsIe5TBcQUD6VAFlcmZfKOZWk2NvIJhbydhj+Vn+UcghY3IJLGrgWLdjlJYx8snaeBvCrhi1qJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:BY1PR0501MB1381; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0501MB1381; X-Forefront-PRVS: 08076ABC99 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0501MB1381; 23:YeJKbtVFhv5a+NZK0y2aaZ8ywnw5hbL4G1EXBMg?= =?us-ascii?Q?MoyaBVqV1HGyqD+2VtnHhbfuPXUukI7BmnHNXwr8MKBF0pvpvGpjhSUABNqD?= =?us-ascii?Q?hQ6vkBzA/w6tGgG1MplvIST/wsOxQjdgEcdyH6lUjRxhE0Z1JWoAv+09JDJ5?= =?us-ascii?Q?rhS5vHeTGre2yzOBZRYF9jioTk/l5oGAox+RIkL/ykBbx4BKO6UHfKs8DWaN?= =?us-ascii?Q?QkWxmlqmeETJW30Pzlv/9hapiF+f+lyROjyLFfpw7EePV02w4981gRdneDxK?= =?us-ascii?Q?U8cdjgsYvNOV6sxxvXTbPh04D+7Pra3kIJZ3Y6p/QF4jq8TqDUBISRpiYiFk?= =?us-ascii?Q?lIneCfSCGuavl4J+KQxtH+tgjT3Y+v6p7QlZQS0ZYVRTXM5vIgrDNrkx6m+N?= =?us-ascii?Q?9kloRWWAtH3U/b4j/nU5eNLJLqdswcrwPUkatXvtm3US5CY6Lb4fj8LOCjH1?= =?us-ascii?Q?tHGgnhU9+2BEJLFPpfZ9nmaPcbGV7s7Yfd6abPqm/844+RMIR5LPjLom2FHU?= =?us-ascii?Q?Oytg7ZB2v/vyO1X2ohXQ4FvpPCgbH62KOjULWCN0wleEZ7Qvz2orLdUx93wF?= =?us-ascii?Q?YLIwkT8iaYq5qNXEZkbiMaTNuLqTfblXe6sgMGjAILNdnZXeDvEokRE+YlvD?= =?us-ascii?Q?9wZYeTu6rM6vSqO8mRFRhRsArcMRsxkU0DG2pQ7NTuv1MOjZzsC3oQX+ViQJ?= =?us-ascii?Q?pZS+P8kd3caO1Ea09Wh7f2fyKY3U69kTNzccGSf8Rfy5Wb/XDuEexCDex+bl?= =?us-ascii?Q?FOIrkftq5FnV9voU5Vn3lwbIkOZznAVlAZCutkkkIb+3oxu4DasTuPsKzRjf?= =?us-ascii?Q?geax8uN8qfTyn5PQ5uRFZke36hOkP+7C6hpSbuLGvY1MmUxY7PqwIiJr6tWt?= =?us-ascii?Q?5wcilhBJYwiamL+LFhdv3ockmls6LOOzR4vbZNLS6r1+6ZSLyO7SnILgyIe0?= =?us-ascii?Q?yrQ1Qx6L30NeaeEm4SuuwbKQxpa8wNHXFUl5k0Zq1c3j+GXrw3TslCfcUH9x?= =?us-ascii?Q?B8LgCZnIdtLRmHtM+6kH5AKExLIQBKKE3wEcI1RiTUzCwQ6fWXo7XLqk/nzi?= =?us-ascii?Q?nwk7d5xKuHfnbQmTQ/oBi2v7Yf6yj?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 5:narI+FHB9a8Emjzfg/1tBQ+RAPze/CO+DiOUI+fEewo0cQHTc+7wjOwJMmof4oSx5+oyuL1LHkCzZgI55f22zGL8E/JgORKWRgDmMjDTdiXDxEKGUQxn97R0yAQGiadvyfqcw8KxIubMrudQW2a37A==; 24:iAuG9vCHvMI2d/F59imxJKCPHWq1TIJApNRTByqIrC+LtACOskc1pROelzd3nQP+mshzCBVDaQHaWvR9m1dL+kqdUEBiu/gcOi08vvJbcWs= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Dec 2015 18:29:20.0107 (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.19]; Helo=[p-emfe01b-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0501MB1381 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, 31 Dec 2015 18:45:03 -0000 Dear Bruce, On 12/30/15, 10:03 PM, "Bruce Evans" wrote: >On Wed, 30 Dec 2015, Jonathan T. Looney wrote: > >> Log: >> Fix a file descriptor leak in mdXhl.c (which is used by numerous >>hashing >> algorithms. > >This code had amazingly low quality and is still especially broken near >the main leak fixed. Thanks for your attention to our code, and for pointing out these bugs. I just volunteered to fix the "new" Coverity alert for a file descriptor leak. (It was a "new" alert due to r292782, which reused this file for SHA384.) However, I agree that there are still bugs in the code, and I'm happy to work on those, too. Happy New Year! Jonathan From owner-svn-src-head@freebsd.org Thu Dec 31 18:46: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 DDEACA56F39; Thu, 31 Dec 2015 18:46:38 +0000 (UTC) (envelope-from jtl@freebsd.org) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0142.outbound.protection.outlook.com [207.46.100.142]) (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 4385119E6; Thu, 31 Dec 2015 18:46:37 +0000 (UTC) (envelope-from jtl@freebsd.org) Received: from SN1PR05CA0034.namprd05.prod.outlook.com (10.163.68.172) by BY1PR0501MB1381.namprd05.prod.outlook.com (10.160.107.139) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 31 Dec 2015 18:32:08 +0000 Received: from BL2FFO11FD048.protection.gbl (2a01:111:f400:7c09::112) by SN1PR05CA0034.outlook.office365.com (2a01:111:e400:5197::44) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Thu, 31 Dec 2015 18:32:07 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.19) smtp.mailfrom=freebsd.org; optusnet.com.au; dkim=none (message not signed) header.d=none;optusnet.com.au; dmarc=none action=none header.from=freebsd.org; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning freebsd.org discourages use of 66.129.239.19 as permitted sender) Received: from p-emfe01b-sac.jnpr.net (66.129.239.19) by BL2FFO11FD048.mail.protection.outlook.com (10.173.161.210) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Thu, 31 Dec 2015 18:32:07 +0000 Received: from magenta.juniper.net (172.17.27.123) by p-emfe01b-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 31 Dec 2015 10:32:06 -0800 Received: from [172.29.33.31] ([172.29.33.31]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id tBVIW2D96601; Thu, 31 Dec 2015 10:32:02 -0800 (PST) (envelope-from jtl@freebsd.org) User-Agent: Microsoft-MacOutlook/14.5.9.151119 Date: Thu, 31 Dec 2015 13:32:02 -0500 Subject: Re: svn commit: r292955 - head/lib/libmd From: "Jonathan T. Looney" Sender: Jonathan Looney To: Allan Jude , Bruce Evans CC: , , Message-ID: Thread-Topic: svn commit: r292955 - head/lib/libmd References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> <5684D606.3080609@freebsd.org> In-Reply-To: <5684D606.3080609@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD048; 1:pKyZDNcYafqHQLYzpB97ZLjnI7FflffRyLWizDVm8cLdDSmiVdrxxmG1Ma5atZQtpQ2/z2Drjd3rFDemVpTF14lWb87tl2rInp5aFVqKbhItLDZbfipE+jJfBaHdDypSAM1soCptsnxRguhtiEid7GwgI8uEF3iv9c3N9RgZRBWA8KGe9iv1MHs8Le+LPxPJ7c6TSqdTsw3LA9kdccjkFL81GRaRCTdsjPAztCAciZMAIJkASLm4eefRbUpH4D+4mQK7Ik9rvnv1hF2SHwWNl6H9xzPdLvfczACpNk6V0TLV78RBtUo+TwJyb+EN+4SPNaRqAFr6qCjy8rDw6pdH2ndTeQibW+Maq0vbTYjYZK7wc3nvjlMPmmiV1zgkQe7/mJhQdvYVB7TKqGEbp31JJg== X-Forefront-Antispam-Report: CIP:66.129.239.19; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(377454003)(189002)(24454002)(199003)(479174004)(4001350100001)(47776003)(2950100001)(230700001)(92566002)(97736004)(46406003)(6806005)(50986999)(50466002)(16796002)(4326007)(5001770100001)(586003)(54356999)(69596002)(23726003)(81156007)(93886004)(76176999)(5001960100002)(1220700001)(83506001)(1096002)(11100500001)(36756003)(189998001)(87936001)(105596002)(575784001)(86362001)(106466001)(77096005)(19580405001)(19580395003)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0501MB1381; H:p-emfe01b-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 2:ZvY/hlnq5AkDnmgfDWOSAtwcr7MTFdHfWlJWiqlFuAaVdUuUqoNhuomk58O0cfh876iSE9FFiZ93ernI7XPkHGgsj04U31x2zKArfupjwQKB8dP8N76oe9Ad/9/pdG+d8h1nB4tNwQZMdl6mSlTOKg==; 3:guDUEuc5SzJrecu91DNdThFoKgvHK+ETjYA04ZI9XBw7vR0BYStcb/7OXYVu8eXnWIsm0KDBTqC20CLLw4gaYpNl9FblWws0i/2kxiK/IW9TsSY0L5wywGKGOid+YD0hshI57vRsFJK2wdlbIUn/y6oZsM44qlLIRDtt6p7iYM4DylRZQCk+Y7fnvYd8gJgv+2IuW/7+UV6YgQklHY3a1dLU2GGN3xDQvGxUr4VdyDY=; 25:QN5dlLu5LuJ9VfpvSEY2uXkXHenl3fjBIfMLJNJsfmMGdPt+xRqmzkP5S3nZkgEo5QyE6BFT6k4ETbTI2AfQShfsjRVZVOk8YXlqjpPjNjzAwaZROxwmcNoadyFqzFcdSm46PPcUAfh5Sn0ukW+boePKbdE4PDImUTS0L3kxQ0yyYt9UTAsWW8LyOraerqd3dk1NDpIrSTyAqfGCFHSUD0B6SSl07gLFHtYwGogrZexGc/maWv02EpBGWLp9cS1k6mL1QHnWLM8pYOgHTTW6AA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0501MB1381; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 20:PsTzCi9d/SF6ZiBg6ZVxKQ8VcqMycpbb/Oxidav4VGoqRIImAHIVzaRiTWhr3z2PZDuXfoyyRgHxQFa4zcXLPokSDjefvUg4m27dHPVugSxv4rNUpoxCAH/IbjCRBszzpxn3tEMZjUyapVge7GIQWvVydrFr/kLjYJwJYOvHibI5N05eUnBwOFk7PyTeenCu+Pd0GgTOo4OJ218hpbxsNgz9Q4/RLcSZhWkEdy+irjeu2yLWzoJjxQhv86KCssS82f11yMaMr36KzQXlSwLgmjkIH8UBOQYUeUZNwJV8qPnMrcfV2K/RQcmuPaBaZDLHIZj0Di9mLKNw8dnDZrurFIMNOTOLTCERYm9IbkHpq4E5wV8XlDMifcyAcmL5JZEGmq1492Ge33zjh1WaQYVhBVafE9cJsxWgHr5dgrZRAZkzqxDaPwREJiFe4sMbqTQylCb5if5fOM9bHqOVdjOWacmINCaLOkTMBQPBkn++dKlJv5D4fkZd4trr7ssS+o8s; 4:J+RrDpNJBJZcuX3AqHIodnQJecahVRDXUnK7OOoELa5eXxBAzdZdANxQN3x/ImBNTqIVsVKw2xjRKQlzNdZ6XWbhgviPIsQsHeNOne9qfwYNefK7F1bnbQrIQc61r6Ux0ehsfx8FItLSuOSDAV9Nc+f8Tw0wwdBEw3OJSAP+071izTf3N3gFllmcTldvdnYuGiwMLvmjroum8GnUHPSoa26PlNeFiMYIwzrdq+BpGfMK5Hr0pxTIY/c/1kSqdn2VnBJ86tCkTwz060AcgNNBWh4yHhG8a+gtzK5PKPDIXgsne6CmXJI/l/3/Z0GtXZu7J+xl+v3FSWQMMDEC4RMZA7derA2MHDppaTePq6nQCrCigPInZnobNhV8DKVhik2G X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:BY1PR0501MB1381; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0501MB1381; X-Forefront-PRVS: 08076ABC99 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0501MB1381; 23:rltxLYZgfjFcd0YI1O8/arNmk8z9QSezacizPhG?= =?us-ascii?Q?uZyDZAxI/T73ufGdkMtlpZMB4vG2YwsraCwSMo949q2FeKq6CyvT3OBMWAQ1?= =?us-ascii?Q?samSAhqTM+ujX+p6iFscSHTjjr6MJKHE9YCFiIjuLM9l5jl0cDIV7j7Hceql?= =?us-ascii?Q?ZPvfN+4rp6lGsDhBZTwOnTPN02v3SP9bW1bmNkQIpS+Xclrraaac4r7Tu5OH?= =?us-ascii?Q?opua+P5MMk/DIDMsvKIDO0PYsyhEa425y07JAo1W3sxLGyyajHvUChv7ouYc?= =?us-ascii?Q?sCxLLXqzIxZMjTfC47lVlbzh31fW8AQitilBD+PJo4kubriQCsthWRS9mC7h?= =?us-ascii?Q?QgQjfvRXxjLF4j4LQjrVMX5srEwSmNydtMblsgxKixXUOtmQi8uwzeh1kYdS?= =?us-ascii?Q?V84WqocsqtyJQYgJz1aN+8X5h9Jt6AeubTtQLHtMt3G8k2xM54GyAd9IFtLH?= =?us-ascii?Q?B/1nDGHFGiOqkVtCJAOUk1OP7YgZkJqyzLd5orPfI1NvH5MI9vKFT3vIDWqg?= =?us-ascii?Q?0l2nabonQ4jDEccEOcqXT/KgiS4VANOhH5n+dYGoud7kn6wgIQIWhnRm/EX9?= =?us-ascii?Q?sD5vyPpjMua9AJn+yqNcStP2e+8+rejiJ1d7t2gPbmKEiQyqgMbaK0QbYXRm?= =?us-ascii?Q?71/+vJYQxSlBKn0wuQs+U5J+dAZv1iT1KhhZ67d/KobKAn/3tiSIOFDaZKm5?= =?us-ascii?Q?pNAO1UDW9/CDZKgpzwiH2xawB+oZxptoQ5b0s35UizdmVKUhnOKaoBDh06Iw?= =?us-ascii?Q?R9E6Upwo61nsvcxWywsgL1i5GDMVtsxkcW3Rl7JW7/t+leBye7ayrUaWGnGO?= =?us-ascii?Q?PKjz1IJAcfae5EO+UcYfJxrhYn8SmbUInzZ+k2DLlaFuScKTdNth/MBGNckD?= =?us-ascii?Q?ZMWOcsWJIOL7Xjtq1XYTRdMLp0SX/DByoF9RUMcSFdYyDuANWbSS47kXGt9h?= =?us-ascii?Q?S7bxu+Db2S3gpsJ9202OydTvxgKpdS9CUulO9AuQByJ9k+Al7DA8SOJEBwlo?= =?us-ascii?Q?QHqnAmcd5vxQsjSzlIYPHP/NkRwpZg8UguQZpZxvrBWwa/5Gyz+J4q9Xff+B?= =?us-ascii?Q?bFA0IDWShg7soJPifk5bKNcLCMlOXe7/Wc+dDMyjmWPh4J7flFACrBQuhoTt?= =?us-ascii?Q?tmn9eP5mN9nXmXkzIn/Hce+LWnURSjNHX?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1381; 5:x+n8do2IKQd/woo0hhgVBy91Wc0oCqgGosFs/o3a1O/Dg/XIyMbvZVjj9aJNAbutDN1XVYxwTanUzDUGA1JI92stXk8nxU5cUhCqKlMRKGG/8MQW6Fae4qZNa2l5mCEcB4nQsNWK2OzjkLBxnAA1lA==; 24:/I/vKTdnRJaIgXrqKsU1aq8HDJxd/VBWC2g8C0GatX44385/hVIFhf/QFU6VuldAGLSljxTIntBdoaEddTj/oA4ZgcR63JniHO5QFdrgG1c= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Dec 2015 18:32:07.6114 (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.19]; Helo=[p-emfe01b-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0501MB1381 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, 31 Dec 2015 18:46:39 -0000 On 12/31/15, 2:15 AM, "Allan Jude" wrote: >It seems these problems also slow things down, a lot: > ># time md5 /media/md5test/bigdata >MD5 (/media/md5test/bigdata) = 6afad0bf5d8318093e943229be05be67 >4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w ># time env LD_PRELOAD=/usr/obj/media/svn/md5/head/tmp/lib/libmd.so >/usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata >MD5 (/media/md5test/bigdata) = 6afad0bf5d8318093e943229be05be67 >4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w > >(file is fully cached in ZFS ARC, dd reads it at 11GB/s) > >Will investigate more tomorrow. md5 will be slower than dd due to the extra processing it needs to do to generate the hash. I suspect that explains the difference you're seeing between those utilities. Jonathan From owner-svn-src-head@freebsd.org Thu Dec 31 18:47: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 496BEA56FBD; Thu, 31 Dec 2015 18:47:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 23AC61B48; Thu, 31 Dec 2015 18:47:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVIltMO007471; Thu, 31 Dec 2015 18:47:55 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVIltHT007469; Thu, 31 Dec 2015 18:47:55 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512311847.tBVIltHT007469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 31 Dec 2015 18:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292994 - head/bin/sh 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, 31 Dec 2015 18:47:56 -0000 Author: jilles Date: Thu Dec 31 18:47:54 2015 New Revision: 292994 URL: https://svnweb.freebsd.org/changeset/base/292994 Log: sh: Perform pathname generation during the first expansion phases. This avoids the need to add and remove CTLESC bytes if pathname generation will not be performed (set -f). Side effect: the order of operations is slightly different: pathname generation in ${$+* $(CMD)} will not see filesystem changes from CMD. Modified: head/bin/sh/expand.c head/bin/sh/expand.h Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Dec 31 18:29:24 2015 (r292993) +++ head/bin/sh/expand.c Thu Dec 31 18:47:54 2015 (r292994) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); enum wordstate { WORD_IDLE, WORD_WS_DELIMITED, WORD_QUOTEMARK }; struct worddest { - struct arglist list; + struct arglist *list; enum wordstate state; }; @@ -102,7 +102,7 @@ static int varisset(const char *, int); static void strtodest(const char *, int, int, int, struct worddest *); static void reprocess(int, int, int, int, struct worddest *); static void varvalue(const char *, int, int, int, struct worddest *); -static void expandmeta(struct arglist *, struct arglist *); +static void expandmeta(char *, struct arglist *); static void expmeta(char *, char *, struct arglist *); static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); @@ -162,7 +162,7 @@ stputs_quotes(const char *data, const ch #define STPUTS_QUOTES(data, syntax, p) p = stputs_quotes((data), syntax, p) static char * -nextword(char c, char *p, struct worddest *dst) +nextword(char c, int flag, char *p, struct worddest *dst) { int is_ws; @@ -170,20 +170,23 @@ nextword(char c, char *p, struct worddes if (p != stackblock() || (is_ws ? dst->state == WORD_QUOTEMARK : dst->state != WORD_WS_DELIMITED) || c == '\0') { STPUTC('\0', p); - appendarglist(&dst->list, grabstackstr(p)); + if (flag & EXP_GLOB) + expandmeta(grabstackstr(p), dst->list); + else + appendarglist(dst->list, grabstackstr(p)); dst->state = is_ws ? WORD_WS_DELIMITED : WORD_IDLE; } else if (!is_ws && dst->state == WORD_WS_DELIMITED) dst->state = WORD_IDLE; /* Reserve space while the stack string is empty. */ - appendarglist(&dst->list, NULL); - dst->list.count--; + appendarglist(dst->list, NULL); + dst->list->count--; STARTSTACKSTR(p); return p; } -#define NEXTWORD(c, p, dstlist) p = nextword(c, p, dstlist) +#define NEXTWORD(c, flag, p, dstlist) p = nextword(c, flag, p, dstlist) static char * -stputs_split(const char *data, const char *syntax, char *p, +stputs_split(const char *data, const char *syntax, int flag, char *p, struct worddest *dst) { const char *ifs; @@ -194,16 +197,16 @@ stputs_split(const char *data, const cha CHECKSTRSPACE(2, p); c = *data++; if (strchr(ifs, c) != NULL) { - NEXTWORD(c, p, dst); + NEXTWORD(c, flag, p, dst); continue; } - if (syntax[(int)c] == CCTL) + if (flag & EXP_GLOB && syntax[(int)c] == CCTL) USTPUTC(CTLESC, p); USTPUTC(c, p); } return (p); } -#define STPUTS_SPLIT(data, syntax, p, dst) p = stputs_split((data), syntax, p, dst) +#define STPUTS_SPLIT(data, syntax, flag, p, dst) p = stputs_split((data), syntax, flag, p, dst) /* * Perform expansions on an argument, placing the resulting list of arguments @@ -222,8 +225,10 @@ expandarg(union node *arg, struct arglis { struct worddest exparg; + if (fflag) + flag &= ~EXP_GLOB; argbackq = arg->narg.backquote; - emptyarglist(&exparg.list); + exparg.list = arglist; exparg.state = WORD_IDLE; STARTSTACKSTR(expdest); argstr(arg->narg.text, flag, &exparg); @@ -231,15 +236,17 @@ expandarg(union node *arg, struct arglis STACKSTRNUL(expdest); return; /* here document expanded */ } - if ((flag & EXP_FULL) == 0 || expdest != stackblock() || + if ((flag & EXP_SPLIT) == 0 || expdest != stackblock() || exparg.state == WORD_QUOTEMARK) { STPUTC('\0', expdest); - if (flag & EXP_FULL) - appendarglist(&exparg.list, grabstackstr(expdest)); + if (flag & EXP_SPLIT) { + if (flag & EXP_GLOB) + expandmeta(grabstackstr(expdest), exparg.list); + else + appendarglist(exparg.list, grabstackstr(expdest)); + } } - if (flag & EXP_FULL) - expandmeta(&exparg.list, arglist); - else + if ((flag & EXP_SPLIT) == 0) appendarglist(arglist, grabstackstr(expdest)); } @@ -250,16 +257,16 @@ expandarg(union node *arg, struct arglis * expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE. * Processing ends at a CTLENDVAR or CTLENDARI character as well as '\0'. * This is used to expand word in ${var+word} etc. - * If EXP_FULL or EXP_CASE are set, keep and/or generate CTLESC + * If EXP_GLOB or EXP_CASE are set, keep and/or generate CTLESC * characters to allow for further processing. * - * If EXP_FULL is set, dst receives any complete words produced. + * If EXP_SPLIT is set, dst receives any complete words produced. */ static char * argstr(char *p, int flag, struct worddest *dst) { char c; - int quotes = flag & (EXP_FULL | EXP_CASE); /* do CTLESC */ + int quotes = flag & (EXP_GLOB | EXP_CASE); /* do CTLESC */ int firsteq = 1; int split_lit; int lit_quoted; @@ -283,7 +290,7 @@ argstr(char *p, int flag, struct worddes if (p[0] == CTLVAR && (p[1] & VSQUOTE) != 0 && p[2] == '@' && p[3] == '=') break; - if ((flag & EXP_FULL) != 0 && expdest == stackblock()) + if ((flag & EXP_SPLIT) != 0 && expdest == stackblock()) dst->state = WORD_QUOTEMARK; break; case CTLQUOTEEND: @@ -293,7 +300,7 @@ argstr(char *p, int flag, struct worddes c = *p++; if (split_lit && !lit_quoted && strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, expdest, dst); + NEXTWORD(c, flag, expdest, dst); break; } if (quotes) @@ -319,7 +326,7 @@ argstr(char *p, int flag, struct worddes */ if (split_lit && !lit_quoted && strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, expdest, dst); + NEXTWORD(c, flag, expdest, dst); break; } USTPUTC(c, expdest); @@ -333,7 +340,7 @@ argstr(char *p, int flag, struct worddes default: if (split_lit && !lit_quoted && strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, expdest, dst); + NEXTWORD(c, flag, expdest, dst); break; } USTPUTC(c, expdest); @@ -438,7 +445,7 @@ expbackq(union node *cmd, int quoted, in struct nodelist *saveargbackq; char lastc; char const *syntax = quoted? DQSYNTAX : BASESYNTAX; - int quotes = flag & (EXP_FULL | EXP_CASE); + int quotes = flag & (EXP_GLOB | EXP_CASE); size_t nnl; const char *ifs; @@ -452,7 +459,7 @@ expbackq(union node *cmd, int quoted, in p = in.buf; lastc = '\0'; nnl = 0; - if (!quoted && flag & EXP_FULL) + if (!quoted && flag & EXP_SPLIT) ifs = ifsset() ? ifsval() : " \t\n"; else ifs = ""; @@ -476,7 +483,7 @@ expbackq(union node *cmd, int quoted, in } else { if (nnl > 0) { if (strchr(ifs, '\n') != NULL) { - NEXTWORD('\n', dest, dst); + NEXTWORD('\n', flag, dest, dst); nnl = 0; } else { CHECKSTRSPACE(nnl + 2, dest); @@ -487,7 +494,7 @@ expbackq(union node *cmd, int quoted, in } } if (strchr(ifs, lastc) != NULL) - NEXTWORD(lastc, dest, dst); + NEXTWORD(lastc, flag, dest, dst); else { CHECKSTRSPACE(2, dest); if (quotes && syntax[(int)lastc] == CCTL) @@ -743,7 +750,7 @@ again: /* jump here after setting a vari case VSPLUS: case VSMINUS: if (!set) { - argstr(p, flag | (flag & EXP_FULL ? EXP_SPLIT_LIT : 0) | + argstr(p, flag | (flag & EXP_SPLIT ? EXP_SPLIT_LIT : 0) | (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0), dst); break; } @@ -763,7 +770,7 @@ again: /* jump here after setting a vari patloc = expdest - stackblock(); subevalvar_trim(p, patloc, subtype, startloc); reprocess(startloc, flag, VSNORMAL, varflags & VSQUOTE, dst); - if (flag & EXP_FULL && *var == '@' && varflags & VSQUOTE) + if (flag & EXP_SPLIT && *var == '@' && varflags & VSQUOTE) dst->state = WORD_QUOTEMARK; break; @@ -860,9 +867,9 @@ strtodest(const char *p, int flag, int s subtype == VSTRIMLEFTMAX || subtype == VSTRIMRIGHT || subtype == VSTRIMRIGHTMAX) STPUTS(p, expdest); - else if (flag & EXP_FULL && !quoted && dst != NULL) - STPUTS_SPLIT(p, BASESYNTAX, expdest, dst); - else if (flag & (EXP_FULL | EXP_CASE)) + else if (flag & EXP_SPLIT && !quoted && dst != NULL) + STPUTS_SPLIT(p, BASESYNTAX, flag, expdest, dst); + else if (flag & (EXP_GLOB | EXP_CASE)) STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest); else STPUTS(p, expdest); @@ -902,8 +909,8 @@ reprocess(int startloc, int flag, int su zpos += zlen + 1; if (zpos == len + 1) break; - if (flag & EXP_FULL && (quoted || (zlen > 0 && zpos < len))) - NEXTWORD('\0', expdest, dst); + if (flag & EXP_SPLIT && (quoted || (zlen > 0 && zpos < len))) + NEXTWORD('\0', flag, expdest, dst); } } @@ -951,14 +958,15 @@ varvalue(const char *name, int quoted, i strtodest(buf, flag, subtype, quoted, dst); return; case '@': - if (flag & EXP_FULL && quoted) { + if (flag & EXP_SPLIT && quoted) { for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { strtodest(p, flag, subtype, quoted, dst); if (*ap) { if (splitlater) STPUTC('\0', expdest); else - NEXTWORD('\0', expdest, dst); + NEXTWORD('\0', flag, expdest, + dst); } } if (shellparam.nparam > 0) @@ -978,11 +986,11 @@ varvalue(const char *name, int quoted, i break; if (sep[0]) strtodest(sep, flag, subtype, quoted, dst); - else if (flag & EXP_FULL && !quoted && **ap != '\0') { + else if (flag & EXP_SPLIT && !quoted && **ap != '\0') { if (splitlater) STPUTC('\0', expdest); else - NEXTWORD('\0', expdest, dst); + NEXTWORD('\0', flag, expdest, dst); } } return; @@ -1014,40 +1022,34 @@ static char expdir[PATH_MAX]; * The results are stored in the list dstlist. */ static void -expandmeta(struct arglist *srclist, struct arglist *dstlist) +expandmeta(char *pattern, struct arglist *dstlist) { char *p; int firstmatch; - int i; char c; - for (i = 0; i < srclist->count; i++) { firstmatch = dstlist->count; - if (!fflag) { - p = srclist->args[i]; + p = pattern; for (; (c = *p) != '\0'; p++) { /* fast check for meta chars */ if (c == '*' || c == '?' || c == '[') { INTOFF; - expmeta(expdir, srclist->args[i], - dstlist); + expmeta(expdir, pattern, dstlist); INTON; break; } } - } if (dstlist->count == firstmatch) { /* * no matches */ - rmescapes(srclist->args[i]); - appendarglist(dstlist, srclist->args[i]); + rmescapes(pattern); + appendarglist(dstlist, pattern); } else { qsort(&dstlist->args[firstmatch], dstlist->count - firstmatch, sizeof(dstlist->args[0]), expsortcmp); } - } } Modified: head/bin/sh/expand.h ============================================================================== --- head/bin/sh/expand.h Thu Dec 31 18:29:24 2015 (r292993) +++ head/bin/sh/expand.h Thu Dec 31 18:47:54 2015 (r292994) @@ -43,12 +43,15 @@ struct arglist { /* * expandarg() flags */ -#define EXP_FULL 0x1 /* perform word splitting & file globbing */ +#define EXP_SPLIT 0x1 /* perform word splitting */ #define EXP_TILDE 0x2 /* do normal tilde expansion */ #define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ #define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ #define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */ #define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */ +#define EXP_GLOB 0x80 /* perform file globbing */ + +#define EXP_FULL (EXP_SPLIT | EXP_GLOB) void emptyarglist(struct arglist *); From owner-svn-src-head@freebsd.org Thu Dec 31 18:50: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 EEFB9A550AE; Thu, 31 Dec 2015 18:50:46 +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 CF6A21D21; Thu, 31 Dec 2015 18:50:46 +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 36366DAD5; Thu, 31 Dec 2015 18:50:40 +0000 (UTC) Subject: Re: svn commit: r292955 - head/lib/libmd To: "Jonathan T. Looney" , Bruce Evans References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> <5684D606.3080609@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Allan Jude Message-ID: <56857911.5010205@freebsd.org> Date: Thu, 31 Dec 2015 13:50:57 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="O083ff9QVAvbmPH4aqR4UNC1wvdF6BD95" 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, 31 Dec 2015 18:50:47 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --O083ff9QVAvbmPH4aqR4UNC1wvdF6BD95 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2015-12-31 13:32, Jonathan T. Looney wrote: > On 12/31/15, 2:15 AM, "Allan Jude" wrote: >=20 >> It seems these problems also slow things down, a lot: >> >> # time md5 /media/md5test/bigdata >> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >> 4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w >> # time env LD_PRELOAD=3D/usr/obj/media/svn/md5/head/tmp/lib/libmd.so >> /usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata >> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >> 4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w >> >> (file is fully cached in ZFS ARC, dd reads it at 11GB/s) >> >> Will investigate more tomorrow. >=20 > md5 will be slower than dd due to the extra processing it needs to do t= o > generate the hash. I suspect that explains the difference you're seeing= > between those utilities. >=20 > Jonathan >=20 >=20 >=20 Sorry, you missed my point here. I replaced MDXFile() with the implementation included in my earlier email. Using the newer libmd with that code, cut the time to md5 the SAME data down a lot. I need to do a more scientific test on a box that isn't doing other stuff still though. The comment about dd doing 11GB/s, was just to clarify that I wasn't reading the file from disk, which would introduce other variables. --=20 Allan Jude --O083ff9QVAvbmPH4aqR4UNC1wvdF6BD95 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) iQIcBAEBAgAGBQJWhXkVAAoJEBmVNT4SmAt+ILUQAIqfQHl2vbev0r4P50O25avg c4M8u2z+rWZ0ETMKwT1ND5vAA+tCnJ8qC816Pk/RvuJSCBUYTXTRysV00WWGBlyP DcJ43uvOjdRDu8xjOQ7FTsR3F3jXE1Sbf6g8MRO6ZkuPXPrEhFj2ejSBWIIQ2UE6 1KhkMbGUHeRWWiyHA4epCCwiVm9v0jB8Njf7ruZFQeT6OBYEWNqq1RCpwRrsey1b UGUczXjIa530YLZjBIAw1en/Kkm2JrPG9iY3QosVqbmp+jEsKSSqk7CPeKpV+uy0 vmAThXR2p7rb7YRjn/YRw7wDi5ynqaSpzYGQ1AvO+aTU2gE87dTQJdhLzjdEujPs NzgWsT5aZHrlLrXpFuE4rCrmE2yfrpJAOeXdVz6q3Eh3spQXxTNZnD+peM1vA/DC yoNx2mm8Sa/vCvUP2/0nEHJwKzzP02fwXB6RzaXhUfXJzGrMDGSxnSOXW+SYLWU4 oZnC3/2/4wLnJRFuoB0D3M0kyei+JMBF0ZFNY12FDuyZGOQg818PPRlcLR9YdUIm v74O1Am8H42NXCjWreZlWGXXmfK22zixF92K2dk2ySVj+PmbljBjXKzX1M/qzkPL KHeQZiW24C5AUWoiilWEmHZBa9SbxdyyMCesLxVBEM0uySbJUeXyONkR/m6pmjNU q5jvRUJq8CyWeX02BZY+ =89t7 -----END PGP SIGNATURE----- --O083ff9QVAvbmPH4aqR4UNC1wvdF6BD95-- From owner-svn-src-head@freebsd.org Thu Dec 31 18:56: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 E3D13A55340; Thu, 31 Dec 2015 18:56:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B630410F3; Thu, 31 Dec 2015 18:56:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVIuBSD010659; Thu, 31 Dec 2015 18:56:11 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVIuB6q010658; Thu, 31 Dec 2015 18:56:11 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512311856.tBVIuB6q010658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 31 Dec 2015 18:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292995 - head/bin/sh 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, 31 Dec 2015 18:56:13 -0000 Author: jilles Date: Thu Dec 31 18:56:11 2015 New Revision: 292995 URL: https://svnweb.freebsd.org/changeset/base/292995 Log: sh: Reindent expandmeta(). Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Dec 31 18:47:54 2015 (r292994) +++ head/bin/sh/expand.c Thu Dec 31 18:56:11 2015 (r292995) @@ -1028,28 +1028,28 @@ expandmeta(char *pattern, struct arglist int firstmatch; char c; - firstmatch = dstlist->count; - p = pattern; - for (; (c = *p) != '\0'; p++) { - /* fast check for meta chars */ - if (c == '*' || c == '?' || c == '[') { - INTOFF; - expmeta(expdir, pattern, dstlist); - INTON; - break; - } - } - if (dstlist->count == firstmatch) { - /* - * no matches - */ - rmescapes(pattern); - appendarglist(dstlist, pattern); - } else { - qsort(&dstlist->args[firstmatch], - dstlist->count - firstmatch, - sizeof(dstlist->args[0]), expsortcmp); + firstmatch = dstlist->count; + p = pattern; + for (; (c = *p) != '\0'; p++) { + /* fast check for meta chars */ + if (c == '*' || c == '?' || c == '[') { + INTOFF; + expmeta(expdir, pattern, dstlist); + INTON; + break; } + } + if (dstlist->count == firstmatch) { + /* + * no matches + */ + rmescapes(pattern); + appendarglist(dstlist, pattern); + } else { + qsort(&dstlist->args[firstmatch], + dstlist->count - firstmatch, + sizeof(dstlist->args[0]), expsortcmp); + } } From owner-svn-src-head@freebsd.org Thu Dec 31 19:00: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 9CE0DA554C3; Thu, 31 Dec 2015 19:00:46 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6B59713C8; Thu, 31 Dec 2015 19:00:46 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVJ0jxt011439; Thu, 31 Dec 2015 19:00:45 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVJ0jbJ011421; Thu, 31 Dec 2015 19:00:45 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512311900.tBVJ0jbJ011421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Thu, 31 Dec 2015 19:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292996 - head/sys/boot/forth 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, 31 Dec 2015 19:00:46 -0000 Author: dteske Date: Thu Dec 31 19:00:45 2015 New Revision: 292996 URL: https://svnweb.freebsd.org/changeset/base/292996 Log: Remove debugging messages. NB: SVN r187143 reads: comment out some debugging messages that slipped in by mistake (removing them 7 years after they have been commented out) MFC after: 1 week Modified: head/sys/boot/forth/support.4th Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Thu Dec 31 18:56:11 2015 (r292995) +++ head/sys/boot/forth/support.4th Thu Dec 31 19:00:45 2015 (r292996) @@ -852,7 +852,6 @@ only forth also support-functions defini \ Interface to loading conf files : load_conf ( addr len -- ) - \ ." ----- Trying conf " 2dup type cr \ debugging 0 to end_of_file? reset_line_reading O_RDONLY fopen fd ! @@ -944,7 +943,6 @@ string current_file_name_ref \ used to p \ loader_conf_files processing support functions : get_conf_files ( -- addr len ) \ put addr/len on stack, reset var - \ ." -- starting on <" conf_files strtype ." >" cr \ debugging conf_files strget 0 0 conf_files strset ; @@ -971,7 +969,6 @@ string current_file_name_ref \ used to p pos char+ to pos repeat addr len pos addr r@ + pos r> - - \ 2dup ." get_file_name has " type cr \ debugging ; : get_next_file ( addr len ptr -- addr len ptr' addr' len' | 0 ) From owner-svn-src-head@freebsd.org Thu Dec 31 19:25: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 128E0A55D57; Thu, 31 Dec 2015 19:25:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D715410DB; Thu, 31 Dec 2015 19:25:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVJPZkC019722; Thu, 31 Dec 2015 19:25:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVJPZAt019721; Thu, 31 Dec 2015 19:25:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201512311925.tBVJPZAt019721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 31 Dec 2015 19:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292997 - head/sys/conf 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, 31 Dec 2015 19:25:37 -0000 Author: emaste Date: Thu Dec 31 19:25:35 2015 New Revision: 292997 URL: https://svnweb.freebsd.org/changeset/base/292997 Log: newvers.sh: put variable assignments on separate lines This makes it easier to grep for where they're set, and may simplify future merging for FreeBSD derivatives that change these. Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Dec 31 19:00:45 2015 (r292996) +++ head/sys/conf/newvers.sh Thu Dec 31 19:25:35 2015 (r292997) @@ -97,7 +97,10 @@ then fi touch version -v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} +v=`cat version` +u=${USER:-root} +d=`pwd` +h=${HOSTNAME:-`hostname`} if [ -n "$SOURCE_DATE_EPOCH" ]; then if ! t=`date -r $SOURCE_DATE_EPOCH 2>/dev/null`; then echo "Invalid SOURCE_DATE_EPOCH" >&2 From owner-svn-src-head@freebsd.org Thu Dec 31 19:33: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 39D8CA57110; Thu, 31 Dec 2015 19:33:19 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 06F2417B3; Thu, 31 Dec 2015 19:33:18 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVJXIvu022621; Thu, 31 Dec 2015 19:33:18 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVJXI7j022620; Thu, 31 Dec 2015 19:33:18 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512311933.tBVJXI7j022620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Thu, 31 Dec 2015 19:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292999 - head/sys/boot/forth 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, 31 Dec 2015 19:33:19 -0000 Author: dteske Date: Thu Dec 31 19:33:17 2015 New Revision: 292999 URL: https://svnweb.freebsd.org/changeset/base/292999 Log: Fix a memory leak. nextboot_conf_file is not volatile, as far as I can tell, and thus the strdup is entirely unnecessary. Thanks to: Toomas Soome (tsoome at-me dot-com) MFC after: 1 week Modified: head/sys/boot/forth/support.4th Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Thu Dec 31 19:32:46 2015 (r292998) +++ head/sys/boot/forth/support.4th Thu Dec 31 19:33:17 2015 (r292999) @@ -1019,7 +1019,7 @@ string current_file_name_ref \ used to p ; : get_nextboot_conf_file ( -- addr len ) - nextboot_conf_file strget strdup + nextboot_conf_file strget ; : rewrite_nextboot_file ( -- ) From owner-svn-src-head@freebsd.org Thu Dec 31 19:37: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 CC4D4A573AC; Thu, 31 Dec 2015 19:37:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9996A1C0E; Thu, 31 Dec 2015 19:37:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVJbE2u022790; Thu, 31 Dec 2015 19:37:14 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVJbEHC022789; Thu, 31 Dec 2015 19:37:14 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512311937.tBVJbEHC022789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Thu, 31 Dec 2015 19:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293000 - head/sys/boot/forth 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, 31 Dec 2015 19:37:15 -0000 Author: dteske Date: Thu Dec 31 19:37:14 2015 New Revision: 293000 URL: https://svnweb.freebsd.org/changeset/base/293000 Log: Remove supposition comment that code would better live elsewhere. Thinking this through, and looking at process_assignment, I believe moving the code would be wrong considering that set_conf_files is called in one condition while set_nextboot_conf is guarded by a different condition of having nextboot_enable="YES". So these must stay separated and not combined. MFC after: 1 week Modified: head/sys/boot/forth/support.4th Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Thu Dec 31 19:33:17 2015 (r292999) +++ head/sys/boot/forth/support.4th Thu Dec 31 19:37:14 2015 (r293000) @@ -684,7 +684,7 @@ only forth also support-functions also f s" loader_conf_files" getenv conf_files string= ; -: set_nextboot_conf \ XXX maybe do as set_conf_files ? +: set_nextboot_conf value_buffer strget unquote nextboot_conf_file string= ; From owner-svn-src-head@freebsd.org Thu Dec 31 20:00:55 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 00C7AA57BC9; Thu, 31 Dec 2015 20:00:55 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C29E315F5; Thu, 31 Dec 2015 20:00:54 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVK0sLG028863; Thu, 31 Dec 2015 20:00:54 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVK0rmi028854; Thu, 31 Dec 2015 20:00:53 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201512312000.tBVK0rmi028854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 31 Dec 2015 20:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293001 - in head/sys/boot: forth i386/loader 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: Thu, 31 Dec 2015 20:00:55 -0000 Author: allanjude Date: Thu Dec 31 20:00:53 2015 New Revision: 293001 URL: https://svnweb.freebsd.org/changeset/base/293001 Log: Introduce the ZFS Boot Environments menu to the loader menu If the system was booted with ZFS, a new menu item (#7) appears It contains an autogenerated list of ZFS Boot Environments This allows the user to switch to an alternate root file system Use Cases: - Revert a failed upgrade - Concurrently run different versions of FreeBSD with common home directory - Easier integration with the sysadmin/beadm utility Requested by: many Reviewed by: dteske MFC after: 10 days Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3167 Modified: head/sys/boot/forth/loader.conf head/sys/boot/forth/menu-commands.4th head/sys/boot/forth/menu.rc head/sys/boot/forth/support.4th head/sys/boot/i386/loader/main.c head/sys/boot/zfs/libzfs.h head/sys/boot/zfs/zfs.c head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/forth/loader.conf Thu Dec 31 20:00:53 2015 (r293001) @@ -90,6 +90,7 @@ ram_blacklist_type="ram_blacklist" # Req #password="" # Prevent changes to boot options #bootlock_password="" # Prevent booting (see check-password.4th(8)) #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root +bootenv_autolist="YES" # Auto populate the list of ZFS Boot Environments #beastie_disable="NO" # Turn the beastie boot menu on and off #kernels="kernel kernel.old" # Kernels to display in the boot menu #loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none Modified: head/sys/boot/forth/menu-commands.4th ============================================================================== --- head/sys/boot/forth/menu-commands.4th Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/forth/menu-commands.4th Thu Dec 31 20:00:53 2015 (r293001) @@ -351,4 +351,68 @@ also menu-namespace also menu-command-he 2 goto_menu ; +\ +\ Set boot environment defaults +\ + +: init_bootenv ( -- ) + s" set menu_caption[1]=${bemenu_current}${vfs.root.mountfrom}" evaluate + s" set ansi_caption[1]=${beansi_current}${vfs.root.mountfrom}" evaluate + s" set menu_caption[2]=${bemenu_bootfs}${zfs_be_active}" evaluate + s" set ansi_caption[2]=${beansi_bootfs}${zfs_be_active}" evaluate + s" set menu_caption[3]=${bemenu_page}${zfs_be_currpage}${bemenu_pageof}${zfs_be_pages}" evaluate + s" set ansi_caption[3]=${beansi_page}${zfs_be_currpage}${bemenu_pageof}${zfs_be_pages}" evaluate +; + +\ +\ Redraw the entire screen. A long BE name can corrupt the menu +\ + +: be_draw_screen + clear \ Clear the screen (in screen.4th) + print_version \ print version string (bottom-right; see version.4th) + draw-beastie \ Draw FreeBSD logo at right (in beastie.4th) + draw-brand \ Draw brand.4th logo at top (in brand.4th) + menu-init \ Initialize menu and draw bounding box (in menu.4th) +; + +\ +\ Select a boot environment +\ + +: set_bootenv ( N -- N TRUE ) + dup s" set vfs.root.mountfrom=${bootenv_root[E]}" 38 +c! evaluate + s" set currdev=${vfs.root.mountfrom}:" evaluate + s" unload" evaluate + free-module-options + s" /boot/defaults/loader.conf" read-conf + s" /boot/loader.conf" read-conf + s" /boot/loader.conf.local" read-conf + init_bootenv + be_draw_screen + menu-redraw + TRUE +; + +\ +\ Switch to the next page of boot environments +\ + +: set_be_page ( N -- N TRUE ) + s" zfs_be_currpage" getenv dup -1 = if + drop s" 1" + else + 0 s>d 2swap + >number ( ud caddr/u -- ud' caddr'/u' ) \ convert string to numbers + 2drop \ drop the string + 1 um/mod ( ud u1 -- u2 u3 ) \ convert double ud' to single u3' and remainder u2 + swap drop ( ud2 u3 -- u3 ) \ drop the remainder u2 + 1+ \ increment the page number + s>d <# #s #> \ convert back to a string + then + s" zfs_be_currpage" setenv + s" reloadbe" evaluate + 3 goto_menu +; + only forth definitions Modified: head/sys/boot/forth/menu.rc ============================================================================== --- head/sys/boot/forth/menu.rc Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/forth/menu.rc Thu Dec 31 20:00:53 2015 (r293001) @@ -68,6 +68,13 @@ set mainmenu_command[6]="2 goto_menu" set mainmenu_keycode[6]=111 set mainansi_caption[6]="Configure Boot ^[1mO^[mptions..." +s" currdev" getenv dup 0> [if] drop 4 s" zfs:" compare 0= [if] + set mainmenu_caption[7]="Select Boot [E]nvironment..." + set mainmenu_command[7]="3 goto_menu" + set mainmenu_keycode[7]=101 + set mainansi_caption[7]="Select Boot ^[1mE^[37mnvironment..." +[then] [else] drop [then] + \ \ BOOT OPTIONS MENU \ @@ -119,6 +126,37 @@ set optionsmenu_keycode[6]=118 set optionsansi_caption[6]="^[1mV^[merbose..... ^[34;1mOff^[m" set optionstoggled_ansi[6]="^[1mV^[merbose..... ^[32;7mOn^[m" +\ +\ BOOT ENVIRONMENT MENU +\ + +set menuset_name3="bootenv" + +set bemenu_current="Active: " +set beansi_current="^[1m${bemenu_current}^[m" +set bemenu_bootfs="bootfs: " +set beansi_bootfs="^[1m${bemenu_bootfs}^[m" +set bemenu_page="[P]age: " +set beansi_page="^[1mP^[mage: " +set bemenu_pageof=" of " +set beansi_pageof="${bemenu_pageof}" +set zfs_be_currpage=1 + +set bootenvmenu_init="init_bootenv" + +set bootenvmenu_command[1]="be_draw_screen 1 goto_menu" +set bootenvmenu_keycode[1]=8 + +set bootenvmenu_command[2]="set_bootenv" +set bootenvmenu_keycode[2]=97 +set bootenv_root[2]="${zfs_be_active}" + +set bootenvmenu_command[3]="set_be_page" +set bootenvmenu_keycode[3]=112 + +set bootenvmenu_options=4 +set bootenvmenu_optionstext="Boot Environments:" + \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to \ customize the timeout; default is 10-seconds) \ @@ -128,6 +166,21 @@ set menu_timeout_command="boot" \ try-include /boot/menu.rc.local +\ Initialize boot environment variables +\ +s" reloadbe" sfind ( xt|0 bool ) [if] + s" bootenv_autolist" getenv dup -1 = [if] + drop s" execute" evaluate \ Use evaluate to avoid passing + \ reloadbe an optional parameter + [else] + s" YES" compare-insensitive 0= [if] + s" execute" evaluate + [then] + [then] +[else] + drop ( xt=0 ) +[then] + \ Display the main menu (see `menu.4th') set menuset_initial=1 menuset-loadinitial Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/forth/support.4th Thu Dec 31 20:00:53 2015 (r293001) @@ -930,6 +930,30 @@ only forth definitions also support-func repeat ; +: free-one-module { addr -- addr } + addr module.name strfree + addr module.loadname strfree + addr module.type strfree + addr module.args strfree + addr module.beforeload strfree + addr module.afterload strfree + addr module.loaderror strfree + addr +; + +: free-module-options + module_options @ + begin + ?dup + while + free-one-module + dup module.next @ + swap free-memory + repeat + 0 module_options ! + 0 last_module_option ! +; + only forth also support-functions definitions \ Variables used for processing multiple conf files Modified: head/sys/boot/i386/loader/main.c ============================================================================== --- head/sys/boot/i386/loader/main.c Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/i386/loader/main.c Thu Dec 31 20:00:53 2015 (r293001) @@ -69,6 +69,7 @@ static int isa_inb(int port); static void isa_outb(int port, int value); void exit(int code); #ifdef LOADER_ZFS_SUPPORT +static void init_zfs_bootenv(char *currdev); static void i386_zfs_probe(void); #endif @@ -294,12 +295,40 @@ extract_currdev(void) new_currdev.d_unit = 0; } +#ifdef LOADER_ZFS_SUPPORT + init_zfs_bootenv(zfs_fmtdev(&new_currdev)); +#endif + env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, env_nounset); } +#ifdef LOADER_ZFS_SUPPORT +static void +init_zfs_bootenv(char *currdev) +{ + char *beroot; + + /* Remove the trailing : */ + currdev[strlen(currdev) - 1] = '\0'; + setenv("zfs_be_active", currdev, 1); + /* Do not overwrite if already set */ + setenv("vfs.root.mountfrom", currdev, 0); + /* Forward past zfs: */ + currdev = strchr(currdev, ':'); + currdev++; + /* Remove the last element (current bootenv) */ + beroot = strrchr(currdev, '/'); + beroot[0] = '\0'; + + beroot = currdev; + + setenv("zfs_be_root", beroot, 1); +} +#endif + COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); static int @@ -353,6 +382,34 @@ command_lszfs(int argc, char *argv[]) command_errmsg = strerror(err); return (CMD_ERROR); } + + return (CMD_OK); +} + +COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", + command_reloadbe); + +static int +command_reloadbe(int argc, char *argv[]) +{ + int err; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + + if (argc == 2) { + err = zfs_bootenv(argv[1]); + } else { + err = zfs_bootenv(getenv("zfs_be_root")); + } + + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + return (CMD_OK); } #endif Modified: head/sys/boot/zfs/libzfs.h ============================================================================== --- head/sys/boot/zfs/libzfs.h Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/zfs/libzfs.h Thu Dec 31 20:00:53 2015 (r293001) @@ -62,6 +62,9 @@ int zfs_parsedev(struct zfs_devdesc *dev char *zfs_fmtdev(void *vdev); int zfs_probe_dev(const char *devname, uint64_t *pool_guid); int zfs_list(const char *name); +int zfs_bootenv(const char *name); +int zfs_belist_add(const char *name); +int zfs_set_env(void); extern struct devsw zfs_dev; extern struct fs_ops zfs_fsops; Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/zfs/zfs.c Thu Dec 31 20:00:53 2015 (r293001) @@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include "zfsimpl.c" +/* Define the range of indexes to be populated with ZFS Boot Environments */ +#define ZFS_BE_FIRST 4 +#define ZFS_BE_LAST 8 + static int zfs_open(const char *path, struct open_file *f); static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static int zfs_close(struct open_file *f); @@ -80,6 +84,16 @@ struct file { zap_leaf_phys_t *f_zap_leaf; /* zap leaf buffer */ }; +static int zfs_env_index; +static int zfs_env_count; + +SLIST_HEAD(zfs_be_list, zfs_be_entry) zfs_be_head = SLIST_HEAD_INITIALIZER(zfs_be_head); +struct zfs_be_list *zfs_be_headp; +struct zfs_be_entry { + const char *name; + SLIST_ENTRY(zfs_be_entry) entries; +} *zfs_be, *zfs_be_tmp; + /* * Open a file. */ @@ -691,6 +705,156 @@ zfs_list(const char *name) rv = zfs_lookup_dataset(spa, dsname, &objid); if (rv != 0) return (rv); - rv = zfs_list_dataset(spa, objid); + + return (zfs_list_dataset(spa, objid)); +} + +int +zfs_bootenv(const char *name) +{ + static char poolname[ZFS_MAXNAMELEN], *dsname; + char becount[4]; + uint64_t objid; + spa_t *spa; + int len, rv, pages, perpage, currpage; + + if (strcmp(name, getenv("zfs_be_root")) != 0) { + if (setenv("zfs_be_root", name, 1) != 0) + return (ENOMEM); + } + + SLIST_INIT(&zfs_be_head); + zfs_env_count = 0; + len = strlen(name); + dsname = strchr(name, '/'); + if (dsname != NULL) { + len = dsname - name; + dsname++; + } else + dsname = ""; + memcpy(poolname, name, len); + poolname[len] = '\0'; + + spa = spa_find_by_name(poolname); + if (!spa) + return (ENXIO); + rv = zfs_lookup_dataset(spa, dsname, &objid); + if (rv != 0) + return (rv); + rv = zfs_callback_dataset(spa, objid, zfs_belist_add); + + /* Calculate and store the number of pages of BEs */ + perpage = (ZFS_BE_LAST - ZFS_BE_FIRST + 1); + pages = (zfs_env_count / perpage) + ((zfs_env_count % perpage) > 0 ? 1 : 0); + snprintf(becount, 4, "%d", pages); + if (setenv("zfs_be_pages", becount, 1) != 0) + return (ENOMEM); + + /* Roll over the page counter if it has exceeded the maximum */ + currpage = strtol(getenv("zfs_be_currpage"), NULL, 10); + if (currpage > pages) { + if (setenv("zfs_be_currpage", "1", 1) != 0) + return (ENOMEM); + } + + /* Populate the menu environment variables */ + zfs_set_env(); + + /* Clean up the SLIST of ZFS BEs */ + while (!SLIST_EMPTY(&zfs_be_head)) { + zfs_be = SLIST_FIRST(&zfs_be_head); + SLIST_REMOVE_HEAD(&zfs_be_head, entries); + free(zfs_be); + } + return (rv); } + +int +zfs_belist_add(const char *name) +{ + + /* Add the boot environment to the head of the SLIST */ + zfs_be = malloc(sizeof(struct zfs_be_entry)); + zfs_be->name = name; + SLIST_INSERT_HEAD(&zfs_be_head, zfs_be, entries); + zfs_env_count++; + + return (0); +} + +int +zfs_set_env(void) +{ + char envname[32], envval[256]; + char *beroot, *pagenum; + int rv, page, ctr; + + beroot = getenv("zfs_be_root"); + if (beroot == NULL) { + return (1); + } + + pagenum = getenv("zfs_be_currpage"); + if (pagenum != NULL) { + page = strtol(pagenum, NULL, 10); + } else { + page = 1; + } + + ctr = 1; + rv = 0; + zfs_env_index = ZFS_BE_FIRST; + SLIST_FOREACH_SAFE(zfs_be, &zfs_be_head, entries, zfs_be_tmp) { + /* Skip to the requested page number */ + if (ctr <= ((ZFS_BE_LAST - ZFS_BE_FIRST + 1) * (page - 1))) { + ctr++; + continue; + } + + snprintf(envname, sizeof(envname), "bootenvmenu_caption[%d]", zfs_env_index); + snprintf(envval, sizeof(envval), "%s", zfs_be->name); + rv = setenv(envname, envval, 1); + if (rv != 0) { + break; + } + + snprintf(envname, sizeof(envname), "bootenvansi_caption[%d]", zfs_env_index); + rv = setenv(envname, envval, 1); + if (rv != 0){ + break; + } + + snprintf(envname, sizeof(envname), "bootenvmenu_command[%d]", zfs_env_index); + rv = setenv(envname, "set_bootenv", 1); + if (rv != 0){ + break; + } + + snprintf(envname, sizeof(envname), "bootenv_root[%d]", zfs_env_index); + snprintf(envval, sizeof(envval), "zfs:%s/%s", beroot, zfs_be->name); + rv = setenv(envname, envval, 1); + if (rv != 0){ + break; + } + + zfs_env_index++; + if (zfs_env_index > ZFS_BE_LAST) { + break; + } + + } + + for (; zfs_env_index <= ZFS_BE_LAST; zfs_env_index++) { + snprintf(envname, sizeof(envname), "bootenvmenu_caption[%d]", zfs_env_index); + (void)unsetenv(envname); + snprintf(envname, sizeof(envname), "bootenvansi_caption[%d]", zfs_env_index); + (void)unsetenv(envname); + snprintf(envname, sizeof(envname), "bootenvmenu_command[%d]", zfs_env_index); + (void)unsetenv(envname); + snprintf(envname, sizeof(envname), "bootenv_root[%d]", zfs_env_index); + (void)unsetenv(envname); + } + + return (rv); +} \ No newline at end of file Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Dec 31 19:37:14 2015 (r293000) +++ head/sys/boot/zfs/zfsimpl.c Thu Dec 31 20:00:53 2015 (r293001) @@ -1473,7 +1473,7 @@ zap_lookup(const spa_t *spa, const dnode * the directory contents. */ static int -mzap_list(const dnode_phys_t *dnode) +mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *)) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; @@ -1492,7 +1492,7 @@ mzap_list(const dnode_phys_t *dnode) mze = &mz->mz_chunk[i]; if (mze->mze_name[0]) //printf("%-32s 0x%jx\n", mze->mze_name, (uintmax_t)mze->mze_value); - printf("%s\n", mze->mze_name); + callback(mze->mze_name); } return (0); @@ -1503,7 +1503,7 @@ mzap_list(const dnode_phys_t *dnode) * the directory header. */ static int -fzap_list(const spa_t *spa, const dnode_phys_t *dnode) +fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *)) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; @@ -1566,13 +1566,21 @@ fzap_list(const spa_t *spa, const dnode_ value = fzap_leaf_value(&zl, zc); //printf("%s 0x%jx\n", name, (uintmax_t)value); - printf("%s\n", name); + callback((const char *)name); } } return (0); } +static int zfs_printf(const char *name) +{ + + printf("%s\n", name); + + return (0); +} + /* * List a zap directory. */ @@ -1587,9 +1595,9 @@ zap_list(const spa_t *spa, const dnode_p zap_type = *(uint64_t *) zap_scratch; if (zap_type == ZBT_MICRO) - return mzap_list(dnode); + return mzap_list(dnode, zfs_printf); else - return fzap_list(spa, dnode); + return fzap_list(spa, dnode, zfs_printf); } static int @@ -1858,6 +1866,48 @@ zfs_list_dataset(const spa_t *spa, uint6 return (zap_list(spa, &child_dir_zap) != 0); } + +int +zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *name)) +{ + uint64_t dir_obj, child_dir_zapobj, zap_type; + dnode_phys_t child_dir_zap, dir, dataset; + dsl_dataset_phys_t *ds; + dsl_dir_phys_t *dd; + int err; + + err = objset_get_dnode(spa, &spa->spa_mos, objnum, &dataset); + if (err != 0) { + printf("ZFS: can't find dataset %ju\n", (uintmax_t)objnum); + return (err); + } + ds = (dsl_dataset_phys_t *) &dataset.dn_bonus; + dir_obj = ds->ds_dir_obj; + + err = objset_get_dnode(spa, &spa->spa_mos, dir_obj, &dir); + if (err != 0) { + printf("ZFS: can't find dirobj %ju\n", (uintmax_t)dir_obj); + return (err); + } + dd = (dsl_dir_phys_t *)&dir.dn_bonus; + + child_dir_zapobj = dd->dd_child_dir_zapobj; + err = objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap); + if (err != 0) { + printf("ZFS: can't find child zap %ju\n", (uintmax_t)dir_obj); + return (err); + } + + err = dnode_read(spa, &child_dir_zap, 0, zap_scratch, child_dir_zap.dn_datablkszsec * 512); + if (err != 0) + return (err); + + zap_type = *(uint64_t *) zap_scratch; + if (zap_type == ZBT_MICRO) + return mzap_list(&child_dir_zap, callback); + else + return fzap_list(spa, &child_dir_zap, callback); +} #endif /* From owner-svn-src-head@freebsd.org Thu Dec 31 20:15: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 A3173A5606A; Thu, 31 Dec 2015 20:15:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5AB441E84; Thu, 31 Dec 2015 20:15:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVKFvxe034550; Thu, 31 Dec 2015 20:15:57 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVKFvqG034549; Thu, 31 Dec 2015 20:15:57 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512312015.tBVKFvqG034549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 31 Dec 2015 20:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293002 - head/bin/sh 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, 31 Dec 2015 20:15:58 -0000 Author: jilles Date: Thu Dec 31 20:15:57 2015 New Revision: 293002 URL: https://svnweb.freebsd.org/changeset/base/293002 Log: sh: Remove redundant CTLQUOTEMARK checks. With the new expand.c code, the intermediate representation passed to the pathname generation code only contains CTLESC, not CTLQUOTEMARK. CTLQUOTEMARK now only occurs in the text of NARG nodes (output of the parser). Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Dec 31 20:00:53 2015 (r293001) +++ head/bin/sh/expand.c Thu Dec 31 20:15:57 2015 (r293002) @@ -1018,7 +1018,7 @@ static char expdir[PATH_MAX]; /* * Perform pathname generation and remove control characters. - * At this point, the only control characters should be CTLESC and CTLQUOTEMARK. + * At this point, the only control characters should be CTLESC. * The results are stored in the list dstlist. */ static void @@ -1083,8 +1083,6 @@ expmeta(char *enddir, char *name, struct if (*q == '!' || *q == '^') q++; for (;;) { - while (*q == CTLQUOTEMARK) - q++; if (*q == CTLESC) q++; if (*q == '/' || *q == '\0') @@ -1096,8 +1094,6 @@ expmeta(char *enddir, char *name, struct } } else if (*p == '\0') break; - else if (*p == CTLQUOTEMARK) - continue; else { if (*p == CTLESC) esc++; @@ -1112,8 +1108,6 @@ expmeta(char *enddir, char *name, struct if (enddir != expdir) metaflag++; for (p = name ; ; p++) { - if (*p == CTLQUOTEMARK) - continue; if (*p == CTLESC) p++; *enddir++ = *p; @@ -1130,8 +1124,6 @@ expmeta(char *enddir, char *name, struct if (start != name) { p = name; while (p < start) { - while (*p == CTLQUOTEMARK) - p++; if (*p == CTLESC) p++; *enddir++ = *p++; @@ -1160,8 +1152,6 @@ expmeta(char *enddir, char *name, struct } matchdot = 0; p = start; - while (*p == CTLQUOTEMARK) - p++; if (*p == CTLESC) p++; if (*p == '.') @@ -1280,8 +1270,6 @@ patmatch(const char *pattern, const char if (*q++ != *p++) goto backtrack; break; - case CTLQUOTEMARK: - continue; case '?': if (*q == '\0') return 0; @@ -1298,7 +1286,7 @@ patmatch(const char *pattern, const char break; case '*': c = *p; - while (c == CTLQUOTEMARK || c == '*') + while (c == '*') c = *++p; /* * If the pattern ends here, we know the string @@ -1342,8 +1330,6 @@ patmatch(const char *pattern, const char c = '['; goto dft; } - if (c == CTLQUOTEMARK) - continue; if (c == '[' && *p == ':') { found |= match_charclass(p, chr, &end); if (end != NULL) @@ -1360,8 +1346,6 @@ patmatch(const char *pattern, const char wc = (unsigned char)c; if (*p == '-' && p[1] != ']') { p++; - while (*p == CTLQUOTEMARK) - p++; if (*p == CTLESC) p++; if (localeisutf8) { From owner-svn-src-head@freebsd.org Thu Dec 31 22:31:45 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 12F0EA57896; Thu, 31 Dec 2015 22:31:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A780A1607; Thu, 31 Dec 2015 22:31:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMVhHn075727; Thu, 31 Dec 2015 22:31:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMVh8K075724; Thu, 31 Dec 2015 22:31:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512312231.tBVMVh8K075724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 31 Dec 2015 22:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293009 - head/sys/contrib/dev/rtwn 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, 31 Dec 2015 22:31:45 -0000 Author: adrian Date: Thu Dec 31 22:31:43 2015 New Revision: 293009 URL: https://svnweb.freebsd.org/changeset/base/293009 Log: [rtwn] add rtwn firmware. Submitted by: kevlo Added: head/sys/contrib/dev/rtwn/ head/sys/contrib/dev/rtwn/LICENSE head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU_B.fw.uu Added: head/sys/contrib/dev/rtwn/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/rtwn/LICENSE Thu Dec 31 22:31:43 2015 (r293009) @@ -0,0 +1,39 @@ +Copyright (c) 2010, Realtek Semiconductor Corporation +All rights reserved. + +Redistribution. Redistribution and use in binary form, without +modification, are permitted provided that the following conditions are +met: + +* Redistributions must reproduce the above copyright notice and the + following disclaimer in the documentation and/or other materials + provided with the distribution. +* Neither the name of Realtek Semiconductor Corporation nor the names of its + suppliers may be used to endorse or promote products derived from this + software without specific prior written permission. +* No reverse engineering, decompilation, or disassembly of this software + is permitted. + +Limited patent license. Realtek Semiconductor Corporation grants a world-wide, +royalty-free, non-exclusive license under patents it now or hereafter +owns or controls to make, have made, use, import, offer to sell and +sell ("Utilize") this software, but solely to the extent that any +such patent is necessary to Utilize the software alone, or in +combination with an operating system licensed under an approved Open +Source license as listed by the Open Source Initiative at +http://opensource.org/licenses. The patent license shall not apply to +any other combinations which include this software. No hardware per +se is licensed hereunder. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +COPYRIGHT OWNER 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. Added: head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU.fw.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU.fw.uu Thu Dec 31 22:31:43 2015 (r293009) @@ -0,0 +1,333 @@ +begin 444 rtwn-rtl8192cfwU.fw.uu +MP8@"`$@````%$!!3PCD!`(%C`0`````````````````"0[H````````````` +M`````````E!$```````````````````````````````````````````````` +M`````````````E;@```````"2VH```4$`P(``P8%!`,`!`8%!`(`!`@'!@0` +M!@H)"`8`"`H)"`0`"`H)"`(`"`H)"```"!(1$`@`$!H9&!``&"(A(!@`("(A +M(!``("(A(`@`("(A'`@`("(A%`@`("(@&`@`(#$P(!``,#$P&```,#$O$!`` +M,#$L$!``,#$H$```,#$@$```,#$0$```,`0$!`4$!`0%!04&!@0$!`4%!08& +M!`0%!04%!@8$!`4%!04&!PH+#1`$!04&!@D,$0@("0D*#!`1!`0$!00$!0<' +M!P@*!`0$!`8*"PT%!0<'"`L-#P0$!`4'!PD)#`X0$@0$!04&"A$3"0D)"0P. +M$1,````````````D)BH8&AT?(2`"@`,@!0`&0`>`",`$L`4`!X`+0`^@$L`9`!]```@`" +M``0`"``,`!(`&``D`#``2`!@`&P`*``\`%``9`"@`,@`\`$8`&0`H`#P`6@! +M]`)8`R`#Z`("`@("`@,#!`0%!P0$!PH*#`P2!0<'"`L2)#P!`0$!`0(#!`4& +M!P@!`@,$!08'"`4&!P@)"@L,(!X<&!`8````````````````NP$,Y8(I]8+E +M@SKU@^`B4`;I)8+XYB*[_@;I)8+XXB+E@BGU@N6#.O6#Y),BNP$&B8**@_`B +M4`+W(KO^`?,B^+L!#>6"*?6"Y8,Z]8/H\")0!NDE@LCV(KO^!>DE@LCR(L7P +M^*/@*/#%\/CE@A6"<`(5@^`X\"*[`0J)@HJ#X/7PH^`B4`:'\`GG&2*[_@?C +M]?`)XQDBB8**@^23]?!T`9,BNP$0Y8(I]8+E@SKU@^#U\*/@(E`)Z26"^(;P +M".8BN_X*Z26"^.+U\`CB(N6#*O6#Z9/U\*/IDR*[`0J)@HJ#\.7PH_`B4`;W +M":?P&2*[_@;SY?`)\QDB^+L!$>6"*?6"Y8,Z]8/H\.7PH_`B4`GI)8+(]@BF +M\"*[_@GI)8+(\N7P"/(B[TO_[DK^[4G][$C\(N#\H^#]H^#^H^#_(J0E@O6" +MY?`U@_6#(N#[H^#ZH^#Y(OC@^Z.CX/DE\/#E@A6"<`(5@^#Z./`BZ_"CZO"C +MZ?`BT(/0@OCDDW`2=`&3<`VCHY/X=`&3]8*(@^1S=`*3:&#OHZ.C@-\"0_@" +M2"_DDZ/XY).C0`/V@`'R"-_T@"GDDZ/X5`1^`9-@O*/_5#\PY0E4'_[DDZ-@`0[/5,`EX&"H +M0+CDDZ/ZY).C^.23H\C%@LC*Q8/*\*/(Q8+(RL6#RM_IWN>`OD&7?P!!EZ$` +M09=K@$&7HP``CX*.@Z.CH^3P(N3U(W]@?@&`[=,0KP'#P-"0EUUQBY"777%K +MD``!4<+ZY?`D`/_D.OZ0EUUQ:Y```>Z/\'$9$B1B_V`HM2,4D)==<6N0``%1 +MPF4E<`3E)&7P8!^0EUUQ:Y```5'"_Z[PL5.`#I"777%K$B1B92-@`I%8T-"2 +MKR+T_Y``0^!?\-,0KP'#P-!_$-_^T-"2KR*0`=,0KP'#P-"+8(IAB6*0EXAQBZMCJF2I99"7BW&+ +MKV859N]@&Y"7B^1U\`%Q=!(D8O^0EXCD=?`!<73O44V`WJM@JF&I8M#0DJ\B +MD)=@[O"C[_!U(P&.)/4EY/U_"[&6Y/U_`K&6$FU;Y/^1YN3U)Y`!R>4G\)"7 +M8.#\H^#][/N-1.3U17T!?V!^`0(P8M,0KP'#P-"0EV/M\)"78N_PTY0'4$ZC +MX'`:D)=BX/]T`:@'"(`"PS/8_/3_D`!'X%_P@!>0EV+@_W0!J`<(@`+#,]C\ +M_Y``1^!/\)'6D)=BX/]T`:@'"(`"PS/8_/3_D`!&@%F0EV+@)/CPH^!P'9"7 +M8N#_=`&H!PB``L,SV/S$5/#T_Y``0^!?\(`:D)=BX/]T`:@'"(`"PS/8_,14 +M\/^0`$/@3_"1UI"78N#_=`&H!PB``L,SV/ST_Y``0^!?\)'6T-"2KR+@_WT! +MD)>4[_"C[?#DH_"C\.5J8`7D_Q).>9"7E.`PX`F0EY;D\*-T@/"0!!W@8!V0 +M!2+@D)>8\.#_5)!@[)`!R'3\\.]4;Y`%(O"`W9"7E.#_PQ.0_1#PD`0E[_"0 +MEY7@8!^CH^#_)`_U@N0T_/6#X$2`\'00+_6"Y#3\]8/@1(#PD)>6H^#__20( +M]8+D-/SU@^3P=`DM]8+D-/SU@^!4\/!T(2_U@N0T_/6#X%3W\)"7EN#^H^#_ +M(O"0`$7@5/[]?T73$*\!P\#0CX)U@P#M\)'6T-"2KR+O%&`P%&!E)`)@`N': +MD)!$$/U_18!OY)"7./"0 +MES1Q4Y"`EA(E"'^`?@@2*PB0`$7@1._]?T7Q()``1>!4[_U_1?$@D`!&X$00 +M_7]&@#>0ESAT`?"0ESYQ4Y"`EA(E"'^`?@@2*PB0`$7@1"#]?T7Q()``1>!$ +M$/U_1?$@D`!&X$00_7]&\2`BD`!)X)"7I/#@5`_P1/#]?TGQ()"7I.!$L/U_ +M2>$@=2@SY/4I=2H"]2N0`3#E*/"CY2GPH^4J\*/E*_`B=3`?=3$!Y/4RD`$X +MY3#PH^4Q\*/E,O`BY)"73_"C\'6.`A)LK9```N!4X)"7AF`%=`'P@`-T`O"0 +M`//@,.,(D)>'=`'P@`7DD)>'\)"7A^"T`1.0`/+@,.<,D)=]=/WPHW0S\(`* +MD)=]=/WPHW0O\.3U5Q)JZQ)O\A)?K!(N`1)M5Q)'^9``\^`PX@V0!4%T$/"0 +M!5KPH^3PD`%D=*#P=43_Y/5%^WT!?U!^`1(P8A$7$D4"$G=(D)=1Y=GP$E`5 +MPJ^0`(#@1$#P$D36=>@#0ZB%TJ^0ET_@9`'P)"^0`<3P=$BC\.57,.0*PJ]3 +M5^_2KQ)7@.57,.86PJ]35[_2KQ)A9)"7/.#_8`.T`0(Q8)"7/.!P`Q)WIC$S +M@+B0!C3@8"8435_^7X!$FSUOP$)D`8UX%0/\(`%@``";)[DD`8T +M\"*0ES/@PY044`7@!/!!&)"7,^!D%&`"01B0ET+@<"60ET7@0!/W@5/[PD)="X)`$1/"0ET/@D`1%\)"71."0 +M!$;PH^3PD)=%X)`$2/"0ET;@D`1)\)"71^"0!$KPH^3PD)#^TY]0"Y"72^##GM.4`4`0D)"0ETGPD`5BX)"72O"0!6/@D)=+\,-T_Y_^D)=)X-.>0![@+_"CX+3_#^3P +MH^"T_P/D\"*0ETN``Y"72N`$\"*0ETG@+_`BD)#_46*0ETQT`1)'%H!`D)=,X&0!<#B0ESW@_U%BY)"73/"0`$7@1`']?T42 +M1R"0ES+@8!60ES020U.0@)82)0A_@'X($BL(@`60!2+D\)`%A^!D@/"0ETC@ +MD`6$\)"72>"0!87PD)=*X)`%AO"0ETO@D`6'\"+`X,#PP(/`@L#0==``P`#` +M`<`"P`/`!,`%P`;`!Y`!Q'1J\'1+H_!3D=^0`3S@53#U-*/@53'U-:/@53+U +M-J/@53/U-^4T,.`&D`$\=`'PY30PX0B0`3QT`O#QJ^4T,.(RD`$\=`3PD`:2 +MX##@'G5$%'5%`.3[_7]8?@$2,&*0`5MT!?"0!I)T`?"`!Y"7=N3PD8KE-##C +M,I`!/'0(\)`&DN`PX1YU1!1U10#D^_U_7'X!$C!BD`%?=`7PD`:2=`+P@`>0 +MEW7D\)&*Y30PY`F0`3QT$/`2;7?E-##E")`!/'0@\%&TY34PX!"0`3UT`?"0 +M`(/@D)=Y\)&*=&H$D`'$\'1+H_#0!]`&T`70!-`#T`+0`=``T-#0@M"#T/#0 +MX#*0EWG@_WT!@`1]`7\,CV>-:.5G5`__D)=WX%0/;V!QY6]@*[%.D)=WX%0/_[\$#>5G(.(($E8Q[V`4T920EW?@5`__ +MOP(($F`)[V`"T>!4O_`BD`8$X$1`\.5IM`$$?P'Q2)"7=^!4\/#@1`3P +M(N]D`7`N?7U_`A(Q+'T"?P,2,2R0`5?D\)`!/'0"\)&3Y/_1>9`&!.!4?_"0 +M!@K@5/CP(I`!-G1]\*-T`O!]??\2,9U]`G\#$C&=D`8$X$2`\)`&"N!$!_"0 +MEW+@H^"0!5CPY6DPX!J0EV_@%&`O)`-P0'\!@#JK$:H2J1.0 +M``(20B#]Y/_14X`GJQ&J$JD3D``"$D(@_7\!T5,?@!.K$:H2J1.0``(20B#] +M?P+14^3_L6HB[R3^8`L$V0EWAP!70%\(`"[?"0EWC@D)=M +M\"+O8`N0EX?@M`$0Y/^`"9"7A^"T`05_`1)O^R*0`3=T`O"0!2)T__`2;E_O +M<`:0`BX&`%D`4BY/"0EW?@ +M5/#PX$0$\"*0!@3@5+_P[V`)Y6FT`03D__%(D)=WX%3P\.!$#/`B$E/\OP$: +MD)=VX'`4D)=UX'`.D)=YX%0/TY0$4`-_`2)_`"*/:Y"7@A)&7>5K8!!T(2_U +M@N0T_/6#X$00\(`.="$O]8+D-/SU@^!4[_"0!!]T`?`B?0)_`Q(Q+.5J%"3] +M4`*`(9"7>N!@!GT!?PR`#Y"7=^!4#\.4!%`&?0%_!)&7Y/_1>2*0EWO@8`[D +M\*/@5/WPX%0'<">`(Y"7;N`$\)"7?.!4[_"0EV[@TY0!0`WE:;0!"J/@<`;@ +M!/`BD8HBD`$PY/"C\*/PH_"0`3CPH_"C\*/P_7]0$D<@Y/U_41)'(.3]?U(2 +M1R#D_7]3`D<@D`$\=/_PH_"C\)`!-/"C\*/PH_#]?U021R!]_W]5$D<@??]_ +M5A)'('W_?U<"1R#`X,#PP(/`@L#0==``P`#``<`"P`/`!,`%P`;`!Y`!Q'1$ +M\'10H_"0`33@52CU+)`!-N!5*O4NH^!5*_4OY2P@X`(AVY`!-'0!\(713872 +M3H733X744(7548764H774X795.545$##$__E4U0@;W`"(9+E5##E`B&2Y5)4 +M'_4(Y4U4/_4)Y5%4'__E""7@)./U@N0TE/6#Y(_P$D*!Y5-4'__E""7@),#U +M@N0TD?6#Y(_P$D*!Y0G3E`1``W4)!'7P"N4(D)``$D-?=?`"Y0D20U_@_J/@ +M_^535!\O_^0^_G7P"N4(D)``$D-?=?`"Y0D20U_N\*/O\.54(.8CY5-4'__E +M""7@)&/U@N0TE/6#Y(_P$D*!Y4\PYS2O"+'#@"[E4U0?_^4()>`DH_6"Y#24 +M]8/DC_`20H'E3S#G$>5/5'_]Y5-4'_4-JPFO")&PY6H4)/U0`H!`D)=ZX&`R +MD`%;Y/"0`3QT!/!Q_.]D`7`H=404]47[_7]8?@$2,&*0`5MT!?"0!I)T`?"0 +MEW;P@`AQ_+\!`Q),BN4L,.$FD`$T=`+PD/T0='_PA=%8A=)9A=-:A=1;A=5< +MA=9=A==>A=E?D0OE+##C!I`!-'0(\.4L,.0)D`$T=!#P0U<0Y2PPY2:0`<_@ +M,.4?X%3?\)`!-'0@\'6H`'7H`!)/Y9```^!4^_`21-:`_N4L,.8&D`$T=$#P +MY2XPX3R0`39T`O!#5T"0`0+@5`-D`7`ID`$WX##@"G0!\)"7?^3P@!B0EW_@ +M!/#@PY0*0`SD\)`$&>`PX`,21/+E+C#@")`!-G0!\-%EY2XPXG&0`39T!/#E +M:60!<&7E:F!AY6ID`F`&Y6ID!7`GD`:KX)"7;?"0!JK@D)=X\)"7;>!P!Y"7 +M>.#_@`60EVW@_Y"7;>_PD)=OX&`#X!3PD)=NY/"0`5?PD`$\=`+PD)=\X%3] +M\.!4[_#E:A0D_5`"@`*Q$.4N,.,QD`$V=`CPY6ED`7`EY6I@(9`!5^3PD`$\ +M=`+P=40#=44`Y/O]?U1^`1(P8I`!5W0%\.4N,.0OD`$V=!#PY6ED`7`CY6I@ +M'Y`!5^3PD`$\=`+PD)=[Y/"0EWS@5/WPX%0'<`,23(KE+C#E'9`!-G0@\.5I +MM`$2Y6I@#I"7>N!D`F`$L7B``K&)Y2XPYAZ0`39T0/#E:;0!$^5J8`^0EWS@ +M5/[PX%0'<`,23(KE+S#A"9`!-W0"\!)/>71$!)`!Q/!T4*/PT`?0!M`%T`30 +M`]`"T`'0`-#0T(+0@]#PT.`RD`0;X%1_9']_`6`"?P`BD)=-X%3P1`/P5`]$ +M@/![`'H`>5B0EY$20XL+>I=Y3=,0KP'#P-"0EXX20XN0EX;@9`)@;)`!K^!@ +M"9`!Q^`$\/"`\9"7H^#_!/"0EXX20VN0``'O$D)?D)>.$D-KBV.*9(EE=68" +M>P%Z`7F@$D4)D)>1$D-KBV.*9(EED)>.$D-K$B1B_\14#_5F>P%Z`7FB$D4) +MD`&O=/_PD`'+X&2`\-#0DJ\BJ07I5!_U#W0!+_6"Y#22]8/@]0Z0!/W@M`$% +M=1`#@`-U$`'KPY400`*AP^4.)0W^Y0^00=:3_>[3G70!0!0EWS@1`'PD)=ZX&0"8`2Q>(`+L8F`!Y"7?.!4_O#E"I"7?##G +M(.!$`O!U1`/D]47[_7]4?@$2,&*0`5=T!?"0EWMT`?`BX%3]\"*0EX'@_^3] +M$D9AD`0?=`'P(I`!7^3PD`$\=`CP=404Y/5%^_U_7'X!$C!BD`%?=`7PD`:2 +M=`+PD)=U%/"0EW?@5`_#E`Q0`Q),DR*M!W7P">V0DR<20U_@_W2E+?6"Y#26 +M]8/@5!_\TY]``JP'["7@))[U@N0T0?6#Y)/^=`&3_^PEX"1F]8+D-$'U@W0! +MDR__Y),^PQ/^[Q/_[27@).'U@N0TDO6#[O"C[_!TA"WU@N0T!/6#[/#_(G'\ +M[V0!<"J0EWS@5`-P(I"7>>!4#].4`E`7D)=\X"#B$)"7?.`@Y`F0EV_@<`-_ +M`2)_`"+DD)=-\.5J8''E:60!<&OE:A1@*23]8"4D`B3[4`*`(Y"7;>`4\.!@ +M!*/@8!:0EVW@<`J0EWC@D)=M\(``D)=-=`'PD)=-X&`QD)=\X$00\)"7=.#U +M1.3U1?O]?U1^`1(P8I`!5W0%\)"7=^!4#\.4!%`'?0%_!!),ER+`X,#PP(/` +M@L#0==``P`#``<`"P`/`!,`%P`;`!Y`!Q'3@\'16H_!3D>^0`%'@_Y``5>!? +M]3WE/3#F&'1`\)"7.^!4`_^_`PN0ESC@8`5_`1)'->4],.<5D`!5=(#PD)<[ +MX%0#_[\#!7\"$D0EZ'@_W0! +M?@"H!PB`!<,SSC/.V/G_[UUP`P)8O9"7H>!U\`20`=`20U_@D)=3\'5C`75D +MEW5E4W5F`7L!>I=Y5!)%"9"75.#_Q!,3$U0!D)>A,.!9X'7P`I``B!)#7^"0 +MEU7PD)>AX'7P`I``B1)#7^"0EU;PD)>AX'7P!)`!T1)#7^"0EU?PD)>AX'7P +M!)`!TA)#7^"0EUCPD)>AX'7P!)`!TQ)#7^"0EUGP@#/@=?`$D`'1$D-?X)"7 +M5?"0EZ'@=?`$D`'2$D-?X)"75O"0EZ'@=?`$D`'3$D-?X)"75_#O5'__>P%Z +MEWE5$#^=`&H!@B``L,SV/ST7Y"74O"0EZ'@_W0!J`<(@`+# +M,]C\D`',\)"7H>`$\.!4`_`"5XJ0`<;@1`+P`E>*(I"76A)#B^\20Y18]`%8 +M_`)9!`-9#`59%`991@=9'`E9)0Q9+@U9-@X``%D_D)=:$D-KP=B0EUH20VO! +MTI"76A)#:^%DD)=:$D-KX0*0EUH20VN`*Y"76A)#:P)$89"76A)#:P)X?Y"7 +M6A)#:^$QD)=:$D-K`G9PD`'&X$0!\"*0``020B#_5!_^[U0@Q!-4!_VO!I"7 +M7>_PH^WPHQ)#BY"77Q)#:Y```Q)"(%3PQ%0/D)=B\)``!!)"(%1`Q!,35`.0 +MEV/PD)==X/]U\`F0DR420U^M@JR#D)=D[/"C[?#O=?`)I"0C^723-?#Z>P&C +M$D.+D)=?$D-KD``#$D(@5`__D)=F$D-K[Q)"39"77Q)#:Y```A)"(/^0EV82 +M0VN0``'O$D)?D)=?$D-KD``!$D(@_Y"79.#\H^#]]8*,@^_P$B1BC8*,@Z/P +MD)=BX/Z0EUW@_R3!]8+D-)+U@^[PD)=>X/YU\`GOD),I$D-?[O!U\`GOD),J +M$D-?=`'PD)=CX/YU\`GOD),K$D-?[O"/$>\EX"3D]8+D-)6O@O43CQ3E$77P +M`J0D@?ETDC7P=14!]1:)%W7P">41D),E$D-?KX*%@QB/&>41=?`)I"0C^723 +M-?!U&@'U&XD<=,$E$?6"Y#22]8/@$D.46M4`6NH!6O\"6Q0#6ST$6U(%6V<& +M6XT,6[H-6^<.7!0/``!<2.41)>`DY/6"Y#25]8-T\/"C=!6`/.41)>`DY/6" +MY#25]8-T\/"C=!"`)^41)>`DY/6"Y#25]8-T\/"C=`6`$N41)>`DY/6"Y#25 +M]8-T\/"CY/#E$27@)('U@N0TDO6#=`_PHW2/\(%(Y1$EX"3D]8+D-)7U@W0/ +M\*-T]8`GY1$EX"3D]8+D-)7U@W0/\*-T\(`2Y1$EX"3D]8+D-)7U@^3PHW0- +M\.41)>`D@?6"Y#22]8/D\*/P@4B0!$?@JQ6J%JD7$D)-D`1&X*L5JA:I%Y`` +M`1)"7Y`$1>"%%(*%$X/PD`1$@3^0!$O@JQ6J%JD7$D)-D`1*X*L5JA:I%Y`` +M`1)"7Y`$2>"%%(*%$X/PD`1(@%B0!$_@JQ6J%JD7$D)-D`1.X*L5JA:I%Y`` +M`1)"7Y`$3>"%%(*%$X/PD`1,@"N0!%/@JQ6J%JD7$D)-D`12X*L5JA:I%Y`` +M`1)"7Y`$4>"%%(*%$X/PD`10X(44@H43@Z/PJQ6J%JD7P`/``L`!$B1B_ZL: +MJANI'!(D8E_0`=`"T`,20DVK%>47)`'YY#46^L`#P`+``1(D8O^K&JH;J1R0 +M``$20B!?T`'0`M`#$D)-A12"A1.#P(/`@N#_A1F"A1B#X/[O7M""T(/PA12" +MA1.#H\"#P(+@_X49@H48@Z/@_N]>T(+0@_#E$27@)('U@N0TDO6#X/ZCX$Y@ +M.W42"W0!?@"H$@B`!<,SSC/.V/G_Y1$EX"2!]8+D-)+U@^!>_J/@7TY@!N42 +M)!"`7142Y1+#E`!0RH!6Y1$EX"3D]8+D-)7U@^#^H^!.8#UU$@]T`7X`J!(( +M@`7#,\XSSMCY_^41)>`DY/6"Y#25]8/@7OZCX%].8`B0EVGE$O"`$!42Y1+# +ME`!0R(`%Y)"7:?#E$27@).3U@N0TE?6#X/ZCX$Y@.^3U$G0!?@"H$@B`!<,S +MSC/.V/G_Y1$EX"3D]8+D-)7U@^!>_J/@7TY@")"7:N42\(!;!1+E$K00RH!2 +MY1$EX"2!]8+D-)+U@^#^H^!.8#GD]1)T`7X`J!((@`7#,\XSSMCY_^41)>`D +M@?6"Y#22]8/@7OZCX%].8`;E$B00@`H%$N42M`S,@`7DD)=J\)"7:>#_=?`) +MY1&0DR<20U_O\)"7:N#^=?`)Y1&0DR@20U_N\'2$)1'U@N0T!/6#X-.?0!^0 +MEVG@_W2$)1'U@N0TEO6#[_!TA"41]8+D-`3U@^_P=(0E$?6"Y#0$]8/@PYY0 +M'Y"7:N#_=(0E$?6"Y#26]8/O\'2$)1'U@N0T!/6#[_"0EVG@_].4$T`(D),B +M=`/P@"'OTY0+0`B0DR)T`O"`$^_3E`-`")"3(G0!\(`%Y)"3(O"0DR+@D`2Q +M\"(2)&+U:2+3$*\!P\#0D``!$D(@D)=Z\)```Q)"()"7;/`2)&)E:F`#$DWQ +MT-"2KR(2)&+U$<.4(%`5D``"$D(@_W0C)1'U@N0TE?6#[_`BY1&T(`J0``(2 +M0B"0DR'P(I```A)"()"7//#@8`3@]'`AHJ_D,_41PJ^0`$?@5/O]?T<21R!] +M0'\!$C%FY1$D_Y*O(I`"">#]$B1B_J\%[2Z0EX#PD``!$D(@_^TOD)>!\)`` +M`A)"(/_M+Y"7@O"0``,20B#_[2^0EX/PD``$$D(@_ZX%[2^0EX3P(N3U:9"7 +M?/#U:I"7>70,\)"7=_#DD)=Z\)"7=O"0EW7PD)=X!/"0EVWPY)"7>_"0EV_P +MD)=T=`?PY)"7;O"0EW+PHW0"\.20EW'PD)=L\"+DD)=[\)"7;O"0EWSP(N57 +M<#>0EWG@5`_3E`%0+)`"A^!P)I"7AN"T`A"0EWW@_J/@]8*.@^!@"(`/D`&O +MX'`)D)=QX&`#?P$B?P`BD``KX$0!\'_H?@,2,A60``C@1!#]?P@21R"0``G@ +M5/?]?PD21R"0`"C@5/[]?R@21R"0`"#@5/[]?R`21R"0`"7@1$#]?R421R"0 +M``G@5._]?PD"1R"0`"7@5+_]?R421R"0`"#@1`']?R`21R"0`"C@1`']?R@2 +M1R"0`/#@,.'YD``)X$0(_7\)$D<@D``(X%3O_7\($D<@D``KX%3^_7\K$D<@ +M?^A^`P(R%8]LD)>#$D9=Y6Q@$'0A+_6"Y#3\]8/@1!#P@`YT(2_U@N0T_/6# +MX%3O\)`$'W0!\"+OPY0@4#GO,.`7[<14\/WOPQ/^)*3U@N0T!/6#X%0/@!#O +MPQ/^)*3U@N0T!/6#X%3P\'2D+O6"Y#0$]8/@3?`BY/41=?`)Y1&0DRH20U_@ +M9`%@`N%AY1$EX"3`]8+D-)'U@^#^H^#3E`#NE`!0`N%AY1%U\`JD)`#Y=)`U +M\'46`?47B1CE$27@),#U@N0TD?6#X/^CX)"75L_PH^_PY1$EX"1C]8+D-)3U +M@^#_H^"0EUC/\*/O\'2$)1'U@N0T!/6#X%0_D)=2\.#^5!^C\'7P">41D),G +M$D-?X)"76_!T9"41]8+D-);U@^##E`5``H$[D)=;X/^0EU/@GT`3D)=;X)"7 +M4_#N5$#^D)=2\.].\)`$_>!D`7`ID)=3X/^004J3_G0C)1'U@N0TE?6#X,.> +M0`;OD$#:@#"0EU/@D$#V@">0EU/@_Y!!2I/^=",E$?6"Y#25]8/@PYY`!N^0 +M01*`!Y"74^"002Z3D)=:\)"76N!U\`:D)%#Y=$`U\'43__44B160EU+@D$'R +MD__3D)=9X)^0EUC@E`!`">3]KQ$2:5K!^.41)>`DX?6"Y#22]8/@]1FCX/4: +MJQ.J%*D5$B1B_WX`JQ:J%ZD8$D*7_:SP$B1[[R4:]1KN-1GU&:L3JA2I%9`` +M`1)"(/]^`*L6JA>I&)```A)"POVL\!(D>^\E&O4:[C49]1FK$ZH4J160``(2 +M0B#_?@"K%JH7J1B0``020L+]K/`2)'OO)1KU&NXU&?49JQ.J%*D5D``#$D(@ +M_WX`JQ:J%ZD8D``&$D+"_:SP$B1[[R4:]1KN-1GU&:L3JA2I%9``!!)"(/]^ +M`*L6JA>I&)``"!)"POVL\!(D>^\E&O4:[C49]1FK$ZH4J160``420B#_?@"0 +MEU;@_*/@_1(D>]/E&I_E&9Y`#.4:G_4:Y1F>]1F`!>3U&?4:Y1$EX"3A]8+D +M-)+U@^49\*/E&O"0EU+@)>`D9O6"Y#1!]8/#=`&3E1KDDY494`:O$?%MP`DGO6"Y#1!]8/3=`&3E1KDDY494`+!S'T!KQ$2:5K!S'1D)1'U@N0T +MEO6#X/QD!6`"H=:0DR+@_[0#"Y"74^##E!E`/8`N[[0""Y"74^##E!%`+H`? +MD),BX/^T`0N0EU/@PY0*0!N`#.]P$9"74^##E`-`#9"50W0!\(`%Y)"50_!T +M0R41]8+D-)3U@^#U&W0C)1'U@N0TE?6#X/_#E#!0`J&#D)5#X&0!8`*A@W1$ +M)1'U@N0TE?6#X&0*8%'O)`7_Y#/^="$E$?6"Y#22]8/@_=.?[F2`^'2`F%`R +M[20%_^0S_G0C)1'U@N0TE?6#X-.?[F2`^'2`F%`4=(0E$?6"Y#26]8/@_Y"7 +M4^!O8#UT(R41]8+D-)7U@^#_TY1"0`5U&P6`#N_3E#E`!74;`X`#=1L!="$E +M$?6"Y#22]8/O\'1$)1'U@N0TE8`I=&0E$?6"Y#26]8/D\'1$)1'U@N0TE?6# +MX`3P@!#D]1MT9"41]8+D-);U@^3PD)=3X/]TA"41]8+D-);U@^_P=$,E$?6" +MY#24]8/E&_!U\`GE$9"3*Q)#7^"T`1#D]1MT9"41]8+D-);U@^3PK1O!R.QD +M!F`"PI&'7P`N42I/6"A?"#$D+"_:SPY1*00@Z3_WX`$B1[[R4: +M]1KN-1GU&<.0EU7@E1J0EU3@E1E`!P42Y1*T!;WE$L,3]1+E&[0!!N42<$:` +M$^4;M`,5Y1)P!74;`X`YY1*T`05U&P&`+X`JY1NT!2CE$G`%=1L%@`WE$K0! +M!74;`X`#=1L!TY"76>"4`Y"76."4`$`#Y/4;TY"76>"4`Y"76."4`$`#Y/4; +M=$,E$?6"Y#24]8/E&_#]KQ$Q)'1D)1'U@N0TEO6#X-.4!71D4`XE$?6"Y#26 +M]8/@!/"`"R41]8+D-);U@^3PJQ:J%ZD8Y/7P$D+ZJQ:J%ZD8D``"Y/7P$D,9 +MD``$Y/7P$D,9D``&Y/7P$D,9D``(Y/7P$D,9Y1$EX"3`]8+D-)'U@^3PH_#E +M$27@)&/U@N0TE/6#Y/"C\.41)>`DH_6"Y#24]8/D\*/P!1'E$<.4(%`"(6S#E!!`(>PD\/]T`7X`J`<(@`7#,\XSSMCY +M_Y"77>!>_J/@7TYP(^S#E!!0.70!?@"H!`B`!<,SSC/.V/G_D)=?X%[^H^!? +M3F`<[&038`CL9!)@`[P1"9"77>`PX`)\&*T$C1R`-`R`BY"77.#\;7!I=*4I +M]8+D-);U@^WP=?`)Z9"3*1)#7^"T`0SE'"#F!^U$0/4<@`.O'"+M)>`DGO6" +MY#1!]8/DD_YT`9/_[27@)&;U@N0T0?6#=`&3+__DDS[#$_[O$__I)>`DX?6" +MY#22]8/N\*/O\(!;[=.<0%:0EUS@_W2E*?6"Y#26]8/O\*T'CQSM)>`DGO6" +MY#1!]8/DD_YT`9/_[27@)&;U@N0T0?6#=`&3+__DDS[#$_[O$__I)>`DX?6" +MY#22]8/N\*/O\*\<(G0!*?6"Y#22]8/D\.4<1(#_=(0I]8+D-`3U@^_P(JH' +M=(0J]8+D-`3U@^!4?_M4'_F0EU[P=?`)ZI"3*!)#7^"0EV#P=?`)ZI"3)Q)# +M7^"0EV'P_.HEX"3D]8+D-)7U@^#_H^"0EV+/\*/O\.HEX"2!]8+D-)+U@^#_ +MH^"0EV3/\*/O\.G3G$`)D)=AX)"77O#[[7`"09V0EU_M\.LPY@F0EU[@^Z/@ +M%/"0EU_@<`)!G9"77N#_TY0`4`)!G>20EUWP[Q20EUSPD)=@X/F0EUS@_M.9 +M0'+NE!!`)>XD\/]T`7X`J`<(@`7#,\XSSMCY_Y"79.#\H^#][%[^[5].<"N0 +MEUS@_\.4$%`V=`%^`*@'"(`%PS/.,\[8^?^0EV+@_*/@_>Q>_NU?3F`5D)=< +MX/NCX`3PD)=?X/^0EUW@;V`(D)=##GU`,D)=`DX?6"Y#22]8/N\*/O\'2$*O6"Y#0$]8/K\/\BD`1$=!'P +MHW3P\*-T#_"CY/#]=*0M]8+D-`3U@^3P#;T0\.3]=?`*[9"0`!)#7^3PH_!U +M\`KMD)`"$D-?Y/"C\'7P"NV0D`020U_D\*/P=?`*[9"0!A)#7^3PH_!U\`KM +MD)`($D-?Y/"C\'2$+?6"Y#26]8-T$_!T1"WU@N0TE?6#Y/!T0RWU@N0TE/6# +MY/#M)>`DP/6"Y#21]8/D\*/P[27@)&/U@N0TE/6#Y/"C\.TEX"3C]8+D-)3U +M@^3PH_#M)>`DH_6"Y#24]8/D\*/P[27@)&3U@N0TE?6#Y/"C\.TEX"2D]8+D +M-)7U@^3PH_!T1"WU@N0TEO6#Y/!T)"WU@N0TEO6#Y/!T9"WU@N0TEO6#Y/"0 +M0<23_G0!D_^008QT`9,O_^23/L,3_N\3_^TEX"3A]8+D-)+U@^[PH^_P=?`) +M[9"3*A)#7W0!\'7P">V0DRD20U]T`?!TP2WU@N0TDO6#=`SP=?`)[9"3)1)# +M7W3_\*/P=?`)[9"3(Q)#7^3PHW0/\'7P">V0DR<20U]T$_!U\`GMD),H$D-? +MY/!TA"WU@N0T!/6#=!/P#>UD(&`"80\BD`8T=/_PY*/PH_"C\"(BY)"7A?"B +MKS.0EU/PD`"`X"#A&A(R*Q(R*Y"74N!D`?#@)*V0`<3P=&RC\(#?D`8P=`'P +MPJ^0`(#@1(#P$D36D)=3X"3_DJ\BCA&/$HL3BA2)%>20EU+P[Y``,?`21-;E +M$50#_Y``,N!4_$_P$D36D``SX%1_\!)$UI``,^`@YPZ0EU+@PY1D4`7@!/"` +MZY"74N##E&10$)``,."K$ZH4J1420DU_`2)_`"+D]28B?PNQON]E)F`0Y2:T +M`07D]2:``W4F`7\!(G\`(N4C9`%P0+%;OP$%?P$21.:0`$;@1`3]?T821R"0 +M`$3@5/O]?T021R"0`$;@5/O]?T821R!_`K&^CR>0`_PTY0'4$?@_W0!J`<(@`+#,]C\]/^0`$;@7_`21-:0EZ7@_70! +M?@"H!0B`!<,SSC/.V/G_D`!$X/OD_N];J`4(@`;.HN<3SA/8^/^`1)"7I>`D +M^/#@_W0!J`<(@`+#,]C\$D3.D)>EX/UT`7X`J`4(@`7#,\XSSMCY_Y``0N#[ +MY/[O6Z@%"(`&SJ+G$\X3V/C_T-"2KR+DD)>=\*/PD`7XX'`/H^!P"Z/@<`>C +MX'`#?P$BTY"7GN"4Z)"7G>"4`T`#?P`B?S)^`!(R%9"7G>1U\`$20H&`QI`` +M$>!$"?`21-:0EQT20U.0@)82)0A_>'X($BL(D)3]_Q(P+)"7A^"T`1&0@&@2)10``RV5Y/U_`1(P+")_>'X($B)ED)<= +M$B4(?P1^#!(B99"7(1(E"'\`?@@2(F60ER42)0B0EX?@D)<=M`$-$D-3[U3' +M_^U4Q_V`!Q)#4^]4Q__LD("6$B4(?WA^"!(K")"7(1)#4^]4#__LD("6$B4( +M?P1^#!(K")"7)1)#4^]$`O_LD("6$B4(?P!^"!(K"']P?@X2(F60ERD2)0B0 +M@)82)10`&R6@?W!^#A(K")"`:!(E%`````#D_?\2,"R0EX?@M`$1D(!H$B44 +M`````.3]?P$2,"R0`!'@5/;P`D36D)>'X)"7+?`B[W`"(;&0ERW@8`*A?)"7 +M&1)#4Y"`EA(E"'^,?@@2*PB0EL420U.0@)82)0A_1'X($BL(D);)$D-3D("6 +M$B4(?UQ^"!(K")"6S1)#4Y"`EA(E"']L?@X2*PB0EM$20U.0@)82)0A_<'X. +M$BL(D);5$D-3D("6$B4(?W1^#A(K")"6V1)#4Y"`EA(E"']X?@X2*PB0EMT2 +M0U.0@)82)0A_?'X.$BL(D);A$D-3D("6$B4(?X!^#A(K")"6Y1)#4Y"`EA(E +M"'^$?@X2*PB0END20U.0@)82)0A_B'X.$BL(D);M$D-3D("6$B4(?XQ^#A(K +M")"6\1)#4Y"`EA(E"'_0?@X2*PB0EO420U.0@)82)0A_U'X.$BL(D);Y$D-3 +MD("6$B4(?]A^#A(K")"6_1)#4Y"`EA(E"'_9$B4(D)>9$D-3[43`_>R0EYD2)0B0EYD20U.0@)82)0A_C'X( +M$BL(D("6$B44``$``']$?@@2*PB0@)82)10`VR6D?UQ^"!(K")"`EA(E%"#; +M):1_;'X.$BL(D("6$B44(-LEI']P?@X2*PB0@)82)10$&R6D?W1^#A(K")"` +MEA(E%`0;):1_>'X.$BL(D("6$B44!!LEI']\?@X2*PB0@)82)10$&R6D?X!^ +M#A(K")"`EA(E%&/;):1_A'X.$BL(D("6$B44!!LEI'^(?@X2*PB0@)82)10@ +MVR6D?XQ^#A(K")"`EA(E%"#;):1_T'X.$BL(D("6$B44(-LEI'_4?@X2*PB0 +M@)82)10@VR6D?]A^#A(K")"`EA(E%``;):1_W'X.$BL(D("6$B44`!LEI'_@ +M?@X2*PB0@)82)10DVR6D?^Q^#A(K"'\$?@P2(F60EYD2)0B0EYD20U/D_^R0 +MEYD2)0B0EYD20U/O1!'_[)"7F1(E")"7F1)#4Y"`EA(E"'\$?@P2*PA_!'X- +M$B)ED)>9$B4(D)>9$D-3[U3P_^R0EYD2)0B0EYD20U/O1`'_[)"7F1(E")"7 +MF1)#4Y"`EA(E"'\$?@T2*PA_#'X)$B)ED)>9$B4(D)>9$D-3Y/_LD)>9$B4( +MD)>9$D-3[T01_^R0EYD2)0B0EYD20U.0@)82)0A_#'X)$BL(?PQ^"1(B99"7 +MF1(E")"7F1)#4^U4#_WL5/#\D)>9$B4(D)>9$D-3[400_>Q$`?R0EYD2)0B0 +MEYD20U.0@)82)0A_#'X)$BL(?P1^"!(B99"7F1(E")"7F1)#4^]4\/_LD)>9 +M$B4(D)>9$D-3[T0!_^R0EYD2)0B0EYD20U.0@)82)0A_!'X($BL(Y)"7+?`B +MTQ"O`?[_#3E`=09>#_=`&H!PB``L,SV/ST_Y``1^!?\!)$ +MUI"7G^#_=`&H!PB``L,SV/S_D`!&X$_P$D36D)>@X&`6D)>?X/]T`:@'"(`" +MPS/8_/^0`$6`:)"7G^#_=`&H!PB``L,SV/ST_Y``18!MD)>?X"3X\.#_=`&H +M!PB``L,SV/S$5/`21,Z0EY_@_W0!J`<(@`+#,]C\_Y``0^!/\!)$UI"7H.!@ +M&Y"7G^#_=`&H!PB``L,SV/S$5/#_D`!"X$^`&I"7G^#_=`&H!PB``L,SV/S$ +M5/#T_Y``0N!?\!)$UM#0DJ\BBQ&*$HD3D``"$D(@D)<[\.`PX$N0ES)T`?!_ +M@'X($B)ED)D`!'X%3S_7]'$D<@D`!(X%3S_7]($D<@D`!&X%3O_7]& +M$D<@Y)"7./`BY/U_11)'()`$_>3PH_"0ESSPD)="\)"71?"0ET/PD)=&\)"7 +M1/"0ET?PD)!$P/U_40)'()"73.!D`6`)D)`$\(`DD)=#X,.4 +M_U`&X`3PY(`1D)=$X,.4_U`,X`3PY)"70_"0ET+PD`!$X##C,I"71>##E/]0 +M!>`$\(`DD)=&X,.4_U`&X`3PY(`1D)='X,.4_U`,X`3PY)"71O"0ET7PD`3] +MX$0!\"*0``(20B"0ESKPD``!$D(@)>`EX)"7.?`2)&(EX"7@D)<]\)`%8."0 +METCPD`5AX)"72?"0!6+@D)=*\)`%8^"0ETOPHJ_D,Y"77?#"KY"7.>#_$DIB +MD)==X"3_DJ^0ESK@<`(AB9"7.>!P`B&)D)<]X'`"(8FBK^0SD)==\,*OD)=, +M=`'PD)==X"3_DJ\21Q>0`$;@1`']?T821R"0ES+@8!60ESX20U.0@)82)0A_ +M@'X($BL(@`:0!2)T?_"0`$7@5._]?T421R"0!8?@9(#PD)=(X)`%A/"0ETG@ +MD`6%\)"72N"0!8;PD)=+X)`%A_"BK^0SD)==\,*OD`$\X$0@\'T@Y/\2,;>` +M+9"7.N!P+Y"73!)'%I``1N!4_OU_1A)'()`%(N3PHJ\SD)==\,*O?2#D_Q(Q +-29"77>`D_Y*O(@"'%P`` +` +end Added: head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU_B.fw.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU_B.fw.uu Thu Dec 31 22:31:43 2015 (r293009) @@ -0,0 +1,366 @@ +begin 444 rtwn-rtl8192cfwU_B.fw.uu +MPH@"`%@``@`'%11$K#\!`,S,S,P````````````````"19L````````````` +M`````````EE4```````````````````````````````````````````````` +M`````````````F2,```````"2[(```4$`P(``P8%!`,`!`8%!`(`!`@'!@0` +M!@H)"`8`"`H)"`0`"`H)"`(`"`H)"```"!(1$`@`$!H9&!``&"(A(!@`("(A +M(!``("(A(`@`("(A'`@`("(A%`@`("(@&`@`(#$P(!``,#$P&```,#$O$!`` +M,#$L$!``,#$H$```,#$@$```,#$0$```,`0$!`4$!`0%!04&!@0$!`4%!08& +M!`0%!04%!@8$!`4%!04&!PH+#1`$!04&!@D,$0@("0D*#!`1!`0$!00$!0<' +M!P@*!`0$!`8*"PT%!0<'"`L-#P0$!`4'!PD)#`X0$@8'"0H,#A$3"0D)"0P. +M$1,````````````D)BH8&AT?(2`"@`,@!0`&0`>`",`$L`4`!X`+0`^@$L`9`!]```@`" +M``0`"``,`!(`&``D`#``2`!@`&P`*``\`%``9`"@`,@`\`$8`&0`H`#P`6@! +M]`)8`R`#Z`("`@("`@,#!`0%!P(#!`H,#A`2!0<'"`L2)#P!`0$!`0(#!`4& +M!P@!`@,$!08'"`4&!P@)"@L,(!X<&!`8````````````````NP$,Y8(I]8+E +M@SKU@^`B4`;I)8+XYB*[_@;I)8+XXB+E@BGU@N6#.O6#Y),BNP$&B8**@_`B +M4`+W(KO^`?,B^+L!#>6"*?6"Y8,Z]8/H\")0!NDE@LCV(KO^!>DE@LCR(L7P +M^*/@*/#%\/CE@A6"<`(5@^`X\"*[`0J)@HJ#X/7PH^`B4`:'\`GG&2*[_@?C +M]?`)XQDBB8**@^23]?!T`9,BNP$0Y8(I]8+E@SKU@^#U\*/@(E`)Z26"^(;P +M".8BN_X*Z26"^.+U\`CB(N6#*O6#Z9/U\*/IDR*[`0J)@HJ#\.7PH_`B4`;W +M":?P&2*[_@;SY?`)\QDB^+L!$>6"*?6"Y8,Z]8/H\.7PH_`B4`GI)8+(]@BF +M\"*[_@GI)8+(\N7P"/(B[TO_[DK^[4G][$C\(N#\H^#]H^#^H^#_(J0E@O6" +MY?`U@_6#(N#[H^#ZH^#Y(OC@^Z.CX/DE\/#E@A6"<`(5@^#Z./`BZ_"CZO"C +MZ?`BT(/0@OCDDW`2=`&3<`VCHY/X=`&3]8*(@^1S=`*3:&#OHZ.C@-_0@]"" +M^.23]D`6`(D`&Y=`'P@&[E)50#8`B0`;ET`O"`8.4C5`_3 +ME`)`")`!N70$\(!/Y24PX@B0`;ET"/"`0N4E,.0(D`&Y=!#P@#60DE?@8`B0 +M`;ET(/"`)Y"27.!@")`!N72`\(`9Y29@!Y`!N>3P@`Z0`;GD\)`!N'0$\'\! +M(I`!N'0$\'\`(@)%`P)%!GT!?PS3$*\!P\#0CV>-:.5G5`__Y2)4#V]@4B5`__OP0.Y6<@X@D21'SO +M8!022C/E(E0/_[\""1)+@N]@`Q)+,=#0DJ\B`D79`E%WY).C^.23HT`#]H`! +M\@C?](`IY).C^%0')`S(PS/$5`]$(,B#0`3T5H`!1O;?Y(`+`0($"!`@0("0 +M2T3D?@&38+RC_U0_,.4)5!_^Y).C8`$.SU3`)>!@J$"XY).C^N23H_CDDZ/( +MQ8+(RL6#RO"CR,6"R,K%@\K?Z=[G@+[D_^4D8'7E(60!<&_E)!1@*R3]8"`4\.!@!*/@8!20DE7@<`B0DF/@D))5\'\!@`)_`>]@.D,E +M$.20DH/PD))6X'7P`Z3_D))?X"^0DH3PY/O]?U1^`1)+EY`!5W0%\.4B5`_# +ME`10!WT!?P0210TBY2%D`7!GY21@8^4D9`)@!N4D9`5P)Y`&J^"0DE7PD`:J +MX)"28_"0DE7@<`>0DF/@_X`%D))5X/^0DE7O\)"25^!@`N3PY)"25O"0!5AT +M`_"0`5?D\)`!/'0"\%,E_5,E[^4D%"3]4`*``Q)'""+DD)(0\)`&J>"0DA#P +MX%3`<`E3)?Y3)?T22WN0DA#@,.850R4!D))DX&0"8`422LR`"!))\X`#4R7^ +MD)(0X##G)T,E`N20DH/PD));X)"2A/#D^_U_5'X!$DN7D`%7=`7PD))E=`'P +M(E,E_2+O9`%P,'UX?P(2-G5]`G\#$C9UD`%7Y/"0`3QT`O`210GD_Q)8II`& +M!.!4?_"0!@K@5/CP(I`!-G1[\*-T`O!]>_\2-N9]`G\#$C;FD`8$X$2`\)`& +M"N!$!_`22W#E(2#@!>20DE?P(I"2*1)#BQ)+9)"2*1)#:Q(IV?4D%&`.%&`? +M%&`Q)`-P1'\!@#V0DBD20VN0``(20B#]Y/\22F6`*9"2*1)#:Y```A)"(/U_ +M`1)*91^`%)"2*1)#:Y```A)"(/U_`A)*9>3_$D=T(N3U)?4D=2,,=2(,D))D +M\)"28O"0DF'PD))C!/"0DE7PY)"29?"0DE?PD))?=`7PY)"25O"0DEWPHW0# +M\)"26O"C=`7PD))9=!3PD))@=`7PY)"26/"0DE3PD))]\)"27/`B$DM5[V0! +M8`B0`;ET`?"`1Y"28N!@")`!N70"\(`YD))AX&`(D`&Y=`3P@"OE(U0/TY0$ +M0`B0`;ET"/"`&N4F8`B0`;ET(/"`#I`!N>3PD`&X=`CP?P$BD`&X=`CP?P`B +MY)"2%O#E)&!)D))EX&`-Y/!3)?WE)50'<#B`,Y"25N`$\%,E[Y"2%N#_D)): +MX"__Y#/^D))6X-.?[F2`^'2`F$`-Y2&T`0NCX'`'X`3P(A)+>R+E)!0D_5`" +M@$>0DF3@8"P210GDD)*#\)"26>"0DH3PY/O]?UA^`1)+EY`!6W0%\)`&DG0! +M\)"28O"`$.4B5`_#E`10!WT!?P0210WD_Q)8IB+3$*\!P\#0CV.0!!W@8"20 +M!2+@]69T__`2=F6_`0V0DGC@_WT!$E@*$D/GD`4BY6;P@`V0DGC@_WT!$E@* +M$D/GD`0?="#PT-"2KR*0`5_D\)`!/'0(\.20DH/PD))9X)"2A/#D^_U_7'X! +M$DN7D`%?=`7PD`:2=`+PD))A%/#E(E0/PY0,4`,210DBD`$W=`+PD`4B=/_P +M$G9E[W`&D`'(=/WP?0)_`Q(VYN4D8`5_`1)8IA)W&U,B\$,B`B+O)/Y@"P1P +M(I"28W0!\(`6[7`*D))@X)"28_"`!9"28^WPD))CX)"25?`B[V`/="$M]8+D +M-/SU@^!$$/`B="$M]8+D-/SU@^!4[_`BD`8$X%2_\.]@"N4AM`$%Y/\22:A3 +M(O!#(@PBD`0=X'`4D))WX/_D_1)8"HYICVJ0!!]T(/`BD)*I[_`2=J:0DJG@ +M8`60!2+D\%,B\$,B!"*0!@3@1$#PY2&T`05_`1))J%,B\$,B!"+E(S#F$N4C +M5`__D`$OX%2`3V2`\%,COR)3(O!#(@$22X422X93(O!#(@(B09)U`$&2J`!! +MDJH`09*B``"0!!O@5']D?W\!8`)_`"+DD))E\)"25O#U)2*0DEW@H^"0!5CP +M(GT!KR,"10U_`"(B(O"0DEG@D)*$\.3[_7]8?@'3$*\!P\#0D)*#X/NCX/5$ +MY/5%$C6KT-"2KR+`X,#PP(/`@L#0==``P`#``<`"P`/`!,`%P`;`!W4.`%.1 +MWY`!/.!5,/4TH^!5,?4UH^!5,O4VH^!5,_4WY30PX`:0`3QT`?#E-##A")`! +M/'0"\#$$Y30PXBR0`3QT!/#E)&`BD`:2X##@%)"2@^1QAY`!6W0%\)`&DG0! +M\(`'D))BY/!Q>^4T,.,\D`$\=`CPY21@,I`&DN`PX220DH/D\)"26>"0DH3P +MY/O]?UQ^`7&7D`%?=`7PD`:2=`+P@`>0DF'D\'%[Y30PY`B0`3QT$/"1]N4T +M,.4)D`$\="#P$E._Y34PX!:0`3UT`?"0`(/@]2.0`;OE(_!Q&7%[Y34PX@:0 +M`3UT!/#E-3#D!I`!/700\.4V,.`&D`$^=`'PY38PX0:0`3YT`O#0!]`&T`70 +M!-`#T`+0`=``T-#0@M"#T/#0X#+E7F0!<#OQN[\!!'\!\:^0`$;@1`3]?T:Q +M0I``1.!4^_U_1+%"D`!&X%3[_7]&L4)_`O'ZCV*0`20DC_PD)([$D-3 +MD("%$BI_?X!^"!(OV9``1>!$[_U_1;%"D`!%X%3O_7]%L4*0`$;@1!#]?T:` +M.)"2/W0!\)"211)#4Y"`A1(J?W^`?@@2+]F0`$7@1"#]?T6Q0I``1>!$$/U_ +M1;%"D`!&X$00_7]&L4(BD``"$D(@D))!\)```1)"("7@)>"0DD#P$BG9)>`E +MX)"21/"0!6#@D))/\)`%8>"0DE#PD`5BX)"24?"0!6/@D))2\**OY#.0DB7P +MPJ^0DD#@_Q)3;9"2)>`D_Y*OD))!X'`"X0:0DD#@<`+A!I"21.!P`N$&HJ_D +M,Y"2)?#"KY"24W0!\)"2)>`D_Y*OL3F0`$;@1`']?T:Q0I"2.>!@%9"211)# +M4Y"`A1(J?W^`?@@2+]F`!I`%(G1_\)``1>!4[_U_1;%"D`6'X&2`\)"23^"0 +M!83PD))0X)`%A?"0DE'@D`6&\)"24N"0!8?PHJ_D,Y"2)?#"KY`!/.!$(/!] +M(.3_$C<`@"N0DD'@<"V0DE.Q.)``1N!4_OU_1K%"D`4BY/"BKS.0DB7PPJ]] +M(.3_$C:2D)(EX"3_DJ\BD`$\=/_PH_"C\)`!-/"C\*/PH_#]?U2Q0GW_?U6Q +M0GW_?U:Q0GW_?U>A0I`!,.3PH_"C\*/PD`$X\*/PH_"C\/U_4+%"Y/U_4;%" +MY/U_4K%"Y/U_4Z%"D`!)X)"2J_#@5`_P1/#]?TFQ0I"2J^!$L/U_2:%"D`'* +MY6'P[V`"\9$B?POQ^N]E86`0Y6&T`07D]6&``W5A`7\!(G\`(N20DGOPD`"` +MX$2`_7^`H4+@7_#3$*\!P\#0?Q#?_M#0DJ\BTQ"O`0DJS@_70!?@"H!0B`!<,SSC/.V/G_D`!$ +MX/OD_N];J`4(@`;.HN<3SA/8^/^`3)"2K.`D^/#@_W0!J`<(@`+#,]C\]/^0 +M`$/@7_`23^J0DJS@_70!?@"H!0B`!<,SSC/.V/G_D`!"X/OD_N];J`4(@`;. +MHN<3SA/8^/_0T)*O(I`"A._PH^[PHW0%\"+OCO`20[I0RP!`4/,`@%$>`0!1 +M,@(`44H$````46?M5#]P!/[_@`1^`']`[RW_[CS^[W@&SL,3SA/8^7@&PS/. +M,\[8^8`F[51_<`3^_X`$?@!_@.\M_^X\_N]X!\[#$\X3V/EX!\,SSC/.V/G] +MK`:`2>UP!/[_@`1^`7\`[RWN/'T`_(`U[%0!37`$_O^`!'X"?P#O+>X\PQ-] +M`(`:[%0#37`$_O^`!'X$?P#O+>X\$Q-4/WT`)>`EX/RN!*\%(I`!Y'18\*-T +M`O`BY)"2%_"C\'6.`A)/U]&ED))\[_#1F9"2?N_PT>V0DG/N\*/O\.3U5?4A +M$G#6T9`22$(2,CW1A1)/.O$%T<#1B='5T811)Q)^=)"2&>79\,*OD`"`X$1` +M\!)/ZG7H`T.HA=*O,6R0DA?@9`'PY54PY`G"KU-5[]*OD77E53#F%L*O4U6_ +MTJ\2:;R0DD/@_V`#M`$"46N0DD/@<`,2?M)1/Y`!O>4B\)"29."0`;SP@+60 +MDJ/@5/[PY)"2I?"0DJ/@5'_PHW0*\"*0!C3@8"4435_^7X!$G8# +MOP$)D`8UX%0/\(`$@`#!LN20!C3P(I"2.N##E!10!>`$\&$CD)(ZX&048`)A +M(Y"22>!P)9"23.!P'Y"22N!P&9"23>!P$Y"22^!P#9"23N!P!Y`$_>!4_O"0 +MDDG@D`1$\)"22N"0!$7PD))+X)`$1O"CY/"0DDS@D`1(\)"23>"0!$GPD)). +MX)`$2O"CY/"0DC7@D`1,\)"2-N"0!$WPD)(WX)`$3O"0DCC@D`1/\.20DCKP +MD)(U!/#DH_"C\*/PD)))\*/PH_"C\*/PH_"0!6#@D)(:\)`%8>"0DAOPD`5B +MX)"2'/"0!6/@D)(=\)"24N#_D)(=X/[3GU`+D))2X,.>TY0!0!"0DD#@M`$" +M@`.0DD3@_W%M(I`%8."0DD_PD`5AX)"24/"0!6+@D))1\)`%8^"0DE+PPW3_ +MG_Z0DE#@TYY`'N`O\*/@M/\/Y/"CX+3_`^3P(I"24H`#D))1X`3P(I"24.`O +M\"*0DD'@9`%@`H%TD`!&X$0!_7]&$DU"D))3X'`RD)(YX&`5D))%$D-3D("% +M$BI_?X!^"!(OV8`&D`4B='_PD))`X/]Q;9"24W0!$DTX@$"0DE/@9`%P.)"2 +M1.#_<6WDD))3\)``1>!$`?U_11)-0I"2.>!@%9"2.Q)#4Y"`A1(J?W^`?@@2 +M+]F`!9`%(N3PD`6'X&2`\)"23^"0!83PD))0X)`%A?"0DE'@D`6&\)"24N"0 +M!8?P(M,0KP'#P-"0`DG4?&W4@`7L! +M>I)Y'+'"D)(\)"2J.!U\`20`=,20U_@D)(?\.]4?_][`7J2>1T27 +MJ1^0DH@20XNO(!4@[V`>D)*(Y'7P`1)#=!(IV?^0DH7D=?`!$D-T[Q)"38#; +MJQJJ&ZDB1]U(`)[`7H!>:"QPI"2CA)#:XL=BAZ)'Y"2BQ)#:Q(IV?_$ +M5`_U('L!>@%YHK'"D`&O=/_PD)*JX`3PD`'+X&2`\-#0DJ\B(N3U82*0`61T +MH/`BD))^X)"2#_`BD`#SX'\`,.,"?P$BD``"X%3@?P%@`G\`(I`&-'3_\.2C +M\*/PH_`BD`#SX##B#9`%0700\)`%6O"CY/`B=3`?=3$!Y/4RD`$XY3#PH^4Q +M\*/E,O`BD))^X+0!#)``\N`PYP5^_7\S(G[]?R\B=2@SY/4I=2H']2N0`3#E +M*/"CY2GPH^4J\*/E*_`BD)(0X%3P1`/P5`]$@/![`'H`>5:0DHX20XL+>I)Y +M$,$1TQ"O`931$=#0DJ\BTQ"O`I)Y9GT"\430T)*O +M(H^"CH.CHZ/D\"+D]5Y_8'X!@.W3$*\!P\#0D`0=X&`:D`4BX%208`>0`<;@ +M1$#PD`''X##AY'\`@`)_`=#0DJ\BTQ"O`_PD)*7X&`?HZ/@ +M_R0/]8+D-/SU@^!$@/!T$"_U@N0T_/6#X$2`\)"2F*/@__TD"/6"Y#3\]8/D +M\'0)+?6"Y#3\]8/@5/#P="$O]8+D-/SU@^!4]_"0DIC@_J/@_]#0DJ\B[V`+ +MD))^X+0!$.3_@`F0DG[@M`$%?P$2=^4B$E?0`33@52CU+*/@52GU+:/@52KU+J/@52OU +M+^4L(.`"0=^0`31T`?"%T4V%TDZ%TT^%U%"%U5&%UE*%UU.%V53E5%1`PQ/_ +MY5-4(&]P`D&515!__Y0@EX"3$]8+D-(WU +M@^2/\!)"@>535!__Y0@EX"2`]8+D-(?U@^2/\!)"@>4)TY0$0`-U"01U\`KE +M")"$`!)#7W7P`N4)$D-?X/ZCX/_E4U0?+__D/OYU\`KE")"$`!)#7W7P`N4) +M$D-?[O"C[_#E5"#F(^535!__Y0@EX"3$]8+D-(SU@^2/\!)"@>5/,.535!_U#:L) +MKPB1F^4D%"3]4`*`.I"29.!@*Y`!6^3PD`$\=`3P$DM5[V0!<"&0DH,22X>0 +M`5MT!?"0!I)T`?"0DF+P@`D22U6_`0,22WOE+##A(9`!-'0"\(715H725X73 +M6(7468756H766X777(7971)7(^4L,.,&D`$T=`CPY2PPY`F0`31T$/!#51#E +M+##E)I`!S^`PY1_@5-_PD`$T="#P=:@`=>@`$D]ED``#X%3[\!)/ZH#^Y2PP +MY@:0`31T0/#E+C#@%)"2?70!\)`!-O`21AZ199"2?>3PY2XPX0N0`39T`O!# +M54`1U^4N,.()D`$V=`3P$D::Y2XPXSB0`39T"/#E(60!<"SE)&`HD`%7Y/"0 +M`3QT`O"0DH/D\)"26^"0DH3PY/O]?U1^`1)+EY`!5W0%\.4N,.0KD`$V=!#P +MY2&T`2#E)&`4E5`=P`Q)+>^4N,.4?D`$V +M="#PY2&T`13E)&`0D))DX&0"8`422LR``Q))\^4N,.8;D`$V=$#PY2&T`1#E +M)&`,4R7^Y254!W`#$DM[Y2\PX0F0`3=T`O`225?0!]`&T`70!-`#T`+0`=`` +MT-#0@M"#T/#0X#*0DJ/@,.`NY2&T`2F0DJ+@!/#@M`H+D)*EX`3PY)"2HO"0 +MDJ7@_Y"2I.#3GU`'L9'DD)*E\"*/"HT+Y0M4'Y"2$O!T`2_U@N0TB/6#X)"2 +M$/"0!/W@D)(3M`$%=`/P@`-T`?"0DA/@_^O#GT`$KPJ`/)"2$.`E#?^C\*/@ +MD$'6D_[OTYY`%'0!)0KU@N0TB/6#Y/"M"Z\*`E>`D)(1X/]T`24*]8+D-(CU +M@^_P(JT'=?`)[9"*2!)#7^#_D)(5\'1G+?6"Y#21]8/@5!^0DA3PTY]`!J/@ +MD)(4\)"2%.#_)>`DGO6"Y#1!]8/DD_IT`9/[[R7@)&;U@N0T0?6#=`&3*__D +MDSK#$_[O$__M)>`DPO6"Y#2)]8/N\*/O\*\%D)(4X/T25X"0DA3@_R+D_P)) +MJ)"2)1)#BQ(IV50!_Y"2H^!4_D_PX##@`K&1D)(E$D-K$BG9PQ,PX`J0``$2 +M0B"0DJ3P(I"2(A)#B^\20Y1>$`%>!P)>-`->/05>1@9>DP=>3@E>5PQ>8`U> +M:0Y>>QQ>&2U>(BY>A#!>*SL``%Z,D)(B$D-K`G-CD)(B$D-K`G-ID)(B +M$D-K`G.>D)(B$D-K`G/FD)(B$D-K`G0?D)(B$D-K`G0XD)(B$D-K`G+,D)(B +M$D-K@$:0DB(20VL"=("0DB(20VL"3?^0DB(20VL"?D&0DB(20VL"?6F0DB(2 +M0VL"#_=?`)D(I&$D-?K8*L@Y"2+.SPH^WP[W7P":0D1/ET +MBC7P^GL!HQ)#BY"2)Q)#:Y```Q)"(%0/_Y"2+A)#:^\20DV0DB<20VN0``(2 +M0B#_D)(N$D-KD``![Q)"7Y"2)Q)#:Y```1)"(/^0DBS@_*/@_?6"C(/O\!(I +MV8V"C(.C\)"2*N#^D)(EX/\D@O6"Y#2)]8/N\)"2)N#^=?`)[Y"*2A)#7^[P +M=?`)[Y"*2Q)#7W0!\)"2*^#^=?`)[Y"*3!)#7^[PCP_O)>`DQO6"Y#2/KX+U +M$(\1Y0]U\`*D)`+Y=(DU\'42`?43B11U\`GE#Y"*1A)#7Z^"A8,5CQ;E#W7P +M":0D1/ETBC7P=14/)>`DQO6" +MY#2/]8-T#_"C=/6`)^4/)>`DQO6"Y#2/]8-T#_"C=/"`$N4/)>`DQO6"Y#2/ +M]8/D\*-T#?#E#R7@)`+U@N0TB?6#Y/"C\"&5D`1'X*L2JA.I%!)"39`$1N"K +M$JH3J120``$20E^0!$7@A1&"A1"#\)`$1"&,D`1+X*L2JA.I%!)"39`$2N"K +M$JH3J120``$20E^0!$G@A1&"A1"#\)`$2(!8D`1/X*L2JA.I%!)"39`$3N"K +M$JH3J120``$20E^0!$W@A1&"A1"#\)`$3(`KD`13X*L2JA.I%!)"39`$4N"K +M$JH3J120``$20E^0!%'@A1&"A1"#\)`$4."%$8*%$(.C\*L2JA.I%,`#P`+` +M`1(IV?^K%ZH8J1D2*=E?T`'0`M`#$D)-JQ+E%"0!^>0U$_K``\`"P`$2*=G_ +MJQ>J&*D9D``!$D(@7]`!T`+0`Q)"3841@H40@\"#P(+@_X46@H45@^#^[U[0 +M@M"#\(41@H40@Z/`@\""X/^%%H*%%8.CX/[O7M""T(/PY0\EX"0"]8+D-(GU +M@^#^H^!.8$N0DC%T"_"0DC'@_\.4`%`"0=IT`7X`J`<(@`7#,\XSSMCY_^4/ +M)>`D`O6"Y#2)]8/@7OZCX%].8`J0DC'@)!"C\(!HD)(QX!3P@+OE#R7@),;U +M@N0TC_6#X/ZCX$Y@1Y"2,70/\)"2,>#_PY0`0#QT`7X`J`<(@`7#,\XSSMCY +M_^4/)>`DQO6"Y#2/]8/@7OZCX%].8`B0DC'@H_"`#9"2,>`4\("_Y)"2,O#E +M#R7@),;U@N0TC_6#X/ZCX$Y@1N20DC'PD)(QX/_#E!!``F&3=`%^`*@'"(`% +MPS/.,\[8^?_E#R7@),;U@N0TC_6#X%[^H^!?3F`&D)(QX(!CD)(QX`3P@+_E +M#R7@)`+U@N0TB?6#X/ZCX$Y@1N20DC'PD)(QX/_#E`Q0/'0!?@"H!PB`!<,S +MSC/.V/G_Y0\EX"0"]8+D-(GU@^!>_J/@7TY@")"2,>`D$(`)D)(QX`3P@+_D +MD)(S\)"2,N#_=?`)Y0^0BD@20U_O\)"2,^#^=?`)Y0^0BDD20U_N\.4/PY0@ +M4"QTA"4/]8+D-`3U@^#3GT`"@$=TA"4/]8+D-`3U@^##GE`(D)(SX*/P@#>` +M+72F)0_U@N0TD/6#X/^0DC+@_N_3GD`'D)(T[O"`%Y"2,^#^[\.>4`6C[O"` +M")"2,N"0DC3PD)(TX/VO#Q)7@)"2-.#_="8E#_6"Y#21]8/O\)"2,N#_TY03 +M0`>0BD-T`_`B[].4"T`'D(I#=`+P(N_3E`-`!Y"*0W0!\"+DD(I#\"+3$*\! +MP\#0Y/W\[S#@`GV`[\,3D/T0\*X$KP70T)*O(L#@P/#`@\""P-!UT`#``,`! +MP`+``\`$P`7`!L`'4Y'OD`!1X/^0`%7@7_4]D`!2X/^0`%;@7_4^Y3TPY`:0 +M`%5T$/#E/3#E!I``570@\.4],.8;D`!5=$#PD))"X%0#_[\#"Y"2/^!@!7\! +M$DU7Y3TPYQ60`%5T@/"0DD+@5`/_OP,%?P(235?E/C#@!I``5G0!\.4^,.$& +MD`!6=`+PY3XPX@:0`%9T!/#E/C#C!I``5G0(\-`'T`;0!=`$T`/0`M`!T`#0 +MT-""T(/0\-#@,N_#E"!0.>\PX!?MQ%3P_>_#$_XDI/6"Y#0$]8/@5`^`$._# +M$_XDI/6"Y#0$]8/@5/#P=*0N]8+D-`3U@^!-\"*M!^W#E"!0$W2$+?6"Y#0$ +M]8/@5'^0DBGP@!%TIBWU@N0TD/6#X%1_D)(I\)"2*>#Y5!^C\'7P">V0BD@2 +M0U_@_Y"2+/#M)>`D`O6"Y#2)]8/@^Z/@D)(MR_"CZ_#M)>`DQO6"Y#2/]8/@ +M^Z/@D)(OR_"CZ_"0DBK@_B7@)&;U@N0T0?6#Y)/Z=`&3^^TEX"3"]8+D-(GU +M@^KPH^OP[L.?0`+!^)"2*N#_=&XD\/]T`7X`J`<(@`7#,\XSSMCY_Y"2+>!>_J/@7TYP +M)Y"2*^#_PY004%ET`7X`J`<(@`7#,\XSSMCY_Y"2+^!>_J/@7TY@/)"2*^"T +M$0V0DB[@,.<&D)(K=!?PD)(KX/]D$V`$[[02#9"2+>`PX`:0DBMT&/"0DBO@ +MD)(J\)"2*?"`0I"2*^`$\,%6D)(LX/R0DBK@_VQP<71G+?6"Y#21]8/O\'7P +M">V0BDH20U_@M`$0Z2#F#)"2*N!$0)"2*?"``Z\!(I"2*N#_)>`DGO6"Y#1! +M]8/DD_IT`9/[[R7@)&;U@N0T0?6#=`&3*__DDSK#$_[O$__M)>`DPO6"Y#2) +M]8/N\*/O\(!FD)(JX-.<0%Z0DBS@_W1G+?6"Y#21]8/O\)"2*N_PD)(I\/RC +MX/\EX"2>]8+D-$'U@^23^G0!D_OO)>`D9O6"Y#1!]8-T`9,K_^23.L,3_N\3 +M_^TEX"3"]8+D-(GU@^[PH^_PKP0B=`$M]8+D-(CU@^3PKP60DBG@1(#]$E>` +MD)(IX$2`_R*L!^S#E"!0$W2$+/6"Y#0$]8/@5'^0DBGP@!%TIBSU@N0TD/6# +MX%1_D)(I\)"2*>!4'_^0DBSP=?`)[)"*21)#7^"0DB[P=?`)[)"*2!)#7^#^ +MD)(O\.PEX"3&]8+D-(_U@^#[H^"0DC#+\*/K\.PEX"0"]8+D-(GU@^#[H^"0 +MDC++\*/K\._3GD`,D)(OX)"2+/"0DBGP[7`"(6J0DBWM\)"2*>`PY@Z0DBS@ +MD)(I\)"2+>`4\)"2+>!P`B%JD)(LX/_3E`!0`B%JY)"2*_#O%)"2*O"0DB[@ +M_9"2*N#_TYU`;^^4$$`A[R3P_W0!?@"H!PB`!<,SSC/.V/G_D)(RX%[^H^!? +M3G`GD)(JX/_#E!!0-W0!?@"H!PB`!<,SSC/.V/G_D)(PX%[^H^!?3F`:D)(J +MX)"2*?"0DBO@!/"0DBW@_Y"2*^!O8`B0DBK@%/"`@Y"2+>#_D)(KX,.?4`^0 +MDBK@M04(D)(NX)"2*?"0DBG@_R7@))[U@N0T0?6#Y)/Z=`&3^^\EX"1F]8+D +M-$'U@W0!DRO_Y),ZPQ/^[Q/_["7@),+U@N0TB?6#[O"C[_"O!)"2*>#]$E>` +MD)(IX/\BY)"2&O"0DAK@_\.40$`#`G#5[[0@%)".Q>`$\)")`>#_D([%X+4' +M`N3PD)(:X/]U\`F0BDL20U_@9`%@`P)PS.\EX"2`]8+D-(?U@^#^H^#3E`#N +ME`!0`P)PS)"2&N"4($`)D([%X&`#`G#5D)(:X'7P"J0D`/ETA#7P=1(!]1.) +M%.#_)>`D@/6"Y#2']8/@_:/@D)(?S?"C[?#O)>`DQ/6"Y#2,]8/@_Z/@D)(A +MS_"C[_"0DAK@_\.4(%`3=(0O]8+D-`3U@^!4/Y"2&_"`%)"2&N`DIO6"Y#20 +M]8/@5#^0DAOPD)(;X/Y4'Z/PD)(:X/]U\`F0BD@20U_@D)(D\'3F+_6"Y#20 +M]8/@PY0%0`*A'I"2).#_D)(0`;OD$$2@`>0DAS@D$$N +MDY"2(_"0DB/@=?`&I"10^71`-?!U#__U$(D1D)(;X)!!\I/_TY"2(N"?D)(A +MX)0`0`V0DAK@_^3]$F?\`G!BD)(:X"7@),+U@N0TB?6#X/^CX)"2'<_PH^_P +MJP^J$*D1$BG9_WX`JQ*J$ZD4$D*7_:SP$BGRD)(=[H_P$D*!JP^J$*D1D``! +M$D(@_WX`JQ*J$ZD4D``"$D+"_:SP$BGRD)(=[H_P$D*!JP^J$*D1D``"$D(@ +M_WX`JQ*J$ZD4D``$$D+"_:SP$BGRD)(=[H_P$D*!JP^J$*D1D``#$D(@_WX` +MJQ*J$ZD4D``&$D+"_:SP$BGRD)(=[H_P$D*!JP^J$*D1D``$$D(@_WX`JQ*J +M$ZD4D``($D+"_:SP$BGRD)(=[H_P$D*!JP^J$*D1D``%$D(@_WX`D)(?X/RC +MX/T2*?+3D)(>X)^0DAW@GD`,H^"?\)"2'>">\(`'Y)"2'?"C\)"2'>#\H^#] +MD)(:X/\EX"3"]8+D-(GU@^SPH^WPD)(;X"7@)&;U@N0T0?6#Y)/Z=`&3^]/M +MF^R:0`8299L"<#"0DAO@)>`DGO6"Y#1!]8/DD_YT`9/_PY"2'N"?D)(=X)Y` +M`P)P,)"2&N#_?0$29_P"<#"0DAK@_R3F]8+D-)#U@^#\9`5@`L']D(I#X/ZT +M`PN0DAS@PY090#V`+NZT`@N0DAS@PY010"Z`'Y"*0^#^M`$+D)(20CH3PD)(:X/XDA/6"Y#2,]8/@D)(H +M\'1$+O6"Y#2.]8/@_L.4,%`*Y)"2*/!TYB_!IY".A.!D`6`"P9R0DAK@)(7U +M@N0TCO6#X&0*8%N0DAK@_^XD!?OD,_IT02_U@N0TB/6#X/_3F^ID@/AT@)A0 +M.)"2&N#^[R0%^^0S^G1$+O6"Y#2.]8/@TYOJ9(#X=("84!:0DAK@)";U@N0T +MD?6#X/^0DAS@;V!6D)(:X"1$]8+D-([U@^#_TY1"0`B0DBAT!?"`$>_3E#F0 +MDBA`!70#\(`#=`'PD)(:X/\D1/6"Y#2.]8/@_G1!+_6"Y#2(]8/N\)"2&N`D +MA?6"Y#2.@"^0DAK@_R3F]8+D-)#U@^3P=(4O]8+D-([U@^`$\(`4Y)"2*/"0 +MDAK@).;U@N0TD/6#Y/"0DAS@_I"2&N#_)";U@N0TD?6#[O"0DBC@_G2$+_6" +MY#2,]8/N\'7P">^0BDP20U_@M`$1Y)"2*/!TYB_U@N0TD/6#Y/"0DBC@_0)P +M+>QD!F`#`G`PD)(=\*/PD$(3D_]^`)"2'^#\H^#]$BGRD)(F[O"C[_"0DAK@ +M)(3U@N0TC/6#X)"2*/#DD)(E\)"2)>#_TY0$4$>K$JH3J11U\`+OI/6"A?"# +M$D+"_:SP[Y!"#I/_?@`2*?*0DAWNC_`20H&0DB;@_J/@_].0DA[@GY"2'>"> +M4`B0DB7@!/"`KY"2)>##$_"0DBC@_[0!#9"2)>!P79"2*`3P@%OOM`,=D)(E +MX/]P")"2*'0#\(!([[0!")"2*'0!\(`\@#60DBC@9`5P,I"2)>#_<`B0DBAT +M!?"`#^^0DBBT`05T`_"``W0!\-.0DB+@E`.0DB'@E`!`!>20DBCPTY"2(N"4 +M`Y"2(>"4`$`%Y)"2*/"0DBC@_9"2&N#_)(3U@N0TC/6#[?`295N0DAK@_R3F +M]8+D-)#U@^#3E`50#W3F+_6"Y#20]8/@!/"`#Y"2&N`DYO6"Y#20]8/D\*L2 +MJA.I%.3U\!)"^JL2JA.I%)```N3U\!)#&9``!.3U\!)#&9``!N3U\!)#&9`` +M".3U\!)#&9"2&N#_)>`D@/6"Y#2']8/D\*/P[R7@),3U@N0TC/6#Y/"C\.\E +MX"1$]8+D-(WU@^3PH_"0DAK@!/`":<$BD`1$=!'PHW3P\*-T#_"CY/"0DAKP +MD)(:X/_#E!!0%'2D+_6"Y#0$]8/D\)"2&N`$\(#BY)".Q?"0B0$$\.20DAKP +MD)(:X/_#E$!``D'+=?`*[Y"$`!)#7^3PH_!U\`KOD(0"$D-?Y/"C\'7P"N^0 +MA`020U_D\*/P=?`*[Y"$!A)#7^3PH_!U\`KOD(0($D-?Y/"C\'0F+_6"Y#21 +M]8-T$_!TA2_U@N0TCO6#Y/!TA"_U@N0TC/6#Y/#O)>`D@/6"Y#2']8/D\*/P +M[R7@),3U@N0TC/6#Y/"C\.\EX"3$]8+D-(WU@^3PH_#O)>`D1/6"Y#2-]8/D +M\*/P[R7@),;U@N0TCO6#Y/"C\.\EX"1&]8+D-(_U@^3PH_!TAB_U@N0TD/6# +MY/!T1B_U@N0TD/6#Y/!TYB_U@N0TD/6#Y/"00<23_G0!D_^008QT`9,O_^23 +M/L,3_N\3_Y"2&N#])>`DPO6"Y#2)]8/N\*/O\'7P">V0BDL20U]T`?!U\`GM +MD(I*$D-?=`'P=((M]8+D-(GU@W0,\'7P">V0BD820U]T__"C\'7P">V0BD02 +M0U_D\*-T#_!U\`GMD(I($D-?=!/P=?`)[9"*21)#7^3P[<.4(%`/=(0M]8+D +M-`3U@W03\(`-=*8M]8+D-)#U@W03\)"2&N`$\"$8(A(IV?_#E$!0%)```A)" +M(/YT1"_U@N0TCO6#[O`B[[1`"I```A)"()"*0O`BD``$$D(@_U0__N]4@,03 +M$Q-4`?VO!@)>J!(IV9")`?`BD)*:[O"C[_#DH_"C\)"2FN#^H^#U@HZ#X&`L +MPY"2G>"4Z)"2G."4`T`*D`'&X$00\'\`(I"2G.1U\`$20H%_"GX`$C=4@,9_ +M`2(2*=GU(2+3$*\!P\#0D)(E$BJ+`````)```1)"()"29/"0``,20B"0DE3P +M$D?3PH^_P@`^0DE]T!?"0DEWD\*-T`_"0 +MDEW@H^"0!5CP(A(IV9"27/!@!^3]?P0210V0DES@D`'G\"*0`@G@_1(IV?ZO +M!>TND))V\)```1)"(/_M+Y"2=_"0``(20B#_[2^0DGCPD``#$D(@_^TOD))Y +M\)``!!)"(/^N!>TOD))Z\"+3$*\!P\#0D)(E$D.+D)(E$D-KD``!$D+"^N7P +M)`#_Y#K^D)(E$D-KD``![H_P$D,9$BG9_V`LM5X6D)(E$D-KD``!$D+"96!P +M!.5?9?!@(Y"2)1)#:Y```1)"PO^N\)'X@!"0DB420VL2*=EE7F`#$E?3T-"2 +MKR*0DBCN\*/O\'5>`8Y?]6#D_7\+L3SD_7\"L3P23[OD_Q)/K^3U8I`!R>5B +M\)"2*.#\H^#][/N-1.3U17T!?V!^`0(UJ],0KP'#P-"0DBOM\)"2*N_PTY0' +M4$^CX'`:D)(JX/]T`:@'"(`"PS/8_/3_D`!'X%_P@!>0DBK@_W0!J`<(@`+# +M,]C\_Y``1^!/\!)/ZI"2*N#_=`&H!PB``L,SV/ST_Y``1H!:D)(JX"3X\*/@ +M`$\(#KD)(:X,.49%`0D``PX*L1JA*I$Q)" +M37\!(G\`(N20DJ;PH_"0!?C@<`^CX'`+H^!P!Z/@<`-_`2+3D)*GX)3HD)*F +MX)0#0`-_`")_,GX`$C=4D)*FY'7P`1)"@8#&D)'_$D-3D("%$BI_?WA^"!(O +MV9"2`Q)#4Y"`A1(J?W\$?@P2+]F0D@<20U.0@(42*G]_`'X($B_9D)(+$D-3 +MD("%$BI_?W!^#A(OV9"`61(JBP`#+97D_?\2-(&0DG[@M`$1D(!9$BJ+``,M +ME>3]?P$2-($B?WA^"!(GWI"1_Q(J?W\$?@P2)]Z0D@,2*G]_`'X($B?>D)(' +M$BI_D))^X)"1_[0!#1)#4^]4Q__M5,?]@`<20U/O5,?_[)"`A1(J?W]X?@@2 +M+]F0D@,20U/O5`__[)"`A1(J?W\$?@P2+]F0D@<20U/O1`+_[)"`A1(J?W\` +M?@@2+]E_<'X.$B?>D)(+$BI_D("%$BJ+`!LEH']P?@X2+]F0@%D2*HL````` +MY/W_$C2!D))^X+0!$9"`61(JBP````#D_7\!$C2!(N]P`P)YG9"2#^!@`P)] +M:)"1^Q)#4Y"`A1(J?W^,?@@2+]F0D:<20U.0@(42*G]_1'X($B_9D)&K$D-3 +MD("%$BI_?UQ^"!(OV9"1KQ)#4Y"`A1(J?W]L?@X2+]F0D;,20U.0@(42*G]_ +M<'X.$B_9D)&W$D-3D("%$BI_?W1^#A(OV9"1NQ)#4Y"`A1(J?W]X?@X2+]F0 +MD;\20U.0@(42*G]_?'X.$B_9D)'#$D-3D("%$BI_?X!^#A(OV9"1QQ)#4Y"` +MA1(J?W^$?@X2+]F0D,20U.0@(42 +M*G]_X'X.$B_9D)'G$D-3D("%$BI_?^Q^#A(OV9"1ZQ)#4Y"`A1(J?W\$?@P2 +M+]F0D>\20U.0@(42*G]_!'X-$B_9D)'S$D-3D("%$BI_?PQ^"1(OV9"1]Q)# +M4Y"`A1(J?W\$?@@2+]F0D@]T`?`BD)(/X&0!8`*A:'^,?@@2)]Z0D?L2*G]_ +M1'X($B?>D)&G$BI_?UQ^"!(GWI"1JQ(J?W]L?@X2)]Z0D:\2*G]_<'X.$B?> +MD)&S$BI_?W1^#A(GWI"1MQ(J?W]X?@X2)]Z0D;L2*G]_?'X.$B?>D)&_$BI_ +M?X!^#A(GWI"1PQ(J?W^$?@X2)]Z0D<<2*G]_B'X.$B?>D)'+$BI_?XQ^#A(G +MWI"1SQ(J?W_0?@X2)]Z0D=,2*G]_U'X.$B?>D)'7$BI_?]A^#A(GWI"1VQ(J +M?W_D)'C$BI_?^Q^#A(GWI"1YQ(J?W\$?@P2 +M)]Z0D>L2*G]_!'X-$B?>D)'O$BI_?PQ^"1(GWI"1\Q(J?W\$?@@2)]Z0D?<2 +M*G]_C'X($B?>D)*>$BI_D)*>$D-3[43`_>R0DIX2*G^0DIX20U.0@(42*G]_ +MC'X($B_9D("%$BJ+``$``']$?@@2+]F0@(42*HL`VR6D?UQ^"!(OV9"`A1(J +MBR#;):1_;'X.$B_9D("%$BJ+(-LEI']P?@X2+]F0@(42*HL$&R6D?W1^#A(O +MV9"`A1(JBP0;):1_>'X.$B_9D("%$BJ+!!LEI']\?@X2+]F0@(42*HL$&R6D +M?X!^#A(OV9"`A1(JBV/;):1_A'X.$B_9D("%$BJ+!!LEI'^(?@X2+]F0@(42 +M*HL@VR6D?XQ^#A(OV9"`A1(JBR#;):1_T'X.$B_9D("%$BJ+(-LEI'_4?@X2 +M+]F0@(42*HL@VR6D?]A^#A(OV9"`A1(JBP`;):1_W'X.$B_9D("%$BJ+`!LE +MI'_@?@X2+]F0@(42*HLDVR6D?^Q^#A(OV7\$?@P2)]Z0DIX2*G^0DIX20U/D +M_^R0DIX2*G^0DIX20U/O1!'_[)"2GA(J?Y"2GA)#4Y"`A1(J?W\$?@P2+]E_ +M!'X-$B?>D)*>$BI_D)*>$D-3[U3P_^R0DIX2*G^0DIX20U/O1`'_[)"2GA(J +M?Y"2GA)#4Y"`A1(J?W\$?@T2+]E_#'X)$B?>D)*>$BI_D)*>$D-3Y/_LD)*> +M$BI_D)*>$D-3[T01_^R0DIX2*G^0DIX20U.0@(42*G]_#'X)$B_9?PQ^"1(G +MWI"2GA(J?Y"2GA)#4^U4#_WL5/#\D)*>$BI_D)*>$D-3[400_>Q$`?R0DIX2 +M*G^0DIX20U.0@(42*G]_#'X)$B_9?P1^"!(GWI"2GA(J?Y"2GA)#4^]4\/_L +MD)*>$BI_D)*>$D-3[T0!_^R0DIX2*G^0DIX20U.0@(42*G]_!'X($B_9Y)"2 +M#_`BBP^*$(D1D``"$D(@D))"\.`PX$N0DCET`?!_@'X($B?>D)([$BI_JP^J +M$*D1D``!$D(@_^3\_?YX&A(J;*@$J06J!JL'D)([$D-3[%0#_!)#1I"211(J +M?Y`%(N3P@"WDD)(Y\'^`?@@2)][L5`/\[$3`_)"2.Q(J?Y"2.Q)#4Y"`A1(J +M?W^`?@@2+]F0DD+@,.$;?0Q_1Q)-0I``2.!$#/U_2!)-0I``1N!$$(`>D`!' +MX%3S_7]'$DU"D`!(X%3S_7]($DU"D`!&X%3O_7]&$DU"Y)"2/_`BD``"$D(@ +MD))#\.!@!.#T<"&BK^0S]0_"KY``1^!4^_U_1Q)-0GU`?P$2-J_E#R3_DJ\B +MY/U_11)-0I`$_>3PH_"0DD/PD)))\)"23/"0DDKPD))-\)"22_"0DD[PD)(U +M!/#DH_"C\*/PD)(Z\)"2/_"0DD'PD))3\)"21/"0DD#PD)(Y\)``4>!$P/U_ +M40)-0I"24^!D`6`(D))!X&`"X:F0DC7@PY3_4`7@!/"`.Y"2-N##E/]0!N`$ +M\.2`*)"2-^##E/]0"N`$\.20DC;P@!60DCC@PY3_4!#@!/#DD)(W\)"2-O"0 +MDC7PD`!$X%0,8';@,.(RD)))X,.4_U`%X`3P@"20DDK@PY3_4`;@!/#D@!&0 +MDDO@PY3_4`S@!/#DD))*\)"22?"0`$3@,.,RD)),X,.4_U`%X`3P@"20DDW@ +JPY3_4`;@!/#D@!&0DD[@PY3_4`S@!/#DD))-\)"23/"0!/W@1`'P(GP. +` +end From owner-svn-src-head@freebsd.org Thu Dec 31 22:32: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 8DF05A57906; Thu, 31 Dec 2015 22:32:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5276418C5; Thu, 31 Dec 2015 22:32:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMWaAm075800; Thu, 31 Dec 2015 22:32:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMWaDZ075798; Thu, 31 Dec 2015 22:32:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512312232.tBVMWaDZ075798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 31 Dec 2015 22:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293010 - head/sys/dev/rtwn 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, 31 Dec 2015 22:32:37 -0000 Author: adrian Date: Thu Dec 31 22:32:36 2015 New Revision: 293010 URL: https://svnweb.freebsd.org/changeset/base/293010 Log: [rtwn] bring over initial rtwn driver. This is a port from openbsd. It's incomplete and unstable, but it's better than nothing. I have no plans to MFC this until it's complete and stable. Submitted by: kevlo Added: head/sys/dev/rtwn/ head/sys/dev/rtwn/if_rtwn.c (contents, props changed) head/sys/dev/rtwn/if_rtwnreg.h (contents, props changed) Added: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/rtwn/if_rtwn.c Thu Dec 31 22:32:36 2015 (r293010) @@ -0,0 +1,3490 @@ +/* $OpenBSD: if_rtwn.c,v 1.6 2015/08/28 00:03:53 deraadt Exp $ */ + +/*- + * Copyright (c) 2010 Damien Bergamini + * Copyright (c) 2015 Stefan Sperling + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for Realtek RTL8188CE + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define RTWN_DEBUG +#ifdef RTWN_DEBUG +#define DPRINTF(x) do { if (sc->sc_debug > 0) printf x; } while (0) +#define DPRINTFN(n, x) do { if (sc->sc_debug >= (n)) printf x; } while (0) +#else +#define DPRINTF(x) +#define DPRINTFN(n, x) +#endif + +/* + * PCI configuration space registers. + */ +#define RTWN_PCI_IOBA 0x10 /* i/o mapped base */ +#define RTWN_PCI_MMBA 0x18 /* memory mapped base */ + +#define RTWN_INT_ENABLE (R92C_IMR_ROK | R92C_IMR_VODOK | R92C_IMR_VIDOK | \ + R92C_IMR_BEDOK | R92C_IMR_BKDOK | R92C_IMR_MGNTDOK | \ + R92C_IMR_HIGHDOK | R92C_IMR_BDOK | R92C_IMR_RDU | \ + R92C_IMR_RXFOVW) + +struct rtwn_ident { + uint16_t vendor; + uint16_t device; + const char *name; +}; + + +static const struct rtwn_ident rtwn_ident_table[] = { + { 0x10ec, 0x8176, "Realtek RTL8188CE" }, + { 0, 0, NULL } +}; + + +static void rtwn_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static void rtwn_setup_rx_desc(struct rtwn_softc *, struct r92c_rx_desc *, + bus_addr_t, size_t, int); +static int rtwn_alloc_rx_list(struct rtwn_softc *); +static void rtwn_reset_rx_list(struct rtwn_softc *); +static void rtwn_free_rx_list(struct rtwn_softc *); +static int rtwn_alloc_tx_list(struct rtwn_softc *, int); +static void rtwn_reset_tx_list(struct rtwn_softc *, int); +static void rtwn_free_tx_list(struct rtwn_softc *, int); +static struct ieee80211vap *rtwn_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); +static void rtwn_vap_delete(struct ieee80211vap *); +static void rtwn_write_1(struct rtwn_softc *, uint16_t, uint8_t); +static void rtwn_write_2(struct rtwn_softc *, uint16_t, uint16_t); +static void rtwn_write_4(struct rtwn_softc *, uint16_t, uint32_t); +static uint8_t rtwn_read_1(struct rtwn_softc *, uint16_t); +static uint16_t rtwn_read_2(struct rtwn_softc *, uint16_t); +static uint32_t rtwn_read_4(struct rtwn_softc *, uint16_t); +static int rtwn_fw_cmd(struct rtwn_softc *, uint8_t, const void *, int); +static void rtwn_rf_write(struct rtwn_softc *, int, uint8_t, uint32_t); +static uint32_t rtwn_rf_read(struct rtwn_softc *, int, uint8_t); +static int rtwn_llt_write(struct rtwn_softc *, uint32_t, uint32_t); +static uint8_t rtwn_efuse_read_1(struct rtwn_softc *, uint16_t); +static void rtwn_efuse_read(struct rtwn_softc *); +static int rtwn_read_chipid(struct rtwn_softc *); +static void rtwn_read_rom(struct rtwn_softc *); +static int rtwn_ra_init(struct rtwn_softc *); +static void rtwn_tsf_sync_enable(struct rtwn_softc *); +static void rtwn_set_led(struct rtwn_softc *, int, int); +static void rtwn_calib_to(void *); +static int rtwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static int rtwn_updateedca(struct ieee80211com *); +static void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); +static int8_t rtwn_get_rssi(struct rtwn_softc *, int, void *); +static void rtwn_rx_frame(struct rtwn_softc *, struct r92c_rx_desc *, + struct rtwn_rx_data *, int); +static int rtwn_tx(struct rtwn_softc *, struct mbuf *, + struct ieee80211_node *); +static void rtwn_tx_done(struct rtwn_softc *, int); +static int rtwn_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); +static int rtwn_transmit(struct ieee80211com *, struct mbuf *); +static void rtwn_parent(struct ieee80211com *); +static void rtwn_start(struct rtwn_softc *sc); +static void rtwn_watchdog(void *); +static int rtwn_power_on(struct rtwn_softc *); +static int rtwn_llt_init(struct rtwn_softc *); +static void rtwn_fw_reset(struct rtwn_softc *); +static void rtwn_fw_loadpage(struct rtwn_softc *, int, const uint8_t *, + int); +static int rtwn_load_firmware(struct rtwn_softc *); +static int rtwn_dma_init(struct rtwn_softc *); +static void rtwn_mac_init(struct rtwn_softc *); +static void rtwn_bb_init(struct rtwn_softc *); +static void rtwn_rf_init(struct rtwn_softc *); +static void rtwn_cam_init(struct rtwn_softc *); +static void rtwn_pa_bias_init(struct rtwn_softc *); +static void rtwn_rxfilter_init(struct rtwn_softc *); +static void rtwn_edca_init(struct rtwn_softc *); +static void rtwn_write_txpower(struct rtwn_softc *, int, uint16_t[]); +static void rtwn_get_txpower(struct rtwn_softc *, int, + struct ieee80211_channel *, struct ieee80211_channel *, + uint16_t[]); +static void rtwn_set_txpower(struct rtwn_softc *, + struct ieee80211_channel *, struct ieee80211_channel *); +static void rtwn_scan_start(struct ieee80211com *); +static void rtwn_scan_end(struct ieee80211com *); +static void rtwn_set_channel(struct ieee80211com *); +static void rtwn_update_mcast(struct ieee80211com *); +static void rtwn_set_chan(struct rtwn_softc *, + struct ieee80211_channel *, struct ieee80211_channel *); +static int rtwn_iq_calib_chain(struct rtwn_softc *, int, uint16_t[2], + uint16_t[2]); +static void rtwn_iq_calib_run(struct rtwn_softc *, int, uint16_t[2][2], + uint16_t[2][2]); +static int rtwn_iq_calib_compare_results(uint16_t[2][2], uint16_t[2][2], + uint16_t[2][2], uint16_t[2][2], int); +static void rtwn_iq_calib_write_results(struct rtwn_softc *, uint16_t[2], + uint16_t[2], int); +static void rtwn_iq_calib(struct rtwn_softc *); +static void rtwn_lc_calib(struct rtwn_softc *); +static void rtwn_temp_calib(struct rtwn_softc *); +static void rtwn_init_locked(struct rtwn_softc *); +static void rtwn_init(struct rtwn_softc *); +static void rtwn_stop_locked(struct rtwn_softc *); +static void rtwn_stop(struct rtwn_softc *); +static void rtwn_intr(void *); +static void rtwn_hw_reset(void *, int); + +/* Aliases. */ +#define rtwn_bb_write rtwn_write_4 +#define rtwn_bb_read rtwn_read_4 + +static int rtwn_probe(device_t); +static int rtwn_attach(device_t); +static int rtwn_detach(device_t); +static int rtwn_shutdown(device_t); +static int rtwn_suspend(device_t); +static int rtwn_resume(device_t); + +static device_method_t rtwn_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rtwn_probe), + DEVMETHOD(device_attach, rtwn_attach), + DEVMETHOD(device_detach, rtwn_detach), + DEVMETHOD(device_shutdown, rtwn_shutdown), + DEVMETHOD(device_suspend, rtwn_suspend), + DEVMETHOD(device_resume, rtwn_resume), + + DEVMETHOD_END +}; + +static driver_t rtwn_driver = { + "rtwn", + rtwn_methods, + sizeof (struct rtwn_softc) +}; +static devclass_t rtwn_devclass; + +DRIVER_MODULE(rtwn, pci, rtwn_driver, rtwn_devclass, NULL, NULL); + +MODULE_VERSION(rtwn, 1); + +MODULE_DEPEND(rtwn, pci, 1, 1, 1); +MODULE_DEPEND(rtwn, wlan, 1, 1, 1); +MODULE_DEPEND(rtwn, firmware, 1, 1, 1); + +static int +rtwn_probe(device_t dev) +{ + const struct rtwn_ident *ident; + + for (ident = rtwn_ident_table; ident->name != NULL; ident++) { + if (pci_get_vendor(dev) == ident->vendor && + pci_get_device(dev) == ident->device) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +static int +rtwn_attach(device_t dev) +{ + struct rtwn_softc *sc = device_get_softc(dev); + struct ieee80211com *ic = &sc->sc_ic; + uint32_t lcsr; + uint8_t bands; + int i, count, error, rid; + + sc->sc_dev = dev; + sc->sc_debug = 0; + + /* + * Get the offset of the PCI Express Capability Structure in PCI + * Configuration Space. + */ + error = pci_find_cap(dev, PCIY_EXPRESS, &sc->sc_cap_off); + if (error != 0) { + device_printf(dev, "PCIe capability structure not found!\n"); + return (error); + } + + /* Enable bus-mastering. */ + pci_enable_busmaster(dev); + + rid = PCIR_BAR(2); + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem == NULL) { + device_printf(dev, "can't map mem space\n"); + return (ENOMEM); + } + sc->sc_st = rman_get_bustag(sc->mem); + sc->sc_sh = rman_get_bushandle(sc->mem); + + /* Install interrupt handler. */ + count = 1; + rid = 0; + if (pci_alloc_msi(dev, &count) == 0) + rid = 1; + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | + (rid != 0 ? 0 : RF_SHAREABLE)); + if (sc->irq == NULL) { + device_printf(dev, "can't map interrupt\n"); + return (ENXIO); + } + + RTWN_LOCK_INIT(sc); + callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); + callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_reinit_task, 0, rtwn_hw_reset, sc); + mbufq_init(&sc->sc_snd, ifqmaxlen); + + error = rtwn_read_chipid(sc); + if (error != 0) { + device_printf(dev, "unsupported test chip\n"); + goto fail; + } + + /* Disable PCIe Active State Power Management (ASPM). */ + lcsr = pci_read_config(sc->sc_dev, sc->sc_cap_off + PCIER_LINK_CTL, 4); + lcsr &= ~PCIEM_LINK_CTL_ASPMC; + pci_write_config(sc->sc_dev, sc->sc_cap_off + PCIER_LINK_CTL, lcsr, 4); + + /* Allocate Tx/Rx buffers. */ + error = rtwn_alloc_rx_list(sc); + if (error != 0) { + device_printf(dev, "could not allocate Rx buffers\n"); + goto fail; + } + for (i = 0; i < RTWN_NTXQUEUES; i++) { + error = rtwn_alloc_tx_list(sc, i); + if (error != 0) { + device_printf(dev, "could not allocate Tx buffers\n"); + goto fail; + } + } + + /* Determine number of Tx/Rx chains. */ + if (sc->chip & RTWN_CHIP_92C) { + sc->ntxchains = (sc->chip & RTWN_CHIP_92C_1T2R) ? 1 : 2; + sc->nrxchains = 2; + } else { + sc->ntxchains = 1; + sc->nrxchains = 1; + } + rtwn_read_rom(sc); + + device_printf(sc->sc_dev, "MAC/BB RTL%s, RF 6052 %dT%dR\n", + (sc->chip & RTWN_CHIP_92C) ? "8192CE" : "8188CE", + sc->ntxchains, sc->nrxchains); + + ic->ic_softc = sc; + ic->ic_name = device_get_nameunit(dev); + ic->ic_opmode = IEEE80211_M_STA; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ + + /* set device capabilities */ + ic->ic_caps = + IEEE80211_C_STA /* station mode */ + | IEEE80211_C_MONITOR /* monitor mode */ + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ + | IEEE80211_C_SHSLOT /* short slot time supported */ + | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ + | IEEE80211_C_BGSCAN /* capable of bg scanning */ + | IEEE80211_C_WME /* 802.11e */ + ; + + bands = 0; + setbit(&bands, IEEE80211_MODE_11B); + setbit(&bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, &bands); + + ieee80211_ifattach(ic); + + ic->ic_wme.wme_update = rtwn_updateedca; + ic->ic_update_mcast = rtwn_update_mcast; + ic->ic_scan_start =rtwn_scan_start; + ic->ic_scan_end = rtwn_scan_end; + ic->ic_set_channel = rtwn_set_channel; + ic->ic_raw_xmit = rtwn_raw_xmit; + ic->ic_transmit = rtwn_transmit; + ic->ic_parent = rtwn_parent; + ic->ic_vap_create = rtwn_vap_create; + ic->ic_vap_delete = rtwn_vap_delete; + + ieee80211_radiotap_attach(ic, + &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), + RTWN_TX_RADIOTAP_PRESENT, + &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), + RTWN_RX_RADIOTAP_PRESENT); + + /* + * Hook our interrupt after all initialization is complete. + */ + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, rtwn_intr, sc, &sc->sc_ih); + if (error != 0) { + device_printf(dev, "can't establish interrupt, error %d\n", + error); + goto fail; + } + + if (bootverbose) + ieee80211_announce(ic); + + return (0); + +fail: + rtwn_detach(dev); + return (error); +} + + +static int +rtwn_detach(device_t dev) +{ + struct rtwn_softc *sc = device_get_softc(dev); + int i; + + if (sc->sc_ic.ic_softc != NULL) { + ieee80211_draintask(&sc->sc_ic, &sc->sc_reinit_task); + rtwn_stop(sc); + + callout_drain(&sc->calib_to); + callout_drain(&sc->watchdog_to); + ieee80211_ifdetach(&sc->sc_ic); + mbufq_drain(&sc->sc_snd); + } + + /* Uninstall interrupt handler. */ + if (sc->irq != NULL) { + bus_teardown_intr(dev, sc->irq, sc->sc_ih); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), + sc->irq); + pci_release_msi(dev); + } + + /* Free Tx/Rx buffers. */ + for (i = 0; i < RTWN_NTXQUEUES; i++) + rtwn_free_tx_list(sc, i); + rtwn_free_rx_list(sc); + + if (sc->mem != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem), sc->mem); + + RTWN_LOCK_DESTROY(sc); + return (0); +} + +static int +rtwn_shutdown(device_t dev) +{ + + return (0); +} + +static int +rtwn_suspend(device_t dev) +{ + return (0); +} + +static int +rtwn_resume(device_t dev) +{ + + return (0); +} + +static void +rtwn_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + + if (error != 0) + return; + KASSERT(nsegs == 1, ("too many DMA segments, %d should be 1", nsegs)); + *(bus_addr_t *)arg = segs[0].ds_addr; +} + +static void +rtwn_setup_rx_desc(struct rtwn_softc *sc, struct r92c_rx_desc *desc, + bus_addr_t addr, size_t len, int idx) +{ + + memset(desc, 0, sizeof(*desc)); + desc->rxdw0 = htole32(SM(R92C_RXDW0_PKTLEN, len) | + ((idx == RTWN_RX_LIST_COUNT - 1) ? R92C_RXDW0_EOR : 0)); + desc->rxbufaddr = htole32(addr); + bus_space_barrier(sc->sc_st, sc->sc_sh, 0, sc->sc_mapsize, + BUS_SPACE_BARRIER_WRITE); + desc->rxdw0 |= htole32(R92C_RXDW0_OWN); +} + +static int +rtwn_alloc_rx_list(struct rtwn_softc *sc) +{ + struct rtwn_rx_ring *rx_ring = &sc->rx_ring; + struct rtwn_rx_data *rx_data; + bus_size_t size; + int i, error; + + /* Allocate Rx descriptors. */ + size = sizeof(struct r92c_rx_desc) * RTWN_RX_LIST_COUNT; + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + size, 1, size, 0, NULL, NULL, &rx_ring->desc_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create rx desc DMA tag\n"); + goto fail; + } + + error = bus_dmamem_alloc(rx_ring->desc_dmat, (void **)&rx_ring->desc, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &rx_ring->desc_map); + if (error != 0) { + device_printf(sc->sc_dev, "could not allocate rx desc\n"); + goto fail; + } + error = bus_dmamap_load(rx_ring->desc_dmat, rx_ring->desc_map, + rx_ring->desc, size, rtwn_dma_map_addr, &rx_ring->paddr, 0); + if (error != 0) { + device_printf(sc->sc_dev, "could not load rx desc DMA map\n"); + goto fail; + } + bus_dmamap_sync(rx_ring->desc_dmat, rx_ring->desc_map, + BUS_DMASYNC_PREWRITE); + + /* Create RX buffer DMA tag. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, NULL, NULL, &rx_ring->data_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create rx buf DMA tag\n"); + goto fail; + } + + /* Allocate Rx buffers. */ + for (i = 0; i < RTWN_RX_LIST_COUNT; i++) { + rx_data = &rx_ring->rx_data[i]; + error = bus_dmamap_create(rx_ring->data_dmat, 0, &rx_data->map); + if (error != 0) { + device_printf(sc->sc_dev, + "could not create rx buf DMA map\n"); + goto fail; + } + + rx_data->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + if (rx_data->m == NULL) { + device_printf(sc->sc_dev, + "could not allocate rx mbuf\n"); + error = ENOMEM; + goto fail; + } + + error = bus_dmamap_load(rx_ring->data_dmat, rx_data->map, + mtod(rx_data->m, void *), MCLBYTES, rtwn_dma_map_addr, + &rx_data->paddr, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sc_dev, + "could not load rx buf DMA map"); + goto fail; + } + + rtwn_setup_rx_desc(sc, &rx_ring->desc[i], rx_data->paddr, + MCLBYTES, i); + } + return (0); + +fail: + rtwn_free_rx_list(sc); + return (error); +} + +static void +rtwn_reset_rx_list(struct rtwn_softc *sc) +{ + struct rtwn_rx_ring *rx_ring = &sc->rx_ring; + struct rtwn_rx_data *rx_data; + int i; + + for (i = 0; i < RTWN_RX_LIST_COUNT; i++) { + rx_data = &rx_ring->rx_data[i]; + rtwn_setup_rx_desc(sc, &rx_ring->desc[i], rx_data->paddr, + MCLBYTES, i); + } +} + +static void +rtwn_free_rx_list(struct rtwn_softc *sc) +{ + struct rtwn_rx_ring *rx_ring = &sc->rx_ring; + struct rtwn_rx_data *rx_data; + int i; + + if (rx_ring->desc_dmat != NULL) { + if (rx_ring->desc != NULL) { + bus_dmamap_unload(rx_ring->desc_dmat, + rx_ring->desc_map); + bus_dmamem_free(rx_ring->desc_dmat, rx_ring->desc, + rx_ring->desc_map); + rx_ring->desc = NULL; + } + bus_dma_tag_destroy(rx_ring->desc_dmat); + rx_ring->desc_dmat = NULL; + } + + for (i = 0; i < RTWN_RX_LIST_COUNT; i++) { + rx_data = &rx_ring->rx_data[i]; + + if (rx_data->m != NULL) { + bus_dmamap_unload(rx_ring->data_dmat, rx_data->map); + m_freem(rx_data->m); + rx_data->m = NULL; + } + bus_dmamap_destroy(rx_ring->data_dmat, rx_data->map); + rx_data->map = NULL; + } + if (rx_ring->data_dmat != NULL) { + bus_dma_tag_destroy(rx_ring->data_dmat); + rx_ring->data_dmat = NULL; + } +} + +static int +rtwn_alloc_tx_list(struct rtwn_softc *sc, int qid) +{ + struct rtwn_tx_ring *tx_ring = &sc->tx_ring[qid]; + struct rtwn_tx_data *tx_data; + bus_size_t size; + int i, error; + + size = sizeof(struct r92c_tx_desc) * RTWN_TX_LIST_COUNT; + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + size, 1, size, 0, NULL, NULL, &tx_ring->desc_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create tx ring DMA tag\n"); + goto fail; + } + + error = bus_dmamem_alloc(tx_ring->desc_dmat, (void **)&tx_ring->desc, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &tx_ring->desc_map); + if (error != 0) { + device_printf(sc->sc_dev, "can't map tx ring DMA memory\n"); + goto fail; + } + error = bus_dmamap_load(tx_ring->desc_dmat, tx_ring->desc_map, + tx_ring->desc, size, rtwn_dma_map_addr, &tx_ring->paddr, + BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sc_dev, "could not load desc DMA map\n"); + goto fail; + } + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, NULL, NULL, &tx_ring->data_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create tx buf DMA tag\n"); + goto fail; + } + + for (i = 0; i < RTWN_TX_LIST_COUNT; i++) { + struct r92c_tx_desc *desc = &tx_ring->desc[i]; + + /* setup tx desc */ + desc->nextdescaddr = htole32(tx_ring->paddr + + + sizeof(struct r92c_tx_desc) + * ((i + 1) % RTWN_TX_LIST_COUNT)); + tx_data = &tx_ring->tx_data[i]; + error = bus_dmamap_create(tx_ring->data_dmat, 0, &tx_data->map); + if (error != 0) { + device_printf(sc->sc_dev, + "could not create tx buf DMA map\n"); + goto fail; + } + tx_data->m = NULL; + tx_data->ni = NULL; + } + return (0); + +fail: + rtwn_free_tx_list(sc, qid); + return (error); +} + +static void +rtwn_reset_tx_list(struct rtwn_softc *sc, int qid) +{ + struct rtwn_tx_ring *tx_ring = &sc->tx_ring[qid]; + int i; + + for (i = 0; i < RTWN_TX_LIST_COUNT; i++) { + struct r92c_tx_desc *desc = &tx_ring->desc[i]; + struct rtwn_tx_data *tx_data = &tx_ring->tx_data[i]; + + memset(desc, 0, sizeof(*desc) - + (sizeof(desc->reserved) + sizeof(desc->nextdescaddr64) + + sizeof(desc->nextdescaddr))); + + if (tx_data->m != NULL) { + bus_dmamap_unload(tx_ring->data_dmat, tx_data->map); + m_freem(tx_data->m); + tx_data->m = NULL; + } + if (tx_data->ni != NULL) { + ieee80211_free_node(tx_data->ni); + tx_data->ni = NULL; + } + } + + bus_dmamap_sync(tx_ring->desc_dmat, tx_ring->desc_map, + BUS_DMASYNC_POSTWRITE); + + sc->qfullmsk &= ~(1 << qid); + tx_ring->queued = 0; + tx_ring->cur = 0; +} + +static void +rtwn_free_tx_list(struct rtwn_softc *sc, int qid) +{ + struct rtwn_tx_ring *tx_ring = &sc->tx_ring[qid]; + struct rtwn_tx_data *tx_data; + int i; + + if (tx_ring->desc_dmat != NULL) { + if (tx_ring->desc != NULL) { + bus_dmamap_unload(tx_ring->desc_dmat, + tx_ring->desc_map); + bus_dmamem_free(tx_ring->desc_dmat, tx_ring->desc, + tx_ring->desc_map); + } + bus_dma_tag_destroy(tx_ring->desc_dmat); + } + + for (i = 0; i < RTWN_TX_LIST_COUNT; i++) { + tx_data = &tx_ring->tx_data[i]; + + if (tx_data->m != NULL) { + bus_dmamap_unload(tx_ring->data_dmat, tx_data->map); + m_freem(tx_data->m); + tx_data->m = NULL; + } + } + if (tx_ring->data_dmat != NULL) { + bus_dma_tag_destroy(tx_ring->data_dmat); + tx_ring->data_dmat = NULL; + } + + sc->qfullmsk &= ~(1 << qid); + tx_ring->queued = 0; + tx_ring->cur = 0; +} + + +static struct ieee80211vap * +rtwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct rtwn_vap *rvp; + struct ieee80211vap *vap; + + if (!TAILQ_EMPTY(&ic->ic_vaps)) + return (NULL); + + rvp = malloc(sizeof(struct rtwn_vap), M_80211_VAP, M_WAITOK | M_ZERO); + vap = &rvp->vap; + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid) != 0) { + /* out of memory */ + free(rvp, M_80211_VAP); + return (NULL); + } + + /* Override state transition machine. */ + rvp->newstate = vap->iv_newstate; + vap->iv_newstate = rtwn_newstate; + + /* Complete setup. */ + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); + ic->ic_opmode = opmode; + return (vap); +} + +static void +rtwn_vap_delete(struct ieee80211vap *vap) +{ + struct rtwn_vap *rvp = RTWN_VAP(vap); + + ieee80211_vap_detach(vap); + free(rvp, M_80211_VAP); +} + +static void +rtwn_write_1(struct rtwn_softc *sc, uint16_t addr, uint8_t val) +{ + + bus_space_write_1(sc->sc_st, sc->sc_sh, addr, val); +} + +static void +rtwn_write_2(struct rtwn_softc *sc, uint16_t addr, uint16_t val) +{ + + val = htole16(val); + bus_space_write_2(sc->sc_st, sc->sc_sh, addr, val); +} + +static void +rtwn_write_4(struct rtwn_softc *sc, uint16_t addr, uint32_t val) +{ + + val = htole32(val); + bus_space_write_4(sc->sc_st, sc->sc_sh, addr, val); +} + +static uint8_t +rtwn_read_1(struct rtwn_softc *sc, uint16_t addr) +{ + + return (bus_space_read_1(sc->sc_st, sc->sc_sh, addr)); +} + +static uint16_t +rtwn_read_2(struct rtwn_softc *sc, uint16_t addr) +{ + + return (bus_space_read_2(sc->sc_st, sc->sc_sh, addr)); +} + +static uint32_t +rtwn_read_4(struct rtwn_softc *sc, uint16_t addr) +{ + + return (bus_space_read_4(sc->sc_st, sc->sc_sh, addr)); +} + +static int +rtwn_fw_cmd(struct rtwn_softc *sc, uint8_t id, const void *buf, int len) +{ + struct r92c_fw_cmd cmd; + int ntries; + + /* Wait for current FW box to be empty. */ + for (ntries = 0; ntries < 100; ntries++) { + if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "could not send firmware command %d\n", id); + return (ETIMEDOUT); + } + memset(&cmd, 0, sizeof(cmd)); + cmd.id = id; + if (len > 3) + cmd.id |= R92C_CMD_FLAG_EXT; + KASSERT(len <= sizeof(cmd.msg), ("rtwn_fw_cmd\n")); + memcpy(cmd.msg, buf, len); + + /* Write the first word last since that will trigger the FW. */ + rtwn_write_2(sc, R92C_HMEBOX_EXT(sc->fwcur), *((uint8_t *)&cmd + 4)); + rtwn_write_4(sc, R92C_HMEBOX(sc->fwcur), *((uint8_t *)&cmd + 0)); + + sc->fwcur = (sc->fwcur + 1) % R92C_H2C_NBOX; + + /* Give firmware some time for processing. */ + DELAY(2000); + + return (0); +} + +static void +rtwn_rf_write(struct rtwn_softc *sc, int chain, uint8_t addr, uint32_t val) +{ + rtwn_bb_write(sc, R92C_LSSI_PARAM(chain), + SM(R92C_LSSI_PARAM_ADDR, addr) | + SM(R92C_LSSI_PARAM_DATA, val)); +} + +static uint32_t +rtwn_rf_read(struct rtwn_softc *sc, int chain, uint8_t addr) +{ + uint32_t reg[R92C_MAX_CHAINS], val; + + reg[0] = rtwn_bb_read(sc, R92C_HSSI_PARAM2(0)); + if (chain != 0) + reg[chain] = rtwn_bb_read(sc, R92C_HSSI_PARAM2(chain)); + + rtwn_bb_write(sc, R92C_HSSI_PARAM2(0), + reg[0] & ~R92C_HSSI_PARAM2_READ_EDGE); + DELAY(1000); + + rtwn_bb_write(sc, R92C_HSSI_PARAM2(chain), + RW(reg[chain], R92C_HSSI_PARAM2_READ_ADDR, addr) | + R92C_HSSI_PARAM2_READ_EDGE); + DELAY(1000); + + rtwn_bb_write(sc, R92C_HSSI_PARAM2(0), + reg[0] | R92C_HSSI_PARAM2_READ_EDGE); + DELAY(1000); + + if (rtwn_bb_read(sc, R92C_HSSI_PARAM1(chain)) & R92C_HSSI_PARAM1_PI) + val = rtwn_bb_read(sc, R92C_HSPI_READBACK(chain)); + else + val = rtwn_bb_read(sc, R92C_LSSI_READBACK(chain)); + return (MS(val, R92C_LSSI_READBACK_DATA)); +} + +static int +rtwn_llt_write(struct rtwn_softc *sc, uint32_t addr, uint32_t data) +{ + int ntries; + + rtwn_write_4(sc, R92C_LLT_INIT, + SM(R92C_LLT_INIT_OP, R92C_LLT_INIT_OP_WRITE) | + SM(R92C_LLT_INIT_ADDR, addr) | + SM(R92C_LLT_INIT_DATA, data)); + /* Wait for write operation to complete. */ + for (ntries = 0; ntries < 20; ntries++) { + if (MS(rtwn_read_4(sc, R92C_LLT_INIT), R92C_LLT_INIT_OP) == + R92C_LLT_INIT_OP_NO_ACTIVE) + return (0); + DELAY(5); + } + return (ETIMEDOUT); +} + +static uint8_t +rtwn_efuse_read_1(struct rtwn_softc *sc, uint16_t addr) +{ + uint32_t reg; + int ntries; + + reg = rtwn_read_4(sc, R92C_EFUSE_CTRL); + reg = RW(reg, R92C_EFUSE_CTRL_ADDR, addr); + reg &= ~R92C_EFUSE_CTRL_VALID; + rtwn_write_4(sc, R92C_EFUSE_CTRL, reg); + /* Wait for read operation to complete. */ + for (ntries = 0; ntries < 100; ntries++) { + reg = rtwn_read_4(sc, R92C_EFUSE_CTRL); + if (reg & R92C_EFUSE_CTRL_VALID) + return (MS(reg, R92C_EFUSE_CTRL_DATA)); + DELAY(5); + } + device_printf(sc->sc_dev, + "could not read efuse byte at address 0x%x\n", addr); + return (0xff); +} + +static void +rtwn_efuse_read(struct rtwn_softc *sc) +{ + uint8_t *rom = (uint8_t *)&sc->rom; + uint16_t addr = 0; + uint32_t reg; + uint8_t off, msk; + int i; + + reg = rtwn_read_2(sc, R92C_SYS_ISO_CTRL); + if (!(reg & R92C_SYS_ISO_CTRL_PWC_EV12V)) { + rtwn_write_2(sc, R92C_SYS_ISO_CTRL, + reg | R92C_SYS_ISO_CTRL_PWC_EV12V); + } + reg = rtwn_read_2(sc, R92C_SYS_FUNC_EN); + if (!(reg & R92C_SYS_FUNC_EN_ELDR)) { + rtwn_write_2(sc, R92C_SYS_FUNC_EN, + reg | R92C_SYS_FUNC_EN_ELDR); + } + reg = rtwn_read_2(sc, R92C_SYS_CLKR); + if ((reg & (R92C_SYS_CLKR_LOADER_EN | R92C_SYS_CLKR_ANA8M)) != + (R92C_SYS_CLKR_LOADER_EN | R92C_SYS_CLKR_ANA8M)) { + rtwn_write_2(sc, R92C_SYS_CLKR, + reg | R92C_SYS_CLKR_LOADER_EN | R92C_SYS_CLKR_ANA8M); + } + memset(&sc->rom, 0xff, sizeof(sc->rom)); + while (addr < 512) { + reg = rtwn_efuse_read_1(sc, addr); + if (reg == 0xff) + break; + addr++; + off = reg >> 4; + msk = reg & 0xf; + for (i = 0; i < 4; i++) { + if (msk & (1 << i)) + continue; + rom[off * 8 + i * 2 + 0] = + rtwn_efuse_read_1(sc, addr); + addr++; + rom[off * 8 + i * 2 + 1] = + rtwn_efuse_read_1(sc, addr); + addr++; + } + } +#ifdef RTWN_DEBUG + if (sc->sc_debug >= 2) { + /* Dump ROM content. */ + printf("\n"); + for (i = 0; i < sizeof(sc->rom); i++) + printf("%02x:", rom[i]); + printf("\n"); + } +#endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 31 22:33: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 A7610A57984; Thu, 31 Dec 2015 22:33:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6760A1A76; Thu, 31 Dec 2015 22:33:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMXX7O075904; Thu, 31 Dec 2015 22:33:33 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMXXGa075898; Thu, 31 Dec 2015 22:33:33 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512312233.tBVMXXGa075898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 31 Dec 2015 22:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293011 - in head/sys/modules: . rtwnfw rtwnfw/rtwnrtl8192cU rtwnfw/rtwnrtl8192cUB 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, 31 Dec 2015 22:33:34 -0000 Author: adrian Date: Thu Dec 31 22:33:32 2015 New Revision: 293011 URL: https://svnweb.freebsd.org/changeset/base/293011 Log: [rtwn] Add rtwn firmware and driver module. Submitted by: kevlo Added: head/sys/modules/rtwnfw/ head/sys/modules/rtwnfw/Makefile (contents, props changed) head/sys/modules/rtwnfw/Makefile.inc (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192cU/ head/sys/modules/rtwnfw/rtwnrtl8192cU/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192cUB/ head/sys/modules/rtwnfw/rtwnrtl8192cUB/Makefile (contents, props changed) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Dec 31 22:32:36 2015 (r293010) +++ head/sys/modules/Makefile Thu Dec 31 22:33:32 2015 (r293011) @@ -311,6 +311,8 @@ SUBDIR= \ re \ reiserfs \ rl \ + rtwn \ + rtwnfw \ ${_s3} \ ${_safe} \ ${_sbni} \ Added: head/sys/modules/rtwnfw/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rtwnfw/Makefile Thu Dec 31 22:33:32 2015 (r293011) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= rtwnrtl8192cU rtwnrtl8192cUB + +.include Added: head/sys/modules/rtwnfw/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rtwnfw/Makefile.inc Thu Dec 31 22:33:32 2015 (r293011) @@ -0,0 +1,15 @@ +# $FreeBSD$ +# +# Common rules for building firmware. Note this gets auto-included +# by the subdir Makefile's as a consequence of included bsd.kmod.mk. + +_FIRM= ${IMG}.fw + +CLEANFILES+= ${_FIRM} + +FIRMWS= ${_FIRM}:${KMOD}:111 + +FIRMWARE_LICENSE= realtek + +${_FIRM}: ${.CURDIR}/../../../contrib/dev/rtwn/${_FIRM}.uu + uudecode -p $? > ${.TARGET} Added: head/sys/modules/rtwnfw/rtwnrtl8192cU/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rtwnfw/rtwnrtl8192cU/Makefile Thu Dec 31 22:33:32 2015 (r293011) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +KMOD= rtwn-rtl8192cfwU +IMG= rtwn-rtl8192cfwU + +.include Added: head/sys/modules/rtwnfw/rtwnrtl8192cUB/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rtwnfw/rtwnrtl8192cUB/Makefile Thu Dec 31 22:33:32 2015 (r293011) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +KMOD= rtwn-rtl8192cfwU_B +IMG= rtwn-rtl8192cfwU_B + +.include From owner-svn-src-head@freebsd.org Thu Dec 31 22:34: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 D18C0A57A06; Thu, 31 Dec 2015 22:34:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 916DD1C0D; Thu, 31 Dec 2015 22:34:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMYGFW075984; Thu, 31 Dec 2015 22:34:16 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMYGgl075981; Thu, 31 Dec 2015 22:34:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512312234.tBVMYGgl075981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 31 Dec 2015 22:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293012 - 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: Thu, 31 Dec 2015 22:34:18 -0000 Author: adrian Date: Thu Dec 31 22:34:16 2015 New Revision: 293012 URL: https://svnweb.freebsd.org/changeset/base/293012 Log: [rtwn] Add initial manpages for the rtwn driver. Added: head/share/man/man4/rtwn.4 (contents, props changed) head/share/man/man4/rtwnfw.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Dec 31 22:33:32 2015 (r293011) +++ head/share/man/man4/Makefile Thu Dec 31 22:34:16 2015 (r293012) @@ -424,6 +424,8 @@ MAN= aac.4 \ rndtest.4 \ route.4 \ rp.4 \ + rtwn.4 \ + rtwnfw.4 \ rue.4 \ rum.4 \ run.4 \ Added: head/share/man/man4/rtwn.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/rtwn.4 Thu Dec 31 22:34:16 2015 (r293012) @@ -0,0 +1,165 @@ +.\" $OpenBSD: rtwn.4,v 1.2 2015/07/09 11:28:53 stsp Exp $ +.\" +.\" Copyright (c) 2010 Damien Bergamini +.\" Copyright (c) 2015 Stefan Sperling +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 28, 2015 +.Dt RTWN 4 +.Os +.Sh NAME +.Nm rtwn +.Nd Realtek RTL8188CE PCIe IEEE 802.11b/g/n wireless network device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device rtwn" +.Cd "device rtwnfw" +.Cd "device wlan" +.Cd "device firmware" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_rtwn_load="YES" +.Ed +.Pp +After you have read the license in +.Pa /usr/share/doc/legal/realtek.LICENSE +you will want to add the following lines to +.Xr loader.conf 5 : +.Bd -literal -offset indent +legal.realtek.license_ack=1 +rtwn-rtl8192cfwU_load="YES" +rtwn-rtl8192cfwU_B_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports PCIe wireless network devices based on the Realtek +RTL8188CE chipset. +.Pp +The RTL8188CE is a highly integrated 802.11n adapter that combines a MAC, +a 1T1R capable baseband and an RF in a single chip. +It operates in the 2GHz spectrum only. +.Pp +These are the modes the +.Nm +driver can operate in: +.Bl -tag -width "IBSS-masterXX" +.It BSS mode +Also known as +.Em infrastructure +mode, this is used when associating with an access point, through +which all traffic passes. +This mode is the default. +.It monitor mode +In this mode the driver is able to receive packets without +associating with an access point. +This disables the internal receive filter and enables the card to +capture packets from networks which it wouldn't normally have access to, +or to scan for access points. +.El +.Pp +The +.Nm +driver can be configured to use +Wired Equivalent Privacy (WEP) or +Wi-Fi Protected Access (WPA-PSK and WPA2-PSK). +WPA is the current encryption standard for wireless networks. +It is strongly recommended that WEP +not be used as the sole mechanism +to secure wireless communication, +due to serious weaknesses in it. +.Pp +The +.Nm +driver can be configured at runtime with +.Xr ifconfig 8 . +.Sh FILES +The driver needs at least version 1.0 of the following firmware files, +which are loaded when an interface is brought up: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It Pa /boot/kernel/rtwn-rtl8192cfwU.ko +.It Pa /boot/kernel/rtwn-rtl8192cfwU_B.ko +.El +.Sh EXAMPLES +Join an existing BSS network (i.e., connect to an access point): +.Bd -literal -offset indent +ifconfig wlan create wlandev rtwn0 inet 192.168.0.20 \e + netmask 0xffffff00 +.Ed +.Pp +Join a specific BSS network with network name +.Dq Li my_net : +.Pp +.Dl "ifconfig wlan create wlandev rtwn0 ssid my_net up" +.Pp +Join a specific BSS network with 64-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev rtwn0 ssid my_net \e + wepmode on wepkey 0x1234567890 weptxkey 1 up +.Ed +.Sh DIAGNOSTICS +.Bl -diag +.It "could not read firmware %s" +For some reason, the driver was unable to read the microcode file from the +filesystem. +The file might be missing or corrupted. +.It "device timeout" +A frame dispatched to the hardware for transmission did not complete in time. +The driver will reset the hardware. +This should not happen. +.El +.Sh SEE ALSO +.Xr pci 4 , +.Xr rtwnfw 4 , +.Xr wlan 4 , +.Xr wlan_ccmp 4 , +.Xr wlan_tkip 4 , +.Xr wlan_wep 4 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 5.8 . +.Sh AUTHORS +The +.Nm +driver was written by +.An -nosplit +.An Stefan Sperling Aq Mt stsp@openbsd.org +and ported by +.An Kevin Lo Aq Mt kevlo@freebsd.org . +It was based on the +.Xr urtwn 4 +driver written by +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . +.Sh CAVEATS +The +.Nm +driver does not support any of the 802.11n capabilities offered by the +adapters. +Additional work is required in +.Xr ieee80211 9 +before those features can be supported. Added: head/share/man/man4/rtwnfw.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/rtwnfw.4 Thu Dec 31 22:34:16 2015 (r293012) @@ -0,0 +1,74 @@ +.\" Copyright (c) 2015 Kevin Lo +.\" 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. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 28, 2015 +.Dt RTWNFW 4 +.Os +.Sh NAME +.Nm rtwnfw +.Nd "Firmware Module for Realtek Wireless driver" +.Sh SYNOPSIS +To compile this module into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device rtwnfw" +.Ed +.Pp +This will include three firmware images inside the kernel. +If you want to pick only the firmware image for your network adapter choose one +of the following: +.Bd -ragged -offset indent +.Cd "device rtwn-rtl8192cfwU" +.Cd "device rtwn-rtl8192cfwU_B" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +rtwn-rtl8192cfwU_load="YES" +rtwn-rtl8192cfwU_B_load="YES" +.Ed +.Sh DESCRIPTION +This module provides access to firmware sets for the +Realtek RTL8188CE chip based PCIe adapters. +It may be +statically linked into the kernel, or loaded as a module. +.Pp +For the loaded firmware to be enabled for use the license at +.Pa /usr/share/doc/legal/realtek.LICENSE +must be agreed to by adding the following line to +.Xr loader.conf 5 : +.Pp +.Dl "legal.realtek.license_ack=1" +.Sh FILES +.Bl -tag -width ".Pa /usr/share/doc/legal/realtek.LICENSE" -compact +.It Pa /usr/share/doc/legal/realtek.LICENSE +.Nm +firmware license +.El +.Sh SEE ALSO +.Xr rtwn 4 , +.Xr firmware 9 From owner-svn-src-head@freebsd.org Thu Dec 31 22:48: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 6697EA57D2C; Thu, 31 Dec 2015 22:48:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 357B81547; Thu, 31 Dec 2015 22:48:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMmk6V078979; Thu, 31 Dec 2015 22:48:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMmkdd078978; Thu, 31 Dec 2015 22:48:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201512312248.tBVMmkdd078978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 31 Dec 2015 22:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293014 - 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: Thu, 31 Dec 2015 22:48:47 -0000 Author: dim Date: Thu Dec 31 22:48:46 2015 New Revision: 293014 URL: https://svnweb.freebsd.org/changeset/base/293014 Log: Merge r293006 from clang380-import branch: For determining the compiler version, quote the string to be echo'd, otherwise the command might fail. This is because clang -v now results in the following: FreeBSD clang version 3.8.0 (trunk 256633) (based on LLVM 3.8.0svn) The second "3.8.8svn)" string tripped up the shell command. MFC after: 3 days Modified: head/share/mk/bsd.compiler.mk Directory Properties: head/ (props changed) head/share/ (props changed) Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Thu Dec 31 22:45:00 2015 (r293013) +++ head/share/mk/bsd.compiler.mk Thu Dec 31 22:48:46 2015 (r293014) @@ -138,7 +138,7 @@ COMPILER_TYPE:= clang . endif .endif .if !defined(COMPILER_VERSION) -COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +COMPILER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif .undef _v .endif From owner-svn-src-head@freebsd.org Thu Dec 31 22:52: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 B3FF6A57F08; Thu, 31 Dec 2015 22:52:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7F7871948; Thu, 31 Dec 2015 22:52:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVMqBpw079766; Thu, 31 Dec 2015 22:52:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVMqBUi079765; Thu, 31 Dec 2015 22:52:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201512312252.tBVMqBUi079765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 31 Dec 2015 22:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293015 - head/contrib/pf/pflogd 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, 31 Dec 2015 22:52:12 -0000 Author: dim Date: Thu Dec 31 22:52:11 2015 New Revision: 293015 URL: https://svnweb.freebsd.org/changeset/base/293015 Log: Merge r293013 from clang380-import branch: Fix a clang 3.8.0 warning in pflogd.c: contrib/pf/pflogd/pflogd.c:769:8: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] if (!if_exists(interface) == -1) { ^ ~~ The if_exists() function does not return -1, and even if it did, it would not be the correct way to check. Just ditch the == -1 instead. Obtained from: OpenBSD's pflogd.c 1.49 MFC after: 3 days Modified: head/contrib/pf/pflogd/pflogd.c Directory Properties: head/ (props changed) head/contrib/pf/ (props changed) Modified: head/contrib/pf/pflogd/pflogd.c ============================================================================== --- head/contrib/pf/pflogd/pflogd.c Thu Dec 31 22:48:46 2015 (r293014) +++ head/contrib/pf/pflogd/pflogd.c Thu Dec 31 22:52:11 2015 (r293015) @@ -766,7 +766,7 @@ main(int argc, char **argv) np = pcap_dispatch(hpcap, PCAP_NUM_PKTS, phandler, (u_char *)dpcap); if (np < 0) { - if (!if_exists(interface) == -1) { + if (!if_exists(interface)) { logmsg(LOG_NOTICE, "interface %s went away", interface); ret = -1; From owner-svn-src-head@freebsd.org Thu Dec 31 23:48: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 54D98A56E76; Thu, 31 Dec 2015 23:48:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1F04B1F56; Thu, 31 Dec 2015 23:48:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVNm8fC096420; Thu, 31 Dec 2015 23:48:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVNm8bQ096419; Thu, 31 Dec 2015 23:48:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201512312348.tBVNm8bQ096419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 31 Dec 2015 23:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293017 - head/sys/modules/rtwn 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, 31 Dec 2015 23:48:09 -0000 Author: adrian Date: Thu Dec 31 23:48:07 2015 New Revision: 293017 URL: https://svnweb.freebsd.org/changeset/base/293017 Log: [rtwn] add rtwn module directory. Pointed out by: dim Added: head/sys/modules/rtwn/ head/sys/modules/rtwn/Makefile (contents, props changed) Added: head/sys/modules/rtwn/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rtwn/Makefile Thu Dec 31 23:48:07 2015 (r293017) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/rtwn + +KMOD = if_rtwn +SRCS = if_rtwn.c device_if.h bus_if.h pci_if.h + +.include From owner-svn-src-head@freebsd.org Fri Jan 1 00:11:30 2016 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 B97D9A57796; Fri, 1 Jan 2016 00:11:30 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7A1C71DA7; Fri, 1 Jan 2016 00:11:30 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u010BTU7003898; Fri, 1 Jan 2016 00:11:29 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u010BTjO003896; Fri, 1 Jan 2016 00:11:29 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601010011.u010BTjO003896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Fri, 1 Jan 2016 00:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293018 - head/libexec/rtld-elf/powerpc64 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, 01 Jan 2016 00:11:30 -0000 Author: nwhitehorn Date: Fri Jan 1 00:11:29 2016 New Revision: 293018 URL: https://svnweb.freebsd.org/changeset/base/293018 Log: Unify the ELFv1 and ELFv2 code paths and make ELFv1 (the normal ABI) more correct in the process. MFC after: 2 weeks Modified: head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/powerpc64/rtld_start.S Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Thu Dec 31 23:48:07 2015 (r293017) +++ head/libexec/rtld-elf/powerpc64/reloc.c Fri Jan 1 00:11:29 2016 (r293018) @@ -338,26 +338,19 @@ static int reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela) { Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset); -#if !defined(_CALL_ELF) || _CALL_ELF == 1 - Elf_Addr *glink; -#endif long reloff; reloff = rela - obj->pltrela; + dbg(" reloc_plt_object: where=%p,reloff=%lx,glink=%#lx", (void *)where, + reloff, obj->glink); + #if !defined(_CALL_ELF) || _CALL_ELF == 1 - if (obj->priv == NULL) - obj->priv = xmalloc(obj->pltrelasize); - glink = obj->priv + reloff*sizeof(Elf_Addr)*2; - - dbg(" reloc_plt_object: where=%p,reloff=%lx,glink=%p", (void *)where, reloff, glink); - - memcpy(where, _rtld_bind_start, sizeof(struct funcdesc)); - ((struct funcdesc *)(where))->env = (Elf_Addr)glink; - *(glink++) = (Elf_Addr)obj; - *(glink++) = reloff*sizeof(Elf_Rela); + /* Glink code is 3 instructions after the first 32k, 2 before */ + *where = (Elf_Addr)obj->glink + 32 + + 8*((reloff < 0x8000) ? reloff : 0x8000) + + 12*((reloff < 0x8000) ? 0 : (reloff - 0x8000)); #else - dbg(" reloc_plt_object: where=%p,reloff=%lx,glink=%#lx", (void *)where, reloff, obj->glink); *where = (Elf_Addr)obj->glink + 4*reloff + 32; #endif @@ -416,13 +409,6 @@ reloc_jmpslots(Obj_Entry *obj, int flags target = (Elf_Addr)(defobj->relocbase + def->st_value); -#if 0 - /* PG XXX */ - dbg("\"%s\" in \"%s\" --> %p in \"%s\"", - defobj->strtab + def->st_name, basename(obj->path), - (void *)target, basename(defobj->path)); -#endif - if (def == &sym_zero) { /* Zero undefined weak symbols */ #if !defined(_CALL_ELF) || _CALL_ELF == 1 @@ -461,12 +447,28 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr (void *)wherep, (void *)target, *(Elf_Addr *)target, (Elf_Addr)defobj->relocbase); + /* + * For the trampoline, the second two elements of the function + * descriptor are unused, so we are fine replacing those at any time + * with the real ones with no thread safety implications. However, we + * need to make sure the main entry point pointer ([0]) is seen to be + * modified *after* the second two elements. This can't be done in + * general, since there are no barriers in the reading code, but put in + * some isyncs to at least make it a little better. + */ memcpy(wherep, (void *)target, sizeof(struct funcdesc)); + wherep[2] = ((Elf_Addr *)target)[2]; + wherep[1] = ((Elf_Addr *)target)[1]; + __asm __volatile ("isync" : : : "memory"); + wherep[0] = ((Elf_Addr *)target)[0]; + __asm __volatile ("isync" : : : "memory"); + if (((struct funcdesc *)(wherep))->addr < (Elf_Addr)defobj->relocbase) { /* - * XXX: It is possible (e.g. LD_BIND_NOW) that the function + * It is possible (LD_BIND_NOW) that the function * descriptor we are copying has not yet been relocated. - * If this happens, fix it. + * If this happens, fix it. Don't worry about threading in + * this case since LD_BIND_NOW makes it irrelevant. */ ((struct funcdesc *)(wherep))->addr += @@ -481,8 +483,6 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr *wherep = target; #endif - __asm __volatile("sync" ::: "memory"); - return (target); } @@ -506,7 +506,6 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flag void init_pltgot(Obj_Entry *obj) { -#if defined(_CALL_ELF) && _CALL_ELF == 2 Elf_Addr *pltcall; pltcall = obj->pltgot; @@ -515,10 +514,12 @@ init_pltgot(Obj_Entry *obj) return; } +#if defined(_CALL_ELF) && _CALL_ELF == 2 pltcall[0] = (Elf_Addr)&_rtld_bind_start; pltcall[1] = (Elf_Addr)obj; - - __asm __volatile("sync" ::: "memory"); +#else + memcpy(pltcall, _rtld_bind_start, sizeof(struct funcdesc)); + pltcall[2] = (Elf_Addr)obj; #endif } Modified: head/libexec/rtld-elf/powerpc64/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_start.S Thu Dec 31 23:48:07 2015 (r293017) +++ head/libexec/rtld-elf/powerpc64/rtld_start.S Fri Jan 1 00:11:29 2016 (r293018) @@ -111,10 +111,7 @@ _ENTRY(_rtld_start) * * Call into the MI binder. This routine is reached via the PLT call cell * - * For ELFv1, on entry, %r11 contains a pointer to the (object, relocation) - * tuple. - * - * For ELFv2, %r11 contains an object pointer and %r0 contains the PLT index. + * On entry, %r11 contains an object pointer and %r0 contains the PLT index. * * Save all registers, call into the binder to resolve and fixup the external * routine, and then transfer to the external routine on return. @@ -122,7 +119,7 @@ _ENTRY(_rtld_start) .globl _rtld_bind _ENTRY(_rtld_bind_start) - mr %r12,%r0 # shunt r0 immediately to r12 for ELFv2 + mr %r12,%r0 # save r0 (index) immediately to r12 mflr %r0 std %r0,16(%r1) # save lr mfcr %r0 @@ -139,13 +136,9 @@ _ENTRY(_rtld_bind_start) std %r9,64+6*8(%r1) std %r10,64+7*8(%r1) -#if !defined(_CALL_ELF) || _CALL_ELF == 1 - ld %r3,0(%r11) - ld %r4,8(%r11) -#else mr %r3,%r11 - mulli %r4,%r12,24 /* Multiply index by sizeof(Elf_Rela) */ -#endif + mulli %r4,%r12,24 # Multiply index by sizeof(Elf_Rela) + bl _rtld_bind # target addr = _rtld_bind(obj, reloff) nop From owner-svn-src-head@freebsd.org Fri Jan 1 00:21:08 2016 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 AE8D2A57ADB; Fri, 1 Jan 2016 00:21:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5F83A1509; Fri, 1 Jan 2016 00:21:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u010L7tJ006628; Fri, 1 Jan 2016 00:21:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u010L7sW006625; Fri, 1 Jan 2016 00:21:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201601010021.u010L7sW006625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 1 Jan 2016 00:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293022 - head/sys/net80211 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, 01 Jan 2016 00:21:08 -0000 Author: adrian Date: Fri Jan 1 00:21:07 2016 New Revision: 293022 URL: https://svnweb.freebsd.org/changeset/base/293022 Log: [net80211] document the (not completely complete) set of places where we're assuming hz=1000 and not gracefully handling when it isn't. The math involved will return 0 for hz < 1000, which it is on some platforms and on DragonflyBSD. This doesn't fix it, it: * converts one manual use over to use the macro, and * comments where it needs some thought/fixing. I'll think about this a bit more before fixing it. Submitted by: imre@vdsz.com Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_scan_sw.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Fri Jan 1 00:16:54 2016 (r293021) +++ head/sys/net80211/ieee80211_freebsd.h Fri Jan 1 00:21:07 2016 (r293022) @@ -246,9 +246,11 @@ void ieee80211_vap_destroy(struct ieee80 (((_ifp)->if_flags & IFF_UP) && \ ((_ifp)->if_drv_flags & IFF_DRV_RUNNING)) +/* XXX TODO: cap these at 1, as hz may not be 1000 */ #define msecs_to_ticks(ms) (((ms)*hz)/1000) #define ticks_to_msecs(t) (1000*(t) / hz) #define ticks_to_secs(t) ((t) / hz) + #define time_after(a,b) ((long)(b) - (long)(a) < 0) #define time_before(a,b) time_after(b,a) #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:16:54 2016 (r293021) +++ head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:21:07 2016 (r293022) @@ -641,7 +641,7 @@ scan_task(void *arg, int pending) * XXX Should use M_TXCB mechanism to eliminate this. */ cv_timedwait(&SCAN_PRIVATE(ss)->ss_scan_cv, - IEEE80211_LOCK_OBJ(ic), hz / 1000); + IEEE80211_LOCK_OBJ(ic), msecs_to_ticks(1)); if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT) goto done; } Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Fri Jan 1 00:16:54 2016 (r293021) +++ head/sys/net80211/ieee80211_var.h Fri Jan 1 00:21:07 2016 (r293022) @@ -84,6 +84,7 @@ #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) #define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000) +/* XXX TODO: cap this at 1, in case hz is not 1000 */ #define IEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000)) /* From owner-svn-src-head@freebsd.org Fri Jan 1 02:22:46 2016 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 E8199A5692D; Fri, 1 Jan 2016 02:22:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AB20414BB; Fri, 1 Jan 2016 02:22:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u012MjOw043510; Fri, 1 Jan 2016 02:22:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u012Mjpo043509; Fri, 1 Jan 2016 02:22:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601010222.u012Mjpo043509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 1 Jan 2016 02:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293028 - head/tools/regression 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, 01 Jan 2016 02:22:47 -0000 Author: ngie Date: Fri Jan 1 02:22:45 2016 New Revision: 293028 URL: https://svnweb.freebsd.org/changeset/base/293028 Log: - Use geom load instead of g load; g doesn't exist for all geom classes, e.g. geom_uzip(4) - These tests require root. Skip all of the tests if they're run as non-root MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/geom_subr.sh Modified: head/tools/regression/geom_subr.sh ============================================================================== --- head/tools/regression/geom_subr.sh Fri Jan 1 01:04:53 2016 (r293027) +++ head/tools/regression/geom_subr.sh Fri Jan 1 02:22:45 2016 (r293028) @@ -1,7 +1,12 @@ #!/bin/sh # $FreeBSD$ -kldstat -q -m g_${class} || g${class} load || exit 1 +if [ $(id -u) -ne 0 ]; then + echo 'Tests must be run as root' + echo 'Bail out!' + exit 1 +fi +kldstat -q -m g_${class} || geom ${class} load || exit 1 devwait() { From owner-svn-src-head@freebsd.org Fri Jan 1 02:25:12 2016 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 51041A56A22; Fri, 1 Jan 2016 02:25:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1F17C195F; Fri, 1 Jan 2016 02:25:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u012PBa8043635; Fri, 1 Jan 2016 02:25:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u012PBCe043634; Fri, 1 Jan 2016 02:25:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601010225.u012PBCe043634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 1 Jan 2016 02:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293029 - head/tools/regression 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, 01 Jan 2016 02:25:12 -0000 Author: ngie Date: Fri Jan 1 02:25:10 2016 New Revision: 293029 URL: https://svnweb.freebsd.org/changeset/base/293029 Log: Add functions for managing md(4) devices and cleaning up said md(4) devices These will be used soon in the various test scripts that source geom_subr.sh MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/geom_subr.sh Modified: head/tools/regression/geom_subr.sh ============================================================================== --- head/tools/regression/geom_subr.sh Fri Jan 1 02:22:45 2016 (r293028) +++ head/tools/regression/geom_subr.sh Fri Jan 1 02:25:10 2016 (r293029) @@ -17,3 +17,32 @@ devwait() sleep 0.2 done } + +# Need to keep track of the test md devices to avoid the scenario where a test +# failing will cause the other tests to bomb out, or a test failing will leave +# a large number of md(4) devices lingering around +: ${TMPDIR=/tmp} +export TMPDIR +TEST_MDS_FILE=${TMPDIR}/test_mds + +attach_md() +{ + local test_md + + test_md=$(mdconfig -a "$@") || exit + echo $test_md >> $TEST_MDS_FILE || exit + echo $test_md +} + +geom_test_cleanup() +{ + local test_md + + if [ -f $TEST_MDS_FILE ]; then + while read test_md; do + # The "#" tells the TAP parser this is a comment + echo "# Removing test memory disk: $test_md" + mdconfig -d -u $test_md + done < $TEST_MDS_FILE + fi +} From owner-svn-src-head@freebsd.org Fri Jan 1 02:47:42 2016 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 84ACBA57102; Fri, 1 Jan 2016 02:47:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4031713C4; Fri, 1 Jan 2016 02:47:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u012lfNT049870; Fri, 1 Jan 2016 02:47:41 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u012led7049864; Fri, 1 Jan 2016 02:47:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201601010247.u012led7049864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jan 2016 02:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293030 - in head/sys/powerpc: include mpc85xx powerpc 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, 01 Jan 2016 02:47:42 -0000 Author: jhibbits Date: Fri Jan 1 02:47:40 2016 New Revision: 293030 URL: https://svnweb.freebsd.org/changeset/base/293030 Log: Extend idle support for newer Book-E cores. Newer Book-E cores (e500mc, e5500, e6500) do not support the WE bit in the MSR, and instead delegate CPU idling to the SoC. Perhaps in the future the QORIQ_DPAA option for the mpc85xx platform will become a subclass, which will eliminate most of the #ifdef's. Modified: head/sys/powerpc/include/platform.h head/sys/powerpc/mpc85xx/mpc85xx.h head/sys/powerpc/mpc85xx/platform_mpc85xx.c head/sys/powerpc/powerpc/cpu.c head/sys/powerpc/powerpc/platform.c head/sys/powerpc/powerpc/platform_if.m Modified: head/sys/powerpc/include/platform.h ============================================================================== --- head/sys/powerpc/include/platform.h Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/include/platform.h Fri Jan 1 02:47:40 2016 (r293030) @@ -57,6 +57,8 @@ void platform_smp_ap_init(void); const char *installed_platform(void); void platform_probe_and_attach(void); +void platform_cpu_idle(int); + void platform_sleep(void); #endif /* _MACHINE_PLATFORM_H_ */ Modified: head/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.h Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/mpc85xx/mpc85xx.h Fri Jan 1 02:47:40 2016 (r293030) @@ -132,6 +132,12 @@ extern vm_offset_t ccsrbar_va; #define OCP85XX_RSTCR (CCSRBAR_VA + 0xe00b0) /* + * Run Control/Power Management Registers. + */ +#define OCP85XX_RCPM_CDOZSR (CCSRBAR_VA + 0xe2004) +#define OCP85XX_RCPM_CDOZCR (CCSRBAR_VA + 0xe200c) + +/* * Prototypes. */ uint32_t ccsr_read4(uintptr_t addr); Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Jan 1 02:47:40 2016 (r293030) @@ -80,6 +80,8 @@ static int mpc85xx_smp_first_cpu(platfor static int mpc85xx_smp_next_cpu(platform_t, struct cpuref *cpuref); static int mpc85xx_smp_get_bsp(platform_t, struct cpuref *cpuref); static int mpc85xx_smp_start_cpu(platform_t, struct pcpu *cpu); +static void mpc85xx_idle(platform_t, int cpu); +static int mpc85xx_idle_wakeup(platform_t plat, int cpu); static void mpc85xx_reset(platform_t); @@ -95,6 +97,8 @@ static platform_method_t mpc85xx_methods PLATFORMMETHOD(platform_smp_start_cpu, mpc85xx_smp_start_cpu), PLATFORMMETHOD(platform_reset, mpc85xx_reset), + PLATFORMMETHOD(platform_idle, mpc85xx_idle), + PLATFORMMETHOD(platform_idle_wakeup, mpc85xx_idle_wakeup), PLATFORMMETHOD_END }; @@ -478,3 +482,36 @@ mpc85xx_reset(platform_t plat) ; } +static void +mpc85xx_idle(platform_t plat, int cpu) +{ +#ifdef QORIQ_DPAA + uint32_t reg; + + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); +#else + register_t msr; + + msr = mfmsr(); + /* Freescale E500 core RM section 6.4.1. */ + __asm __volatile("msync; mtmsr %0; isync" :: + "r" (msr | PSL_WE)); +#endif +} + +static int +mpc85xx_idle_wakeup(platform_t plat, int cpu) +{ +#ifdef QORIQ_DPAA + uint32_t reg; + + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + + return (1); +#endif + return (0); +} Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/powerpc/cpu.c Fri Jan 1 02:47:40 2016 (r293030) @@ -607,12 +607,6 @@ cpu_idle(int busy) busy, curcpu); } -int -cpu_idle_wakeup(int cpu) -{ - return (0); -} - static void cpu_idle_60x(sbintime_t sbt) { @@ -651,14 +645,9 @@ cpu_idle_60x(sbintime_t sbt) static void cpu_idle_booke(sbintime_t sbt) { - register_t msr; - - msr = mfmsr(); #ifdef E500 - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (msr | PSL_WE)); + platform_cpu_idle(PCPU_GET(cpuid)); #endif } Modified: head/sys/powerpc/powerpc/platform.c ============================================================================== --- head/sys/powerpc/powerpc/platform.c Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/powerpc/platform.c Fri Jan 1 02:47:40 2016 (r293030) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -252,6 +253,19 @@ cpu_reset() PLATFORM_RESET(plat_obj); } +int +cpu_idle_wakeup(int cpu) +{ + return (PLATFORM_IDLE_WAKEUP(plat_obj, cpu)); +} + +void +platform_cpu_idle(int cpu) +{ + + PLATFORM_IDLE(plat_obj, cpu); +} + /* * Platform install routines. Highest priority wins, using the same * algorithm as bus attachment. Modified: head/sys/powerpc/powerpc/platform_if.m ============================================================================== --- head/sys/powerpc/powerpc/platform_if.m Fri Jan 1 02:25:10 2016 (r293029) +++ head/sys/powerpc/powerpc/platform_if.m Fri Jan 1 02:47:40 2016 (r293030) @@ -84,6 +84,14 @@ CODE { { return; } + static void platform_null_idle(platform_t plat, int cpu) + { + return; + } + static int platform_null_idle_wakeup(platform_t plat, int cpu) + { + return (0); + } }; /** @@ -211,6 +219,22 @@ METHOD void reset { }; /** + * @brief Idle a CPU + */ +METHOD void idle { + platform_t _plat; + int _cpu; +} DEFAULT platform_null_idle; + +/** + * @brief Wake up an idle CPU + */ +METHOD int idle_wakeup { + platform_t _plat; + int _cpu; +} DEFAULT platform_null_idle_wakeup; + +/** * @brief Suspend the CPU */ METHOD void sleep { From owner-svn-src-head@freebsd.org Fri Jan 1 03:12:52 2016 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 F0130A5784C; Fri, 1 Jan 2016 03:12:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A12D311BF; Fri, 1 Jan 2016 03:12:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u013CpWO059993; Fri, 1 Jan 2016 03:12:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u013Cpvs059988; Fri, 1 Jan 2016 03:12:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601010312.u013Cpvs059988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 1 Jan 2016 03:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293032 - in head/tools/regression: geom_concat geom_mirror geom_raid3 geom_shsec geom_stripe 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, 01 Jan 2016 03:12:53 -0000 Author: ngie Date: Fri Jan 1 03:12:51 2016 New Revision: 293032 URL: https://svnweb.freebsd.org/changeset/base/293032 Log: Use randomly generated device names in testcases via mktemp -u instead of using the hardcoded device name, "test" MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/geom_concat/conf.sh head/tools/regression/geom_mirror/conf.sh head/tools/regression/geom_raid3/conf.sh head/tools/regression/geom_shsec/conf.sh head/tools/regression/geom_stripe/conf.sh Modified: head/tools/regression/geom_concat/conf.sh ============================================================================== --- head/tools/regression/geom_concat/conf.sh Fri Jan 1 02:52:29 2016 (r293031) +++ head/tools/regression/geom_concat/conf.sh Fri Jan 1 03:12:51 2016 (r293032) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u concat.XXXXXX)" class="concat" base=`basename $0` Modified: head/tools/regression/geom_mirror/conf.sh ============================================================================== --- head/tools/regression/geom_mirror/conf.sh Fri Jan 1 02:52:29 2016 (r293031) +++ head/tools/regression/geom_mirror/conf.sh Fri Jan 1 03:12:51 2016 (r293032) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u mirror.XXXXXX)" class="mirror" base=`basename $0` Modified: head/tools/regression/geom_raid3/conf.sh ============================================================================== --- head/tools/regression/geom_raid3/conf.sh Fri Jan 1 02:52:29 2016 (r293031) +++ head/tools/regression/geom_raid3/conf.sh Fri Jan 1 03:12:51 2016 (r293032) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u graid3.XXXXXX)" class="raid3" base=`basename $0` Modified: head/tools/regression/geom_shsec/conf.sh ============================================================================== --- head/tools/regression/geom_shsec/conf.sh Fri Jan 1 02:52:29 2016 (r293031) +++ head/tools/regression/geom_shsec/conf.sh Fri Jan 1 03:12:51 2016 (r293032) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u shsec.XXXXXX)" class="shsec" base=`basename $0` Modified: head/tools/regression/geom_stripe/conf.sh ============================================================================== --- head/tools/regression/geom_stripe/conf.sh Fri Jan 1 02:52:29 2016 (r293031) +++ head/tools/regression/geom_stripe/conf.sh Fri Jan 1 03:12:51 2016 (r293032) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -name="test" +name="$(mktemp -u stripe.XXXXXX)" class="stripe" base=`basename $0` From owner-svn-src-head@freebsd.org Fri Jan 1 03:59:10 2016 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 EEDCAA581BA; Fri, 1 Jan 2016 03:59:10 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BA00D1613; Fri, 1 Jan 2016 03:59:10 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u013x9G8073504; Fri, 1 Jan 2016 03:59:09 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u013x9Gh073503; Fri, 1 Jan 2016 03:59:09 GMT (envelope-from des@FreeBSD.org) Message-Id: <201601010359.u013x9Gh073503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 1 Jan 2016 03:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293033 - head/sys/conf 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, 01 Jan 2016 03:59:11 -0000 Author: des Date: Fri Jan 1 03:59:09 2016 New Revision: 293033 URL: https://svnweb.freebsd.org/changeset/base/293033 Log: In the unload target, check that the module is loaded first. Add a reload target which unloads and then loads the module. Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Jan 1 03:12:51 2016 (r293032) +++ head/sys/conf/kmod.mk Fri Jan 1 03:59:09 2016 (r293033) @@ -28,6 +28,9 @@ # # KMODUNLOAD Command to unload a kernel module [/sbin/kldunload] # +# KMODISLOADED Command to check whether a kernel module is +# loaded [/sbin/kldstat -q -n] +# # PROG The name of the kernel module to build. # If not supplied, ${KMOD}.ko is used. # @@ -56,10 +59,14 @@ # unload: # Unload a module. # +# reload: +# Unload if loaded, then load. +# AWK?= awk KMODLOAD?= /sbin/kldload KMODUNLOAD?= /sbin/kldunload +KMODISLOADED?= /sbin/kldstat -q -n OBJCOPY?= objcopy .include @@ -325,7 +332,11 @@ load: ${PROG} .if !target(unload) unload: - ${KMODUNLOAD} -v ${PROG} + if ${KMODISLOADED} ${PROG} ; then ${KMODUNLOAD} -v ${PROG} ; fi +.endif + +.if !target(reload) +reload: unload load .endif .if defined(KERNBUILDDIR) From owner-svn-src-head@freebsd.org Fri Jan 1 04:04:42 2016 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 77CF2A5837E; Fri, 1 Jan 2016 04:04:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3A3C91AD0; Fri, 1 Jan 2016 04:04:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0144frk076435; Fri, 1 Jan 2016 04:04:41 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0144e1A076429; Fri, 1 Jan 2016 04:04:40 GMT (envelope-from des@FreeBSD.org) Message-Id: <201601010404.u0144e1A076429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 1 Jan 2016 04:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293034 - in head: share/man/man4 sys/dev/syscons/plasma sys/modules/syscons sys/modules/syscons/plasma 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, 01 Jan 2016 04:04:42 -0000 Author: des Date: Fri Jan 1 04:04:40 2016 New Revision: 293034 URL: https://svnweb.freebsd.org/changeset/base/293034 Log: 17 years and change after I wrote warp_saver, here's a simple plasma effect (currently only three circular patterns) which requires quite a bit of fixed-point arithmetic, including sqrt() and cos(). Happy New Year! Added: head/sys/dev/syscons/plasma/ head/sys/dev/syscons/plasma/fp16.c (contents, props changed) head/sys/dev/syscons/plasma/fp16.h (contents, props changed) head/sys/dev/syscons/plasma/plasma_saver.c (contents, props changed) head/sys/modules/syscons/plasma/ head/sys/modules/syscons/plasma/Makefile (contents, props changed) Modified: head/share/man/man4/splash.4 head/sys/modules/syscons/Makefile Modified: head/share/man/man4/splash.4 ============================================================================== --- head/share/man/man4/splash.4 Fri Jan 1 03:59:09 2016 (r293033) +++ head/share/man/man4/splash.4 Fri Jan 1 04:04:40 2016 (r293034) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 29, 2010 +.Dd December 31, 2015 .Dt SPLASH 4 .Os .Sh NAME @@ -130,6 +130,8 @@ the screen will also be powered off. Animated graphical .Fx logo. +.It Pa plasma_saver.ko +Draws an animated interference pattern. .It Pa rain_saver.ko Draws a shower on the screen. .It Pa snake_saver.ko @@ -282,6 +284,14 @@ based on the code, with some additional inspiration from the .Pa daemon_saver code. +The +.Pa logo_saver , +.Pa plasma_saver , +.Pa rain_saver +and +.Pa warp_saver +modules were written by +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . .Sh CAVEATS Both the splash screen and the screen saver work with .Xr syscons 4 Added: head/sys/dev/syscons/plasma/fp16.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/syscons/plasma/fp16.c Fri Jan 1 04:04:40 2016 (r293034) @@ -0,0 +1,131 @@ +/*- + * Copyright (c) 2015 Dag-Erling Smørgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifdef _KERNEL +#include +#else +#include +#include +#endif + +#include "fp16.h" + +/* + * Compute the quare root of x, using Newton's method with 2^(log2(x)/2) + * as the initial estimate. + */ +fp16_t +fp16_sqrt(fp16_t x) +{ + fp16_t y, delta; + signed int log2x; + + /* special case */ + if (x == 0) + return (0); + + /* shift toward 0 by half the logarithm */ + log2x = flsl(x) - 1; + if (log2x >= 16) { + y = x >> (log2x - 16) / 2; + } else { +#if 0 + y = x << (16 - log2x) / 2; +#else + /* XXX for now, return 0 for anything < 1 */ + return (0); +#endif + } + while (y > 0) { + /* delta = y^2 / 2y */ + delta = fp16_div(fp16_sub(fp16_mul(y, y), x), y * 2); + if (delta == 0) + break; + y = fp16_sub(y, delta); + } + return (y); +} + +static fp16_t fp16_cos_table[256] = { + 65536, 65534, 65531, 65524, 65516, 65505, 65491, 65475, + 65457, 65436, 65412, 65386, 65358, 65327, 65294, 65258, + 65220, 65179, 65136, 65091, 65043, 64992, 64939, 64884, + 64826, 64766, 64703, 64638, 64571, 64501, 64428, 64353, + 64276, 64197, 64115, 64030, 63943, 63854, 63762, 63668, + 63571, 63473, 63371, 63268, 63162, 63053, 62942, 62829, + 62714, 62596, 62475, 62353, 62228, 62100, 61971, 61839, + 61705, 61568, 61429, 61288, 61144, 60998, 60850, 60700, + 60547, 60392, 60235, 60075, 59913, 59749, 59583, 59414, + 59243, 59070, 58895, 58718, 58538, 58356, 58172, 57986, + 57797, 57606, 57414, 57219, 57022, 56822, 56621, 56417, + 56212, 56004, 55794, 55582, 55368, 55152, 54933, 54713, + 54491, 54266, 54040, 53811, 53581, 53348, 53114, 52877, + 52639, 52398, 52155, 51911, 51665, 51416, 51166, 50914, + 50660, 50403, 50146, 49886, 49624, 49360, 49095, 48828, + 48558, 48288, 48015, 47740, 47464, 47186, 46906, 46624, + 46340, 46055, 45768, 45480, 45189, 44897, 44603, 44308, + 44011, 43712, 43412, 43110, 42806, 42501, 42194, 41885, + 41575, 41263, 40950, 40636, 40319, 40002, 39682, 39362, + 39039, 38716, 38390, 38064, 37736, 37406, 37075, 36743, + 36409, 36074, 35738, 35400, 35061, 34721, 34379, 34036, + 33692, 33346, 32999, 32651, 32302, 31952, 31600, 31247, + 30893, 30538, 30181, 29824, 29465, 29105, 28745, 28383, + 28020, 27656, 27291, 26925, 26557, 26189, 25820, 25450, + 25079, 24707, 24334, 23960, 23586, 23210, 22833, 22456, + 22078, 21699, 21319, 20938, 20557, 20175, 19792, 19408, + 19024, 18638, 18253, 17866, 17479, 17091, 16702, 16313, + 15923, 15533, 15142, 14751, 14359, 13966, 13573, 13179, + 12785, 12390, 11995, 11600, 11204, 10807, 10410, 10013, + 9616, 9218, 8819, 8421, 8022, 7623, 7223, 6823, + 6423, 6023, 5622, 5222, 4821, 4420, 4018, 3617, + 3215, 2814, 2412, 2010, 1608, 1206, 804, 402, +}; + +/* + * Compute the cosine of theta. + */ +fp16_t +fp16_cos(fp16_t theta) +{ + unsigned int i; + + i = 1024 * (theta % FP16_2PI) / FP16_2PI; + switch (i / 256) { + case 0: + return (fp16_cos_table[i % 256]); + case 1: + return (-fp16_cos_table[255 - i % 256]); + case 2: + return (-fp16_cos_table[i % 256]); + case 3: + return (fp16_cos_table[255 - i % 256]); + default: + /* inconceivable! */ + return (0); + } +} Added: head/sys/dev/syscons/plasma/fp16.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/syscons/plasma/fp16.h Fri Jan 1 04:04:40 2016 (r293034) @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2015 Dag-Erling Smørgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef FP16_H_INCLUDED +#define FP16_H_INCLUDED + +typedef signed long long fp16_t; + +#define ItoFP16(n) ((signed long long)(n) << 16) +#define FP16toI(n) ((signed long long)(n) >> 16) + +#ifndef _KERNEL +#define FP16toF(n) ((n) / 65536.0) +#endif + +/* add a and b */ +static inline fp16_t +fp16_add(fp16_t a, fp16_t b) +{ + + return (a + b); +} + +/* subtract b from a */ +static inline fp16_t +fp16_sub(fp16_t a, fp16_t b) +{ + + return (a - b); +} + +/* multiply a by b */ +static inline fp16_t +fp16_mul(fp16_t a, fp16_t b) +{ + + return (a * b >> 16); +} + +/* divide a by b */ +static inline fp16_t +fp16_div(fp16_t a, fp16_t b) +{ + + return ((a << 16) / b); +} + +/* square root */ +fp16_t fp16_sqrt(fp16_t); + +#define FP16_2PI 411774 +#define FP16_PI 205887 +#define FP16_PI_2 102943 +#define FP16_PI_4 51471 + +/* cosine */ +fp16_t fp16_cos(fp16_t); + +#endif Added: head/sys/dev/syscons/plasma/plasma_saver.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/syscons/plasma/plasma_saver.c Fri Jan 1 04:04:40 2016 (r293034) @@ -0,0 +1,239 @@ +/*- + * Copyright (c) 2015 Dag-Erling Smørgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + * To CJA, in appreciation of Nighthawk brunches past and future. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define SAVER_NAME "plasma_saver" + +#include "fp16.h" + +/* + * Preferred video modes + */ +static int modes[] = { + M_VGA_CG640, + M_PC98_PEGC640x480, + M_PC98_PEGC640x400, + M_VGA_CG320, + -1 +}; + +/* + * Display parameters + */ +static unsigned char *vid; +static unsigned int banksize, scrmode, scrw, scrh; +static unsigned int blanked; + +/* + * List of foci + */ +#define FOCI 3 +static struct { + int x, y; /* coordinates */ + int vx, vy; /* velocity */ +} plasma_foci[FOCI]; + +/* + * Palette + */ +static struct { + unsigned char r, g, b; +} plasma_pal[256]; + +/* + * Draw a new frame + */ +static void +plasma_update(video_adapter_t *adp) +{ + unsigned int x, y; /* coordinates */ + signed int dx, dy; /* horizontal / vertical distance */ + fp16_t sqd, d; /* square of distance and distance */ + fp16_t m; /* magnitude */ + unsigned int org, off; /* origin and offset */ + unsigned int i; /* loop index */ + + /* switch to bank 0 */ + vidd_set_win_org(adp, 0); + /* for each scan line */ + for (y = org = off = 0; y < scrh; ++y) { + /* for each pixel on scan line */ + for (x = 0; x < scrw; ++x, ++off) { + /* for each focus */ + for (i = m = 0; i < FOCI; ++i) { + dx = x - plasma_foci[i].x; + dy = y - plasma_foci[i].y; + sqd = ItoFP16(dx * dx + dy * dy); + d = fp16_sqrt(sqd); + /* divide by 4 to stretch out the pattern */ + m = fp16_add(m, fp16_cos(d / 4)); + } + /* + * m is now in the range +/- FOCI, but we need a + * value between 0 and 255. We scale to +/- 127 + * and add 127, which moves it into the range [0, + * 254]. + */ + m = fp16_mul(m, ItoFP16(127)); + m = fp16_div(m, ItoFP16(FOCI)); + m = fp16_add(m, ItoFP16(127)); + /* switch banks if necessary */ + if (off > banksize) { + off -= banksize; + org += banksize; + vidd_set_win_org(adp, org); + } + /* plot */ + vid[off] = FP16toI(m); + } + } + /* now move the foci */ + for (i = 0; i < FOCI; ++i) { + plasma_foci[i].x += plasma_foci[i].vx; + if (plasma_foci[i].x < 0) { + /* bounce against left wall */ + plasma_foci[i].vx = -plasma_foci[i].vx; + plasma_foci[i].x = -plasma_foci[i].x; + } else if (plasma_foci[i].x >= scrw) { + /* bounce against right wall */ + plasma_foci[i].vx = -plasma_foci[i].vx; + plasma_foci[i].x = scrw - (plasma_foci[i].x - scrw); + } + plasma_foci[i].y += plasma_foci[i].vy; + if (plasma_foci[i].y < 0) { + /* bounce against ceiling */ + plasma_foci[i].vy = -plasma_foci[i].vy; + plasma_foci[i].y = -plasma_foci[i].y; + } else if (plasma_foci[i].y >= scrh) { + /* bounce against floor */ + plasma_foci[i].vy = -plasma_foci[i].vy; + plasma_foci[i].y = scrh - (plasma_foci[i].y - scrh); + } + } +} + +/* + * Start or stop the screensaver + */ +static int +plasma_saver(video_adapter_t *adp, int blank) +{ + int pl; + + if (blank) { + /* switch to graphics mode */ + if (blanked <= 0) { + pl = splhigh(); + vidd_set_mode(adp, scrmode); + vidd_load_palette(adp, (unsigned char *)plasma_pal); + vidd_set_border(adp, 0); + blanked++; + vid = (unsigned char *)adp->va_window; + banksize = adp->va_window_size; + splx(pl); + vidd_clear(adp); + } + /* update display */ + plasma_update(adp); + } else { + blanked = 0; + } + return (0); +} + +/* + * Initialize on module load + */ +static int +plasma_init(video_adapter_t *adp) +{ + video_info_t info; + int i; + + /* select video mode */ + for (i = 0; modes[i] >= 0; ++i) + if (vidd_get_info(adp, modes[i], &info) == 0) + break; + if (modes[i] < 0) { + log(LOG_NOTICE, "%s: no supported video modes\n", SAVER_NAME); + return (ENODEV); + } + scrmode = modes[i]; + scrw = info.vi_width; + scrh = info.vi_height; + + /* initialize the palette */ + for (i = 0; i < 256; ++i) + plasma_pal[i].r = plasma_pal[i].g = plasma_pal[i].b = i; + + /* randomize the foci */ + for (i = 0; i < FOCI; i++) { + plasma_foci[i].x = random() % scrw; + plasma_foci[i].y = random() % scrh; + plasma_foci[i].vx = random() % 5 - 2; + plasma_foci[i].vy = random() % 5 - 2; + } + + return (0); +} + +/* + * Clean up before module unload + */ +static int +plasma_term(video_adapter_t *adp) +{ + + return (0); +} + +/* + * Boilerplate + */ +static scrn_saver_t plasma_module = { + SAVER_NAME, + plasma_init, + plasma_term, + plasma_saver, + NULL +}; + +SAVER_MODULE(plasma_saver, plasma_module); Modified: head/sys/modules/syscons/Makefile ============================================================================== --- head/sys/modules/syscons/Makefile Fri Jan 1 03:59:09 2016 (r293033) +++ head/sys/modules/syscons/Makefile Fri Jan 1 04:04:40 2016 (r293034) @@ -9,6 +9,7 @@ SUBDIR= ${_apm} \ ${_fire} \ green \ ${_logo} \ + ${_plasma} \ ${_rain} \ ${_snake} \ ${_star} \ @@ -25,6 +26,7 @@ _daemon= daemon _dragon= dragon _fire= fire _logo= logo +_plasma= plasma _rain= rain _snake= snake _star= star Added: head/sys/modules/syscons/plasma/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/syscons/plasma/Makefile Fri Jan 1 04:04:40 2016 (r293034) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../dev/syscons/plasma + +KMOD= plasma_saver +SRCS= fp16.c plasma_saver.c + +.include From owner-svn-src-head@freebsd.org Fri Jan 1 10:15:07 2016 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 81ECAA5D36C; Fri, 1 Jan 2016 10:15:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5025D1601; Fri, 1 Jan 2016 10:15:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01AF6FJ090126; Fri, 1 Jan 2016 10:15:06 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01AF62N090123; Fri, 1 Jan 2016 10:15:06 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201601011015.u01AF62N090123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 1 Jan 2016 10:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293035 - in head/sys: net 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, 01 Jan 2016 10:15:07 -0000 Author: melifaro Date: Fri Jan 1 10:15:06 2016 New Revision: 293035 URL: https://svnweb.freebsd.org/changeset/base/293035 Log: Remove second EVENTHANDLER_REGISTER slipped in r292978. Describe the reason of doing unconditional M_PREPEND in ether_output(). Modified: head/sys/net/if_ethersubr.c head/sys/netinet/if_ether.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Fri Jan 1 04:04:40 2016 (r293034) +++ head/sys/net/if_ethersubr.c Fri Jan 1 10:15:06 2016 (r293035) @@ -324,6 +324,10 @@ ether_output(struct ifnet *ifp, struct m /* * Add local net header. If no space in first mbuf, * allocate another. + * + * Note that we do prepend regardless of RT_HAS_HEADER flag. + * This is done because BPF code shifts m_data pointer + * to the end of ethernet header prior to calling if_output(). */ M_PREPEND(m, hlen, M_NOWAIT); if (m == NULL) Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Jan 1 04:04:40 2016 (r293034) +++ head/sys/netinet/if_ether.c Fri Jan 1 10:15:06 2016 (r293035) @@ -1334,8 +1334,5 @@ arp_init(void) if (IS_DEFAULT_VNET(curvnet)) iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY); - if (IS_DEFAULT_VNET(curvnet)) - iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, - arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY); } SYSINIT(arp, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, arp_init, 0); From owner-svn-src-head@freebsd.org Fri Jan 1 11:57:33 2016 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 86A1DA544F3; Fri, 1 Jan 2016 11:57:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5372E172E; Fri, 1 Jan 2016 11:57:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01BvWBn020040; Fri, 1 Jan 2016 11:57:32 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01BvWLj020039; Fri, 1 Jan 2016 11:57:32 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201601011157.u01BvWLj020039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 1 Jan 2016 11:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293037 - head/etc/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: Fri, 01 Jan 2016 11:57:33 -0000 Author: cy Date: Fri Jan 1 11:57:32 2016 New Revision: 293037 URL: https://svnweb.freebsd.org/changeset/base/293037 Log: Update leap-seconds to latest. This will satisfy the ntpd leap-second version check. Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/. See also: http://www.iers.org/SharedDocs/News/EN/BulletinC.html Modified: head/etc/ntp/leap-seconds Modified: head/etc/ntp/leap-seconds ============================================================================== --- head/etc/ntp/leap-seconds Fri Jan 1 11:19:32 2016 (r293036) +++ head/etc/ntp/leap-seconds Fri Jan 1 11:57:32 2016 (r293037) @@ -1,119 +1,221 @@ # # $FreeBSD$ # -# ATOMIC TIME. -# The Coordinated Universal Time (UTC) is the reference time scale derived -# from The "Temps Atomique International" (TAI) calculated by the Bureau -# International des Poids et Mesures (BIPM) using a worldwide network of atomic -# clocks. UTC differs from TAI by an integer number of seconds; it is the basis -# of all activities in the world. -# -# -# ASTRONOMICAL TIME (UT1) is the time scale based on the rate of rotation of the earth. -# It is now mainly derived from Very Long Baseline Interferometry (VLBI). The various -# irregular fluctuations progressively detected in the rotation rate of the Earth lead -# in 1972 to the replacement of UT1 by UTC as the reference time scale. -# -# -# LEAP SECOND -# Atomic clocks are more stable than the rate of the earth rotatiob since the later -# undergoes a full range of geophysical perturbations at various time scales (lunisolar -# and core-mantle torques,atmospheric and oceanic effetcs, ...) -# Leap seconds are needed to keep the two time scales in agreement, i.e. UT1-UTC smaller -# than 0.9 second. So, when necessary a "leap second" is introduced in UTC. -# Since the adoption of this system in 1972 it has been necessary to add 26 seconds to UTC, -# firstly due to the initial choice of the value of the second (1/86400 mean solar day of -# the year 1820) and secondly to the general slowing down of the Earth's rotation. It is -# theorically possible to have a negative leap second (a second removed from UTC), but so far, -# all leap seconds have been positive (a second has been added to UTC). Based on what we know about the earth's rotation, -# it is unlikely that we will ever have a negative leap second. -# -# -# HISTORY -# The first leap second was added on June 30, 1972. Until 2000, it was necessary in average to add a leap second at a rate -# of 1 to 2 years. Since 2000, due to the fact that the earth rate of rotation is accelerating, leap seconds are introduced -# with an average frequency of 3 to 4 years. -# -# -# RESPONSABILITY OF THE DECISION TO INTRODUCE A LEAP SECOND IN UTC -# The decision to introduce a leap second in UTC is the responsibility of the Earth Orientation Center of -# the International Earth Rotation and reference System Service (IERS). This center is located at Paris -# Observatory. According to international agreements, leap second date have to occur at fixed date : -# first preference is given to the end of December and June, and second preference at the end of March -# and September. Since the system was introduced in 1972, only dates in June and December were used. -# -# Questions or comments to: -# Daniel Gambis, daniel.gambis@obspm.fr -# Christian Bizouard: christian.bizouard@obspm.fr -# Earth orientation Center of the IERS -# Paris Observatory, France -# -# -# -# VALIDITY OF THE FILE -# It is important to express the validity of the file. These next two dates are -# given in units of seconds since 1900.0. -# -# 1) Last update of the file. -# -# Updated through IERS Bulletin C (ftp://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat) -# -# The following line shows the last update of this file in NTP timestamp: -# -#$ 3645216000 -# -# 2) Expiration date of the file given on a semi-annual basis: last June or last December -# -# File expires on 28 December 2015 -# -# Expire date in NTP timestamp: -# -#@ 3660249600 -# -# -# LIST OF LEAP SECONDS -# NTP timestamp (X parameter) is the number of seconds since 1900.0 -# -# MJD: The Modified Julian Day number. MJD = X/86400 + 15020 -# -# DTAI: The difference DTAI= TAI-UTC in units of seconds -# It is the quantity to add to UTC to get the time in TAI -# -# Day Month Year : epoch in clear -# -#NTP Time DTAI Day Month Year -# -2272060800 10 # 1 Jan 1972 -2287785600 11 # 1 Jul 1972 -2303683200 12 # 1 Jan 1973 -2335219200 13 # 1 Jan 1974 -2366755200 14 # 1 Jan 1975 -2398291200 15 # 1 Jan 1976 -2429913600 16 # 1 Jan 1977 -2461449600 17 # 1 Jan 1978 -2492985600 18 # 1 Jan 1979 -2524521600 19 # 1 Jan 1980 -2571782400 20 # 1 Jul 1981 -2603318400 21 # 1 Jul 1982 -2634854400 22 # 1 Jul 1983 -2698012800 23 # 1 Jul 1985 -2776982400 24 # 1 Jan 1988 -2840140800 25 # 1 Jan 1990 -2871676800 26 # 1 Jan 1991 -2918937600 27 # 1 Jul 1992 -2950473600 28 # 1 Jul 1993 -2982009600 29 # 1 Jul 1994 -3029443200 30 # 1 Jan 1996 -3076704000 31 # 1 Jul 1997 -3124137600 32 # 1 Jan 1999 -3345062400 33 # 1 Jan 2006 -3439756800 34 # 1 Jan 2009 -3550089600 35 # 1 Jul 2012 -3644697600 36 # 1 Jul 2015 -# -# In order to verify the integrity of this file, a hash code -# has been generated. For more information how to use -# this hash code, please consult the README file under the -# 'sha' repertory. +# In the following text, the symbol '#' introduces +# a comment, which continues from that symbol until +# the end of the line. A plain comment line has a +# whitespace character following the comment indicator. +# There are also special comment lines defined below. +# A special comment will always have a non-whitespace +# character in column 2. +# +# A blank line should be ignored. +# +# The following table shows the corrections that must +# be applied to compute International Atomic Time (TAI) +# from the Coordinated Universal Time (UTC) values that +# are transmitted by almost all time services. +# +# The first column shows an epoch as a number of seconds +# since 1900.0 and the second column shows the number of +# seconds that must be added to UTC to compute TAI for +# any timestamp at or after that epoch. The value on +# each line is valid from the indicated initial instant +# until the epoch given on the next one or indefinitely +# into the future if there is no next line. +# (The comment on each line shows the representation of +# the corresponding initial epoch in the usual +# day-month-year format. The epoch always begins at +# 00:00:00 UTC on the indicated day. See Note 5 below.) +# +# Important notes: +# +# 1. Coordinated Universal Time (UTC) is often referred to +# as Greenwich Mean Time (GMT). The GMT time scale is no +# longer used, and the use of GMT to designate UTC is +# discouraged. +# +# 2. The UTC time scale is realized by many national +# laboratories and timing centers. Each laboratory +# identifies its realization with its name: Thus +# UTC(NIST), UTC(USNO), etc. The differences among +# these different realizations are typically on the +# order of a few nanoseconds (i.e., 0.000 000 00x s) +# and can be ignored for many purposes. These differences +# are tabulated in Circular T, which is published monthly +# by the International Bureau of Weights and Measures +# (BIPM). See www.bipm.fr for more information. +# +# 3. The current defintion of the relationship between UTC +# and TAI dates from 1 January 1972. A number of different +# time scales were in use before than epoch, and it can be +# quite difficult to compute precise timestamps and time +# intervals in those "prehistoric" days. For more information, +# consult: +# +# The Explanatory Supplement to the Astronomical +# Ephemeris. +# or +# Terry Quinn, "The BIPM and the Accurate Measurement +# of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, +# July, 1991. +# +# 4. The insertion of leap seconds into UTC is currently the +# responsibility of the International Earth Rotation Service, +# which is located at the Paris Observatory: +# +# Central Bureau of IERS +# 61, Avenue de l'Observatoire +# 75014 Paris, France. +# +# Leap seconds are announced by the IERS in its Bulletin C +# +# See hpiers.obspm.fr or www.iers.org for more details. +# +# All national laboratories and timing centers use the +# data from the BIPM and the IERS to construct their +# local realizations of UTC. +# +# Although the definition also includes the possibility +# of dropping seconds ("negative" leap seconds), this has +# never been done and is unlikely to be necessary in the +# foreseeable future. +# +# 5. If your system keeps time as the number of seconds since +# some epoch (e.g., NTP timestamps), then the algorithm for +# assigning a UTC time stamp to an event that happens during a positive +# leap second is not well defined. The official name of that leap +# second is 23:59:60, but there is no way of representing that time +# in these systems. +# Many systems of this type effectively stop the system clock for +# one second during the leap second and use a time that is equivalent +# to 23:59:59 UTC twice. For these systems, the corresponding TAI +# timestamp would be obtained by advancing to the next entry in the +# following table when the time equivalent to 23:59:59 UTC +# is used for the second time. Thus the leap second which +# occurred on 30 June 1972 at 23:59:59 UTC would have TAI +# timestamps computed as follows: +# +# ... +# 30 June 1972 23:59:59 (2287785599, first time): TAI= UTC + 10 seconds +# 30 June 1972 23:59:60 (2287785599,second time): TAI= UTC + 11 seconds +# 1 July 1972 00:00:00 (2287785600) TAI= UTC + 11 seconds +# ... +# +# If your system realizes the leap second by repeating 00:00:00 UTC twice +# (this is possible but not usual), then the advance to the next entry +# in the table must occur the second time that a time equivlent to +# 00:00:00 UTC is used. Thus, using the same example as above: +# +# ... +# 30 June 1972 23:59:59 (2287785599): TAI= UTC + 10 seconds +# 30 June 1972 23:59:60 (2287785600, first time): TAI= UTC + 10 seconds +# 1 July 1972 00:00:00 (2287785600,second time): TAI= UTC + 11 seconds +# ... +# +# in both cases the use of timestamps based on TAI produces a smooth +# time scale with no discontinuity in the time interval. +# +# This complexity would not be needed for negative leap seconds (if they +# are ever used). The UTC time would skip 23:59:59 and advance from +# 23:59:58 to 00:00:00 in that case. The TAI offset would decrease by +# 1 second at the same instant. This is a much easier situation to deal +# with, since the difficulty of unambiguously representing the epoch +# during the leap second does not arise. +# +# Questions or comments to: +# Jeff Prillaman +# Time Service Department +# US Naval Observatory +# Washington, DC +# jeffrey.prillaman@usno.navy.mil +# +# Last Update of leap second values: 31 Dec 2015 +# +# The following line shows this last update date in NTP timestamp +# format. This is the date on which the most recent change to +# the leap second data was added to the file. This line can +# be identified by the unique pair of characters in the first two +# columns as shown below. +# +#$ 3660508800 +# +# The data in this file will be updated periodically as new leap +# seconds are announced. In addition to being entered on the line +# above, the update time (in NTP format) will be added to the basic +# file name leap-seconds to form the name leap-seconds.. +# In addition, the generic name leap-seconds.list will always point to +# the most recent version of the file. +# +# This update procedure will be performed only when a new leap second +# is announced. +# +# The following entry specifies the expiration date of the data +# in this file in units of seconds since 1900.0. This expiration date +# will be changed at least twice per year whether or not a new leap +# second is announced. These semi-annual changes will be made no +# later than 1 June and 1 December of each year to indicate what +# action (if any) is to be taken on 30 June and 31 December, +# respectively. (These are the customary effective dates for new +# leap seconds.) This expiration date will be identified by a +# unique pair of characters in columns 1 and 2 as shown below. +# In the unlikely event that a leap second is announced with an +# effective date other than 30 June or 31 December, then this +# file will be edited to include that leap second as soon as it is +# announced or at least one month before the effective date +# (whichever is later). +# If an announcement by the IERS specifies that no leap second is +# scheduled, then only the expiration date of the file will +# be advanced to show that the information in the file is still +# current -- the update time stamp, the data and the name of the file +# will not change. +# +# Updated through IERS Bulletin C 50 +# File expires on: 1 Jun 2016 +# +#@ 3673728000 +# +2272060800 10 # 1 Jan 1972 +2287785600 11 # 1 Jul 1972 +2303683200 12 # 1 Jan 1973 +2335219200 13 # 1 Jan 1974 +2366755200 14 # 1 Jan 1975 +2398291200 15 # 1 Jan 1976 +2429913600 16 # 1 Jan 1977 +2461449600 17 # 1 Jan 1978 +2492985600 18 # 1 Jan 1979 +2524521600 19 # 1 Jan 1980 +2571782400 20 # 1 Jul 1981 +2603318400 21 # 1 Jul 1982 +2634854400 22 # 1 Jul 1983 +2698012800 23 # 1 Jul 1985 +2776982400 24 # 1 Jan 1988 +2840140800 25 # 1 Jan 1990 +2871676800 26 # 1 Jan 1991 +2918937600 27 # 1 Jul 1992 +2950473600 28 # 1 Jul 1993 +2982009600 29 # 1 Jul 1994 +3029443200 30 # 1 Jan 1996 +3076704000 31 # 1 Jul 1997 +3124137600 32 # 1 Jan 1999 +3345062400 33 # 1 Jan 2006 +3439756800 34 # 1 Jan 2009 +3550089600 35 # 1 Jul 2012 +3644697600 36 # 1 Jul 2015 +# +# the following special comment contains the +# hash value of the data in this file computed +# use the secure hash algorithm as specified +# by FIPS 180-1. See the files in ~/sha for +# the details of how this hash value is +# computed. Note that the hash computation +# ignores comments and whitespace characters +# in data lines. It includes the NTP values +# of both the last modification time and the +# expiration time of the file, but not the +# white space on those lines. +# the hash line is also ignored in the +# computation. +# +#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5 # -#h 620ba8af 37900668 95ac09ba d77640f9 6fd75493 From owner-svn-src-head@freebsd.org Fri Jan 1 12:35:34 2016 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 65E69A56A6B; Fri, 1 Jan 2016 12:35:34 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2C6881ADE; Fri, 1 Jan 2016 12:35:34 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01CZX5A031618; Fri, 1 Jan 2016 12:35:33 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01CZXDZ031617; Fri, 1 Jan 2016 12:35:33 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201601011235.u01CZXDZ031617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 1 Jan 2016 12:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293038 - 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: Fri, 01 Jan 2016 12:35:34 -0000 Author: melifaro Date: Fri Jan 1 12:35:33 2016 New Revision: 293038 URL: https://svnweb.freebsd.org/changeset/base/293038 Log: Use lltable_get_ifp() instead of direct access to lltable fields. Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Fri Jan 1 11:57:32 2016 (r293037) +++ head/sys/netinet6/nd6_nbr.c Fri Jan 1 12:35:33 2016 (r293038) @@ -877,6 +877,7 @@ nd6_na_input(struct mbuf *m, int off, in */ struct nd_defrouter *dr; struct in6_addr *in6; + struct ifnet *nd6_ifp; in6 = &ln->r_l3addr.addr6; @@ -886,10 +887,11 @@ nd6_na_input(struct mbuf *m, int off, in * is only called under the network software interrupt * context. However, we keep it just for safety. */ - dr = defrouter_lookup(in6, ln->lle_tbl->llt_ifp); + nd6_ifp = lltable_get_ifp(ln->lle_tbl); + dr = defrouter_lookup(in6, nd6_ifp); if (dr) defrtrlist_del(dr); - else if (ND_IFINFO(ln->lle_tbl->llt_ifp)->flags & + else if (ND_IFINFO(nd6_ifp)->flags & ND6_IFF_ACCEPT_RTADV) { /* * Even if the neighbor is not in the default From owner-svn-src-head@freebsd.org Fri Jan 1 12:45:00 2016 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 A2030A56D74; Fri, 1 Jan 2016 12:45:00 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (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 6BB791F2B; Fri, 1 Jan 2016 12:44:59 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9E1C31FE024; Fri, 1 Jan 2016 13:44:50 +0100 (CET) Subject: Re: svn commit: r292987 - in head/sys/compat/linuxkpi/common: include/linux src To: "Bjoern A. Zeeb" References: <201512311230.tBVCUJB7094023@repo.freebsd.org> <1F2A43B0-6A36-4C8C-B09C-5BA66B3BFE6C@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <56867540.9020003@selasky.org> Date: Fri, 1 Jan 2016 13:46:56 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1F2A43B0-6A36-4C8C-B09C-5BA66B3BFE6C@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed 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, 01 Jan 2016 12:45:00 -0000 On 12/31/15 19:15, Bjoern A. Zeeb wrote: > >> On 31 Dec 2015, at 12:30 , Hans Petter Selasky wrote: >> >> Author: hselasky >> Date: Thu Dec 31 12:30:19 2015 >> New Revision: 292987 >> URL: https://svnweb.freebsd.org/changeset/base/292987 >> >> Log: >> Minor LinuxKPI code cleanup: >> - Declare some static functions in linux_compat.c instead if inside >> various header files. >> - Prefix FreeBSD local functions in the LinuxKPI with "linux_" to >> avoid symbol name conflicts in the future and to make debugging >> easier. >> - Make the "struct kobj_ktype" declaractions constant to shave off a >> few bytes from the data segment. >> >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/cdev.h >> head/sys/compat/linuxkpi/common/include/linux/device.h >> head/sys/compat/linuxkpi/common/include/linux/kobject.h >> head/sys/compat/linuxkpi/common/include/linux/miscdevice.h >> head/sys/compat/linuxkpi/common/src/linux_compat.c >> head/sys/compat/linuxkpi/common/src/linux_pci.c > > > I can only guess if it was this commit? This is i386.LINT* erroring (but there might be other kernels as well; don’t know yet): > I'll check it out. Did you build from clean? --HPS From owner-svn-src-head@freebsd.org Fri Jan 1 12:55:36 2016 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 1D4FDA5D0B7; Fri, 1 Jan 2016 12:55:36 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (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 DE3E31395; Fri, 1 Jan 2016 12:55:35 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 950DD1FE024; Fri, 1 Jan 2016 13:55:32 +0100 (CET) Subject: Re: svn commit: r292987 - in head/sys/compat/linuxkpi/common: include/linux src To: "Bjoern A. Zeeb" References: <201512311230.tBVCUJB7094023@repo.freebsd.org> <1F2A43B0-6A36-4C8C-B09C-5BA66B3BFE6C@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <568677C2.3040907@selasky.org> Date: Fri, 1 Jan 2016 13:57:38 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1F2A43B0-6A36-4C8C-B09C-5BA66B3BFE6C@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed 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, 01 Jan 2016 12:55:36 -0000 On 12/31/15 19:15, Bjoern A. Zeeb wrote: > >> On 31 Dec 2015, at 12:30 , Hans Petter Selasky wrote: >> >> Author: hselasky >> Date: Thu Dec 31 12:30:19 2015 >> New Revision: 292987 >> URL: https://svnweb.freebsd.org/changeset/base/292987 >> >> Log: >> Minor LinuxKPI code cleanup: >> - Declare some static functions in linux_compat.c instead if inside >> various header files. >> - Prefix FreeBSD local functions in the LinuxKPI with "linux_" to >> avoid symbol name conflicts in the future and to make debugging >> easier. >> - Make the "struct kobj_ktype" declaractions constant to shave off a >> few bytes from the data segment. >> >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/cdev.h >> head/sys/compat/linuxkpi/common/include/linux/device.h >> head/sys/compat/linuxkpi/common/include/linux/kobject.h >> head/sys/compat/linuxkpi/common/include/linux/miscdevice.h >> head/sys/compat/linuxkpi/common/src/linux_compat.c >> head/sys/compat/linuxkpi/common/src/linux_pci.c > > > I can only guess if it was this commit? This is i386.LINT* erroring (but there might be other kernels as well; don’t know yet): > Hi, There are currently missing dependency rules, which is due to a lack in the "config" utility, for the infiniband code, so you'll need to clean your already compiled objects manually, and the compile errors will go away I think. I'll double check my LINT builds locally and come back to you if it is a real issue. --HPS From owner-svn-src-head@freebsd.org Fri Jan 1 15:17:25 2016 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 CE140A5E7BE; Fri, 1 Jan 2016 15:17:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 977D61328; Fri, 1 Jan 2016 15:17:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01FHOcr079301; Fri, 1 Jan 2016 15:17:24 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01FHOCo079299; Fri, 1 Jan 2016 15:17:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201601011517.u01FHOCo079299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jan 2016 15:17:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293039 - in head/sys/dev: sec tsec 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, 01 Jan 2016 15:17:25 -0000 Author: jhibbits Date: Fri Jan 1 15:17:24 2016 New Revision: 293039 URL: https://svnweb.freebsd.org/changeset/base/293039 Log: Fix a couple printf formats. This was found when working on 64-bit PowerPC book-e support. Modified: head/sys/dev/sec/sec.c head/sys/dev/tsec/if_tsec.c Modified: head/sys/dev/sec/sec.c ============================================================================== --- head/sys/dev/sec/sec.c Fri Jan 1 12:35:33 2016 (r293038) +++ head/sys/dev/sec/sec.c Fri Jan 1 15:17:24 2016 (r293039) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -235,7 +236,7 @@ sec_probe(device_t dev) sc->sc_version = 3; break; default: - device_printf(dev, "unknown SEC ID 0x%016llx!\n", id); + device_printf(dev, "unknown SEC ID 0x%16"PRIx64"!\n", id); return (ENXIO); } Modified: head/sys/dev/tsec/if_tsec.c ============================================================================== --- head/sys/dev/tsec/if_tsec.c Fri Jan 1 12:35:33 2016 (r293038) +++ head/sys/dev/tsec/if_tsec.c Fri Jan 1 15:17:24 2016 (r293039) @@ -561,7 +561,7 @@ tsec_set_mac_address(struct tsec_softc * TSEC_GLOBAL_LOCK_ASSERT(sc); KASSERT((ETHER_ADDR_LEN <= sizeof(macbuf)), - ("tsec_set_mac_address: (%d <= %d", ETHER_ADDR_LEN, + ("tsec_set_mac_address: (%d <= %zd", ETHER_ADDR_LEN, sizeof(macbuf))); macbufp = (char *)macbuf; From owner-svn-src-head@freebsd.org Fri Jan 1 15:30:13 2016 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 2056FA5EAE6; Fri, 1 Jan 2016 15:30:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EB1F91D35; Fri, 1 Jan 2016 15:30:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01FUBsr082326; Fri, 1 Jan 2016 15:30:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01FUBSK082324; Fri, 1 Jan 2016 15:30:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601011530.u01FUBSK082324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 1 Jan 2016 15:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293040 - in head: lib/libstand sys/boot/libstand32 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, 01 Jan 2016 15:30:13 -0000 Author: emaste Date: Fri Jan 1 15:30:11 2016 New Revision: 293040 URL: https://svnweb.freebsd.org/changeset/base/293040 Log: Reduce libstand Makefile duplication libstand is built in three places (lib/libstand, sys/boot/libstand32, and sys/boot/userboot/libstand). Reduce Makefile duplication by .including libstand/Makefile from sys/boot/libstand32/Makefile. sys/boot/userboot/libstand/Makefile will be addressed later, as it contains additional differences yet to be handled. This change also switches libstand32 to use the new uuid_from_string and uuid_to_string, which was not included in r292473. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4747 Modified: head/lib/libstand/Makefile head/sys/boot/libstand32/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Fri Jan 1 15:17:24 2016 (r293039) +++ head/lib/libstand/Makefile Fri Jan 1 15:30:11 2016 (r293040) @@ -11,13 +11,14 @@ MK_SSP= no .include -LIBSTAND_SRC= ${.CURDIR} +LIBSTAND_SRC?= ${.CURDIR} +LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} LIBC_SRC= ${LIBSTAND_SRC}/../libc LIB= stand NO_PIC= INCS= stand.h -MAN= libstand.3 +MAN?= libstand.3 WARNS?= 0 @@ -78,7 +79,7 @@ SRCS+= syncicache.c SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c # _setjmp/_longjmp -.PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH} +.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH} SRCS+= _setjmp.S # decompression functionality from libbz2 Modified: head/sys/boot/libstand32/Makefile ============================================================================== --- head/sys/boot/libstand32/Makefile Fri Jan 1 15:17:24 2016 (r293039) +++ head/sys/boot/libstand32/Makefile Fri Jan 1 15:30:11 2016 (r293040) @@ -1,151 +1,23 @@ # $FreeBSD$ -# Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $ -# -# Notes: -# - We don't use the libc strerror/sys_errlist because the string table is -# quite large. -# - -MAN= .include -MK_SSP= no LIBSTAND_SRC= ${.CURDIR}/../../../lib/libstand -LIBC_SRC= ${LIBSTAND_SRC}/../libc - -.PATH: ${LIBSTAND_SRC} -LIB= stand -INTERNALLIB= -MK_PROFILE= no -NO_PIC= -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" -CFLAGS+= -m32 -I. -.endif - -WARNS?= 0 - -# standalone components and stuff we have modified locally -SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ - globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \ - sbrk.c twiddle.c zalloc.c zalloc_malloc.c - -# private (pruned) versions of libc string functions -SRCS+= strcasecmp.c - -.PATH: ${LIBC_SRC}/net - -SRCS+= ntoh.c - -# string functions from libc -.PATH: ${LIBC_SRC}/string -SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ - memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ - strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ - strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c -.if ${MACHINE_CPUARCH} == "arm" -.PATH: ${LIBC_SRC}/arm/gen - -# Compiler support functions -.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/ -# __clzsi2 and ctzsi2 for various builtin functions -SRCS+= clzsi2.c ctzsi2.c -# Divide and modulus functions called by the compiler -SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c -SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c - -.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/ -SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S -SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S - -.endif -.if ${MACHINE_CPUARCH} == "powerpc" -.PATH: ${LIBC_SRC}/quad -SRCS+= ashldi3.c ashrdi3.c -SRCS+= syncicache.c -.endif - -# uuid functions from libc -.PATH: ${LIBC_SRC}/uuid -SRCS+= uuid_equal.c uuid_is_nil.c - -# _setjmp/_longjmp .if ${MACHINE_CPUARCH} == "amd64" -.PATH: ${LIBSTAND_SRC}/i386 +LIBSTAND_CPUARCH=i386 .else -.PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH} +LIBSTAND_CPUARCH=${MACHINE_CPUARCH} .endif -SRCS+= _setjmp.S - -# decompression functionality from libbz2 -# NOTE: to actually test this functionality after libbz2 upgrade compile -# loader(8) with LOADER_BZIP2_SUPPORT defined -.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 -CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS -SRCS+= libstand_bzlib_private.h - -.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c -SRCS+= _${file} -CLEANFILES+= _${file} - -_${file}: ${file} - sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \ - ${.ALLSRC} > ${.TARGET} -.endfor - -CLEANFILES+= libstand_bzlib_private.h -libstand_bzlib_private.h: bzlib_private.h - sed -e 's||"stand.h"|' \ - ${.ALLSRC} > ${.TARGET} - -# decompression functionality from libz -.PATH: ${LIBSTAND_SRC}/../libz -CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz -SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h - -.for file in infback.c inffast.c inflate.c inftrees.c zutil.c -SRCS+= _${file} -CLEANFILES+= _${file} - -_${file}: ${file} - sed -e "s|zutil\.h|libstand_zutil.h|" \ - -e "s|gzguts\.h|libstand_gzguts.h|" \ - ${.ALLSRC} > ${.TARGET} -.endfor - -# depend on stand.h being able to be included multiple times -.for file in zutil.h gzguts.h -CLEANFILES+= libstand_${file} -libstand_${file}: ${file} - sed -e 's||"stand.h"|' \ - -e 's||"stand.h"|' \ - -e 's||"stand.h"|' \ - -e 's||"stand.h"|' \ - -e 's||"stand.h"|' \ - ${.ALLSRC} > ${.TARGET} -.endfor - -# io routines -SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ - fstat.c close.c lseek.c open.c read.c write.c readdir.c - -# network routines -SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c - -# network info services: -SRCS+= bootp.c rarp.c bootparam.c +LIBC_SRC= ${LIBSTAND_SRC}/../libc +INTERNALLIB= +MAN= +.PATH: ${LIBSTAND_SRC} -# boot filesystems -SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c -SRCS+= dosfs.c ext2fs.c -SRCS+= splitfs.c -SRCS+= pkgfs.c -.if ${MK_NAND} != "no" -SRCS+= nandfs.c +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -m32 -I. .endif -.include -.include +.include "${LIBSTAND_SRC}/Makefile" .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine From owner-svn-src-head@freebsd.org Fri Jan 1 15:36:58 2016 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 33421A5EC91; Fri, 1 Jan 2016 15:36:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F20B410CD; Fri, 1 Jan 2016 15:36:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01Fav8d085146; Fri, 1 Jan 2016 15:36:57 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01Favhj085145; Fri, 1 Jan 2016 15:36:57 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201601011536.u01Favhj085145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jan 2016 15:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293041 - head/sys/powerpc/mpc85xx 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, 01 Jan 2016 15:36:58 -0000 Author: jhibbits Date: Fri Jan 1 15:36:56 2016 New Revision: 293041 URL: https://svnweb.freebsd.org/changeset/base/293041 Log: Use uint32_t for LBC block size. LBC block size can only be up to 4GB. The existing code already clamps it, but mixes unsigned long and uint32_t. This works on 32-bit targets, but not 64-bit, so isn't completely correct. This fixes the type confusion. Modified: head/sys/powerpc/mpc85xx/lbc.c Modified: head/sys/powerpc/mpc85xx/lbc.c ============================================================================== --- head/sys/powerpc/mpc85xx/lbc.c Fri Jan 1 15:30:11 2016 (r293040) +++ head/sys/powerpc/mpc85xx/lbc.c Fri Jan 1 15:36:56 2016 (r293041) @@ -126,11 +126,11 @@ lbc_address_mask(uint32_t size) { int n = 15; - if (size == ~0UL) + if (size == ~0) return (0); while (n < 32) { - if (size == (1UL << n)) + if (size == (1U << n)) break; n++; } @@ -267,7 +267,7 @@ lbc_banks_map(struct lbc_softc *sc) static int lbc_banks_enable(struct lbc_softc *sc) { - u_long size; + uint32_t size; uint32_t regval; int error, i; From owner-svn-src-head@freebsd.org Fri Jan 1 15:48:49 2016 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 74349A5EF55; Fri, 1 Jan 2016 15:48:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3B8821628; Fri, 1 Jan 2016 15:48:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01FmmL6088141; Fri, 1 Jan 2016 15:48:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01Fmm81088140; Fri, 1 Jan 2016 15:48:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201601011548.u01Fmm81088140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 1 Jan 2016 15:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293042 - head/sys/fs/devfs 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, 01 Jan 2016 15:48:49 -0000 Author: kib Date: Fri Jan 1 15:48:48 2016 New Revision: 293042 URL: https://svnweb.freebsd.org/changeset/base/293042 Log: Minor style cleanup. Submitted by: bde MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Jan 1 15:36:56 2016 (r293041) +++ head/sys/fs/devfs/devfs_vnops.c Fri Jan 1 15:48:48 2016 (r293042) @@ -1147,7 +1147,7 @@ devfs_open(struct vop_open_args *ap) error = dsw->d_fdopen(dev, ap->a_mode, td, fp); else error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td); - /* cleanup any cdevpriv upon error */ + /* Clean up any cdevpriv upon error. */ if (error != 0) devfs_clear_cdevpriv(); td->td_fpop = fpop; From owner-svn-src-head@freebsd.org Fri Jan 1 17:06:18 2016 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 4AC54A5DCC4; Fri, 1 Jan 2016 17:06:18 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F21131542; Fri, 1 Jan 2016 17:06:17 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01H6HY5013412; Fri, 1 Jan 2016 17:06:17 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01H6G9n013410; Fri, 1 Jan 2016 17:06:16 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201601011706.u01H6G9n013410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Fri, 1 Jan 2016 17:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293043 - in head: sys/kgssapi usr.sbin/gssd 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, 01 Jan 2016 17:06:18 -0000 Author: jpaetzel Date: Fri Jan 1 17:06:16 2016 New Revision: 293043 URL: https://svnweb.freebsd.org/changeset/base/293043 Log: Unset the gss kernel state when gssd exits When gssd exits it leaves the kernel state set by gssd_syscall(). nfsd sees this and waits endlessly in an unkillable state for gssd to come back. If you had acidentally started gssd then stopped it, then started nfsd you'd be in a bad way until you either restarted gssd or rebooted the system. This change fixes that by setting the kernel state to "" when gssd exits. Reviewed by: rmacklem MFC after: 1 week Sponsored by: iXsystems Modified: head/sys/kgssapi/gss_impl.c head/usr.sbin/gssd/gssd.c Modified: head/sys/kgssapi/gss_impl.c ============================================================================== --- head/sys/kgssapi/gss_impl.c Fri Jan 1 15:48:48 2016 (r293042) +++ head/sys/kgssapi/gss_impl.c Fri Jan 1 17:06:16 2016 (r293043) @@ -105,14 +105,17 @@ sys_gssd_syscall(struct thread *td, stru if (error) return (error); - sun.sun_family = AF_LOCAL; - strcpy(sun.sun_path, path); - sun.sun_len = SUN_LEN(&sun); - - nconf = getnetconfigent("local"); - cl = clnt_reconnect_create(nconf, - (struct sockaddr *) &sun, GSSD, GSSDVERS, - RPC_MAXDATASIZE, RPC_MAXDATASIZE); + if (path[0] != '\0') { + sun.sun_family = AF_LOCAL; + strcpy(sun.sun_path, path); + sun.sun_len = SUN_LEN(&sun); + + nconf = getnetconfigent("local"); + cl = clnt_reconnect_create(nconf, + (struct sockaddr *) &sun, GSSD, GSSDVERS, + RPC_MAXDATASIZE, RPC_MAXDATASIZE); + } else + cl = NULL; mtx_lock(&kgss_gssd_lock); oldcl = kgss_gssd_handle; Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Fri Jan 1 15:48:48 2016 (r293042) +++ head/usr.sbin/gssd/gssd.c Fri Jan 1 17:06:16 2016 (r293043) @@ -254,6 +254,7 @@ main(int argc, char **argv) gssd_syscall(_PATH_GSSDSOCK); svc_run(); + gssd_syscall(""); return (0); } @@ -1285,6 +1286,7 @@ void gssd_terminate(int sig __unused) if (hostbased_initiator_cred != 0) unlink(GSSD_CREDENTIAL_CACHE_FILE); #endif + gssd_syscall(""); exit(0); } From owner-svn-src-head@freebsd.org Fri Jan 1 17:30:23 2016 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 41F80A5E3D7; Fri, 1 Jan 2016 17:30:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-yk0-f171.google.com (mail-yk0-f171.google.com [209.85.160.171]) (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 0DB44133C; Fri, 1 Jan 2016 17:30:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-yk0-f171.google.com with SMTP id x67so199735518ykd.2; Fri, 01 Jan 2016 09:30:22 -0800 (PST) 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=XksIpdFWjfs5TOtXdg/XnTPFQBJzz9G8lTwfFoZh2HQ=; b=jg+SJ8k8PbHszOnjQ4J5XLvftAiHAnBftmRDysQQwnKgn2POu70aOBIjQna9RJi6JJ P6J4zH5O/WYsicaTcxCC52LEQHXYftxdrgp80+9UL4sc7UwgPRaHQHRNN2cMGqCl28uy v7eK5dM7YDbC1zUDlX27Ex82R/cBIl7GkYrSrmEEEgZh1eAqwCbsUgkv84BfB5/wvhuH 5Et0g/kkJSTK3i9pyszuf+bO1GyjaHTwJHuSQpIE7VnV5G01Zr8Ajo7yYICqVc3/GhOM Tu+WXhSipD0V7lBnPt34g8BQXs43Rwn9i+mlluD+6tSpslSKN98b3L3cGst5CcZ2w8/s SGeQ== X-Received: by 10.129.116.213 with SMTP id p204mr47047110ywc.322.1451668978472; Fri, 01 Jan 2016 09:22:58 -0800 (PST) Received: from mail-yk0-f178.google.com (mail-yk0-f178.google.com. [209.85.160.178]) by smtp.gmail.com with ESMTPSA id g66sm65588698ywd.56.2016.01.01.09.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jan 2016 09:22:58 -0800 (PST) Received: by mail-yk0-f178.google.com with SMTP id a85so123257870ykb.1; Fri, 01 Jan 2016 09:22:57 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.13.232.83 with SMTP id r80mr54889036ywe.237.1451668977733; Fri, 01 Jan 2016 09:22:57 -0800 (PST) Reply-To: cem@FreeBSD.org Received: by 10.37.4.69 with HTTP; Fri, 1 Jan 2016 09:22:57 -0800 (PST) In-Reply-To: <201601011517.u01FHOCo079299@repo.freebsd.org> References: <201601011517.u01FHOCo079299@repo.freebsd.org> Date: Fri, 1 Jan 2016 09:22:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r293039 - in head/sys/dev: sec tsec From: Conrad Meyer To: Justin Hibbits 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: Fri, 01 Jan 2016 17:30:23 -0000 On Fri, Jan 1, 2016 at 7:17 AM, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Jan 1 15:17:24 2016 > New Revision: 293039 > URL: https://svnweb.freebsd.org/changeset/base/293039 > > Log: > Fix a couple printf formats. > > ... > @@ -235,7 +236,7 @@ sec_probe(device_t dev) > sc->sc_version = 3; > break; > default: > - device_printf(dev, "unknown SEC ID 0x%016llx!\n", id); > + device_printf(dev, "unknown SEC ID 0x%16"PRIx64"!\n", id); > return (ENXIO); > } Hi, The 0 got dropped, which makes this a slightly different format. The zero is ignored if a precision is given, but the 16 in the format string represents a field width. (Either "%016" or "%.16" should print the same as the original, I think.) Best, Conrad From owner-svn-src-head@freebsd.org Fri Jan 1 17:56:53 2016 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 44534A5ECD4; Fri, 1 Jan 2016 17:56:53 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 151161C95; Fri, 1 Jan 2016 17:56:53 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u01Huq7j029845; Fri, 1 Jan 2016 17:56:52 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u01Huq4R029844; Fri, 1 Jan 2016 17:56:52 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201601011756.u01Huq4R029844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jan 2016 17:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293044 - head/sys/dev/sec 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, 01 Jan 2016 17:56:53 -0000 Author: jhibbits Date: Fri Jan 1 17:56:52 2016 New Revision: 293044 URL: https://svnweb.freebsd.org/changeset/base/293044 Log: Accidentally dropped the 0 padding. Pointed out by: cmeyer Modified: head/sys/dev/sec/sec.c Modified: head/sys/dev/sec/sec.c ============================================================================== --- head/sys/dev/sec/sec.c Fri Jan 1 17:06:16 2016 (r293043) +++ head/sys/dev/sec/sec.c Fri Jan 1 17:56:52 2016 (r293044) @@ -236,7 +236,7 @@ sec_probe(device_t dev) sc->sc_version = 3; break; default: - device_printf(dev, "unknown SEC ID 0x%16"PRIx64"!\n", id); + device_printf(dev, "unknown SEC ID 0x%016"PRIx64"!\n", id); return (ENXIO); } From owner-svn-src-head@freebsd.org Fri Jan 1 18:01:32 2016 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 2E1A9A5EE71; Fri, 1 Jan 2016 18:01:32 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ob0-x22e.google.com (mail-ob0-x22e.google.com [IPv6:2607:f8b0:4003:c01::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 0318D1EE5; Fri, 1 Jan 2016 18:01:31 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ob0-x22e.google.com with SMTP id 18so305439140obc.2; Fri, 01 Jan 2016 10:01:31 -0800 (PST) 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=GHyWbIHLGphJR/DF7lTMa7Fgv27HhnelvfSqCNG0yl8=; b=OuBey12+nmzVgGWG6V3sn4e19Ou+YLZDK35GllY0cxVPPAusmYNmpOE4WXoVSO/qSd x74VMPw/kKJLUaarpOQfjhexgZ+Txzt9X4i0qzGaI594p8Ae8ez/cF1HZ+0zrfdfsrjE fAsjbEtCHzje0MXjjC9ITE+52ux5/zmlrV0lACedz2QbrObLxCilQQI2qHicOpHBSSmc wwAGMLDNibH5bSdT99vg9FpN52ES8tNj7OGHzU1HcsUvH5H0IyrQYktBJ0sMJb8YT2ak 6rM3ynJIqwZGvGfnmdGAHJv1dlz38n6GxpXXNY1L2PjAO9sZiLfM0UVmW2BQ1b5th73U 8XFQ== MIME-Version: 1.0 X-Received: by 10.182.241.3 with SMTP id we3mr49200674obc.82.1451671290971; Fri, 01 Jan 2016 10:01:30 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.182.184.84 with HTTP; Fri, 1 Jan 2016 10:01:30 -0800 (PST) Received: by 10.182.184.84 with HTTP; Fri, 1 Jan 2016 10:01:30 -0800 (PST) In-Reply-To: References: <201601011517.u01FHOCo079299@repo.freebsd.org> Date: Fri, 1 Jan 2016 12:01:30 -0600 X-Google-Sender-Auth: bIF_r44WGaPCC6Hbp9ANz0bbNDo Message-ID: Subject: Re: svn commit: r293039 - in head/sys/dev: sec tsec From: Justin Hibbits To: cem@freebsd.org Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@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: Fri, 01 Jan 2016 18:01:32 -0000 On Jan 1, 2016 11:30, "Conrad Meyer" wrote: > > On Fri, Jan 1, 2016 at 7:17 AM, Justin Hibbits wrote: > > Author: jhibbits > > Date: Fri Jan 1 15:17:24 2016 > > New Revision: 293039 > > URL: https://svnweb.freebsd.org/changeset/base/293039 > > > > Log: > > Fix a couple printf formats. > > > > ... > > @@ -235,7 +236,7 @@ sec_probe(device_t dev) > > sc->sc_version = 3; > > break; > > default: > > - device_printf(dev, "unknown SEC ID 0x%016llx!\n", id); > > + device_printf(dev, "unknown SEC ID 0x%16"PRIx64"!\n", id); > > return (ENXIO); > > } > > Hi, > > The 0 got dropped, which makes this a slightly different format. The > zero is ignored if a precision is given, but the 16 in the format > string represents a field width. (Either "%016" or "%.16" should > print the same as the original, I think.) > > Best, > Conrad Oops, fixed in r293044. Thanks! -Justin From owner-svn-src-head@freebsd.org Fri Jan 1 19:01:43 2016 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 A8F19A5EE00; Fri, 1 Jan 2016 19:01:43 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ob0-x231.google.com (mail-ob0-x231.google.com [IPv6:2607:f8b0:4003:c01::231]) (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 8334815F3; Fri, 1 Jan 2016 19:01:43 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ob0-x231.google.com with SMTP id wp13so78111550obc.1; Fri, 01 Jan 2016 11:01:43 -0800 (PST) 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:content-type; bh=DDYTBpgqCa2qqwEfzwh4lXs4YQqrvP1NwQwJ2nNliTQ=; b=g5N5o6qzZXSFbe5mlnPxjA76FTzcK9xXZqFGTT3kPjsiQIeAQwy6fXiQe4gB/VeE2d y3iXxRpXK6tGQ4tRW/8N0m+yATFCwXsToJnCh/RDIjbYVbhWVf8HBAq/5RP4Y5VwfmdN R5AWGvd4Op1Yp5veiexQyb4rep+TrApIl3LFC0xr5O3vVLaP9BPD84KUP0gKg18Vtjzn 4Tppd+iutarF4/bcvOrICSBWnTbACEzu9do7j3yVwTEF7GoXkIWvx8K77raGidIs2Gvr 8In5IB/2+NHCyRCQPsD5k41tPO+gTV9GrD7a/y4weJAD8+sYaPcAxc6WIHlP/Wmes4nM g5EQ== MIME-Version: 1.0 X-Received: by 10.182.120.101 with SMTP id lb5mr37181543obb.37.1451674902735; Fri, 01 Jan 2016 11:01:42 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.182.184.84 with HTTP; Fri, 1 Jan 2016 11:01:42 -0800 (PST) In-Reply-To: <201601011756.u01Huq4R029844@repo.freebsd.org> References: <201601011756.u01Huq4R029844@repo.freebsd.org> Date: Fri, 1 Jan 2016 13:01:42 -0600 X-Google-Sender-Auth: MHO0NY1C8B3VbfsrZZ32DvSlLq4 Message-ID: Subject: Re: svn commit: r293044 - head/sys/dev/sec From: Justin Hibbits To: src-committers , "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, 01 Jan 2016 19:01:43 -0000 On Fri, Jan 1, 2016 at 11:56 AM, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Jan 1 17:56:52 2016 > New Revision: 293044 > URL: https://svnweb.freebsd.org/changeset/base/293044 > > Log: > Accidentally dropped the 0 padding. > > Pointed out by: cmeyer That should be cem. - Justin From owner-svn-src-head@freebsd.org Fri Jan 1 21:50:50 2016 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 23F9EA5EDFF; Fri, 1 Jan 2016 21:50:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 049E51F89; Fri, 1 Jan 2016 21:50:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 531F4B980; Fri, 1 Jan 2016 16:50:48 -0500 (EST) From: John Baldwin To: Adrian Chadd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r293022 - head/sys/net80211 Date: Fri, 01 Jan 2016 11:50:55 -0800 Message-ID: <5919271.R3YaC4QkYh@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201601010021.u010L7sW006625@repo.freebsd.org> References: <201601010021.u010L7sW006625@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 01 Jan 2016 16:50:48 -0500 (EST) 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, 01 Jan 2016 21:50:50 -0000 On Friday, January 01, 2016 12:21:07 AM Adrian Chadd wrote: > Author: adrian > Date: Fri Jan 1 00:21:07 2016 > New Revision: 293022 > URL: https://svnweb.freebsd.org/changeset/base/293022 > > Log: > [net80211] document the (not completely complete) set of places where > we're assuming hz=1000 and not gracefully handling when it isn't. > > The math involved will return 0 for hz < 1000, which it is on some > platforms and on DragonflyBSD. > > This doesn't fix it, it: > > * converts one manual use over to use the macro, and > * comments where it needs some thought/fixing. > > I'll think about this a bit more before fixing it. > > Submitted by: imre@vdsz.com > > Modified: > head/sys/net80211/ieee80211_freebsd.h > head/sys/net80211/ieee80211_scan_sw.c > head/sys/net80211/ieee80211_var.h > > Modified: head/sys/net80211/ieee80211_scan_sw.c > ============================================================================== > --- head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:16:54 2016 (r293021) > +++ head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:21:07 2016 (r293022) > @@ -641,7 +641,7 @@ scan_task(void *arg, int pending) > * XXX Should use M_TXCB mechanism to eliminate this. > */ > cv_timedwait(&SCAN_PRIVATE(ss)->ss_scan_cv, > - IEEE80211_LOCK_OBJ(ic), hz / 1000); > + IEEE80211_LOCK_OBJ(ic), msecs_to_ticks(1)); It would be better to use SBT_1MS instead with cv_timedwait_sbt(). Especially if the 1 ms is fuzzy you can specify "how" fuzzy it is to permit coalescing of timer interrupts to reduce power usage. This would seem to be especially useful for 802.11 since it is commonly used in devices for which power usage is more impactful. -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jan 2 02:53:51 2016 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 06C74A5D0A2; Sat, 2 Jan 2016 02:53:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D7B6C1617; Sat, 2 Jan 2016 02:53:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u022ro44085765; Sat, 2 Jan 2016 02:53:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u022rmn7085754; Sat, 2 Jan 2016 02:53:48 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601020253.u022rmn7085754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 02:53:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293045 - in head/sys: amd64/amd64 arm/arm arm/xscale/ixp425 arm64/arm64 boot i386/i386 kern mips/beri powerpc/powerpc sparc64/sparc64 x86/xen 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, 02 Jan 2016 02:53:51 -0000 Author: ian Date: Sat Jan 2 02:53:48 2016 New Revision: 293045 URL: https://svnweb.freebsd.org/changeset/base/293045 Log: Make the 'env' directive described in config(5) work on all architectures, providing compiled-in static environment data that is used instead of any data passed in from a boot loader. Previously 'env' worked only on i386 and arm xscale systems, because it required the MD startup code to examine the global envmode variable and decide whether to use static_env or an environment obtained from the boot loader, and set the global kern_envp accordingly. Most startup code wasn't doing so. Making things even more complex, some mips startup code uses an alternate scheme that involves calling init_static_kenv() to pass an empty buffer and its size, then uses a series of kern_setenv() calls to populate that buffer. Now all MD startup code calls init_static_kenv(), and that routine provides a single point where envmode is checked and the decision is made whether to use the compiled-in static_kenv or the values provided by the MD code. The routine also continues to serve its original purpose for mips; if a non-zero buffer size is passed the routine installs the empty buffer ready to accept kern_setenv() values. Now if the size is zero, the provided buffer full of existing env data is installed. A NULL pointer can be passed if the boot loader provides no env data; this allows the static env to be installed if envmode is set to do so. Most of the work here is a near-mechanical change to call the init function instead of directly setting kern_envp. A notable exception is in xen/pv.c; that code was originally installing a buffer full of preformatted env data along with its non-zero size (like mips code does), which would have allowed kern_setenv() calls to wipe out the preformatted data. Now it passes a zero for the size so that the buffer of data it installs is treated as non-writeable. Modified: head/sys/amd64/amd64/machdep.c head/sys/arm/arm/machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm64/arm64/machdep.c head/sys/boot/Makefile.arm head/sys/i386/i386/machdep.c head/sys/kern/kern_environment.c head/sys/mips/beri/beri_machdep.c head/sys/powerpc/powerpc/machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/x86/xen/pv.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/amd64/amd64/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -1484,6 +1484,7 @@ static caddr_t native_parse_preload_data(u_int64_t modulep) { caddr_t kmdp; + char *envp; #ifdef DDB vm_offset_t ksym_start; vm_offset_t ksym_end; @@ -1495,7 +1496,10 @@ native_parse_preload_data(u_int64_t modu if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *) + KERNBASE; + envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + if (envp != NULL) + envp += KERNBASE; + init_static_kenv(envp, 0); #ifdef DDB ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/arm/arm/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -1002,6 +1002,8 @@ fake_preload_metadata(struct arm_boot_pa fake_preload[i] = 0; preload_metadata = (void *)fake_preload; + init_static_kenv(NULL, 0); + return (lastaddr); } @@ -1074,6 +1076,8 @@ linux_parse_boot_param(struct arm_boot_p bcopy(atag_list, atags, (char *)walker - (char *)atag_list + ATAG_SIZE(walker)); + init_static_kenv(NULL, 0); + return fake_preload_metadata(abp); } #endif @@ -1106,7 +1110,7 @@ freebsd_parse_boot_param(struct arm_boot return 0; boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); #ifdef DDB ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -225,8 +225,8 @@ initarm(struct arm_boot_params *abp) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); - if (envmode == 1) - kern_envp = static_env; + init_static_kenv(NULL, 0); + /* Do basic tuning, hz etc */ init_param1(); @@ -426,10 +426,6 @@ initarm(struct arm_boot_params *abp) init_param2(physmem); kdb_init(); - /* use static kernel environment if so configured */ - if (envmode == 1) - kern_envp = static_env; - return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - sizeof(struct pcb))); #undef next_page Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/arm64/arm64/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -820,7 +820,7 @@ initarm(struct arm64_bootparams *abp) kmdp = preload_search_by_type("elf64 kernel"); boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); #ifdef FDT try_load_dtb(kmdp); Modified: head/sys/boot/Makefile.arm ============================================================================== --- head/sys/boot/Makefile.arm Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/boot/Makefile.arm Sat Jan 2 02:53:48 2016 (r293045) @@ -5,3 +5,10 @@ SUBDIR+= fdt .endif SUBDIR+= efi uboot + +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +CFLAGS.clang+= -mllvm -arm-use-movt=0 +CFLAGS.clang+= -mfpu=none +.export: CFLAGS.clang Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/i386/i386/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -2462,10 +2462,11 @@ init386(first) } else { metadata_missing = 1; } - if (envmode == 1) - kern_envp = static_env; - else if (bootinfo.bi_envp) - kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE; + + if (bootinfo.bi_envp) + init_static_kenv((caddr_t)bootinfo.bi_envp + KERNBASE, 0); + else + init_static_kenv(NULL, 0); /* Init basic tunables, hz etc */ init_param1(); Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/kern/kern_environment.c Sat Jan 2 02:53:48 2016 (r293045) @@ -210,12 +210,44 @@ done: return (error); } +/* + * Populate the initial kernel environment. + * + * This is called very early in MD startup, either to provide a copy of the + * environment obtained from a boot loader, or to provide an empty buffer into + * which MD code can store an initial environment using kern_setenv() calls. + * + * If the global envmode is 1, the environment is initialized from the global + * static_env[], regardless of the arguments passed. This implements the env + * keyword described in config(5). In this case env_pos is set to env_len, + * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until + * the dynamic environment is available. The envmode and static_env variables + * are defined in env.c which is generated by config(8). + * + * If len is non-zero, the caller is providing an empty buffer. The caller will + * subsequently use kern_setenv() to add up to len bytes of initial environment + * before the dynamic environment is available. + * + * If len is zero, the caller is providing a pre-loaded buffer containing + * environment strings. Additional strings cannot be added until the dynamic + * environment is available. The memory pointed to must remain stable at least + * until sysinit runs init_dynamic_kenv(). If no initial environment is + * available from the boot loader, passing a NULL pointer allows the static_env + * to be installed if it is configured. + */ void init_static_kenv(char *buf, size_t len) { - kern_envp = buf; - env_len = len; - env_pos = 0; + + if (envmode == 1) { + kern_envp = static_env; + env_len = len; + env_pos = len; + } else { + kern_envp = buf; + env_len = len; + env_pos = 0; + } } /* Modified: head/sys/mips/beri/beri_machdep.c ============================================================================== --- head/sys/mips/beri/beri_machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/mips/beri/beri_machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -273,7 +273,7 @@ platform_start(__register_t a0, __regist * Configure more boot-time parameters passed in by loader. */ boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); /* * Get bootargs from FDT if specified. Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/powerpc/powerpc/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -261,7 +261,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_ kmdp = preload_search_by_type("elf kernel"); if (kmdp != NULL) { boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), + 0); endkernel = ulmax(endkernel, MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t)); #ifdef DDB Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/sparc64/sparc64/machdep.c Sat Jan 2 02:53:48 2016 (r293045) @@ -379,7 +379,8 @@ sparc64_init(caddr_t mdp, u_long o1, u_l kmdp = preload_search_by_type("elf kernel"); if (kmdp != NULL) { boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), + 0); end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); kernel_tlb_slots = MD_FETCH(kmdp, MODINFOMD_DTLB_SLOTS, int); Modified: head/sys/x86/xen/pv.c ============================================================================== --- head/sys/x86/xen/pv.c Fri Jan 1 17:56:52 2016 (r293044) +++ head/sys/x86/xen/pv.c Sat Jan 2 02:53:48 2016 (r293045) @@ -296,7 +296,7 @@ xen_pv_set_env(void) for (cmd_line_next = cmd_line; strsep(&cmd_line_next, ",") != NULL;) ; - init_static_kenv(cmd_line, env_size); + init_static_kenv(cmd_line, 0); } static void @@ -382,6 +382,7 @@ xen_pv_parse_preload_data(u_int64_t modu caddr_t kmdp; vm_ooffset_t off; vm_paddr_t metadata; + char *envp; if (HYPERVISOR_start_info->mod_start != 0) { preload_metadata = (caddr_t)(HYPERVISOR_start_info->mod_start); @@ -404,8 +405,10 @@ xen_pv_parse_preload_data(u_int64_t modu preload_bootstrap_relocate(off); boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - kern_envp += off; + envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + if (envp != NULL) + envp += off; + init_static_kenv(envp, 0); } else { /* Parse the extra boot information given by Xen */ xen_pv_set_env(); From owner-svn-src-head@freebsd.org Sat Jan 2 03:00:32 2016 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 C4C3CA5D370; Sat, 2 Jan 2016 03:00:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9513F1A0D; Sat, 2 Jan 2016 03:00:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0230VR3086167; Sat, 2 Jan 2016 03:00:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0230V55086166; Sat, 2 Jan 2016 03:00:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601020300.u0230V55086166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 03:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293046 - head/sys/boot 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, 02 Jan 2016 03:00:32 -0000 Author: ian Date: Sat Jan 2 03:00:31 2016 New Revision: 293046 URL: https://svnweb.freebsd.org/changeset/base/293046 Log: Revert accidental change that snuck into r293045. Modified: head/sys/boot/Makefile.arm Modified: head/sys/boot/Makefile.arm ============================================================================== --- head/sys/boot/Makefile.arm Sat Jan 2 02:53:48 2016 (r293045) +++ head/sys/boot/Makefile.arm Sat Jan 2 03:00:31 2016 (r293046) @@ -5,10 +5,3 @@ SUBDIR+= fdt .endif SUBDIR+= efi uboot - -# Do not generate movt/movw, because the relocation fixup for them does not -# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). -# Also, the fpu is not available in a standalone environment. -CFLAGS.clang+= -mllvm -arm-use-movt=0 -CFLAGS.clang+= -mfpu=none -.export: CFLAGS.clang From owner-svn-src-head@freebsd.org Sat Jan 2 03:41:43 2016 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 2C6B3A5E12D; Sat, 2 Jan 2016 03:41:43 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (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 F0FE61F3D; Sat, 2 Jan 2016 03:41:42 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x232.google.com with SMTP id o67so397436396iof.3; Fri, 01 Jan 2016 19:41:42 -0800 (PST) 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=cEIr0GV58HpzwYJ/sUISTJQfPIic4EO3E/7louVdmcE=; b=Fv7Xb4Rdi6TPyHFbX+g+Q9UCXBrcbGH0BvsNRNS27OCrXDbvPC+Fw5zTc0U/Hiet3b 2kfuWhwcUBv0Y1cKZ3BPu2xMo6kwd6dUbRwGizgGOgnY9IwOs7hPDiFPYtTFOOiUc+z2 4jcxmAnUKQi6YnJimUMCt4JKbXQJwG3KgSFl8Yx8XoDSfnEAY+lYe2Kip3zj8bru2EBz LF41AS0ZypE98CyWwtTkB+KyIg7ERagEfPg4mF8dnEYUmo22uNQ3dKRJrsIjgDI1/IPe oyXEFjcgxD8+FXqERQk+FBLUfju7gIsrDKSA5VQOwYuSMv3FTJK62Mmz+0E/urk4aPh+ +h+w== MIME-Version: 1.0 X-Received: by 10.107.10.217 with SMTP id 86mr60395872iok.75.1451706102453; Fri, 01 Jan 2016 19:41:42 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.121.202 with HTTP; Fri, 1 Jan 2016 19:41:42 -0800 (PST) In-Reply-To: <5919271.R3YaC4QkYh@ralph.baldwin.cx> References: <201601010021.u010L7sW006625@repo.freebsd.org> <5919271.R3YaC4QkYh@ralph.baldwin.cx> Date: Fri, 1 Jan 2016 19:41:42 -0800 X-Google-Sender-Auth: YpNkqGrx-8zbZ1GdjZ7Ph_AYU0k Message-ID: Subject: Re: svn commit: r293022 - head/sys/net80211 From: Adrian Chadd To: John Baldwin 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: Sat, 02 Jan 2016 03:41:43 -0000 yup. all of this is ... terrible atm. I do need to be able to give a bounds though. :( -a From owner-svn-src-head@freebsd.org Sat Jan 2 04:42:55 2016 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 79223A5E177; Sat, 2 Jan 2016 04:42:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 41A8619AE; Sat, 2 Jan 2016 04:42:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u024gsAd022235; Sat, 2 Jan 2016 04:42:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u024grvH022226; Sat, 2 Jan 2016 04:42:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601020442.u024grvH022226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 2 Jan 2016 04:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293047 - head/share/vt/keymaps 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, 02 Jan 2016 04:42:55 -0000 Author: emaste Date: Sat Jan 2 04:42:53 2016 New Revision: 293047 URL: https://svnweb.freebsd.org/changeset/base/293047 Log: Use correct name 'us' for character 31 in keymaps 'ns' was a historical accident, and kbdcontrol(1) has accepted the correct 'us' as well as 'ns' since r38139. PR: 205776 MFC after: 1 week Modified: head/share/vt/keymaps/gr.101.acc.kbd head/share/vt/keymaps/gr.elot.acc.kbd head/share/vt/keymaps/hu.101.kbd head/share/vt/keymaps/hu.102.kbd head/share/vt/keymaps/lt.kbd head/share/vt/keymaps/pt.acc.kbd head/share/vt/keymaps/pt.kbd head/share/vt/keymaps/ua.kbd head/share/vt/keymaps/ua.shift.alt.kbd Modified: head/share/vt/keymaps/gr.101.acc.kbd ============================================================================== --- head/share/vt/keymaps/gr.101.acc.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/gr.101.acc.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -18,7 +18,7 @@ 009 '8' '*' nop nop '8' '*' nop nop O 010 '9' '(' nop nop '9' '(' nop nop O 011 '0' ')' nop nop '0' ')' nop nop O - 012 '-' '_' ns ns '-' '_' ns ns O + 012 '-' '_' us us '-' '_' us us O 013 '=' '+' nop nop '=' '+' nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O @@ -90,7 +90,7 @@ 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N 083 del '.' '.' '.' '.' '.' boot boot N - 084 ns ns ns ns ns ns ns ns O + 084 us us us us us us us us O 085 nop nop nop nop nop nop nop nop O 086 '\' '|' nop nop '\' '|' nop nop O 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O @@ -148,7 +148,7 @@ 137 '8' '*' nop nop '8' '*' nop nop O 138 '9' '(' nop nop '9' '(' nop nop O 139 '0' ')' nop nop '0' ')' nop nop O - 140 '-' '_' ns ns '-' '_' ns ns O + 140 '-' '_' us us '-' '_' us us O 141 '=' '+' nop nop '=' '+' nop nop O 142 bs bs del del bs bs del del O 143 ht btab nop nop ht btab nop nop O @@ -220,7 +220,7 @@ 209 fkey59 '3' '3' '3' '3' '3' '3' '3' N 210 fkey60 '0' '0' '0' '0' '0' '0' '0' N 211 del '.' '.' '.' '.' '.' boot boot N - 212 ns ns ns ns ns ns ns ns O + 212 us us us us us us us us O 213 nop nop nop nop nop nop nop nop O 214 '\' '|' nop nop '\' '|' nop nop O 215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O Modified: head/share/vt/keymaps/gr.elot.acc.kbd ============================================================================== --- head/share/vt/keymaps/gr.elot.acc.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/gr.elot.acc.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -18,7 +18,7 @@ 009 '8' '*' nop nop '8' '*' nop nop O 010 '9' '(' nop nop '9' '(' nop nop O 011 '0' ')' nop nop '0' ')' nop nop O - 012 '-' '_' ns ns '-' '_' ns ns O + 012 '-' '_' us us '-' '_' us us O 013 '=' '+' nop nop '=' '+' nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O @@ -90,7 +90,7 @@ 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N 083 del '.' '.' '.' '.' '.' boot boot N - 084 ns ns ns ns ns ns ns ns O + 084 us us us us us us us us O 085 nop nop nop nop nop nop nop nop O 086 '\' '|' nop nop '\' '|' nop nop O 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O @@ -148,7 +148,7 @@ 137 '8' '*' nop nop '8' '*' nop nop O 138 '9' '(' nop nop '9' '(' nop nop O 139 '0' ')' nop nop '0' ')' nop nop O - 140 '-' '_' ns ns '-' '_' ns ns O + 140 '-' '_' us us '-' '_' us us O 141 '=' '+' nop nop '=' '+' nop nop O 142 bs bs del del bs bs del del O 143 ht btab nop nop ht btab nop nop O @@ -220,7 +220,7 @@ 209 fkey59 '3' '3' '3' '3' '3' '3' '3' N 210 fkey60 '0' '0' '0' '0' '0' '0' '0' N 211 del '.' '.' '.' '.' '.' boot boot N - 212 ns ns ns ns ns ns ns ns O + 212 us us us us us us us us O 213 nop nop nop nop nop nop nop nop O 214 '\' '|' nop nop '\' '|' nop nop O 215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O Modified: head/share/vt/keymaps/hu.101.kbd ============================================================================== --- head/share/vt/keymaps/hu.101.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/hu.101.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -46,7 +46,7 @@ 009 '8' '*' nop nop '8' '*' nop nop O 010 '9' '(' nop nop '9' '(' nop nop O 011 '0' ')' nop nop 0xf6 0xd6 nop nop O - 012 '-' '_' ns ns 0xfc 0xdc ns ns C + 012 '-' '_' us us 0xfc 0xdc us us C 013 '=' '+' nop nop 0xf3 0xd3 nop nop C 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O @@ -175,7 +175,7 @@ 137 '8' '*' nop nop '8' '*' nop nop O 138 '9' '(' nop nop '9' '(' nop nop O 139 0xf6 0xd6 nop nop '0' ')' nop nop O - 140 0xfc 0xdc ns ns '-' '_' ns ns C + 140 0xfc 0xdc us us '-' '_' us us C 141 0xf3 0xd3 nop nop '=' '+' nop nop C 142 bs bs del del bs bs del del O 143 ht btab nop nop ht btab nop nop O Modified: head/share/vt/keymaps/hu.102.kbd ============================================================================== --- head/share/vt/keymaps/hu.102.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/hu.102.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -60,7 +60,7 @@ 050 'm' 'M' cr cr '<' nop cr cr C 051 ',' '?' nop nop ';' nop nop nop O 052 '.' ':' nop nop '>' nop nop nop O - 053 '-' '_' ns ns '*' nop nop nop O + 053 '-' '_' us us '*' nop nop nop O 054 rshift rshift rshift rshift rshift rshift rshift rshift O 055 '*' '*' '*' '*' '*' '*' '*' '*' O 056 lalt lalt lalt lalt lalt lalt lalt lalt O Modified: head/share/vt/keymaps/lt.kbd ============================================================================== --- head/share/vt/keymaps/lt.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/lt.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -15,7 +15,7 @@ 009 '8' '*' nop nop 0x016b 0x0172 nop nop O 010 '9' '(' nop nop '9' '(' nop nop O 011 '0' ')' nop nop '0' ')' nop nop O - 012 '-' '_' ns ns '-' '_' ns ns O + 012 '-' '_' us us '-' '_' us us O 013 '=' '+' nop nop 0x017e 0x017d nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O @@ -87,7 +87,7 @@ 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N 083 del '.' ',' ',' del ',' boot boot N - 084 ns ns ns ns ns ns ns ns O + 084 us us us us us us us us O 085 nop nop nop nop nop nop nop nop O 086 ralt ralt ralt ralt ralt ralt ralt ralt O 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O @@ -143,7 +143,7 @@ 137 0x016b 0x016a nop nop '8' '*' nop nop C 138 '9' '(' nop nop '9' '(' nop nop O 139 '0' ')' nop nop '0' ')' nop nop O - 140 '-' '_' ns ns '-' '_' ns ns O + 140 '-' '_' us us '-' '_' us us O 141 0x017e 0x017d nop nop '=' '+' nop nop C 142 bs bs del del bs bs del del O 143 ht btab nop nop ht btab nop nop O @@ -215,7 +215,7 @@ 209 fkey59 '3' '3' '3' '3' '3' '3' '3' N 210 fkey60 '0' '0' '0' '0' '0' '0' '0' N 211 del ',' '.' '.' del '.' boot boot N - 212 ns ns ns ns ns ns ns ns O + 212 us us us us us us us us O 213 nop nop nop nop nop nop nop nop O 214 ralt ralt ralt ralt ralt ralt ralt ralt O 215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O Modified: head/share/vt/keymaps/pt.acc.kbd ============================================================================== --- head/share/vt/keymaps/pt.acc.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/pt.acc.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -17,7 +17,7 @@ 009 '8' '(' nop nop '[' '*' nop nop O 010 '9' ')' nop nop ']' '(' nop nop O 011 '0' '=' nop nop '}' ')' nop nop O - 012 ''' '?' ns ns '-' '_' ns ns O + 012 ''' '?' us us '-' '_' us us O 013 '=' '+' nop nop '=' '+' nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O Modified: head/share/vt/keymaps/pt.kbd ============================================================================== --- head/share/vt/keymaps/pt.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/pt.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -17,7 +17,7 @@ 009 '8' '(' nop nop '[' '*' nop nop O 010 '9' ')' nop nop ']' '(' nop nop O 011 '0' '=' nop nop '}' ')' nop nop O - 012 ''' '?' ns ns '-' '_' ns ns O + 012 ''' '?' us us '-' '_' us us O 013 '=' '+' nop nop '=' '+' nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop ht btab nop nop O Modified: head/share/vt/keymaps/ua.kbd ============================================================================== --- head/share/vt/keymaps/ua.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/ua.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -15,7 +15,7 @@ 009 '8' '*' nop nop '8' ';' nop nop O 010 '9' '(' nop nop '9' '?' nop nop O 011 '0' ')' nop nop '0' '%' nop nop O - 012 '-' '_' ns ns '-' '_' ns ns O + 012 '-' '_' us us '-' '_' us us O 013 '=' '+' nop nop '=' '+' nop nop O 014 bs bs del del bs bs del del O 015 ht btab nop nop btab btab nop nop O @@ -144,7 +144,7 @@ 137 '8' ';' nop nop '8' '*' nop nop O 138 '9' '?' nop nop '9' '(' nop nop O 139 '0' '%' nop nop '0' ')' nop nop O - 140 '-' '_' ns ns '-' '_' ns ns O + 140 '-' '_' us us '-' '_' us us O 141 '=' '+' nop nop '=' '+' nop nop O 142 bs bs del del bs bs del del O 143 ht btab nop nop btab btab nop nop O Modified: head/share/vt/keymaps/ua.shift.alt.kbd ============================================================================== --- head/share/vt/keymaps/ua.shift.alt.kbd Sat Jan 2 03:00:31 2016 (r293046) +++ head/share/vt/keymaps/ua.shift.alt.kbd Sat Jan 2 04:42:53 2016 (r293047) @@ -27,7 +27,7 @@ 009 '8' '*' nop nop '8' '*' nop nop O 010 '9' '(' nop nop '9' '(' nop nop O 011 '0' ')' nop nop '0' ')' nop nop O - 012 '-' '_' ns ns 0x0456 0x0406 0xf7 0xf7 O + 012 '-' '_' us us 0x0456 0x0406 0xf7 0xf7 O 013 '=' '+' nop nop 0x0454 0x0404 nop nop O 014 bs bs del del bs bs 0x042a 0x042a O 015 ht btab nop nop ht btab nop nop O @@ -155,7 +155,7 @@ 137 '8' '*' nop nop '8' '*' nop nop O 138 '9' '(' nop nop '9' '(' nop nop O 139 '0' ')' nop nop '0' ')' nop nop O - 140 0x0456 0x0406 ns ns '-' '_' 0xf7 0xf7 O + 140 0x0456 0x0406 us us '-' '_' 0xf7 0xf7 O 141 0x0454 0x0404 nop nop '=' '+' nop nop O 142 bs bs del del bs bs 0x042a 0x042a O 143 ht btab nop nop ht btab nop nop O From owner-svn-src-head@freebsd.org Sat Jan 2 06:28:10 2016 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 04693A5FA74; Sat, 2 Jan 2016 06:28:10 +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 CF23D1221; Sat, 2 Jan 2016 06:28:09 +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 DA847DE5B; Sat, 2 Jan 2016 06:28:02 +0000 (UTC) Subject: Re: svn commit: r292955 - head/lib/libmd To: "Jonathan T. Looney" , Bruce Evans References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> <5684D606.3080609@freebsd.org> <56857911.5010205@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Allan Jude Message-ID: <56876DF1.4030807@freebsd.org> Date: Sat, 2 Jan 2016 01:28:01 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56857911.5010205@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="o512q8QPWFHJtvrgCfHRr1eoILvnNqKbC" 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, 02 Jan 2016 06:28:10 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --o512q8QPWFHJtvrgCfHRr1eoILvnNqKbC Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2015-12-31 13:50, Allan Jude wrote: > On 2015-12-31 13:32, Jonathan T. Looney wrote: >> On 12/31/15, 2:15 AM, "Allan Jude" wrote: >> >>> It seems these problems also slow things down, a lot: >>> >>> # time md5 /media/md5test/bigdata >>> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >>> 4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w >>> # time env LD_PRELOAD=3D/usr/obj/media/svn/md5/head/tmp/lib/libmd.so >>> /usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata >>> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >>> 4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w >>> >>> (file is fully cached in ZFS ARC, dd reads it at 11GB/s) >>> >>> Will investigate more tomorrow. >> >> md5 will be slower than dd due to the extra processing it needs to do = to >> generate the hash. I suspect that explains the difference you're seein= g >> between those utilities. >> >> Jonathan >> >> >> >=20 > Sorry, you missed my point here. >=20 > I replaced MDXFile() with the implementation included in my earlier > email. Using the newer libmd with that code, cut the time to md5 the > SAME data down a lot. I need to do a more scientific test on a box that= > isn't doing other stuff still though. >=20 > The comment about dd doing 11GB/s, was just to clarify that I wasn't > reading the file from disk, which would introduce other variables. >=20 I found the cause of my bogus benchmark, the world on my test machine was just old enough to be missing jmg@'s bufsize patch. Now the difference is about 1 second on a 2GB file, so ignore my foolishness. --=20 Allan Jude --o512q8QPWFHJtvrgCfHRr1eoILvnNqKbC 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) iQIcBAEBAgAGBQJWh230AAoJEBmVNT4SmAt+DvoQAJ47k8w+2fxCLPHv6XwZxFzh o3Fy0W4OVh8DdZPh1i2Q38aTkQTZrN0YYAe+8kbQ2S2Rv8ALA+Ezy+VV9U0qtc37 ZIi958iISK9f0Z+JZ7OmU3Esw804f8yYCLoheyc73cK9tjgtc5Lqk7mQ6UeTo8fp oRt5GAj6DHa06LEGCqbIInxuqpKLBBybAD4rkRo8W5X3xLjnVg12QHSDRftcZM/2 sdodS53pP/lJVVm/Y4oML6dg8umAKIx772CN5c+cQAFXQkzOAwT3Xctxw7/Y7CjK vEBZ2AtpwSDFbkAJtuxPMp6c+DysuCea/QbpqmpxPOe4YfM/bYcquek++rslArLB +q/M90Judv4wtCUYg2hpM/AGSWbSEtluExUvldHZ1hR7kUD49qXy4zKmPyWDdsDA Q5SbgY/susvQf8MjwZye44Aj07CRuCgl1ssePv1LYmURD2RCP4kdwBn60I3ivv97 JfPSS0xEtfQCqGtewGDnXeaeDC/ocAcXM24Y+s3qdGyf2H90gGUUDGj8PuW79/ey QVy8dVhKesQZ0S793Gka9Zv8nIskuF+M5XYhN2QIZx+aQG7gWN2guaxnEqB/1Giy uU8YpOXhNQbz5LGCTCkF94Bz4l3csgInZbUXalklm/P8iJWODxryBDNrCHW4KDFp F0cOfSIfi6U2ejRdF79n =XYxK -----END PGP SIGNATURE----- --o512q8QPWFHJtvrgCfHRr1eoILvnNqKbC-- From owner-svn-src-head@freebsd.org Sat Jan 2 10:07:27 2016 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 A0C05A5E6C8; Sat, 2 Jan 2016 10:07:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 5BC221843; Sat, 2 Jan 2016 10:07:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id A5EE8D42B23; Sat, 2 Jan 2016 21:07:16 +1100 (AEDT) Date: Sat, 2 Jan 2016 21:07:15 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Allan Jude cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r292955 - head/lib/libmd In-Reply-To: <56876DF1.4030807@freebsd.org> Message-ID: <20160102210313.M934@besplex.bde.org> References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> <5684D606.3080609@freebsd.org> <56857911.5010205@freebsd.org> <56876DF1.4030807@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=PfoC/XVd c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=JKkEluhCpGZgfhysuqUA:9 a=CjuIK1q_8ugA:10 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, 02 Jan 2016 10:07:27 -0000 On Sat, 2 Jan 2016, Allan Jude wrote: > On 2015-12-31 13:50, Allan Jude wrote: >> On 2015-12-31 13:32, Jonathan T. Looney wrote: >>> On 12/31/15, 2:15 AM, "Allan Jude" wrote: >>> >>>> It seems these problems also slow things down, a lot: >>>> >>>> # time md5 /media/md5test/bigdata >>>> MD5 (/media/md5test/bigdata) = 6afad0bf5d8318093e943229be05be67 >>>> 4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w >>>> # time env LD_PRELOAD=/usr/obj/media/svn/md5/head/tmp/lib/libmd.so >>>> /usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata >>>> MD5 (/media/md5test/bigdata) = 6afad0bf5d8318093e943229be05be67 >>>> 4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w >>>> >>>> (file is fully cached in ZFS ARC, dd reads it at 11GB/s) >>>> >>>> Will investigate more tomorrow. >>> >>> md5 will be slower than dd due to the extra processing it needs to do to >>> generate the hash. I suspect that explains the difference you're seeing >>> between those utilities. >> >> Sorry, you missed my point here. >> >> I replaced MDXFile() with the implementation included in my earlier >> email. Using the newer libmd with that code, cut the time to md5 the >> SAME data down a lot. I need to do a more scientific test on a box that >> isn't doing other stuff still though. >> >> The comment about dd doing 11GB/s, was just to clarify that I wasn't >> reading the file from disk, which would introduce other variables. > > I found the cause of my bogus benchmark, the world on my test machine > was just old enough to be missing jmg@'s bufsize patch. > > Now the difference is about 1 second on a 2GB file, so ignore my > foolishness. That patch is surprisingly new. The main slowness that I complained about was for the other path in md5 that must be used for special files. That uses stdio so it suffers from stdio trusting st_blksize. But st_blksize is rarely as small as the old size BUFSIZ in MDXFile. Bruce From owner-svn-src-head@freebsd.org Sat Jan 2 10:07:32 2016 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 BB6B0A5E6FB; Sat, 2 Jan 2016 10:07:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8F0BD188F; Sat, 2 Jan 2016 10:07:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02A7VlV017650; Sat, 2 Jan 2016 10:07:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02A7VHn017649; Sat, 2 Jan 2016 10:07:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601021007.u02A7VHn017649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 2 Jan 2016 10:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293048 - head/tools/regression 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, 02 Jan 2016 10:07:32 -0000 Author: ngie Date: Sat Jan 2 10:07:31 2016 New Revision: 293048 URL: https://svnweb.freebsd.org/changeset/base/293048 Log: - Use a temporary file for the temporary md(4) devices instead of hardcoding it - Remove the temporary file in the cleanup routine MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/geom_subr.sh Modified: head/tools/regression/geom_subr.sh ============================================================================== --- head/tools/regression/geom_subr.sh Sat Jan 2 04:42:53 2016 (r293047) +++ head/tools/regression/geom_subr.sh Sat Jan 2 10:07:31 2016 (r293048) @@ -23,7 +23,7 @@ devwait() # a large number of md(4) devices lingering around : ${TMPDIR=/tmp} export TMPDIR -TEST_MDS_FILE=${TMPDIR}/test_mds +TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX) || exit 1 attach_md() { @@ -45,4 +45,5 @@ geom_test_cleanup() mdconfig -d -u $test_md done < $TEST_MDS_FILE fi + rm -f $TEST_MDS_FILE } From owner-svn-src-head@freebsd.org Sat Jan 2 14:26:16 2016 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 2E01CA5F12B; Sat, 2 Jan 2016 14:26:16 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0707717B4; Sat, 2 Jan 2016 14:26:16 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [192.168.200.3] (c-73-147-115-187.hsd1.va.comcast.net [73.147.115.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gallatin) by duke.cs.duke.edu (Postfix) with ESMTPSA id B5380F80108; Sat, 2 Jan 2016 09:19:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail; t=1451744378; bh=+eXUiS2CfuA4RvciEg/w1kUS6jPfeHd0nVMM49s3MH4=; h=Subject:To:From:Date; b=fYo10J8Xm9bl4ZZQMUfjBoSsskmZ0jsJPkYIFOxBoN49VfHhsXqAejuQtFLSfZDq7 7VeMOuwtZHxLg5nQsocj4J0TMW0cSHUUZFg/4tcnpFf0BTERN+A71bcy+j6s8Vtl/R yy6wJCS4cpZ9U7aGUd+VecQmDIbpa3Iiytw2UytdmCRAx2Eqf2KXYK/L8sz+VHcnT0 U3bn+x0xlSENCk3AJnszv0++VgFANmYigDej//eR+tI7oB9DrhYA2dJKahkA+Q99XF LCcLXHvEln+1pQdNO6t+KIvNyhh/LKF9sGekrPyNeAHxbngkgXuP9HX29IRl0wCG3C hohRX1TRXcQoQ== Subject: Re: svn commit: r292949 - head/sys/dev/mlx5/mlx5_en To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201512301501.tBUF1lef010775@repo.freebsd.org> From: Andrew Gallatin Message-ID: <5687DC76.40307@cs.duke.edu> Date: Sat, 2 Jan 2016 09:19:34 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201512301501.tBUF1lef010775@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: Sat, 02 Jan 2016 14:26:16 -0000 On 12/30/2015 10:01, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Dec 30 15:01:47 2015 > New Revision: 292949 > URL: https://svnweb.freebsd.org/changeset/base/292949 > > Log: > Add support for modifying coalescing parameters runtime. > Thank you -- this will be very helpful! Drew From owner-svn-src-head@freebsd.org Sat Jan 2 16:40:38 2016 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 B7A5DA5F8E7; Sat, 2 Jan 2016 16:40:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 91B6614A8; Sat, 2 Jan 2016 16:40:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02GebKH030991; Sat, 2 Jan 2016 16:40:37 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02GebdU030988; Sat, 2 Jan 2016 16:40:37 GMT (envelope-from des@FreeBSD.org) Message-Id: <201601021640.u02GebdU030988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sat, 2 Jan 2016 16:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293049 - head/sys/dev/syscons/plasma 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, 02 Jan 2016 16:40:38 -0000 Author: des Date: Sat Jan 2 16:40:37 2016 New Revision: 293049 URL: https://svnweb.freebsd.org/changeset/base/293049 Log: Replace the cosine table with a sine table, which (due to the vagaries of rounding) has better spread. Implement fp16_sin() to go along with fp16_cos(). In the rendering loop, switch from addition to subtraction so the center of the pattern will be a trough rather than a peak. This is completely arbitrary, of course, but looks better to me. Modified: head/sys/dev/syscons/plasma/fp16.c head/sys/dev/syscons/plasma/fp16.h head/sys/dev/syscons/plasma/plasma_saver.c Modified: head/sys/dev/syscons/plasma/fp16.c ============================================================================== --- head/sys/dev/syscons/plasma/fp16.c Sat Jan 2 10:07:31 2016 (r293048) +++ head/sys/dev/syscons/plasma/fp16.c Sat Jan 2 16:40:37 2016 (r293049) @@ -71,42 +71,66 @@ fp16_sqrt(fp16_t x) return (y); } -static fp16_t fp16_cos_table[256] = { - 65536, 65534, 65531, 65524, 65516, 65505, 65491, 65475, - 65457, 65436, 65412, 65386, 65358, 65327, 65294, 65258, - 65220, 65179, 65136, 65091, 65043, 64992, 64939, 64884, - 64826, 64766, 64703, 64638, 64571, 64501, 64428, 64353, - 64276, 64197, 64115, 64030, 63943, 63854, 63762, 63668, - 63571, 63473, 63371, 63268, 63162, 63053, 62942, 62829, - 62714, 62596, 62475, 62353, 62228, 62100, 61971, 61839, - 61705, 61568, 61429, 61288, 61144, 60998, 60850, 60700, - 60547, 60392, 60235, 60075, 59913, 59749, 59583, 59414, - 59243, 59070, 58895, 58718, 58538, 58356, 58172, 57986, - 57797, 57606, 57414, 57219, 57022, 56822, 56621, 56417, - 56212, 56004, 55794, 55582, 55368, 55152, 54933, 54713, - 54491, 54266, 54040, 53811, 53581, 53348, 53114, 52877, - 52639, 52398, 52155, 51911, 51665, 51416, 51166, 50914, - 50660, 50403, 50146, 49886, 49624, 49360, 49095, 48828, - 48558, 48288, 48015, 47740, 47464, 47186, 46906, 46624, - 46340, 46055, 45768, 45480, 45189, 44897, 44603, 44308, - 44011, 43712, 43412, 43110, 42806, 42501, 42194, 41885, - 41575, 41263, 40950, 40636, 40319, 40002, 39682, 39362, - 39039, 38716, 38390, 38064, 37736, 37406, 37075, 36743, - 36409, 36074, 35738, 35400, 35061, 34721, 34379, 34036, - 33692, 33346, 32999, 32651, 32302, 31952, 31600, 31247, - 30893, 30538, 30181, 29824, 29465, 29105, 28745, 28383, - 28020, 27656, 27291, 26925, 26557, 26189, 25820, 25450, - 25079, 24707, 24334, 23960, 23586, 23210, 22833, 22456, - 22078, 21699, 21319, 20938, 20557, 20175, 19792, 19408, - 19024, 18638, 18253, 17866, 17479, 17091, 16702, 16313, - 15923, 15533, 15142, 14751, 14359, 13966, 13573, 13179, - 12785, 12390, 11995, 11600, 11204, 10807, 10410, 10013, - 9616, 9218, 8819, 8421, 8022, 7623, 7223, 6823, - 6423, 6023, 5622, 5222, 4821, 4420, 4018, 3617, - 3215, 2814, 2412, 2010, 1608, 1206, 804, 402, +static fp16_t fp16_sin_table[256] = { + 0, 402, 804, 1206, 1608, 2010, 2412, 2814, + 3215, 3617, 4018, 4420, 4821, 5222, 5622, 6023, + 6423, 6823, 7223, 7623, 8022, 8421, 8819, 9218, + 9616, 10013, 10410, 10807, 11204, 11600, 11995, 12390, + 12785, 13179, 13573, 13966, 14359, 14751, 15142, 15533, + 15923, 16313, 16702, 17091, 17479, 17866, 18253, 18638, + 19024, 19408, 19792, 20175, 20557, 20938, 21319, 21699, + 22078, 22456, 22833, 23210, 23586, 23960, 24334, 24707, + 25079, 25450, 25820, 26189, 26557, 26925, 27291, 27656, + 28020, 28383, 28745, 29105, 29465, 29824, 30181, 30538, + 30893, 31247, 31600, 31952, 32302, 32651, 32999, 33346, + 33692, 34036, 34379, 34721, 35061, 35400, 35738, 36074, + 36409, 36743, 37075, 37406, 37736, 38064, 38390, 38716, + 39039, 39362, 39682, 40002, 40319, 40636, 40950, 41263, + 41575, 41885, 42194, 42501, 42806, 43110, 43412, 43712, + 44011, 44308, 44603, 44897, 45189, 45480, 45768, 46055, + 46340, 46624, 46906, 47186, 47464, 47740, 48015, 48288, + 48558, 48828, 49095, 49360, 49624, 49886, 50146, 50403, + 50660, 50914, 51166, 51416, 51665, 51911, 52155, 52398, + 52639, 52877, 53114, 53348, 53581, 53811, 54040, 54266, + 54491, 54713, 54933, 55152, 55368, 55582, 55794, 56004, + 56212, 56417, 56621, 56822, 57022, 57219, 57414, 57606, + 57797, 57986, 58172, 58356, 58538, 58718, 58895, 59070, + 59243, 59414, 59583, 59749, 59913, 60075, 60235, 60392, + 60547, 60700, 60850, 60998, 61144, 61288, 61429, 61568, + 61705, 61839, 61971, 62100, 62228, 62353, 62475, 62596, + 62714, 62829, 62942, 63053, 63162, 63268, 63371, 63473, + 63571, 63668, 63762, 63854, 63943, 64030, 64115, 64197, + 64276, 64353, 64428, 64501, 64571, 64638, 64703, 64766, + 64826, 64884, 64939, 64992, 65043, 65091, 65136, 65179, + 65220, 65258, 65294, 65327, 65358, 65386, 65412, 65436, + 65457, 65475, 65491, 65505, 65516, 65524, 65531, 65534, }; /* + * Compute the sine of theta. + */ +fp16_t +fp16_sin(fp16_t theta) +{ + unsigned int i; + + i = 1024 * (theta % FP16_2PI) / FP16_2PI; + switch (i / 256) { + case 0: + return (fp16_sin_table[i % 256]); + case 1: + return (fp16_sin_table[255 - i % 256]); + case 2: + return (-fp16_sin_table[i % 256]); + case 3: + return (-fp16_sin_table[255 - i % 256]); + default: + /* inconceivable! */ + return (0); + } +} + +/* * Compute the cosine of theta. */ fp16_t @@ -117,13 +141,13 @@ fp16_cos(fp16_t theta) i = 1024 * (theta % FP16_2PI) / FP16_2PI; switch (i / 256) { case 0: - return (fp16_cos_table[i % 256]); + return (fp16_sin_table[255 - i % 256]); case 1: - return (-fp16_cos_table[255 - i % 256]); + return (-fp16_sin_table[i % 256]); case 2: - return (-fp16_cos_table[i % 256]); + return (-fp16_sin_table[255 - i % 256]); case 3: - return (fp16_cos_table[255 - i % 256]); + return (fp16_sin_table[i % 256]); default: /* inconceivable! */ return (0); Modified: head/sys/dev/syscons/plasma/fp16.h ============================================================================== --- head/sys/dev/syscons/plasma/fp16.h Sat Jan 2 10:07:31 2016 (r293048) +++ head/sys/dev/syscons/plasma/fp16.h Sat Jan 2 16:40:37 2016 (r293049) @@ -78,7 +78,8 @@ fp16_t fp16_sqrt(fp16_t); #define FP16_PI_2 102943 #define FP16_PI_4 51471 -/* cosine */ +/* sine and cosine */ +fp16_t fp16_sin(fp16_t); fp16_t fp16_cos(fp16_t); #endif Modified: head/sys/dev/syscons/plasma/plasma_saver.c ============================================================================== --- head/sys/dev/syscons/plasma/plasma_saver.c Sat Jan 2 10:07:31 2016 (r293048) +++ head/sys/dev/syscons/plasma/plasma_saver.c Sat Jan 2 16:40:37 2016 (r293049) @@ -104,7 +104,7 @@ plasma_update(video_adapter_t *adp) sqd = ItoFP16(dx * dx + dy * dy); d = fp16_sqrt(sqd); /* divide by 4 to stretch out the pattern */ - m = fp16_add(m, fp16_cos(d / 4)); + m = fp16_sub(m, fp16_cos(d / 4)); } /* * m is now in the range +/- FOCI, but we need a From owner-svn-src-head@freebsd.org Sat Jan 2 17:14:23 2016 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 C3D98A5E1E5; Sat, 2 Jan 2016 17:14:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A0C2C1E01; Sat, 2 Jan 2016 17:14:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02HEM6k042498; Sat, 2 Jan 2016 17:14:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02HEMMK042496; Sat, 2 Jan 2016 17:14:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201601021714.u02HEMMK042496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 2 Jan 2016 17:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293050 - head/sys/dev/ath 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, 02 Jan 2016 17:14:23 -0000 Author: adrian Date: Sat Jan 2 17:14:22 2016 New Revision: 293050 URL: https://svnweb.freebsd.org/changeset/base/293050 Log: [ath] add explicit bus barriers. The ath hal and driver code all assume the world is an x86 or the bus layer does an explicit bus flush after each operation (eg netbsd.) However, we don't do that. So, to be "correct" on platforms like sparc64, mips and ppc (and maybe ARM, I am not sure), just do explicit barriers after each operation. Now, this does slow things down a tad on embedded platforms but I'd rather things be "correct" versus "fast." At some later point if someone wishes it to be fast then we should add the barrier calls to the HAL and driver. Tested: * carambola 2 (AR9331.) Modified: head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ah_osdep.h Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Sat Jan 2 16:40:37 2016 (r293049) +++ head/sys/dev/ath/ah_osdep.c Sat Jan 2 17:14:22 2016 (r293050) @@ -291,6 +291,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_ if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); bus_space_write_4(tag, h, reg, val); + OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_WRITE); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); } @@ -311,6 +312,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_i if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); + OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_READ); val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); @@ -371,6 +373,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_ if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); bus_space_write_4(tag, h, reg, val); + OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_WRITE); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); } @@ -391,6 +394,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_i if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); + OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_READ); val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); Modified: head/sys/dev/ath/ah_osdep.h ============================================================================== --- head/sys/dev/ath/ah_osdep.h Sat Jan 2 16:40:37 2016 (r293049) +++ head/sys/dev/ath/ah_osdep.h Sat Jan 2 17:14:22 2016 (r293050) @@ -110,6 +110,27 @@ struct ath_hal; do { } while (0) /* + * Read and write barriers. Some platforms require more strongly ordered + * operations and unfortunately most of the HAL is written assuming everything + * is either an x86 or the bus layer will do the barriers for you. + * + * Read barriers should occur before each read, and write barriers + * occur after each write. + * + * Later on for SDIO/USB parts we will methodize this and make them no-ops; + * register accesses will go via USB commands. + */ +#define OS_BUS_BARRIER_READ BUS_SPACE_BARRIER_READ +#define OS_BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE +#define OS_BUS_BARRIER_RW \ + (BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE) +#define OS_BUS_BARRIER(_ah, _start, _len, _t) \ + bus_space_barrier((bus_space_tag_t)(_ah)->ah_st, \ + (bus_space_handle_t)(_ah)->ah_sh, (_start), (_len), (_t)) +#define OS_BUS_BARRIER_REG(_ah, _reg, _t) \ + OS_BUS_BARRIER((_ah), (_reg), 4, (_t)) + +/* * Register read/write operations are either handled through * platform-dependent routines (or when debugging is enabled * with AH_DEBUG); or they are inline expanded using the macros @@ -123,11 +144,17 @@ extern void ath_hal_reg_write(struct ath extern u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int reg); #else #define OS_REG_WRITE(_ah, _reg, _val) \ + do { \ bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) + (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)); \ + OS_BUS_BARRIER_REG((_ah), (_reg), OS_BUS_BARRIER_WRITE); \ + } while (0) #define OS_REG_READ(_ah, _reg) \ + do { \ + OS_BUS_BARRIER_REG((_ah), (_reg), OS_BUS_BARRIER_READ); \ bus_space_read_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg)) + (bus_space_handle_t)(_ah)->ah_sh, (_reg)); \ + } while (0) #endif #ifdef AH_DEBUG_ALQ From owner-svn-src-head@freebsd.org Sat Jan 2 18:10:55 2016 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 3720BA5F25B; Sat, 2 Jan 2016 18:10:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 032DF18AC; Sat, 2 Jan 2016 18:10:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02IAs56057789; Sat, 2 Jan 2016 18:10:54 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02IArou057787; Sat, 2 Jan 2016 18:10:53 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601021810.u02IArou057787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 2 Jan 2016 18:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293051 - head/sys/powerpc/aim 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, 02 Jan 2016 18:10:55 -0000 Author: nwhitehorn Date: Sat Jan 2 18:10:53 2016 New Revision: 293051 URL: https://svnweb.freebsd.org/changeset/base/293051 Log: Switch setting MSR[SF] to C code. This removes any CPU-specific code (MSF[SF] is a Book 3-S thing) in the 64-bit locore64.S. Modified: head/sys/powerpc/aim/aim_machdep.c head/sys/powerpc/aim/locore64.S Modified: head/sys/powerpc/aim/aim_machdep.c ============================================================================== --- head/sys/powerpc/aim/aim_machdep.c Sat Jan 2 17:14:22 2016 (r293050) +++ head/sys/powerpc/aim/aim_machdep.c Sat Jan 2 18:10:53 2016 (r293051) @@ -179,6 +179,17 @@ aim_cpu_init(vm_offset_t toc) trap_offset = 0; cacheline_warn = 0; + #ifdef __powerpc64__ + /* + * Switch to 64-bit mode, if the bootloader didn't, before we start + * using memory beyond what the bootloader might have set up. + * Guaranteed not to cause an implicit branch since we either (a) + * started with a 32-bit bootloader below 4 GB or (b) were already in + * 64-bit mode, making this a no-op. + */ + mtmsrd(mfmsr() | PSL_SF); + #endif + /* Various very early CPU fix ups */ switch (mfpvr() >> 16) { /* Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Sat Jan 2 17:14:22 2016 (r293050) +++ head/sys/powerpc/aim/locore64.S Sat Jan 2 18:10:53 2016 (r293051) @@ -157,13 +157,6 @@ ASENTRY_NOPROF(__start) ld %r5,64(%r1) ld %r6,72(%r1) - /* Switch to 64-bit mode */ - mfmsr %r9 - li %r8,1 - insrdi %r9,%r8,1,0 - mtmsrd %r9 - isync - /* Begin CPU init */ mr %r4,%r2 /* Replace ignored r4 with tocbase for trap handlers */ bl powerpc_init From owner-svn-src-head@freebsd.org Sat Jan 2 18:15:11 2016 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 A70CFA5F483; Sat, 2 Jan 2016 18:15:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6714E1CCD; Sat, 2 Jan 2016 18:15:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02IFAvT060545; Sat, 2 Jan 2016 18:15:10 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02IFAip060542; Sat, 2 Jan 2016 18:15:10 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601021815.u02IFAip060542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 2 Jan 2016 18:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293052 - in head/sys/powerpc: booke include powerpc 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, 02 Jan 2016 18:15:11 -0000 Author: nwhitehorn Date: Sat Jan 2 18:15:10 2016 New Revision: 293052 URL: https://svnweb.freebsd.org/changeset/base/293052 Log: Bring CPU features list in line with the ABI requirements. MFC after: 1 week Modified: head/sys/powerpc/booke/booke_machdep.c head/sys/powerpc/include/cpu.h head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/booke/booke_machdep.c ============================================================================== --- head/sys/powerpc/booke/booke_machdep.c Sat Jan 2 18:10:53 2016 (r293051) +++ head/sys/powerpc/booke/booke_machdep.c Sat Jan 2 18:15:10 2016 (r293052) @@ -211,6 +211,8 @@ void booke_cpu_init(void) { + cpu_features |= PPC_FEATURE_BOOKE; + pmap_mmu_install(MMU_TYPE_BOOKE, BUS_PROBE_GENERIC); } Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Sat Jan 2 18:10:53 2016 (r293051) +++ head/sys/powerpc/include/cpu.h Sat Jan 2 18:15:10 2016 (r293052) @@ -48,19 +48,32 @@ */ extern int cpu_features; +extern int cpu_features2; #define PPC_FEATURE_32 0x80000000 /* Always true */ #define PPC_FEATURE_64 0x40000000 /* Defined on a 64-bit CPU */ #define PPC_FEATURE_HAS_ALTIVEC 0x10000000 #define PPC_FEATURE_HAS_FPU 0x08000000 #define PPC_FEATURE_HAS_MMU 0x04000000 -#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 -#define PPC_FEATURE_HAS_VSX 0x00000080 +#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 +#define PPC_FEATURE_BOOKE 0x00008000 +#define PPC_FEATURE_SMT 0x00004000 +#define PPC_FEATURE_ARCH_2_05 0x00001000 +#define PPC_FEATURE_HAS_DFP 0x00000400 +#define PPC_FEATURE_ARCH_2_06 0x00000100 +#define PPC_FEATURE_HAS_VSX 0x00000080 + +#define PPC_FEATURE2_ARCH_2_07 0x80000000 +#define PPC_FEATURE2_HAS_HTM 0x40000000 +#define PPC_FEATURE2_HAS_VCRYPTO 0x02000000 #define PPC_FEATURE_BITMASK \ "\20" \ "\040PPC32\037PPC64\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE" \ - "\010VSX" + "\020BOOKE\017SMT\015ARCH205\013DFP\011ARCH206\010VSX" +#define PPC_FEATURE2_BITMASK \ + "\20" \ + "\040ARCH207\037HTM\032VCRYPTO" #define TRAPF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) #define TRAPF_PC(frame) ((frame)->srr0) Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sat Jan 2 18:10:53 2016 (r293051) +++ head/sys/powerpc/powerpc/cpu.c Sat Jan 2 18:15:10 2016 (r293052) @@ -91,6 +91,7 @@ struct cputab { uint16_t revfmt; int features; /* Do not include PPC_FEATURE_32 or * PPC_FEATURE_HAS_MMU */ + int features2; void (*cpu_setup)(int cpuid, uint16_t vers); }; #define REVFMT_MAJMIN 1 /* %u.%u */ @@ -98,93 +99,102 @@ struct cputab { #define REVFMT_DEC 3 /* %u */ static const struct cputab models[] = { { "Motorola PowerPC 601", MPC601, REVFMT_DEC, - PPC_FEATURE_HAS_FPU | PPC_FEATURE_UNIFIED_CACHE, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU | PPC_FEATURE_UNIFIED_CACHE, 0, cpu_6xx_setup }, { "Motorola PowerPC 602", MPC602, REVFMT_DEC, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 603", MPC603, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 603e", MPC603e, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 603ev", MPC603ev, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 604", MPC604, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 604ev", MPC604ev, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 620", MPC620, REVFMT_HEX, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL }, { "Motorola PowerPC 750", MPC750, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "IBM PowerPC 750FX", IBM750FX, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "IBM PowerPC 970", IBM970, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - cpu_970_setup }, + 0, cpu_970_setup }, { "IBM PowerPC 970FX", IBM970FX, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - cpu_970_setup }, + 0, cpu_970_setup }, { "IBM PowerPC 970GX", IBM970GX, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - cpu_970_setup }, + 0, cpu_970_setup }, { "IBM PowerPC 970MP", IBM970MP, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - cpu_970_setup }, + 0, cpu_970_setup }, { "IBM POWER4", IBMPOWER4, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL }, { "IBM POWER4+", IBMPOWER4PLUS, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL }, { "IBM POWER5", IBMPOWER5, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT, 0, NULL }, { "IBM POWER5+", IBMPOWER5PLUS, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT, 0, NULL }, { "IBM POWER6", IBMPOWER6, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05, 0, NULL }, { "IBM POWER7", IBMPOWER7, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_HAS_VSX, NULL }, + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, 0, NULL }, { "IBM POWER7+", IBMPOWER7PLUS, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_HAS_VSX, NULL }, + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, 0, NULL }, { "IBM POWER8E", IBMPOWER8E, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_HAS_VSX, NULL }, + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, + PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | + PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "IBM POWER8", IBMPOWER8, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_HAS_VSX, NULL }, + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, + PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | + PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7450", MPC7450, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7455", MPC7455, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7457", MPC7457, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7447A", MPC7447A, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7448", MPC7448, REVFMT_MAJMIN, - PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 8240", MPC8240, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 8245", MPC8245, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN, - 0, cpu_booke_setup }, + PPC_FEATURE_BOOKE, 0, cpu_booke_setup }, { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, - 0, cpu_booke_setup }, + PPC_FEATURE_BOOKE, 0, cpu_booke_setup }, { "Freescale e500mc core", FSL_E500mc, REVFMT_MAJMIN, - PPC_FEATURE_HAS_FPU, cpu_booke_setup }, + PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup }, { "Freescale e5500 core", FSL_E5500, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, cpu_booke_setup }, - { "Freescale e6500 core", FSL_E6500, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + PPC_FEATURE_BOOKE | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup }, + { "Freescale e6500 core", FSL_E6500, REVFMT_MAJMIN, + PPC_FEATURE_BOOKE | PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | + PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup }, { "IBM Cell Broadband Engine", IBMCELLBE, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, - NULL}, - { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, NULL }, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | + PPC_FEATURE_SMT, 0, NULL}, + { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, 0, NULL }, }; static void cpu_6xx_print_cacheinfo(u_int, uint16_t); @@ -194,8 +204,11 @@ static char model[64]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, ""); int cpu_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU; +int cpu_features2 = 0; SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features, CTLFLAG_RD, &cpu_features, sizeof(cpu_features), "IX", "PowerPC CPU features"); +SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features2, CTLFLAG_RD, + &cpu_features2, sizeof(cpu_features2), "IX", "PowerPC CPU features 2"); /* Provide some user-friendly aliases for bits in cpu_features */ SYSCTL_PROC(_hw, OID_AUTO, floatingpoint, CTLTYPE_INT | CTLFLAG_RD, @@ -265,8 +278,12 @@ cpu_setup(u_int cpuid) printf("\n"); cpu_features |= cp->features; + cpu_features2 |= cp->features2; printf("cpu%d: Features %b\n", cpuid, cpu_features, PPC_FEATURE_BITMASK); + if (cpu_features2 != 0) + printf("cpu%d: Features2 %b\n", cpuid, cpu_features2, + PPC_FEATURE2_BITMASK); /* * Configure CPU From owner-svn-src-head@freebsd.org Sat Jan 2 18:16:25 2016 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 EBC5FA5F533; Sat, 2 Jan 2016 18:16:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A2CEA1E4A; Sat, 2 Jan 2016 18:16:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02IGOUL060621; Sat, 2 Jan 2016 18:16:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02IGOXQ060620; Sat, 2 Jan 2016 18:16:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601021816.u02IGOXQ060620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 18:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293053 - head/sys/boot/uboot/lib 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, 02 Jan 2016 18:16:26 -0000 Author: ian Date: Sat Jan 2 18:16:24 2016 New Revision: 293053 URL: https://svnweb.freebsd.org/changeset/base/293053 Log: Use 64-bit math when finding a block of ram to hold the kernel. This fixes a problem on 32-bit systems which have ram occupying the end of the physical address space -- for example, a block of ram at 0x80000000 with a size of 0x80000000 was overflowing 32 bit math and ending up with a calculated size of zero. This is a fix for one of the two problems mentioned in the PR. Something similar will need to be done on the kernel side before the PR is closed. PR: 201614 Modified: head/sys/boot/uboot/lib/copy.c Modified: head/sys/boot/uboot/lib/copy.c ============================================================================== --- head/sys/boot/uboot/lib/copy.c Sat Jan 2 18:15:10 2016 (r293052) +++ head/sys/boot/uboot/lib/copy.c Sat Jan 2 18:16:24 2016 (r293053) @@ -69,11 +69,11 @@ uint64_t uboot_loadaddr(u_int type, void *data, uint64_t addr) { struct sys_info *si; - uintptr_t sblock, eblock, subldr, eubldr; - uintptr_t biggest_block, this_block; - size_t biggest_size, this_size; + uint64_t sblock, eblock, subldr, eubldr; + uint64_t biggest_block, this_block; + uint64_t biggest_size, this_size; int i; - char * envstr; + char *envstr; if (addr == 0) { /* @@ -100,14 +100,15 @@ uboot_loadaddr(u_int type, void *data, u biggest_block = 0; biggest_size = 0; - subldr = rounddown2((uintptr_t)_start, KERN_ALIGN); - eubldr = roundup2(uboot_heap_end, KERN_ALIGN); + subldr = rounddown2((uint64_t)_start, KERN_ALIGN); + eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN); for (i = 0; i < si->mr_no; i++) { if (si->mr[i].flags != MR_ATTR_DRAM) continue; - sblock = roundup2(si->mr[i].start, KERN_ALIGN); - eblock = rounddown2(si->mr[i].start + si->mr[i].size, + sblock = roundup2((uint64_t)si->mr[i].start, KERN_ALIGN); + eblock = rounddown2((uint64_t)si->mr[i].start + + si->mr[i].size, KERN_ALIGN); if (biggest_size == 0) sblock += KERN_MINADDR; if (subldr >= sblock && subldr < eblock) { @@ -134,9 +135,10 @@ uboot_loadaddr(u_int type, void *data, u if (biggest_size == 0) panic("Not enough DRAM to load kernel\n"); #if 0 - printf("Loading kernel into region 0x%08x-0x%08x (%u MiB)\n", - biggest_block, biggest_block + biggest_size - 1, - biggest_size / 1024 / 1024); + printf("Loading kernel into region 0x%08jx-0x%08jx (%ju MiB)\n", + (uintmax_t)biggest_block, + (uintmax_t)biggest_block + biggest_size - 1, + (uintmax_t)biggest_size / 1024 / 1024); #endif return (biggest_block); } From owner-svn-src-head@freebsd.org Sat Jan 2 18:32:21 2016 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 B9C79A5FA75; Sat, 2 Jan 2016 18:32:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 895BD1C4E; Sat, 2 Jan 2016 18:32:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02IWKOU066404; Sat, 2 Jan 2016 18:32:20 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02IWKQD066403; Sat, 2 Jan 2016 18:32:20 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201601021832.u02IWKQD066403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 2 Jan 2016 18:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293054 - head/sys/dev/ath 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, 02 Jan 2016 18:32:21 -0000 Author: adrian Date: Sat Jan 2 18:32:20 2016 New Revision: 293054 URL: https://svnweb.freebsd.org/changeset/base/293054 Log: ... and that would've never worked. Sorry! (Note: everything I tested on locally has ATH_DEBUG / AH_DEBUG set.) Modified: head/sys/dev/ath/ah_osdep.h Modified: head/sys/dev/ath/ah_osdep.h ============================================================================== --- head/sys/dev/ath/ah_osdep.h Sat Jan 2 18:16:24 2016 (r293053) +++ head/sys/dev/ath/ah_osdep.h Sat Jan 2 18:32:20 2016 (r293054) @@ -143,18 +143,13 @@ struct ath_hal; extern void ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val); extern u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int reg); #else +/* XXX TODO: enforce barriers */ #define OS_REG_WRITE(_ah, _reg, _val) \ - do { \ bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)); \ - OS_BUS_BARRIER_REG((_ah), (_reg), OS_BUS_BARRIER_WRITE); \ - } while (0) + (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) #define OS_REG_READ(_ah, _reg) \ - do { \ - OS_BUS_BARRIER_REG((_ah), (_reg), OS_BUS_BARRIER_READ); \ bus_space_read_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg)); \ - } while (0) + (bus_space_handle_t)(_ah)->ah_sh, (_reg)) #endif #ifdef AH_DEBUG_ALQ From owner-svn-src-head@freebsd.org Sat Jan 2 18:35:12 2016 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 9850BA5FBD9; Sat, 2 Jan 2016 18:35:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 674161E46; Sat, 2 Jan 2016 18:35:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02IZBV4066554; Sat, 2 Jan 2016 18:35:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02IZBok066553; Sat, 2 Jan 2016 18:35:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601021835.u02IZBok066553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 2 Jan 2016 18:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293055 - head/usr.sbin/kbdcontrol 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, 02 Jan 2016 18:35:12 -0000 Author: emaste Date: Sat Jan 2 18:35:11 2016 New Revision: 293055 URL: https://svnweb.freebsd.org/changeset/base/293055 Log: kbdmap.5: Use current names for ASCII control codes lf, ff, us Refer to the old names nl, np, ns as historical aliases. PR: 205776, 205778 MFC After: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/kbdcontrol/kbdmap.5 Modified: head/usr.sbin/kbdcontrol/kbdmap.5 ============================================================================== --- head/usr.sbin/kbdcontrol/kbdmap.5 Sat Jan 2 18:32:20 2016 (r293054) +++ head/usr.sbin/kbdcontrol/kbdmap.5 Sat Jan 2 18:35:11 2016 (r293055) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 29, 2008 +.Dd January 2, 2016 .Dt KBDMAP 5 .Os .Sh NAME @@ -111,9 +111,9 @@ ack, bel, bs, ht, -nl, +lf, vt, -np, +ff, cr, so, si, @@ -132,10 +132,16 @@ esc, fs, gs, rs, -ns, us, sp, del. +.It Ar control-alias +One of the historical aliases for certain +.Tn ASCII +control characters: +nl, +np, +ns. .It Ar accentname By giving one of the accent names, the next key pressed will produce From owner-svn-src-head@freebsd.org Sat Jan 2 19:14:21 2016 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 58854A5E659; Sat, 2 Jan 2016 19:14:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1871E1736; Sat, 2 Jan 2016 19:14:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02JEKfL078306; Sat, 2 Jan 2016 19:14:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02JEKVF078304; Sat, 2 Jan 2016 19:14:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601021914.u02JEKVF078304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 19:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293056 - in head/sys: arm64/arm64 conf 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, 02 Jan 2016 19:14:21 -0000 Author: ian Date: Sat Jan 2 19:14:19 2016 New Revision: 293056 URL: https://svnweb.freebsd.org/changeset/base/293056 Log: Add an OF_decode_addr() implementation for arm64. Discussed with: andrew Added: head/sys/arm64/arm64/ofw_machdep.c (contents, props changed) Modified: head/sys/conf/files.arm64 Added: head/sys/arm64/arm64/ofw_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/ofw_machdep.c Sat Jan 2 19:14:19 2016 (r293056) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2015 Ian Lepore + * 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 + +extern struct bus_space memmap_bus; + +int +OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, + bus_space_handle_t *handle) +{ + bus_addr_t addr; + bus_size_t size; + int err; + + err = ofw_reg_to_paddr(dev, regno, &addr, &size, NULL); + if (err != 0) + return (err); + + *tag = memmap_bus; + return (bus_space_map(*tag, addr, size, 0, handle)); +} Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Jan 2 18:35:11 2016 (r293055) +++ head/sys/conf/files.arm64 Sat Jan 2 19:14:19 2016 (r293056) @@ -38,6 +38,7 @@ arm64/arm64/mem.c standard arm64/arm64/minidump_machdep.c standard arm64/arm64/mp_machdep.c optional smp arm64/arm64/nexus.c standard +arm64/arm64/ofw_machdep.c optional fdt arm64/arm64/pic_if.m standard arm64/arm64/pmap.c standard arm64/arm64/stack_machdep.c optional ddb | stack From owner-svn-src-head@freebsd.org Sat Jan 2 19:28:37 2016 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 7C425A5EB58; Sat, 2 Jan 2016 19:28:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2C5F71C62; Sat, 2 Jan 2016 19:28:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02JSaMi081446; Sat, 2 Jan 2016 19:28:36 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02JSa2a081443; Sat, 2 Jan 2016 19:28:36 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601021928.u02JSa2a081443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 2 Jan 2016 19:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293057 - in head/sys: arm64/include dev/ofw sparc64/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: Sat, 02 Jan 2016 19:28:37 -0000 Author: nwhitehorn Date: Sat Jan 2 19:28:35 2016 New Revision: 293057 URL: https://svnweb.freebsd.org/changeset/base/293057 Log: Make using the #address-cells property on the interrupt parent in device tree parsing opt-out rather than opt-in. All FDT-based systems as well as PowerPC systems with real Open Firmware use the CHRP-derived binding that includes it, which makes SPARC the odd man out here. Making it opt-out avoids astonishment on new platform bring up. Modified: head/sys/arm64/include/ofw_machdep.h head/sys/dev/ofw/ofw_bus_subr.c head/sys/sparc64/include/ofw_machdep.h Modified: head/sys/arm64/include/ofw_machdep.h ============================================================================== --- head/sys/arm64/include/ofw_machdep.h Sat Jan 2 19:14:19 2016 (r293056) +++ head/sys/arm64/include/ofw_machdep.h Sat Jan 2 19:28:35 2016 (r293057) @@ -41,7 +41,4 @@ struct mem_region { vm_size_t mr_size; }; -/* FDT follows ePAPR */ -#define OFW_EPAPR - #endif /* _MACHINE_OFW_MACHDEP_H_ */ Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Sat Jan 2 19:14:19 2016 (r293056) +++ head/sys/dev/ofw/ofw_bus_subr.c Sat Jan 2 19:28:35 2016 (r293057) @@ -361,10 +361,11 @@ ofw_bus_search_intrmap(void *intr, int i paddrsz = 0; while (i > 0) { bcopy(mptr + physsz + intrsz, &parent, sizeof(parent)); -#ifdef OFW_EPAPR +#ifndef OFW_IMAP_NO_IPARENT_ADDR_CELLS /* - * Find if we need to read the parent address data. Sparc64 - * uses a different encoding that doesn't include this data. + * Find if we need to read the parent address data. + * CHRP-derived OF bindings, including ePAPR-compliant FDTs, + * use this as an optional part of the specifier. */ if (OF_getencprop(OF_node_from_xref(parent), "#address-cells", &paddrsz, sizeof(paddrsz)) == -1) Modified: head/sys/sparc64/include/ofw_machdep.h ============================================================================== --- head/sys/sparc64/include/ofw_machdep.h Sat Jan 2 19:14:19 2016 (r293056) +++ head/sys/sparc64/include/ofw_machdep.h Sat Jan 2 19:28:35 2016 (r293057) @@ -34,6 +34,9 @@ typedef uint64_t cell_t; +/* sparc64 doesn't use the interrupt parent #address-cells in interrupt maps */ +#define OFW_IMAP_NO_IPARENT_ADDR_CELLS + int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); u_int OF_getscsinitid(device_t); From owner-svn-src-head@freebsd.org Sat Jan 2 19:34:38 2016 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 D2881A5EDFB; Sat, 2 Jan 2016 19:34:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9E635113D; Sat, 2 Jan 2016 19:34:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02JYbvt084439; Sat, 2 Jan 2016 19:34:37 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02JYbX5084437; Sat, 2 Jan 2016 19:34:37 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601021934.u02JYbX5084437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 2 Jan 2016 19:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293058 - in head/sys/powerpc: include powerpc 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, 02 Jan 2016 19:34:38 -0000 Author: nwhitehorn Date: Sat Jan 2 19:34:37 2016 New Revision: 293058 URL: https://svnweb.freebsd.org/changeset/base/293058 Log: Bump the maximum number of interrupt controllers to allow for the proliferation of them on large IBM systems and add some error checking if we exceed that number. MFC after: 1 week Modified: head/sys/powerpc/include/intr_machdep.h head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/include/intr_machdep.h ============================================================================== --- head/sys/powerpc/include/intr_machdep.h Sat Jan 2 19:28:35 2016 (r293057) +++ head/sys/powerpc/include/intr_machdep.h Sat Jan 2 19:34:37 2016 (r293058) @@ -30,7 +30,7 @@ #define INTR_VECTORS 256 -#define MAX_PICS 5 +#define MAX_PICS 16 #define MAP_IRQ(node, pin) powerpc_get_irq(node, pin) /* Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Sat Jan 2 19:28:35 2016 (r293057) +++ head/sys/powerpc/powerpc/intr_machdep.c Sat Jan 2 19:34:37 2016 (r293058) @@ -352,6 +352,9 @@ powerpc_register_pic(device_t dev, uint3 npics++; } + KASSERT(npics < MAX_PICS, + ("Number of PICs exceeds maximum (%d)", MAX_PICS)); + mtx_unlock(&intr_table_lock); } @@ -385,6 +388,9 @@ powerpc_get_irq(uint32_t node, u_int pin nirqs += 128; npics++; + KASSERT(npics < MAX_PICS, + ("Number of PICs exceeds maximum (%d)", MAX_PICS)); + mtx_unlock(&intr_table_lock); return (piclist[idx].base + pin); From owner-svn-src-head@freebsd.org Sat Jan 2 20:19:42 2016 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 28CE7A5FB0B; Sat, 2 Jan 2016 20:19:42 +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 DE2C41AD5; Sat, 2 Jan 2016 20:19:41 +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 8A690D899; Sat, 2 Jan 2016 20:19:40 +0000 (UTC) Subject: Re: svn commit: r292955 - head/lib/libmd To: Bruce Evans References: <201512301804.tBUI4oGp065466@repo.freebsd.org> <20151231115651.R995@besplex.bde.org> <20151231143314.Y1520@besplex.bde.org> <5684D606.3080609@freebsd.org> <56857911.5010205@freebsd.org> <56876DF1.4030807@freebsd.org> <20160102210313.M934@besplex.bde.org> Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Allan Jude X-Enigmail-Draft-Status: N1110 Message-ID: <568830DD.4080006@freebsd.org> Date: Sat, 2 Jan 2016 15:19:41 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160102210313.M934@besplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Wi6QfO8nTjV1lrg40kwbNOGXqaFa80LtA" 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, 02 Jan 2016 20:19:42 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Wi6QfO8nTjV1lrg40kwbNOGXqaFa80LtA Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2016-01-02 05:07, Bruce Evans wrote: > On Sat, 2 Jan 2016, Allan Jude wrote: >=20 >> On 2015-12-31 13:50, Allan Jude wrote: >>> On 2015-12-31 13:32, Jonathan T. Looney wrote: >>>> On 12/31/15, 2:15 AM, "Allan Jude" wrote: >>>> >>>>> It seems these problems also slow things down, a lot: >>>>> >>>>> # time md5 /media/md5test/bigdata >>>>> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >>>>> 4.310u 3.476s 0:07.79 99.8% 20+167k 0+0io 0pf+0w >>>>> # time env LD_PRELOAD=3D/usr/obj/media/svn/md5/head/tmp/lib/libmd.s= o >>>>> /usr/obj/media/svn/md5/head/sbin/md5/md5 /media/md5test/bigdata >>>>> MD5 (/media/md5test/bigdata) =3D 6afad0bf5d8318093e943229be05be67 >>>>> 4.133u 0.354s 0:04.49 99.7% 20+167k 1+0io 0pf+0w >>>>> >>>>> (file is fully cached in ZFS ARC, dd reads it at 11GB/s) >>>>> >>>>> Will investigate more tomorrow. >>>> >>>> md5 will be slower than dd due to the extra processing it needs to >>>> do to >>>> generate the hash. I suspect that explains the difference you're see= ing >>>> between those utilities. >>> >>> Sorry, you missed my point here. >>> >>> I replaced MDXFile() with the implementation included in my earlier >>> email. Using the newer libmd with that code, cut the time to md5 the >>> SAME data down a lot. I need to do a more scientific test on a box th= at >>> isn't doing other stuff still though. >>> >>> The comment about dd doing 11GB/s, was just to clarify that I wasn't >>> reading the file from disk, which would introduce other variables. >> >> I found the cause of my bogus benchmark, the world on my test machine >> was just old enough to be missing jmg@'s bufsize patch. >> >> Now the difference is about 1 second on a 2GB file, so ignore my >> foolishness. >=20 > That patch is surprisingly new. >=20 > The main slowness that I complained about was for the other path in md5= > that must be used for special files. That uses stdio so it suffers fro= m > stdio trusting st_blksize. But st_blksize is rarely as small as the ol= d > size BUFSIZ in MDXFile. >=20 > Bruce >=20 I did some experiments on MDXFilter, adjusting the buffer size fo 16kb, and using setvbuf() on stdin before reading from it. It improved things, but only marginally. dd if=3D/mnt/bigzerofile bs=3D1m | md5 10 GB took 80 seconds for unmodified md5, and 73.5 seconds with the bigger buffer size. I will try to setup and flamegraph it, and see if we can determine what can be done to make it faster. --=20 Allan Jude --Wi6QfO8nTjV1lrg40kwbNOGXqaFa80LtA 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) iQIcBAEBAgAGBQJWiDDgAAoJEBmVNT4SmAt++V4QAIFqNPQfNz70nWB4H9FLjwNv /wYiRttW4F2qKpYTutWBihciRCFDwifLoVmdeUg4BJd+j63pOgpO3Y74pdpxkA2k DEym4FIdMAlVTG2sw8PqxZlbpxEKU1qr+RIercR7AmiPyGZpkoHtR+3USWFNpR+A 6PoLpUr77TbwfXEhlegueiwnTWeu3OmqqJZTQ8+CJdn6za7hVeNlPLVYWvOnPYvx 65gLzLuy/cgwtb9CvabmTF577Vyi9nxGrm5SQIUIo5T40J8OJmLc9JhYZaTZ4qwg pATgWxR3JoFVY0ZKloveWMUmB3FryVkPBfhHvGZTJ5VdVpc7PK5W6Uk/RX5EoqSJ UB1Bmp0YnOafKuHzLLmzH24AcC4DShZiYwljaXJ/k+S7leZpjecyhb0veuTgMYvj IYrtaVJY2zMaUJw9VPI2ksyFwXZ4e/jcSoGgsMuzHDm6Q+74jBv8D8PVZjhOKZ+1 hNzccQJqqTzjXOMNOX9xUqr+R4bAmzIIr63xQcZC/M9V46u0B15ZFi1VqEQkDrxy tOvhvmh8BFrSyNZIxiFGLX6TePVMjCDvMpyGq+Z1nfWl1VOuUlLeNBiX/EjtBhIy m710LajAvRU+YiYYWPeVEpnL33XQI/xqIQULq8UAXlKz139tePe47BROGs/ySikt /QlrSshZw7NqOh8Z+UWI =oG7U -----END PGP SIGNATURE----- --Wi6QfO8nTjV1lrg40kwbNOGXqaFa80LtA-- From owner-svn-src-head@freebsd.org Sat Jan 2 20:29:29 2016 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 C8194A5FF53; Sat, 2 Jan 2016 20:29:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 96EBF125D; Sat, 2 Jan 2016 20:29:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02KTSkT099643; Sat, 2 Jan 2016 20:29:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02KTSbS099642; Sat, 2 Jan 2016 20:29:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201601022029.u02KTSbS099642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 2 Jan 2016 20:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293059 - head/sys/fs/devfs 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, 02 Jan 2016 20:29:29 -0000 Author: kib Date: Sat Jan 2 20:29:28 2016 New Revision: 293059 URL: https://svnweb.freebsd.org/changeset/base/293059 Log: Hide transient EBADF errors caused by the parallel revoke(2) or forced unmount of devfs mounts, by restarting the failed syscall. When restarted, failing syscalls eventually either stop finding the node and returning ENOENT, or the vnode op vectors finally transition to the deadfs vop. The later return EIO or other error, more appropriate for the operation. Submitted by: bde Tested by: pho MFC after: 3 weeks Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Sat Jan 2 19:34:37 2016 (r293058) +++ head/sys/fs/devfs/devfs_vnops.c Sat Jan 2 20:29:28 2016 (r293059) @@ -244,18 +244,18 @@ devfs_populate_vp(struct vnode *vp) if (DEVFS_DMP_DROP(dmp)) { sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); - return (EBADF); + return (ERESTART); } if ((vp->v_iflag & VI_DOOMED) != 0) { sx_xunlock(&dmp->dm_lock); - return (EBADF); + return (ERESTART); } de = vp->v_data; KASSERT(de != NULL, ("devfs_populate_vp: vp->v_data == NULL but vnode not doomed")); if ((de->de_flags & DE_DOOMED) != 0) { sx_xunlock(&dmp->dm_lock); - return (EBADF); + return (ERESTART); } return (0); From owner-svn-src-head@freebsd.org Sat Jan 2 21:13:15 2016 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 8FE33A5EF95; Sat, 2 Jan 2016 21:13:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5F18A19F7; Sat, 2 Jan 2016 21:13:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02LDEf4014233; Sat, 2 Jan 2016 21:13:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02LDEXw014232; Sat, 2 Jan 2016 21:13:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601022113.u02LDEXw014232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 21:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293060 - 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: Sat, 02 Jan 2016 21:13:15 -0000 Author: ian Date: Sat Jan 2 21:13:14 2016 New Revision: 293060 URL: https://svnweb.freebsd.org/changeset/base/293060 Log: Fix the arm64 build by adding an all-important '&' to get a pointer. I'm not sure how I missed the error when I test-built here, I guess the pointy hat must have slipped down over my eyes. Modified: head/sys/arm64/arm64/ofw_machdep.c Modified: head/sys/arm64/arm64/ofw_machdep.c ============================================================================== --- head/sys/arm64/arm64/ofw_machdep.c Sat Jan 2 20:29:28 2016 (r293059) +++ head/sys/arm64/arm64/ofw_machdep.c Sat Jan 2 21:13:14 2016 (r293060) @@ -49,6 +49,6 @@ OF_decode_addr(phandle_t dev, int regno, if (err != 0) return (err); - *tag = memmap_bus; + *tag = &memmap_bus; return (bus_space_map(*tag, addr, size, 0, handle)); } From owner-svn-src-head@freebsd.org Sat Jan 2 22:00:53 2016 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 86F10A5FCF9; Sat, 2 Jan 2016 22:00:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 35B8B1C9E; Sat, 2 Jan 2016 22:00:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02M0qHC028667; Sat, 2 Jan 2016 22:00:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02M0q0H028666; Sat, 2 Jan 2016 22:00:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601022200.u02M0q0H028666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 22:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293061 - head/sys/arm/arm 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, 02 Jan 2016 22:00:53 -0000 Author: ian Date: Sat Jan 2 22:00:52 2016 New Revision: 293061 URL: https://svnweb.freebsd.org/changeset/base/293061 Log: Use 64-bit math when processing the lists of physical and excluded memory to generate the phys_avail and dump_avail arrays. This is a partial fix for the kernel side of the problem mentioned in the PR. This part handles the cases where comparing start and end addresses of a block would fail because 32-bit wrap caused the end address to come out zero if the end of the region is the end of the address space (0xffffffff with 32-bit vm_paddr_t, but now the code should also work right if we ever support LPAE with 36-bit addresses). More work is necessary to make systems with ram at the end of the physical address space usable, but at least initially it's going to be more like a workaround than a fix, so this non-hacky part is being committed first. PR: 201614 Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sat Jan 2 21:13:14 2016 (r293060) +++ head/sys/arm/arm/physmem.c Sat Jan 2 22:00:52 2016 (r293061) @@ -161,7 +161,7 @@ static size_t regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail) { size_t acnt, exi, hwi; - vm_paddr_t end, start, xend, xstart; + uint64_t end, start, xend, xstart; long availmem; const struct region *exp, *hwp; @@ -171,7 +171,7 @@ regions_to_avail(vm_paddr_t *avail, uint for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { start = hwp->addr; end = hwp->size + start; - realmem += arm32_btop(end - start); + realmem += arm32_btop((vm_offset_t)(end - start)); for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) { /* * If the excluded region does not match given flags, @@ -212,9 +212,10 @@ regions_to_avail(vm_paddr_t *avail, uint * could affect the remainder of this hw region. */ if ((xstart > start) && (xend < end)) { - avail[acnt++] = start; - avail[acnt++] = xstart; - availmem += arm32_btop(xstart - start); + avail[acnt++] = (vm_paddr_t)start; + avail[acnt++] = (vm_paddr_t)xstart; + availmem += + arm32_btop((vm_offset_t)(xstart - start)); start = xend; continue; } @@ -233,9 +234,9 @@ regions_to_avail(vm_paddr_t *avail, uint * available entry for it. */ if (end > start) { - avail[acnt++] = start; - avail[acnt++] = end; - availmem += arm32_btop(end - start); + avail[acnt++] = (vm_paddr_t)start; + avail[acnt++] = (vm_paddr_t)end; + availmem += arm32_btop((vm_offset_t)(end - start)); } if (acnt >= MAX_AVAIL_ENTRIES) panic("Not enough space in the dump/phys_avail arrays"); From owner-svn-src-head@freebsd.org Sat Jan 2 22:04:38 2016 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 5E5AEA5FE57; Sat, 2 Jan 2016 22:04:38 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2FC2D1FFA; Sat, 2 Jan 2016 22:04:38 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02M4bxp029330; Sat, 2 Jan 2016 22:04:37 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02M4bAw029329; Sat, 2 Jan 2016 22:04:37 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201601022204.u02M4bAw029329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Sat, 2 Jan 2016 22:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293062 - head/sys/powerpc/aim 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, 02 Jan 2016 22:04:38 -0000 Author: andreast Date: Sat Jan 2 22:04:37 2016 New Revision: 293062 URL: https://svnweb.freebsd.org/changeset/base/293062 Log: Fix booting of 32-bit kernels on 64-bit G5 hardware. For rs6000, most memory insns and addi/addis do not allow GPR0 for RA (they use literal zero there instead). So use a 'b' constraint to make sure to have a base register other than GPR0. GCC-4.7 and up handles this with allocating r9 instead of r0. Modified: head/sys/powerpc/aim/mp_cpudep.c Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Sat Jan 2 22:00:52 2016 (r293061) +++ head/sys/powerpc/aim/mp_cpudep.c Sat Jan 2 22:04:37 2016 (r293062) @@ -77,10 +77,10 @@ cpudep_ap_early_bootstrap(void) #else __asm __volatile("ld %0, 16(%2); sync; isync; \ mtspr %1, %0; sync; isync;" - : "=r"(reg) : "K"(SPR_HID4), "r"(bsp_state)); + : "=r"(reg) : "K"(SPR_HID4), "b"(bsp_state)); __asm __volatile("ld %0, 24(%2); sync; isync; \ mtspr %1, %0; sync; isync;" - : "=r"(reg) : "K"(SPR_HID5), "r"(bsp_state)); + : "=r"(reg) : "K"(SPR_HID5), "b"(bsp_state)); #endif powerpc_sync(); break; @@ -324,10 +324,10 @@ cpudep_ap_setup() mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; \ mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; \ sync; isync" - : "=r"(reg) : "K"(SPR_HID0), "r"(bsp_state)); + : "=r"(reg) : "K"(SPR_HID0), "b"(bsp_state)); __asm __volatile("ld %0, 8(%2); sync; isync; \ mtspr %1, %0; mtspr %1, %0; sync; isync" - : "=r"(reg) : "K"(SPR_HID1), "r"(bsp_state)); + : "=r"(reg) : "K"(SPR_HID1), "b"(bsp_state)); #endif powerpc_sync(); From owner-svn-src-head@freebsd.org Sat Jan 2 22:20:40 2016 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 5C7AFA5E438; Sat, 2 Jan 2016 22:20:40 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C285184B; Sat, 2 Jan 2016 22:20:40 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id ECFAA25D385E; Sat, 2 Jan 2016 22:20:36 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B49D5C77005; Sat, 2 Jan 2016 22:20:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id I8mP_d0fwBlo; Sat, 2 Jan 2016 22:20:34 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:451c:b13a:9af7:25a0] (unknown [IPv6:fde9:577b:c1a9:4410:451c:b13a:9af7:25a0]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 83E03C76FEE; Sat, 2 Jan 2016 22:20:32 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r293053 - head/sys/boot/uboot/lib From: "Bjoern A. Zeeb" In-Reply-To: <201601021816.u02IGOXQ060620@repo.freebsd.org> Date: Sat, 2 Jan 2016 22:20:28 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <90CAFE3D-DB95-4790-8FBD-9C40E6BF1075@lists.zabbadoz.net> References: <201601021816.u02IGOXQ060620@repo.freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.2104) 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, 02 Jan 2016 22:20:40 -0000 > On 02 Jan 2016, at 18:16 , Ian Lepore wrote: >=20 > Author: ian > Date: Sat Jan 2 18:16:24 2016 > New Revision: 293053 > URL: https://svnweb.freebsd.org/changeset/base/293053 >=20 > Log: > Use 64-bit math when finding a block of ram to hold the kernel. This = fixes > a problem on 32-bit systems which have ram occupying the end of the = physical > address space -- for example, a block of ram at 0x80000000 with a = size of > 0x80000000 was overflowing 32 bit math and ending up with a = calculated size > of zero. >=20 > This is a fix for one of the two problems mentioned in the PR. = Something > similar will need to be done on the kernel side before the PR is = closed. >=20 > PR: 201614 >=20 > Modified: > head/sys/boot/uboot/lib/copy.c This seems to have broken powerpc/powerpc64 worlds: =3D=3D=3D> sys/boot/uboot/lib (all) cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c: In function = 'uboot_loadaddr': /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c:103: warning: cast = from pointer to integer of different size --- copy.o --- *** [copy.o] Error code 1 From owner-svn-src-head@freebsd.org Sat Jan 2 22:31:15 2016 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 7B74EA5E89D; Sat, 2 Jan 2016 22:31:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4BE4C1EC7; Sat, 2 Jan 2016 22:31:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02MVERP037284; Sat, 2 Jan 2016 22:31:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02MVEb5037283; Sat, 2 Jan 2016 22:31:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601022231.u02MVEb5037283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 22:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293063 - head/sys/arm/arm 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, 02 Jan 2016 22:31:15 -0000 Author: ian Date: Sat Jan 2 22:31:14 2016 New Revision: 293063 URL: https://svnweb.freebsd.org/changeset/base/293063 Log: Work around problems that happen when there is ram at the end of the physical address space. Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sat Jan 2 22:04:37 2016 (r293062) +++ head/sys/arm/arm/physmem.c Sat Jan 2 22:31:14 2016 (r293063) @@ -280,10 +280,24 @@ arm_physmem_hardware_region(vm_paddr_t p /* * Filter out the page at PA 0x00000000. The VM can't handle it, as * pmap_extract() == 0 means failure. + * + * Also filter out the page at the end of the physical address space -- + * if addr is non-zero and addr+size is zero that means we wrapped to + * the next byte beyond what vm_paddr_t can express. The calculations + * in vm_page_startup() are going to have the same problem, so just work + * around it by leaving the last page out. + * + * XXX This just in: subtract out a whole megabyte, not just 1 page. + * Reducing the size by anything less than 1MB results in a NULL pointer + * deref in _vm_map_lock_read() very early in startup. Better to give + * up a whole megabyte than leave some folks with an unusable system + * while we investigate. */ if (pa == 0) { pa = PAGE_SIZE; sz -= PAGE_SIZE; + } else if (pa + sz == 0) { + sz -= 1024 * 1024; } /* From owner-svn-src-head@freebsd.org Sat Jan 2 22:36:55 2016 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 BCB29A5E9D1 for ; Sat, 2 Jan 2016 22:36:55 +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 8A094123C for ; Sat, 2 Jan 2016 22:36:55 +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; Sat, 2 Jan 2016 22:37:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id u02MakpB026739; Sat, 2 Jan 2016 15:36:46 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451774206.1369.109.camel@freebsd.org> Subject: Re: svn commit: r293063 - head/sys/arm/arm From: Ian Lepore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 02 Jan 2016 15:36:46 -0700 In-Reply-To: <201601022231.u02MVEb5037283@repo.freebsd.org> References: <201601022231.u02MVEb5037283@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Sat, 02 Jan 2016 22:36:55 -0000 On Sat, 2016-01-02 at 22:31 +0000, Ian Lepore wrote: > Author: ian > Date: Sat Jan 2 22:31:14 2016 > New Revision: 293063 > URL: https://svnweb.freebsd.org/changeset/base/293063 > > Log: > Work around problems that happen when there is ram at the end of the > physical address space. > > Modified: > head/sys/arm/arm/physmem.c > > Modified: head/sys/arm/arm/physmem.c > ============================================================================== > --- head/sys/arm/arm/physmem.c> > Sat Jan 2 22:04:37 2016> > (r293062) > +++ head/sys/arm/arm/physmem.c> > Sat Jan 2 22:31:14 2016> > (r293063) > @@ -280,10 +280,24 @@ arm_physmem_hardware_region(vm_paddr_t p > > > /* > > > * Filter out the page at PA 0x00000000. The VM can't handle it, as > > > * pmap_extract() == 0 means failure. > +> > * > +> > * Also filter out the page at the end of the physical address space -- > +> > * if addr is non-zero and addr+size is zero that means we wrapped to > +> > * the next byte beyond what vm_paddr_t can express. The calculations > +> > * in vm_page_startup() are going to have the same problem, so just work > +> > * around it by leaving the last page out. > +> > * > +> > * XXX This just in: subtract out a whole megabyte, not just 1 page. > +> > * Reducing the size by anything less than 1MB results in a NULL pointer > +> > * deref in _vm_map_lock_read() very early in startup. Better to give > +> > * up a whole megabyte than leave some folks with an unusable system > +> > * while we investigate. > > > */ > > > if (pa == 0) { > > > > pa = PAGE_SIZE; > > > > sz -= PAGE_SIZE; > +> > } else if (pa + sz == 0) { > +> > > sz -= 1024 * 1024; > > > } > > > > /* > Bah. This is not what I intended to commit, I was going to reword that comment block to better match what I found while testing. I was editing the commit message when I decided to do that, so I hit ^C in the shell that was waiting for me to finish editing in emacs, and to my surprise it sent the commit instead of cancelling. What's the right way to change your mind at this late stage of a commit? -- Ian From owner-svn-src-head@freebsd.org Sat Jan 2 22:46:44 2016 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 65357A5EDA8 for ; Sat, 2 Jan 2016 22:46:44 +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 492491B1E for ; Sat, 2 Jan 2016 22:46:43 +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; Sat, 2 Jan 2016 22:47:09 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id u02MkfsQ026767; Sat, 2 Jan 2016 15:46:41 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1451774801.1369.112.camel@freebsd.org> Subject: Re: svn commit: r293053 - head/sys/boot/uboot/lib From: Ian Lepore To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 02 Jan 2016 15:46:41 -0700 In-Reply-To: <90CAFE3D-DB95-4790-8FBD-9C40E6BF1075@lists.zabbadoz.net> References: <201601021816.u02IGOXQ060620@repo.freebsd.org> <90CAFE3D-DB95-4790-8FBD-9C40E6BF1075@lists.zabbadoz.net> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 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: Sat, 02 Jan 2016 22:46:44 -0000 On Sat, 2016-01-02 at 22:20 +0000, Bjoern A. Zeeb wrote: > > On 02 Jan 2016, at 18:16 , Ian Lepore wrote: > > > > Author: ian > > Date: Sat Jan 2 18:16:24 2016 > > New Revision: 293053 > > URL: https://svnweb.freebsd.org/changeset/base/293053 > > > > Log: > > Use 64-bit math when finding a block of ram to hold the kernel. > > This fixes > > a problem on 32-bit systems which have ram occupying the end of > > the physical > > address space -- for example, a block of ram at 0x80000000 with a > > size of > > 0x80000000 was overflowing 32 bit math and ending up with a > > calculated size > > of zero. > > > > This is a fix for one of the two problems mentioned in the PR. > > Something > > similar will need to be done on the kernel side before the PR is > > closed. > > > > PR: 201614 > > > > Modified: > > head/sys/boot/uboot/lib/copy.c > > > This seems to have broken powerpc/powerpc64 worlds: > > ===> sys/boot/uboot/lib (all) > cc1: warnings being treated as errors > /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c: In function > 'uboot_loadaddr': > /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c:103: warning: cast > from pointer to integer of different size > --- copy.o --- > *** [copy.o] Error code 1 > Grrrr. Casting from a pointer to an integer of a different size is exactly what I want to do, and I thought explicitly casting was a rather elegant way of expressing that. -- Ian From owner-svn-src-head@freebsd.org Sat Jan 2 22:52:42 2016 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 301F8A5F029; Sat, 2 Jan 2016 22:52:42 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ob0-x233.google.com (mail-ob0-x233.google.com [IPv6:2607:f8b0:4003:c01::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 E99031F25; Sat, 2 Jan 2016 22:52:41 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ob0-x233.google.com with SMTP id wp13so91254832obc.1; Sat, 02 Jan 2016 14:52:41 -0800 (PST) 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=l/gFtd2kUqCyTLEUrQBCfY6MlQFhvDV4f+9glLTwxOY=; b=QtIu2g2tnhTo35A78KmDjMawbPqIPmAjOmyxXkfz/balctumrN5phVZZ2BL9B9Snfs hjvJHD1bxQICxLu360icCvm+Siq3VDlOf4F99lYADcVfn2I33Oo4dRQuNeji+CNpMArG DdwaPt7i8/Ylw9uJXuI1TTdhTat0ime5r6bUdE/WTA/rN898a07z1ABRNb/UvxsKv9q6 ufTbDIOt+IdEPy6MHzdb8BoQCwVXMw/bNcaYy/VZuJnK5bf3aL6PaVLOrIPY1v8w/yhM nqJdJxw3DUTIyr2UwUxZjDC6UjmPAI8+Gi2G690L10tR9u6BXtB1j5rEEBtbzAaggtuy Z/Zg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=l/gFtd2kUqCyTLEUrQBCfY6MlQFhvDV4f+9glLTwxOY=; b=m4JxR5UpOX2GyA90NGxbqvKYhMp43JD3Q7sYAcacYcILlw6hQeL8zRCpzKoQWbBeY6 AsgDl2LpU5PekgWJknsYq3onwoAVY5Z2Y5w0eTEEzm0tSMWgLFqY+zVqkH2Tm6LA84Ci YRNiq5Q360/HPBDLNF417kyxBAN2ksiS6YGmw/Qz1EaTb74MPJVXCRu2cwuA4V0n4Y7J nn6kBmFtkr5SDpCKh0D9W0kjwlWyRgXFw+zRY2WZtjetCGAursh5h3CDwNR4muSXwHK0 +jpANvKajZAyKEwoE+eoXm9A0QEtKixg7xT7qKgx0JihGMv31s3FKcv5hdBW8bP3fxJB gJtA== MIME-Version: 1.0 X-Received: by 10.182.241.3 with SMTP id we3mr53648584obc.82.1451775161079; Sat, 02 Jan 2016 14:52:41 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.182.184.84 with HTTP; Sat, 2 Jan 2016 14:52:41 -0800 (PST) In-Reply-To: <1451774801.1369.112.camel@freebsd.org> References: <201601021816.u02IGOXQ060620@repo.freebsd.org> <90CAFE3D-DB95-4790-8FBD-9C40E6BF1075@lists.zabbadoz.net> <1451774801.1369.112.camel@freebsd.org> Date: Sat, 2 Jan 2016 16:52:41 -0600 X-Google-Sender-Auth: VolWvz_IyXLr6if1kZMI-BvIy2I Message-ID: Subject: Re: svn commit: r293053 - head/sys/boot/uboot/lib From: Justin Hibbits To: Ian Lepore Cc: "Bjoern A. Zeeb" , src-committers , "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: Sat, 02 Jan 2016 22:52:42 -0000 On Sat, Jan 2, 2016 at 4:46 PM, Ian Lepore wrote: > On Sat, 2016-01-02 at 22:20 +0000, Bjoern A. Zeeb wrote: >> > On 02 Jan 2016, at 18:16 , Ian Lepore wrote: >> > >> > Author: ian >> > Date: Sat Jan 2 18:16:24 2016 >> > New Revision: 293053 >> > URL: https://svnweb.freebsd.org/changeset/base/293053 >> > >> > Log: >> > Use 64-bit math when finding a block of ram to hold the kernel. >> > This fixes >> > a problem on 32-bit systems which have ram occupying the end of >> > the physical >> > address space -- for example, a block of ram at 0x80000000 with a >> > size of >> > 0x80000000 was overflowing 32 bit math and ending up with a >> > calculated size >> > of zero. >> > >> > This is a fix for one of the two problems mentioned in the PR. >> > Something >> > similar will need to be done on the kernel side before the PR is >> > closed. >> > >> > PR: 201614 >> > >> > Modified: >> > head/sys/boot/uboot/lib/copy.c >> >> >> This seems to have broken powerpc/powerpc64 worlds: >> >> ===> sys/boot/uboot/lib (all) >> cc1: warnings being treated as errors >> /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c: In function >> 'uboot_loadaddr': >> /scratch/tmp/bz/head.svn/sys/boot/uboot/lib/copy.c:103: warning: cast >> from pointer to integer of different size >> --- copy.o --- >> *** [copy.o] Error code 1 >> > > Grrrr. Casting from a pointer to an integer of a different size is > exactly what I want to do, and I thought explicitly casting was a > rather elegant way of expressing that. > > -- Ian > > Casting through uintptr_t should solve the problem. - Justin From owner-svn-src-head@freebsd.org Sat Jan 2 22:56:00 2016 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 DF8C3A5F15F; Sat, 2 Jan 2016 22:56:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B252611D2; Sat, 2 Jan 2016 22:56:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02MtxcR043922; Sat, 2 Jan 2016 22:55:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02Mtxe4043921; Sat, 2 Jan 2016 22:55:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601022255.u02Mtxe4043921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 22:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293064 - head/sys/boot/uboot/lib 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, 02 Jan 2016 22:56:01 -0000 Author: ian Date: Sat Jan 2 22:55:59 2016 New Revision: 293064 URL: https://svnweb.freebsd.org/changeset/base/293064 Log: Cast pointer through uintptr_t on the way to uint64_t to squelch a warning. Modified: head/sys/boot/uboot/lib/copy.c Modified: head/sys/boot/uboot/lib/copy.c ============================================================================== --- head/sys/boot/uboot/lib/copy.c Sat Jan 2 22:31:14 2016 (r293063) +++ head/sys/boot/uboot/lib/copy.c Sat Jan 2 22:55:59 2016 (r293064) @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, u biggest_block = 0; biggest_size = 0; - subldr = rounddown2((uint64_t)_start, KERN_ALIGN); + subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN); eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN); for (i = 0; i < si->mr_no; i++) { if (si->mr[i].flags != MR_ATTR_DRAM) From owner-svn-src-head@freebsd.org Sat Jan 2 22:56:08 2016 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 A44CBA5F18C; Sat, 2 Jan 2016 22:56:08 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [IPv6:2001:770:10:300::86e2:510b]) (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 410B7135F; Sat, 2 Jan 2016 22:56:08 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from salmon.maths.tcd.ie (localhost [127.0.0.1]) by salmon.maths.tcd.ie (Postfix) with ESMTP id 17BDC1591F3; Sat, 2 Jan 2016 22:56:05 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=maths.tcd.ie; h= user-agent:in-reply-to:content-disposition:content-type :content-type:mime-version:references:message-id:subject:subject :from:from:date:date:received:received:received; s=20150418; t= 1451775359; x=1453589760; bh=R3Vg6DlMqNUXFLFZW5u1Rfvd1EYIA6aRFJu zWhFaERQ=; b=B1oxhiUDBxxSnqWfkQeVw1QuqrP5ljxeC+94taNDI3d8hR/+Aqd K4q51WTyzTmjDB1dgpbXiKUEr5hJHbXSvqIFi0LiEGcH6NpfknGkeYR3ZH9Coq5X zLDEU0xo/FxyEwnmtrShyjkgrU8SUTh6z+/NHJFpqSM3WNYAIGQH5gI4= X-Virus-Scanned: amavisd-new at maths.tcd.ie Received: from salmon.maths.tcd.ie ([127.0.0.1]) by salmon.maths.tcd.ie (salmon.maths.tcd.ie [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RWDvjD3q1urF; Sat, 2 Jan 2016 22:55:59 +0000 (GMT) Received: from smtp.maths.tcd.ie (walton.maths.tcd.ie [134.226.81.10]) by salmon.maths.tcd.ie (Postfix) with ESMTP id 552891591F0; Sat, 2 Jan 2016 22:55:59 +0000 (GMT) Received: by smtp.maths.tcd.ie (Postfix, from userid 238) id F1FF27308A; Sat, 2 Jan 2016 22:55:58 +0000 (GMT) Date: Sat, 2 Jan 2016 22:55:58 +0000 From: David Malone To: Colin Percival Cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, edwin@freebsd.org, Xin Li Subject: Re: svn commit: r289421 - in head/etc: . mtree ntp Message-ID: <20160102225558.GA57501@walton.maths.tcd.ie> References: <201510161404.t9GE4GqM046436@repo.freebsd.org> <5683D325.6020409@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5683D325.6020409@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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, 02 Jan 2016 22:56:08 -0000 On Wed, Dec 30, 2015 at 04:50:45AM -0800, Colin Percival wrote: > So... is someone going to be keeping this file up to date? We seem to have > the same information in contrib/tzdata/leapseconds (which is being kept up > to date -- thank you edwin and delphij!) but having this file in /etc/ntp/ > being out of date is making ntpd refuse to start. Which version of ntpd is that? I installed a machine from an image from the end of December earlier today and ntpd logged a message but started without any problems: ntpd: leapsecond file ('/etc/ntp/leap-seconds'): good hash signature ntpd: leapsecond file ('/etc/ntp/leap-seconds'): loaded, expire=2015-12-28T00:00:00Z last=2015-07-01T00:00:00Z ofs=36 ntpd: leapsecond file ('/etc/ntp/leap-seconds'): expired less than 6 days ago David. From owner-svn-src-head@freebsd.org Sat Jan 2 23:14:54 2016 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 6B6F6A5F71D; Sat, 2 Jan 2016 23:14:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1FA7B1DCF; Sat, 2 Jan 2016 23:14:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u02NErvE050060; Sat, 2 Jan 2016 23:14:53 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u02NErHt050059; Sat, 2 Jan 2016 23:14:53 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601022314.u02NErHt050059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 2 Jan 2016 23:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293065 - head/sys/arm/arm 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, 02 Jan 2016 23:14:54 -0000 Author: ian Date: Sat Jan 2 23:14:52 2016 New Revision: 293065 URL: https://svnweb.freebsd.org/changeset/base/293065 Log: Reword the comment to better describe what I found while researching the problem that led to this temporary workaround (and also so I can properly cite the PR in the commit this time). In general this is intended to be a temporary workaround until we can figure out why including any ram from the last megabyte of the physical address space leads to a NULL pointer deref. Debugging that is made trickier by the fact that I couldn't even get a backtrace in ddb. PR: 201614 Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sat Jan 2 22:55:59 2016 (r293064) +++ head/sys/arm/arm/physmem.c Sat Jan 2 23:14:52 2016 (r293065) @@ -282,16 +282,14 @@ arm_physmem_hardware_region(vm_paddr_t p * pmap_extract() == 0 means failure. * * Also filter out the page at the end of the physical address space -- - * if addr is non-zero and addr+size is zero that means we wrapped to - * the next byte beyond what vm_paddr_t can express. The calculations - * in vm_page_startup() are going to have the same problem, so just work - * around it by leaving the last page out. + * if addr is non-zero and addr+size is zero we wrapped to the next byte + * beyond what vm_paddr_t can express. That leads to a NULL pointer + * deref early in startup; work around it by leaving the last page out. * * XXX This just in: subtract out a whole megabyte, not just 1 page. - * Reducing the size by anything less than 1MB results in a NULL pointer - * deref in _vm_map_lock_read() very early in startup. Better to give - * up a whole megabyte than leave some folks with an unusable system - * while we investigate. + * Reducing the size by anything less than 1MB results in the NULL + * pointer deref in _vm_map_lock_read(). Better to give up a megabyte + * than leave some folks with an unusable system while we investigate. */ if (pa == 0) { pa = PAGE_SIZE; From owner-svn-src-head@freebsd.org Sat Jan 2 23:59:22 2016 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 20159A5E2B2; Sat, 2 Jan 2016 23:59:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id E06741DD8; Sat, 2 Jan 2016 23:59:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id D20EA3C5D6A; Sun, 3 Jan 2016 10:59:10 +1100 (AEDT) Date: Sun, 3 Jan 2016 10:59:10 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r293064 - head/sys/boot/uboot/lib In-Reply-To: <201601022255.u02Mtxe4043921@repo.freebsd.org> Message-ID: <20160103101219.C1033@besplex.bde.org> References: <201601022255.u02Mtxe4043921@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=R4L+YolX c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=YDqFnzWMhb-X08EIHl0A:9 a=CjuIK1q_8ugA:10 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, 02 Jan 2016 23:59:22 -0000 On Sat, 2 Jan 2016, Ian Lepore wrote: > Log: > Cast pointer through uintptr_t on the way to uint64_t to squelch a warning. > > Modified: head/sys/boot/uboot/lib/copy.c > ============================================================================== > --- head/sys/boot/uboot/lib/copy.c Sat Jan 2 22:31:14 2016 (r293063) > +++ head/sys/boot/uboot/lib/copy.c Sat Jan 2 22:55:59 2016 (r293064) > @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, u > > biggest_block = 0; > biggest_size = 0; > - subldr = rounddown2((uint64_t)_start, KERN_ALIGN); > + subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN); > eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN); > for (i = 0; i < si->mr_no; i++) { > if (si->mr[i].flags != MR_ATTR_DRAM) This gives 1 more bogus cast here: - _start is a function pointer, so it should be cast to uintfptr_t - rounddown2() acts on any integer and subldr is an integer, and both of the integers are unsigned, and KERN_ALIGN is a small signed int, and so there is no need for any further cast, except possibily on arches with uintfptr_t larger than uint64_t or the type of subldr where the compiler warns about downwards cast, but then the downcast may be a bug since it just breaks the warning - if there is a need for a further cast, then it should be of rounddown2(), not of one of its args, so that the args and the internals of rounddown2() don't have to be analysed for promotions. I did some of did analysis above -- KERN_ALIGN is a small int, so its promotion is int and that is presumably smaller than uintfptr_t. rounddown2() is of course undocumented, but everyone knows that macros like it are supposed to mix the args without any casts and end up with a type related to the arg types. - subldr actually has type uintptr_t, so the old cast to uint64_t was just a double type mismatch (mismatched with both the source and target) and leaving it makes it just change the correct type to a wrong one before converting back to the correct type. Since you cast to uintptr_t and not uintfptr_t and KERN_ALIGN is small int, the rvalue would already have the same type as the lvalue unless it is messed up by the uint64_t cast. - not quite similarly on the next line: - the lvalue has type uintptr_t - casting to uint64_t is wrong, as in the new version of the previous line. uboot_heap_end already has type uintptr_t, and casting it to uint64_t just breaks it or complicates the analysis: - if uintptr_t is 64 bits, then casting to uint64_t has no effect - if uintptr_t is 128 bits, then casting to uint64_t just breaks things - if uintptr_t is 32, bits, then casting to uint64_t doesn't even break things. There is an overflow problem in theory, but the bogus cast doesn't fix the problem. roundup2() normally overflows if the address is at a nonzero offset on the last "page" (of size KERN_ALIGN bytes here). Then roundup2() should overflow to 0. On 32-bit arches, the bogus cast avoids the overflow and gives a result of 0x100000000. But since the rvalue has type uintptr_t, it cannot represent this result, and the value overflows to 0 on assignment instead of in roundup2(). roundup2() and its overflow problems are of course undocumented. Another of your recent commits reminded me about this overflow problem. I will complain about that separately :-). rounddown2() cannot overflow, and is also missing the bug of being named in lower case despite being an unsafe macro (one which evaluates its args more than once). It happens to be safe because it only needs to evaluate its args more than once, but its name is just because it folows the bad example of howmany(). Even howmany() is undocumented. Bruce