From owner-svn-src-head@freebsd.org Sun Sep 4 00:25: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 2FADBA94151; Sun, 4 Sep 2016 00:25:51 +0000 (UTC) (envelope-from markj@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 DCB90BC1; Sun, 4 Sep 2016 00:25:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u840Ponn019423; Sun, 4 Sep 2016 00:25:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840Po7f019422; Sun, 4 Sep 2016 00:25:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609040025.u840Po7f019422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 4 Sep 2016 00:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305367 - 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.22 Precedence: list List-Id: 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, 04 Sep 2016 00:25:51 -0000 Author: markj Date: Sun Sep 4 00:25:49 2016 New Revision: 305367 URL: https://svnweb.freebsd.org/changeset/base/305367 Log: Respect the caller's hints when performing swap readahead. The pager getpages interface allows the caller to bound the number of readahead and readbehind pages, and vm_fault_hold() makes use of this feature. These bounds were ignored after r305056, causing the swap pager to potentially page in more than the specified number of pages. Reported and reviewed by: alc X-MFC with: r305056 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Sep 3 23:57:17 2016 (r305366) +++ head/sys/vm/swap_pager.c Sun Sep 4 00:25:49 2016 (r305367) @@ -1086,7 +1086,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t mpred, msucc, p; vm_pindex_t pindex; daddr_t blk; - int i, j, reqcount, shift; + int i, j, maxahead, maxbehind, reqcount, shift; reqcount = count; @@ -1094,7 +1094,7 @@ swap_pager_getpages(vm_object_t object, bp = getpbuf(&nsw_rcount); VM_OBJECT_WLOCK(object); - if (!swap_pager_haspage(object, m[0]->pindex, rbehind, rahead)) { + if (!swap_pager_haspage(object, m[0]->pindex, &maxbehind, &maxahead)) { relpbuf(bp, &nsw_rcount); return (VM_PAGER_FAIL); } @@ -1103,15 +1103,16 @@ swap_pager_getpages(vm_object_t object, * Clip the readahead and readbehind ranges to exclude resident pages. */ if (rahead != NULL) { - KASSERT(reqcount - 1 <= *rahead, + KASSERT(reqcount - 1 <= maxahead, ("page count %d extends beyond swap block", reqcount)); - *rahead -= reqcount - 1; + *rahead = imin(*rahead, maxahead - (reqcount - 1)); pindex = m[reqcount - 1]->pindex; msucc = TAILQ_NEXT(m[reqcount - 1], listq); if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead) *rahead = msucc->pindex - pindex - 1; } if (rbehind != NULL) { + *rbehind = imin(*rbehind, maxbehind); pindex = m[0]->pindex; mpred = TAILQ_PREV(m[0], pglist, listq); if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind) From owner-svn-src-head@freebsd.org Sun Sep 4 00:29: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 236C0A941E9; Sun, 4 Sep 2016 00:29:50 +0000 (UTC) (envelope-from markj@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 DD524D5D; Sun, 4 Sep 2016 00:29:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u840TnfI019585; Sun, 4 Sep 2016 00:29:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840Tn5D019584; Sun, 4 Sep 2016 00:29:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609040029.u840Tn5D019584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 4 Sep 2016 00:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305368 - 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.22 Precedence: list List-Id: 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, 04 Sep 2016 00:29:50 -0000 Author: markj Date: Sun Sep 4 00:29:48 2016 New Revision: 305368 URL: https://svnweb.freebsd.org/changeset/base/305368 Log: Micro-optimize sleepq_signal(). Lift a comparison out of the loop that finds the highest-priority thread on the queue. MFC after: 1 week Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Sun Sep 4 00:25:49 2016 (r305367) +++ head/sys/kern/subr_sleepqueue.c Sun Sep 4 00:29:48 2016 (r305368) @@ -861,9 +861,9 @@ sleepq_signal(void *wchan, int flags, in * been sleeping the longest since threads are always added to * the tail of sleep queues. */ - besttd = NULL; + besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) { - if (besttd == NULL || td->td_priority < besttd->td_priority) + if (td->td_priority < besttd->td_priority) besttd = td; } MPASS(besttd != NULL); From owner-svn-src-head@freebsd.org Sun Sep 4 00:58: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 0DD58A94871; Sun, 4 Sep 2016 00:58:22 +0000 (UTC) (envelope-from landonf@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 A034ED9F; Sun, 4 Sep 2016 00:58:21 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u840wKnB030877; Sun, 4 Sep 2016 00:58:20 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840wJVs030864; Sun, 4 Sep 2016 00:58:19 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040058.u840wJVs030864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 00:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305371 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/siba dev/bwn mips/broadcom modules/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 00:58:22 -0000 Author: landonf Date: Sun Sep 4 00:58:19 2016 New Revision: 305371 URL: https://svnweb.freebsd.org/changeset/base/305371 Log: Migrate bhndb(4) to the new bhnd_erom API. Adds support for probing and initializing bhndb(4) bridge state using the bhnd_erom API, ensuring that full bridge configuration is available *prior* to actually attaching and enumerating the bhnd(4) child device, allowing us to safely allocate bus-level agent/device resources during bhnd(4) bus enumeration. - Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue to the existing bhnd_erom_probe_static() method, and allows the bhndb bridge to discover the best available erom parser class prior to newbus probing of its children. - Add support for supplying identification hints when probing erom devices. This is required on early EXTIF-only chipsets, where chip identification registers are not available. - Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info records rather than bridged bhnd(4) device_t references to determine the bridged chipsets' capability/bridge configuration. - The bhndb parent (e.g. if_bwn) is now required to supply a hardware priority table to the bridge. The default table is currently sufficient for our supported devices. - Drop the two-pass attach approach we used for compatibility with bhndb(4) in the bhnd(4) bus drivers, and instead perform bus enumeration immediately, and allocate bridged per-child bus-level resources during that enumeration. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7768 Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_bhndb.c head/sys/dev/bhnd/bcma/bcma_erom.c head/sys/dev/bhnd/bcma/bcma_eromvar.h head/sys/dev/bhnd/bcma/bcma_nexus.c head/sys/dev/bhnd/bcma/bcma_subr.c head/sys/dev/bhnd/bcma/bcmavar.h head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_erom.c head/sys/dev/bhnd/bhnd_erom.h head/sys/dev/bhnd/bhnd_erom_if.m head/sys/dev/bhnd/bhnd_match.h head/sys/dev/bhnd/bhnd_nexus.c head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_bus_if.m head/sys/dev/bhnd/bhndb/bhndb_if.m head/sys/dev/bhnd/bhndb/bhndb_pci.c head/sys/dev/bhnd/bhndb/bhndb_private.h head/sys/dev/bhnd/bhndb/bhndb_subr.c head/sys/dev/bhnd/bhndb/bhndbvar.h head/sys/dev/bhnd/cores/chipc/chipcreg.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/dev/bhnd/siba/siba_erom.c head/sys/dev/bhnd/siba/siba_nexus.c head/sys/dev/bhnd/siba/sibavar.h head/sys/dev/bwn/if_bwn_pci.c head/sys/dev/bwn/if_bwn_pcivar.h head/sys/mips/broadcom/bcm_machdep.c head/sys/modules/bhnd/bhndb/Makefile Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma.c Sun Sep 4 00:58:19 2016 (r305371) @@ -48,6 +48,12 @@ __FBSDID("$FreeBSD$"); /* RID used when allocating EROM table */ #define BCMA_EROM_RID 0 +static bhnd_erom_class_t * +bcma_get_erom_class(driver_t *driver) +{ + return (&bcma_erom_parser); +} + int bcma_probe(device_t dev) { @@ -55,70 +61,25 @@ bcma_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +/** + * Default bcma(4) bus driver implementation of DEVICE_ATTACH(). + * + * This implementation initializes internal bcma(4) state and performs + * bus enumeration, and must be called by subclassing drivers in + * DEVICE_ATTACH() before any other bus methods. + */ int bcma_attach(device_t dev) { - struct bcma_devinfo *dinfo; - device_t *devs, child; - int ndevs; - int error; + int error; - - if ((error = device_get_children(dev, &devs, &ndevs))) + /* Enumerate children */ + if ((error = bcma_add_children(dev))) { + device_delete_children(dev); return (error); - - /* - * Map our children's agent register block. - */ - for (int i = 0; i < ndevs; i++) { - bhnd_addr_t addr; - bhnd_size_t size; - rman_res_t r_start, r_count, r_end; - - child = devs[i]; - dinfo = device_get_ivars(child); - - KASSERT(!device_is_suspended(child), - ("bcma(4) stateful suspend handling requires that devices " - "not be suspended before bcma_attach()")); - - /* Verify that the agent register block exists and is - * mappable */ - if (bhnd_get_port_rid(child, BHND_PORT_AGENT, 0, 0) == -1) - continue; - - /* Fetch the address of the agent register block */ - error = bhnd_get_region_addr(child, BHND_PORT_AGENT, 0, 0, - &addr, &size); - if (error) { - device_printf(dev, "failed fetching agent register " - "block address for core %d\n", i); - goto cleanup; - } - - /* Allocate the resource */ - r_start = addr; - r_count = size; - r_end = r_start + r_count - 1; - - dinfo->rid_agent = i + 1; - dinfo->res_agent = BHND_BUS_ALLOC_RESOURCE(dev, dev, - SYS_RES_MEMORY, &dinfo->rid_agent, r_start, r_end, r_count, - RF_ACTIVE); - if (dinfo->res_agent == NULL) { - device_printf(dev, "failed allocating agent register " - "block for core %d\n", i); - error = ENXIO; - goto cleanup; - } } -cleanup: - free(devs, M_BHND); - if (error) - return (error); - - return (bhnd_generic_attach(dev)); + return (0); } int @@ -191,15 +152,6 @@ bcma_get_resource_list(device_t dev, dev return (&dinfo->resources); } -static device_t -bcma_find_hostb_device(device_t dev) -{ - struct bcma_softc *sc = device_get_softc(dev); - - /* This is set (or not) by the concrete bcma driver subclass. */ - return (sc->hostb_dev); -} - static int bcma_reset_core(device_t dev, device_t child, uint16_t flags) { @@ -516,8 +468,7 @@ bcma_add_children(device_t bus) corecfg = NULL; /* Allocate our EROM parser */ - erom = bhnd_erom_alloc(&bcma_erom_parser, bus, BCMA_EROM_RID, - cid->enum_addr); + erom = bhnd_erom_alloc(&bcma_erom_parser, cid, bus, BCMA_EROM_RID); if (erom == NULL) return (ENODEV); @@ -528,17 +479,21 @@ bcma_add_children(device_t bus) child = BUS_ADD_CHILD(bus, 0, NULL, -1); if (child == NULL) { error = ENXIO; - goto failed; + goto cleanup; } /* Initialize device ivars */ dinfo = device_get_ivars(child); if ((error = bcma_init_dinfo(bus, dinfo, corecfg))) - goto failed; + goto cleanup; /* The dinfo instance now owns the corecfg value */ corecfg = NULL; + /* Allocate device's agent registers, if any */ + if ((error = bcma_dinfo_alloc_agent(bus, child, dinfo))) + goto cleanup; + /* If pins are floating or the hardware is otherwise * unpopulated, the device shouldn't be used. */ if (bhnd_is_hw_disabled(child)) @@ -548,16 +503,19 @@ bcma_add_children(device_t bus) BHND_BUS_CHILD_ADDED(bus, child); } - /* Hit EOF parsing cores? */ + /* EOF while parsing cores is expected */ if (error == ENOENT) error = 0; -failed: +cleanup: bhnd_erom_free(erom); if (corecfg != NULL) bcma_free_corecfg(corecfg); + if (error) + device_delete_children(bus); + return (error); } @@ -574,7 +532,7 @@ static device_method_t bcma_methods[] = DEVMETHOD(bus_get_resource_list, bcma_get_resource_list), /* BHND interface */ - DEVMETHOD(bhnd_bus_find_hostb_device, bcma_find_hostb_device), + DEVMETHOD(bhnd_bus_get_erom_class, bcma_get_erom_class), DEVMETHOD(bhnd_bus_alloc_devinfo, bcma_alloc_bhnd_dinfo), DEVMETHOD(bhnd_bus_free_devinfo, bcma_free_bhnd_dinfo), DEVMETHOD(bhnd_bus_reset_core, bcma_reset_core), Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_bhndb.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Sun Sep 4 00:58:19 2016 (r305371) @@ -72,26 +72,21 @@ bcma_bhndb_probe(device_t dev) static int bcma_bhndb_attach(device_t dev) { - struct bcma_softc *sc; - int error; + int error; - sc = device_get_softc(dev); + /* Perform initial attach and enumerate our children. */ + if ((error = bcma_attach(dev))) + goto failed; + + /* Delegate remainder to standard bhnd method implementation */ + if ((error = bhnd_generic_attach(dev))) + goto failed; - /* Enumerate our children. */ - if ((error = bcma_add_children(dev))) - return (error); - - /* Initialize full bridge configuration */ - error = BHNDB_INIT_FULL_CONFIG(device_get_parent(dev), dev, - bhndb_bcma_priority_table); - if (error) - return (error); - - /* Ask our parent bridge to find the corresponding bridge core */ - sc->hostb_dev = BHNDB_FIND_HOSTB_DEVICE(device_get_parent(dev), dev); + return (0); - /* Call our superclass' implementation */ - return (bcma_attach(dev)); +failed: + device_delete_children(dev); + return (error); } static int Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Sun Sep 4 00:58:19 2016 (r305371) @@ -58,7 +58,13 @@ __FBSDID("$FreeBSD$"); * marker. */ +struct bcma_erom_io; + static const char *bcma_erom_entry_type_name (uint8_t entry); + +static uint32_t bcma_eio_read4(struct bcma_erom_io *io, + bus_size_t offset); + static int bcma_erom_read32(struct bcma_erom *erom, uint32_t *entry); static int bcma_erom_skip32(struct bcma_erom *erom); @@ -72,8 +78,10 @@ static int bcma_erom_seek_next(struct static int bcma_erom_region_to_port_type(struct bcma_erom *erom, uint8_t region_type, bhnd_port_type *port_type); + static int bcma_erom_peek32(struct bcma_erom *erom, uint32_t *entry); + static bus_size_t bcma_erom_tell(struct bcma_erom *erom); static void bcma_erom_seek(struct bcma_erom *erom, bus_size_t offset); @@ -96,9 +104,33 @@ static void bcma_erom_to_core_info(con u_int core_idx, int core_unit, struct bhnd_core_info *info); +/** + * BCMA EROM generic I/O context + */ +struct bcma_erom_io { + struct bhnd_resource *res; /**< memory resource, or NULL if initialized + with bus space tag and handle */ + int rid; /**< memory resource id, or -1 */ + + bus_space_tag_t bst; /**< bus space tag, if any */ + bus_space_handle_t bsh; /**< bus space handle, if any */ + + bus_size_t start; /**< base read offset */ +}; + +/** + * BCMA EROM per-instance state. + */ +struct bcma_erom { + struct bhnd_erom obj; + device_t dev; /**< parent device, or NULL if none. */ + struct bcma_erom_io io; /**< I/O context */ + bus_size_t offset; /**< current read offset */ +}; + #define EROM_LOG(erom, fmt, ...) do { \ if (erom->dev != NULL) { \ - device_printf(erom->dev, "erom[0x%llx]: " fmt, \ + device_printf(erom->dev, "erom[0x%llx]: " fmt, \ (unsigned long long) (erom->offset), ##__VA_ARGS__);\ } else { \ printf("erom[0x%llx]: " fmt, \ @@ -106,7 +138,6 @@ static void bcma_erom_to_core_info(con } \ } while(0) - /** Return the type name for an EROM entry */ static const char * bcma_erom_entry_type_name (uint8_t entry) @@ -123,47 +154,112 @@ bcma_erom_entry_type_name (uint8_t entry } } + +/** + * Read a 32-bit value from an EROM I/O context. + * + * @param io EROM I/O context. + * @param offset Read offset. + */ +static uint32_t +bcma_eio_read4(struct bcma_erom_io *io, bus_size_t offset) +{ + bus_size_t read_off; + + read_off = io->start + offset; + if (io->res != NULL) + return (bhnd_bus_read_4(io->res, read_off)); + else + return (bus_space_read_4(io->bst, io->bsh, read_off)); +} + +/* Initialize bcma_erom resource I/O context */ +static void +bcma_eio_init(struct bcma_erom_io *io, struct bhnd_resource *res, int rid, + bus_size_t offset) +{ + io->res = res; + io->rid = rid; + io->start = offset; +} + +/* Initialize bcma_erom bus space I/O context */ +static void +bcma_eio_init_static(struct bcma_erom_io *io, bus_space_tag_t bst, + bus_space_handle_t bsh, bus_size_t offset) +{ + io->res = NULL; + io->rid = -1; + io->bst = bst; + io->bsh = bsh; + io->start = offset; +} + +/* BCMA implementation of BHND_EROM_INIT() */ static int -bcma_erom_init(bhnd_erom_t *erom, device_t parent, int rid, bus_addr_t enum_addr) +bcma_erom_init(bhnd_erom_t *erom, const struct bhnd_chipid *cid, + device_t parent, int rid) { - struct bcma_erom *sc = (struct bcma_erom *)erom; + struct bcma_erom *sc; + struct bhnd_resource *res; + sc = (struct bcma_erom *)erom; sc->dev = parent; + sc->offset = 0; + + res = bhnd_alloc_resource(parent, SYS_RES_MEMORY, &rid, cid->enum_addr, + cid->enum_addr + BCMA_EROM_TABLE_SIZE - 1, BCMA_EROM_TABLE_SIZE, + RF_ACTIVE|RF_SHAREABLE); - sc->rid = rid; - sc->res = bhnd_alloc_resource(parent, SYS_RES_MEMORY, &sc->rid, - enum_addr, enum_addr + BCMA_EROM_TABLE_SIZE - 1, - BCMA_EROM_TABLE_SIZE, RF_ACTIVE|RF_SHAREABLE); - if (sc->res == NULL) + if (res == NULL) return (ENOMEM); - - sc->start = BCMA_EROM_TABLE_START; + + bcma_eio_init(&sc->io, res, rid, BCMA_EROM_TABLE_START); + + return (0); +} + +/* BCMA implementation of BHND_EROM_INIT_STATIC() */ +static int +bcma_erom_init_static(bhnd_erom_t *erom, const struct bhnd_chipid *cid, + bus_space_tag_t bst, bus_space_handle_t bsh) +{ + struct bcma_erom *sc; + + sc = (struct bcma_erom *)erom; + sc->dev = NULL; sc->offset = 0; + bcma_eio_init_static(&sc->io, bst, bsh, BCMA_EROM_TABLE_START); + return (0); } +/* Common implementation of BHND_EROM_PROBE/BHND_EROM_PROBE_STATIC */ static int -bcma_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, struct bhnd_chipid *cid) +bcma_erom_probe_common(struct bcma_erom_io *io, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) { - uint32_t idreg, eaddr; - uint8_t chip_type; + uint32_t idreg, eromptr; - idreg = bus_space_read_4(bst, bsh, CHIPC_ID); - chip_type = CHIPC_GET_BITS(idreg, CHIPC_ID_BUS); + /* Hints aren't supported; all BCMA devices have a ChipCommon + * core */ + if (hint != NULL) + return (EINVAL); - /* Fetch EROM physical address */ - if (!BHND_CHIPTYPE_HAS_EROM(chip_type)) + /* Confirm CHIPC_EROMPTR availability */ + idreg = bcma_eio_read4(io, CHIPC_ID); + if (!BHND_CHIPTYPE_HAS_EROM(CHIPC_GET_BITS(idreg, CHIPC_ID_BUS))) return (ENXIO); - eaddr = bus_space_read_4(bst, bsh, CHIPC_EROMPTR); + /* Fetch EROM address */ + eromptr = bcma_eio_read4(io, CHIPC_EROMPTR); /* Parse chip identifier */ - *cid = bhnd_parse_chipid(idreg, eaddr); + *cid = bhnd_parse_chipid(idreg, eromptr); /* Verify chip type */ - switch (chip_type) { + switch (cid->chip_type) { case BHND_CHIPTYPE_BCMA: return (BUS_PROBE_DEFAULT); @@ -173,37 +269,44 @@ bcma_erom_probe_static(bhnd_erom_class_t default: return (ENXIO); - } + } } static int -bcma_erom_init_static(bhnd_erom_t *erom, bus_space_tag_t bst, - bus_space_handle_t bsh) +bcma_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, + bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) { - struct bcma_erom *sc = (struct bcma_erom *)erom; + struct bcma_erom_io io; - sc->dev = NULL; - sc->rid = -1; - sc->res = NULL; - sc->bst = bst; - sc->bsh = bsh; - sc->start = BCMA_EROM_TABLE_START; - sc->offset = 0; + bcma_eio_init(&io, res, rman_get_rid(res->res), + offset + BCMA_EROM_TABLE_START); - return (0); + return (bcma_erom_probe_common(&io, hint, cid)); } +static int +bcma_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, + bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) +{ + struct bcma_erom_io io; + + bcma_eio_init_static(&io, bst, bsh, BCMA_EROM_TABLE_START); + return (bcma_erom_probe_common(&io, hint, cid)); +} + + static void bcma_erom_fini(bhnd_erom_t *erom) { struct bcma_erom *sc = (struct bcma_erom *)erom; - if (sc->res != NULL) { - bhnd_release_resource(sc->dev, SYS_RES_MEMORY, sc->rid, - sc->res); + if (sc->io.res != NULL) { + bhnd_release_resource(sc->dev, SYS_RES_MEMORY, sc->io.rid, + sc->io.res); - sc->res = NULL; - sc->rid = -1; + sc->io.res = NULL; + sc->io.rid = -1; } } @@ -484,19 +587,12 @@ bcma_erom_seek(struct bcma_erom *erom, b static int bcma_erom_peek32(struct bcma_erom *erom, uint32_t *entry) { - bus_size_t off; - - if (erom->offset >= BCMA_EROM_TABLE_SIZE) { + if (erom->offset >= (BCMA_EROM_TABLE_SIZE - sizeof(uint32_t))) { EROM_LOG(erom, "BCMA EROM table missing terminating EOF\n"); return (EINVAL); } - - off = erom->start + erom->offset; - if (erom->res != NULL) - *entry = bhnd_bus_read_4(erom->res, off); - else - *entry = bus_space_read_4(erom->bst, erom->bsh, off); - + + *entry = bcma_eio_read4(&erom->io, erom->offset); return (0); } @@ -1259,6 +1355,7 @@ failed: } static kobj_method_t bcma_erom_methods[] = { + KOBJMETHOD(bhnd_erom_probe, bcma_erom_probe), KOBJMETHOD(bhnd_erom_probe_static, bcma_erom_probe_static), KOBJMETHOD(bhnd_erom_init, bcma_erom_init), KOBJMETHOD(bhnd_erom_init_static, bcma_erom_init_static), Modified: head/sys/dev/bhnd/bcma/bcma_eromvar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_eromvar.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_eromvar.h Sun Sep 4 00:58:19 2016 (r305371) @@ -42,25 +42,6 @@ struct bcma_erom; int bcma_erom_next_corecfg(struct bcma_erom *sc, struct bcma_corecfg **result); -/** - * BCMA EROM per-instance state. - */ -struct bcma_erom { - struct bhnd_erom obj; - device_t dev; /**< EROM parent device, or NULL - if none. */ - struct bhnd_resource *res; /**< EROM table resource, or - NULL if initialized with - bus space tag and handle */ - int rid; /**< EROM table rid, or -1 */ - - bus_space_tag_t bst; /**< EROM table bus space */ - bus_space_handle_t bsh; /**< EROM table bus handle */ - - bus_size_t start; /**< EROM table offset */ - bus_size_t offset; /**< current read offset */ -}; - /** EROM core descriptor. */ struct bcma_erom_core { uint16_t vendor; /**< core's designer */ Modified: head/sys/dev/bhnd/bcma/bcma_nexus.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_nexus.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_nexus.c Sun Sep 4 00:58:19 2016 (r305371) @@ -93,10 +93,19 @@ bcma_nexus_attach(device_t dev) { int error; - if ((error = bcma_add_children(dev))) - return (error); - - return (bcma_attach(dev)); + /* Perform initial attach and enumerate our children. */ + if ((error = bcma_attach(dev))) + goto failed; + + /* Delegate remainder to standard bhnd method implementation */ + if ((error = bhnd_generic_attach(dev))) + goto failed; + + return (0); + +failed: + device_delete_children(dev); + return (error); } static const struct bhnd_chipid * Modified: head/sys/dev/bhnd/bcma/bcma_subr.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_subr.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_subr.c Sun Sep 4 00:58:19 2016 (r305371) @@ -43,6 +43,10 @@ __FBSDID("$FreeBSD$"); #include "bcmavar.h" +/* Return the resource ID for a device's agent register allocation */ +#define BCMA_AGENT_RID(_dinfo) \ + (BCMA_AGENT_RID_BASE + BCMA_DINFO_COREIDX(_dinfo)) + /** * Allocate and initialize new core config structure. * @@ -244,6 +248,63 @@ bcma_init_dinfo(device_t bus, struct bcm return (0); } + +/** + * Allocate the per-core agent register block for a device info structure + * previous initialized via bcma_init_dinfo(). + * + * If an agent0.0 region is not defined on @p dinfo, the device info + * agent resource is set to NULL and 0 is returned. + * + * @param bus The requesting bus device. + * @param child The bcma child device. + * @param dinfo The device info associated with @p child + * + * @retval 0 success + * @retval non-zero resource allocation failed. + */ +int +bcma_dinfo_alloc_agent(device_t bus, device_t child, struct bcma_devinfo *dinfo) +{ + bhnd_addr_t addr; + bhnd_size_t size; + rman_res_t r_start, r_count, r_end; + int error; + + KASSERT(dinfo->res_agent == NULL, ("double allocation of agent")); + + /* Verify that the agent register block exists and is + * mappable */ + if (bhnd_get_port_rid(child, BHND_PORT_AGENT, 0, 0) == -1) + return (0); /* nothing to do */ + + /* Fetch the address of the agent register block */ + error = bhnd_get_region_addr(child, BHND_PORT_AGENT, 0, 0, + &addr, &size); + if (error) { + device_printf(bus, "failed fetching agent register block " + "address for core %u\n", BCMA_DINFO_COREIDX(dinfo)); + return (error); + } + + /* Allocate the resource */ + r_start = addr; + r_count = size; + r_end = r_start + r_count - 1; + + dinfo->rid_agent = BCMA_AGENT_RID(dinfo); + dinfo->res_agent = BHND_BUS_ALLOC_RESOURCE(bus, bus, SYS_RES_MEMORY, + &dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE); + if (dinfo->res_agent == NULL) { + device_printf(bus, "failed allocating agent register block for " + "core %u\n", BCMA_DINFO_COREIDX(dinfo)); + return (ENXIO); + } + + return (0); +} + + /** * Deallocate the given device info structure and any associated resources. * Modified: head/sys/dev/bhnd/bcma/bcmavar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcmavar.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcmavar.h Sun Sep 4 00:58:19 2016 (r305371) @@ -45,6 +45,18 @@ * Internal definitions shared by bcma(4) driver implementations. */ +/** Base resource ID for per-core agent register allocations */ +#define BCMA_AGENT_RID_BASE 100 + +/** + * Return the device's core index. + * + * @param _dinfo The bcma_devinfo instance to query. + */ +#define BCMA_DINFO_COREIDX(_dinfo) \ + ((_dinfo)->corecfg->core_info.core_idx) + + /** BCMA port identifier. */ typedef u_int bcma_pid_t; #define BCMA_PID_MAX UINT_MAX /**< Maximum bcma_pid_t value */ @@ -72,6 +84,8 @@ struct bcma_devinfo *bcma_alloc_dinfo(de int bcma_init_dinfo(device_t bus, struct bcma_devinfo *dinfo, struct bcma_corecfg *corecfg); +int bcma_dinfo_alloc_agent(device_t bus, device_t child, + struct bcma_devinfo *dinfo); void bcma_free_dinfo(device_t bus, struct bcma_devinfo *dinfo); @@ -147,7 +161,6 @@ struct bcma_devinfo { /** BMCA per-instance state */ struct bcma_softc { struct bhnd_softc bhnd_sc; /**< bhnd state */ - device_t hostb_dev; /**< host bridge core, or NULL */ }; #endif /* _BCMA_BCMAVAR_H_ */ Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd.h Sun Sep 4 00:58:19 2016 (r305371) @@ -39,6 +39,7 @@ #include "bhnd_ids.h" #include "bhnd_types.h" +#include "bhnd_erom_types.h" #include "bhnd_debug.h" #include "bhnd_bus_if.h" #include "bhnd_match.h" @@ -188,6 +189,12 @@ struct bhnd_resource { * is MMIO accessible. */ }; +/** Wrap the active resource @p _r in a bhnd_resource structure */ +#define BHND_DIRECT_RESOURCE(_r) ((struct bhnd_resource) { \ + .res = (_r), \ + .direct = true, \ +}) + /** * Device quirk table descriptor. */ @@ -278,6 +285,13 @@ const struct bhnd_core_info *bhnd_find_c const struct bhnd_core_info *cores, u_int num_cores, bhnd_devclass_t class); +struct bhnd_core_match bhnd_core_get_match_desc( + const struct bhnd_core_info *core); + +bool bhnd_cores_equal( + const struct bhnd_core_info *lhs, + const struct bhnd_core_info *rhs); + bool bhnd_core_matches( const struct bhnd_core_info *core, const struct bhnd_core_match *desc); @@ -389,7 +403,16 @@ int bhnd_bus_generic_deactivate_reso bhnd_attach_type bhnd_bus_generic_get_attach_type(device_t dev, device_t child); - +/** + * Return the bhnd(4) bus driver's device enumeration parser class + * + * @param driver A bhnd bus driver instance. + */ +static inline bhnd_erom_class_t * +bhnd_driver_get_erom_class(driver_t *driver) +{ + return (BHND_BUS_GET_EROM_CLASS(driver)); +} /** * Return the active host bridge core for the bhnd bus, if any, or NULL if Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_bus_if.m Sun Sep 4 00:58:19 2016 (r305371) @@ -29,6 +29,7 @@ #include #include +#include INTERFACE bhnd_bus; @@ -49,7 +50,13 @@ CODE { #include #include - + + static bhnd_erom_class_t * + bhnd_bus_null_get_erom_class(driver_t *driver) + { + return (NULL); + } + static struct bhnd_chipid * bhnd_bus_null_get_chipid(device_t dev, device_t child) { @@ -152,7 +159,7 @@ CODE { static device_t bhnd_bus_null_find_hostb_device(device_t dev) { - panic("bhnd_bus_find_hostb_device unimplemented"); + return (NULL); } static bool @@ -199,6 +206,15 @@ CODE { } /** + * Return the bhnd(4) bus driver's device enumeration parser class. + * + * @param driver The bhnd bus driver instance. + */ +STATICMETHOD bhnd_erom_class_t * get_erom_class { + driver_t *driver; +} DEFAULT bhnd_bus_null_get_erom_class; + +/** * Return the active host bridge core for the bhnd bus, if any. * * @param dev The bhnd bus device. Modified: head/sys/dev/bhnd/bhnd_erom.c ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom.c Sun Sep 4 00:58:19 2016 (r305371) @@ -45,15 +45,15 @@ __FBSDID("$FreeBSD$"); * be allocated. * @param rid The resource ID to be used when allocating EROM * resources. - * @param enum_addr The base address of the device enumeration table. + * @param cid The device's chip identifier. * * @retval non-NULL success * @retval NULL if an error occured allocating or initializing the * EROM parser. */ bhnd_erom_t * -bhnd_erom_alloc(bhnd_erom_class_t *cls, device_t parent, int rid, - bus_addr_t enum_addr) +bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct bhnd_chipid *cid, + device_t parent, int rid) { bhnd_erom_t *erom; int error; @@ -61,9 +61,9 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, erom = (bhnd_erom_t *)kobj_create((kobj_class_t)cls, M_BHND, M_WAITOK|M_ZERO); - if ((error = BHND_EROM_INIT(erom, parent, rid, enum_addr))) { + if ((error = BHND_EROM_INIT(erom, cid, parent, rid))) { printf("error initializing %s parser at %#jx with " - "rid %d: %d\n", cls->name, (uintmax_t)enum_addr, rid, + "rid %d: %d\n", cls->name, (uintmax_t)cid->enum_addr, rid, error); kobj_delete((kobj_t)erom, M_BHND); @@ -86,6 +86,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, * @param esize The total available number of bytes allocated for * @p erom. If this is less than is required by @p cls, * ENOMEM will be returned. + * @param cid The device's chip identifier. * @param bst Bus space tag. * @param bsh Bus space handle mapping the device enumeration * space. @@ -97,7 +98,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, */ int bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_erom_t *erom, size_t esize, - bus_space_tag_t bst, bus_space_handle_t bsh) + const struct bhnd_chipid *cid, bus_space_tag_t bst, bus_space_handle_t bsh) { kobj_class_t kcls; @@ -109,7 +110,7 @@ bhnd_erom_init_static(bhnd_erom_class_t /* Perform instance initialization */ kobj_init_static((kobj_t)erom, kcls); - return (BHND_EROM_INIT_STATIC(erom, bst, bsh)); + return (BHND_EROM_INIT_STATIC(erom, cid, bst, bsh)); } /** Modified: head/sys/dev/bhnd/bhnd_erom.h ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom.h Sun Sep 4 00:58:19 2016 (r305371) @@ -42,11 +42,12 @@ #include "bhnd_erom_if.h" bhnd_erom_t *bhnd_erom_alloc(bhnd_erom_class_t *cls, - device_t parent, int rid, - bus_addr_t enum_addr); + const struct bhnd_chipid *cid, + device_t parent, int rid); int bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_erom_t *erom, size_t esize, + const struct bhnd_chipid *cid, bus_space_tag_t bst, bus_space_handle_t bsh); @@ -94,15 +95,48 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_er /** * Probe to see if this device enumeration class supports the bhnd bus + * mapped by the given resource, returning a standard newbus device probe + * result (see BUS_PROBE_*) and the probed chip identification. + * + * @param cls The erom class to probe. + * @param res A resource mapping the first bus core (EXTIF or + * ChipCommon) + * @param offset Offset to the first bus core within @p res. + * @param hint Identification hint used to identify the device. If + * chipset supports standard chip identification registers + * within the first core, this parameter should be NULL. + * @param[out] cid On success, the probed chip identifier. + * + * @retval 0 if this is the only possible device enumeration + * parser for the probed bus. + * @retval negative if the probe succeeds, a negative value should be + * returned; the parser returning the highest negative + * value will be selected to handle device enumeration. + * @retval ENXIO If the bhnd bus type is not handled by this parser. + * @retval positive if an error occurs during probing, a regular unix error + * code should be returned. + */ +static inline int +bhnd_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, + bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) +{ + return (BHND_EROM_PROBE(cls, res, offset, hint, cid)); +} + +/** + * Probe to see if this device enumeration class supports the bhnd bus * mapped at the given bus space tag and handle, returning a standard * newbus device probe result (see BUS_PROBE_*) and the probed * chip identification. * - * @param cls The parser class to be probed. + * @param cls The erom class to probe. * @param bst Bus space tag. * @param bsh Bus space handle mapping the EXTIF or ChipCommon core. * @param paddr The physical address of the core mapped by @p bst and * @p bsh. + * @param hint Identification hint used to identify the device. If + * chipset supports standard chip identification registers + * within the first core, this parameter should be NULL. * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration @@ -116,9 +150,10 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_er */ static inline int bhnd_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, struct bhnd_chipid *cid) + bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) { - return (BHND_EROM_PROBE_STATIC(cls, bst, bsh, paddr, cid)); + return (BHND_EROM_PROBE_STATIC(cls, bst, bsh, paddr, hint, cid)); } /** Modified: head/sys/dev/bhnd/bhnd_erom_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_erom_if.m Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom_if.m Sun Sep 4 00:58:19 2016 (r305371) @@ -45,15 +45,48 @@ INTERFACE bhnd_erom; /** * Probe to see if this device enumeration class supports the bhnd bus + * mapped by the given resource, returning a standard newbus device probe + * result (see BUS_PROBE_*) and the probed chip identification. + * + * @param cls The erom class to probe. + * @param res A resource mapping the first bus core. + * @param offset Offset to the first bus core within @p res. + * @param hint Hint used to identify the device. If chipset supports + * standard chip identification registers within the first + * core, this parameter should be NULL. + * @param[out] cid On success, the probed chip identifier. + * + * @retval 0 if this is the only possible device enumeration + * parser for the probed bus. + * @retval negative if the probe succeeds, a negative value should be + * returned; the parser returning the highest negative + * value will be selected to handle device enumeration. + * @retval ENXIO If the bhnd bus type is not handled by this parser. + * @retval positive if an error occurs during probing, a regular unix error + * code should be returned. + */ +STATICMETHOD int probe { + bhnd_erom_class_t *cls; + struct bhnd_resource *res; + bus_size_t offset; + const struct bhnd_chipid *hint; + struct bhnd_chipid *cid; +}; + +/** + * Probe to see if this device enumeration class supports the bhnd bus * mapped at the given bus space tag and handle, returning a standard * newbus device probe result (see BUS_PROBE_*) and the probed * chip identification. * - * @param cls The erom parse class to probe. + * @param cls The erom class to probe. * @param bst Bus space tag. - * @param bsh Bus space handle mapping the EXTIF or ChipCommon core. + * @param bsh Bus space handle mapping the first bus core. * @param paddr The physical address of the core mapped by @p bst and * @p bsh. + * @param hint Hint used to identify the device. If chipset supports + * standard chip identification registers within the first + * core, this parameter should be NULL. * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration @@ -66,51 +99,54 @@ INTERFACE bhnd_erom; * code should be returned. */ STATICMETHOD int probe_static { - bhnd_erom_class_t *cls; - bus_space_tag_t bst; - bus_space_handle_t bsh; - bus_addr_t paddr; - struct bhnd_chipid *cid; + bhnd_erom_class_t *cls; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_addr_t paddr; + const struct bhnd_chipid *hint; + struct bhnd_chipid *cid; }; /** *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Sep 4 01:17: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 02976A94DF0; Sun, 4 Sep 2016 01:17:18 +0000 (UTC) (envelope-from landonf@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 AE10F7BE; Sun, 4 Sep 2016 01:17:17 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841HGlk038161; Sun, 4 Sep 2016 01:17:16 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841HGDO038160; Sun, 4 Sep 2016 01:17:16 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040117.u841HGDO038160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305372 - in head/sys: dev/bhnd/pmu dev/bhnd/soc mips/sentry5 modules/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 01:17:18 -0000 Author: landonf Date: Sun Sep 4 01:17:16 2016 New Revision: 305372 URL: https://svnweb.freebsd.org/changeset/base/305372 Log: Remove empty directories left by r299241, r302190, r304870, and r301410 Approved by: adrian (mentor, implicit) Deleted: head/sys/dev/bhnd/pmu/ head/sys/dev/bhnd/soc/ head/sys/mips/sentry5/ head/sys/modules/bhnd/nvram/ From owner-svn-src-head@freebsd.org Sun Sep 4 01:25:47 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 7E221B781EE; Sun, 4 Sep 2016 01:25:47 +0000 (UTC) (envelope-from landonf@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 4E8E7CBE; Sun, 4 Sep 2016 01:25:47 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841PkfW041725; Sun, 4 Sep 2016 01:25:46 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841PkJH041724; Sun, 4 Sep 2016 01:25:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040125.u841PkJH041724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305373 - head/sys/dev/bhnd/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 01:25:47 -0000 Author: landonf Date: Sun Sep 4 01:25:46 2016 New Revision: 305373 URL: https://svnweb.freebsd.org/changeset/base/305373 Log: siba(4): Add missing bhnd_device/bhnd_device_quirk table terminator entries. This resulted in an over-read on siba chipsets that failed to match the existing entries. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/siba/siba_bhndb.c Modified: head/sys/dev/bhnd/siba/siba_bhndb.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep 4 01:17:16 2016 (r305372) +++ head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep 4 01:25:46 2016 (r305373) @@ -71,10 +71,12 @@ enum { static struct bhnd_device_quirk bridge_quirks[] = { BHND_CHIP_QUIRK(4311, HWREV_EQ(2), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT), BHND_CHIP_QUIRK(4312, HWREV_EQ(0), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT), + BHND_DEVICE_QUIRK_END }; static struct bhnd_device bridge_devs[] = { BHND_DEVICE(BCM, PCI, NULL, bridge_quirks), + BHND_DEVICE_END }; static int From owner-svn-src-head@freebsd.org Sun Sep 4 01:43:56 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 5C6A7B786E1; Sun, 4 Sep 2016 01:43:56 +0000 (UTC) (envelope-from landonf@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 1B34B65E; Sun, 4 Sep 2016 01:43:56 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841htiB049150; Sun, 4 Sep 2016 01:43:55 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841htkf049147; Sun, 4 Sep 2016 01:43:55 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040143.u841htkf049147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305374 - head/sys/dev/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 01:43:56 -0000 Author: landonf Date: Sun Sep 4 01:43:54 2016 New Revision: 305374 URL: https://svnweb.freebsd.org/changeset/base/305374 Log: bhndb(4): Skip disabled cores when performing bridge configuration probing. On BCM4321 chipsets, both PCI and PCIe cores are included, with one of the cores potentially left floating. Since the PCI core appears first in the device table, and the PCI profiles appear first in the resource configuration tables, this resulted in incorrectly matching and using the PCI/v1 resource configuration on PCIe devices, rather than the correct PCIe/v1 profile. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_if.m Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Sun Sep 4 01:43:54 2016 (r305374) @@ -66,6 +66,17 @@ bhnd_bhndb_get_attach_type(device_t dev, return (BHND_ATTACH_ADAPTER); } + +static bool +bhnd_bhndb_is_hw_disabled(device_t dev, device_t child) +{ + struct bhnd_core_info core = bhnd_get_core_info(child); + + /* Delegate to parent bridge */ + return (BHNDB_IS_CORE_DISABLED(device_get_parent(dev), dev, &core)); +} + + static device_t bhnd_bhndb_find_hostb_device(device_t dev) { @@ -112,6 +123,7 @@ bhnd_bhndb_pwrctl_ungate_clock(device_t static device_method_t bhnd_bhndb_methods[] = { /* BHND interface */ DEVMETHOD(bhnd_bus_get_attach_type, bhnd_bhndb_get_attach_type), + DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_bhndb_is_hw_disabled), DEVMETHOD(bhnd_bus_find_hostb_device, bhnd_bhndb_find_hostb_device), DEVMETHOD(bhnd_bus_read_board_info, bhnd_bhndb_read_board_info), Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep 4 01:43:54 2016 (r305374) @@ -85,8 +85,9 @@ static int bhndb_init_full_config(str static struct bhnd_core_info *bhndb_get_bridge_core(struct bhndb_softc *sc); -static bool bhndb_hw_matches(struct bhnd_core_info *cores, - u_int ncores, const struct bhndb_hw *hw); +static bool bhndb_hw_matches(struct bhndb_softc *sc, + struct bhnd_core_info *cores, u_int ncores, + const struct bhndb_hw *hw); static int bhndb_init_region_cfg(struct bhndb_softc *sc, bhnd_erom_t *erom, @@ -212,14 +213,15 @@ bhndb_get_bridge_core(struct bhndb_softc /** * Return true if @p cores matches the @p hw specification. - * + * + * @param sc BHNDB device state. * @param cores A device table to match against. * @param ncores The number of cores in @p cores. * @param hw The hardware description to be matched against. */ static bool -bhndb_hw_matches(struct bhnd_core_info *cores, u_int ncores, - const struct bhndb_hw *hw) +bhndb_hw_matches(struct bhndb_softc *sc, struct bhnd_core_info *cores, + u_int ncores, const struct bhndb_hw *hw) { for (u_int i = 0; i < hw->num_hw_reqs; i++) { const struct bhnd_core_match *match; @@ -229,7 +231,12 @@ bhndb_hw_matches(struct bhnd_core_info * found = false; for (u_int d = 0; d < ncores; d++) { - if (!bhnd_core_matches(&cores[d], match)) + struct bhnd_core_info *core = &cores[d]; + + if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core)) + continue; + + if (!bhnd_core_matches(core, match)) continue; found = true; @@ -353,7 +360,7 @@ bhndb_init_region_cfg(struct bhndb_softc */ /* ... do not require bridge resources */ - if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, sc->dev, core)) + if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core)) continue; /* ... do not have a priority table entry */ @@ -475,7 +482,7 @@ bhndb_find_hwspec(struct bhndb_softc *sc /* Search for the first matching hardware config. */ hw_table = BHNDB_BUS_GET_HARDWARE_TABLE(sc->parent_dev, sc->dev); for (next = hw_table; next->hw_reqs != NULL; next++) { - if (!bhndb_hw_matches(cores, ncores, next)) + if (!bhndb_hw_matches(sc, cores, ncores, next)) continue; /* Found */ @@ -1166,30 +1173,27 @@ bhndb_get_chipid(device_t dev, device_t return (&sc->chipid); } - /** - * Default implementation of BHND_BUS_IS_HW_DISABLED(). + * Default implementation of BHNDB_IS_CORE_DISABLED(). */ static bool -bhndb_is_hw_disabled(device_t dev, device_t child) +bhndb_is_core_disabled(device_t dev, device_t child, + struct bhnd_core_info *core) { struct bhndb_softc *sc; struct bhnd_core_info *bridge_core; - struct bhnd_core_info core; sc = device_get_softc(dev); - core = bhnd_get_core_info(child); - /* Try to defer to the bhndb bus parent */ - if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, dev, &core)) + if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, dev, core)) return (true); /* Otherwise, we treat bridge-capable cores as unpopulated if they're * not the configured host bridge */ bridge_core = bhndb_get_bridge_core(sc); - if (BHND_DEVCLASS_SUPPORTS_HOSTB(bhnd_core_class(&core))) - return (!bhnd_cores_equal(&core, bridge_core)); + if (BHND_DEVCLASS_SUPPORTS_HOSTB(bhnd_core_class(core))) + return (!bhnd_cores_equal(core, bridge_core)); /* Assume the core is populated */ return (false); @@ -2153,12 +2157,12 @@ static device_method_t bhndb_methods[] = /* BHNDB interface */ DEVMETHOD(bhndb_get_chipid, bhndb_get_chipid), + DEVMETHOD(bhndb_is_core_disabled, bhndb_is_core_disabled), DEVMETHOD(bhndb_get_hostb_core, bhndb_get_hostb_core), DEVMETHOD(bhndb_suspend_resource, bhndb_suspend_resource), DEVMETHOD(bhndb_resume_resource, bhndb_resume_resource), /* BHND interface */ - DEVMETHOD(bhnd_bus_is_hw_disabled, bhndb_is_hw_disabled), DEVMETHOD(bhnd_bus_get_chipid, bhndb_get_chipid), DEVMETHOD(bhnd_bus_activate_resource, bhndb_activate_bhnd_resource), DEVMETHOD(bhnd_bus_deactivate_resource, bhndb_deactivate_bhnd_resource), Modified: head/sys/dev/bhnd/bhndb/bhndb_if.m ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_if.m Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhndb_if.m Sun Sep 4 01:43:54 2016 (r305374) @@ -61,7 +61,14 @@ CODE { { panic("bhndb_populate_board_info unimplemented"); } - + + static int + bhndb_null_is_core_disabled(device_t dev, device_t child, + struct bhnd_core_info *core) + { + panic("bhndb_is_core_disabled unimplemented"); + } + static int bhndb_null_get_hostb_core(device_t dev, device_t child, struct bhnd_core_info *core) @@ -118,6 +125,24 @@ METHOD int populate_board_info { } DEFAULT bhndb_null_populate_board_info; /** + * Return true if the hardware required by @p core is unpopulated or + * otherwise unusable. + * + * In some cases, the core's pins may be left floating, or the hardware + * may otherwise be non-functional; this method allows the parent device + * to explicitly specify whether @p core should be disabled. + * + * @param dev The parent device of @p child. + * @param child The attached bhnd device. + * @param core A core discovered on @p child. + */ +METHOD bool is_core_disabled { + device_t dev; + device_t child; + struct bhnd_core_info *core; +} DEFAULT bhndb_null_is_core_disabled; + +/** * Get the host bridge core info for the attached bhnd bus. * * @param dev The bridge device. From owner-svn-src-head@freebsd.org Sun Sep 4 01:47: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 D4995B788D2; Sun, 4 Sep 2016 01:47:22 +0000 (UTC) (envelope-from landonf@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 A4F4A9A8; Sun, 4 Sep 2016 01:47:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841lLhQ049326; Sun, 4 Sep 2016 01:47:21 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841lL2G049325; Sun, 4 Sep 2016 01:47:21 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040147.u841lL2G049325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305375 - head/sys/dev/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 01:47:22 -0000 Author: landonf Date: Sun Sep 4 01:47:21 2016 New Revision: 305375 URL: https://svnweb.freebsd.org/changeset/base/305375 Log: bhndb(4): Fix probing of bhndb-attached bhnd_nvram devices. This fixes bhnd(4) nvram handling on devices that map SPROM CSRs via PCI configuration space. The probe method previously required that a bhnd(4) device be attached to the parent bridge; now that the bhnd_nvram device is always attached first, this unnecessary sanity check always failed. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Sun Sep 4 01:43:54 2016 (r305374) +++ head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Sun Sep 4 01:47:21 2016 (r305375) @@ -60,17 +60,13 @@ __FBSDID("$FreeBSD$"); static int bhndb_pci_sprom_probe(device_t dev) { - device_t bridge, bus; + device_t bridge; int error; - /* Our parent must be a PCI-BHND bridge with an attached bhnd bus */ + /* Our parent must be a PCI-BHND bridge */ bridge = device_get_parent(dev); if (device_get_driver(bridge) != &bhndb_pci_driver) return (ENXIO); - - bus = device_find_child(bridge, devclass_get_name(bhnd_devclass), 0); - if (bus == NULL) - return (ENXIO); /* Defer to default driver implementation */ if ((error = bhnd_sprom_probe(dev)) > 0) From owner-svn-src-head@freebsd.org Sun Sep 4 04:12:06 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 53964BCE644; Sun, 4 Sep 2016 04:12:06 +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 ECC03B16; Sun, 4 Sep 2016 04:12:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 068F9D4A9FA; Sun, 4 Sep 2016 14:11:51 +1000 (AEST) Date: Sun, 4 Sep 2016 14:11:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305362 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/i386/i386 sys/i386/include sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/powerpc/powerpc... In-Reply-To: <201609032038.u83KcDYA033362@repo.freebsd.org> Message-ID: <20160904131717.I913@besplex.bde.org> References: <201609032038.u83KcDYA033362@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=CoZCCSMD c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=TwZxhBisbO2s35zHJhEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 04:12:06 -0000 On Sat, 3 Sep 2016, Mark Johnston wrote: > Log: > Remove support for idle page zeroing. > > Idle page zeroing has been disabled by default on all architectures since > r170816 and has some bugs that make it seemingly unusable. Specifically, > the idle-priority pagezero thread exacerbates contention for the free page > lock, and yields the CPU without releasing it in non-preemptive kernels. The > pagezero thread also does not behave correctly when superpage reservations > are enabled: its target is a function of v_free_count, which includes > reserved-but-free pages, but it is only able to zero pages belonging to the > physical memory allocator. > > Reviewed by: alc, imp, kib It worked well in 2007. I tried to fix it, and asked alc to fix it, in 2008, but didn't get anywhere. Now another problem is obvious. Memories and CPUs are a bit faster, but context switches are still very slow. My newest system can "rep stosb" at 16-128GB/sec or 1/32-1/4usec per page, but it takes 1 usec for a (user) context switch. So to amortize the cost of a context switch, idlezero needs to zero many pages per switch, perhaps hundreds, and to ensure this it must run at high (numerically low) priority and schedule itself to not become too active, but it does exactly the opposite (idle priority, and then if PREEMPTION is configured, scheduled generally with the opposite policy). But if it schedules itself to do many pages at a time, this gives bad latency. Zeroing in idle last worked correctly in FreeBSD-4 with UP. Then there were no kernel context switches and vm_page_zero_idle() was just a function call away from the idle loop. However, the version with context switching was better than nothing with slow memory in 2007. This is not fixed in the following patch for a ~2008 version: X Index: vm_phys.c X =================================================================== X --- vm_phys.c (revision 181737) X +++ vm_phys.c (working copy) X @@ -41,6 +41,8 @@ X #include X #include X +#include X #include X #include X +#include X #include X #include X @@ -552,7 +554,18 @@ X cnt.v_free_count--; X mtx_unlock(&vm_page_queue_free_mtx); X +#ifndef PREEMPTION_AND_PREEMPTION_WORKS X + if (sched_runnable()) { X + thread_lock(curthread); X + critical_exit(); X + mi_switch(SW_VOL | SWT_IDLE, X + NULL); X + thread_unlock(curthread); X + } else X +#endif X + critical_exit(); X pmap_zero_page_idle(m_tmp); X m_tmp->flags |= PG_ZERO; X mtx_lock(&vm_page_queue_free_mtx); X + critical_enter(); X cnt.v_free_count++; X vm_phys_free_pages(m_tmp, 0); X Index: vm_zeroidle.c X =================================================================== X --- vm_zeroidle.c (revision 181737) X +++ vm_zeroidle.c (working copy) X @@ -122,18 +122,14 @@ X X mtx_lock(&vm_page_queue_free_mtx); X + critical_enter(); X for (;;) { X if (vm_page_zero_check()) { X vm_page_zero_idle(); X -#ifndef PREEMPTION X - if (sched_runnable()) { X - thread_lock(curthread); X - mi_switch(SW_VOL | SWT_IDLE, NULL); X - thread_unlock(curthread); X - } X -#endif X } else { X wakeup_needed = TRUE; X + critical_exit(); X msleep(&zero_state, &vm_page_queue_free_mtx, 0, X "pgzero", hz * 300); X + critical_enter(); X } X } PREEMPTION had to be turned off for best results. This is only practical for SMP systems. It was more broken (gave too many context switches) in 2007 than now. I still turn it off for SMP. Perhaps the extra context switches had a lot to do with this idlezero problem. Any time the system goes idle for a short time, idlezero runs for a short time. Then it gets preempted, but still holds the lock, so there may be another context switch back to it. This might be repeated several times per page. The version in FreeBSD-5.2 is threaded and uses preemption if available, but has vestiges of the FreeBSD-4 scheduling. It sleeps voluntarily after zeroing maxrun pages. But maxrun defaults to 16. A system too new to run FreeBSD-4 is just warming up after doing 16 pages. So my only idea for making this work is: - do it from the idle loop (first remove idle threads, a larger task) - do only 1 page at a time, at high priority - use trylock (while at high priority) and not lock (at idle priority) so see if the lock can be acquired. I now remember that it already raised its priority while holding the lock, using a critical section. Doesn't that work? My fix has something to do with this -- I enlarged the critical section. It should be around acquiring the lock too, so that we never get preempted while holding the lock, but that needs trylock. Bruce From owner-svn-src-head@freebsd.org Sun Sep 4 05:11: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 90BACBCC25F; Sun, 4 Sep 2016 05:11:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::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 5B0C5AB; Sun, 4 Sep 2016 05:11:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x232.google.com with SMTP id p64so54808781pfb.1; Sat, 03 Sep 2016 22:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/jfVrV1LdCaGJGwe3BwXauLRKaepHRuMKsGDNSk6yVY=; b=VxPxoAioCXtuW5WQYJeDL7J7TJP8SDqZe/fJqj+a2pB/+6sudulxKzfESDTkCJ0Von k8i47TE4+BrWSShJmAFT+/Lcg/Jw9SMhN4h8pDIMimzdVZ49To0QD2+Dt/eN9/PP5u2u UgxHC0BrQKHIC6YWcOQ0/0u6YY0mjrPwDAkI/jiLyap+AYsbnCr7JbJCraJ38hvLOv+p dPEzZW2P3jmwkwmPieGt2M1ysdOABnBKTpPmjSL0yc19sT9e26DM2vkbzDPsBpP4qc48 6MIEoUJHk/xJgsqFNwbBeRDi/b8ZLJJX8tHEgM+vMQ7v87fpBJI2LvLMBwpPXwuABRRQ 8JvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/jfVrV1LdCaGJGwe3BwXauLRKaepHRuMKsGDNSk6yVY=; b=TZ2lhYVxqH767NNkxgsMEYyweZEzPVqL+khHZKsxIrboXWLHainoEmEJSQbSD0qU0U 3KfWlCvc7Yv8R7jwZSkAdPGvbIqB/E6XzmaUnWdAJaEMCQlfTOKoH107JZssv8fWcALv 2Xaj7LagoISKjxbLU35q+uGsPehAh+LAqJO2OlDEPH60kgsgkOGkFbTblQ1yy3M/n/8G ayZhGttkI9GknYqde4TTHJcglh3RyD50FfCSLm3qmr9d/MUWvUBNK2GjayCfG09UPZVs Iv1s2l1pJpdjqcO7LLGP/BgUlOQPfbvS/csMh1UXYmaECwv2kzkTrnJdkKPmUlZVRER3 X5Jw== X-Gm-Message-State: AE9vXwNUx//Rtt6gr+74gLjVdJ/0SkKSrru2hin9LzR61+zZv8HsD65gij8SLkfju8DLHQ== X-Received: by 10.98.106.65 with SMTP id f62mr51108644pfc.107.1472965901719; Sat, 03 Sep 2016 22:11:41 -0700 (PDT) Received: from ?IPv6:2607:fb90:f32:78bf:b53f:4873:1528:4d33? ([2607:fb90:f32:78bf:b53f:4873:1528:4d33]) by smtp.gmail.com with ESMTPSA id ww14sm25008015pac.34.2016.09.03.22.11.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 03 Sep 2016 22:11:41 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r305084 - head/tools/regression/capsicum/syscalls From: Ngie Cooper X-Mailer: iPhone Mail (13G36) In-Reply-To: <20160831070607.GA3259@jarvis> Date: Sat, 3 Sep 2016 22:11:39 -0700 Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <201608301958.u7UJwf1G032550@repo.freebsd.org> <20160831070607.GA3259@jarvis> To: Mariusz Zaborski X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 04 Sep 2016 05:11:42 -0000 > On Aug 31, 2016, at 00:06, Mariusz Zaborski wrote: >=20 >> On Tue, Aug 30, 2016 at 06:04:50PM -0700, Ngie Cooper wrote: >>> On Tue, Aug 30, 2016 at 12:58 PM, Mariusz Zaborski = wrote: >>> Author: oshogbo >>> Date: Tue Aug 30 19:58:41 2016 >>> New Revision: 305084 >>> URL: https://svnweb.freebsd.org/changeset/base/305084 >>>=20 >>> Log: >>> Fix Capsicum syscalls test suite. >>=20 >> Do you plan on MFCing the change? > emaste@ suggested to change it to the kyua tests, what would you think abo= ut > MFCing after that? Sure. Let's work out the kinks with the tests, then we can push that back to= ^/stable/11. Thanks! -Ngie= From owner-svn-src-head@freebsd.org Sun Sep 4 08:55: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 6826BBCEC96; Sun, 4 Sep 2016 08:55:16 +0000 (UTC) (envelope-from mjg@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 45B7AC83; Sun, 4 Sep 2016 08:55:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u848tFsG055196; Sun, 4 Sep 2016 08:55:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848tFbF055195; Sun, 4 Sep 2016 08:55:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609040855.u848tFbF055195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 08:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305378 - 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.22 Precedence: list List-Id: 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, 04 Sep 2016 08:55:16 -0000 Author: mjg Date: Sun Sep 4 08:55:15 2016 New Revision: 305378 URL: https://svnweb.freebsd.org/changeset/base/305378 Log: cache: put all negative entry management code into dedicated functions Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 08:53:58 2016 (r305377) +++ head/sys/kern/vfs_cache.c Sun Sep 4 08:55:15 2016 (r305378) @@ -433,6 +433,50 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n #endif /* + * Negative entries management + */ +static void +cache_negative_hit(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + TAILQ_REMOVE(&ncneg, ncp, nc_dst); + TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); +} + +static void +cache_negative_insert(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + MPASS(ncp->nc_vp == NULL); + TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + numneg++; +} + +static void +cache_negative_remove(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + MPASS(ncp->nc_vp == NULL); + TAILQ_REMOVE(&ncneg, ncp, nc_dst); + numneg--; +} + +static void +cache_negative_zap_one(void) +{ + struct namecache *ncp; + + rw_assert(&cache_lock, RA_WLOCKED); + ncp = TAILQ_FIRST(&ncneg); + KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", + ncp, ncp->nc_vp)); + cache_zap(ncp); +} + +/* * cache_zap(): * * Removes a namecache entry from cache, whether it contains an actual @@ -469,8 +513,7 @@ cache_zap(struct namecache *ncp) if (ncp == ncp->nc_vp->v_cache_dd) ncp->nc_vp->v_cache_dd = NULL; } else { - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - numneg--; + cache_negative_remove(ncp); } numcache--; cache_free(ncp); @@ -640,14 +683,7 @@ negative_success: if (!wlocked && !CACHE_UPGRADE_LOCK()) goto wlock; counter_u64_add(numneghits, 1); - /* - * We found a "negative" match, so we shift it to the end of - * the "negative" cache entries queue to satisfy LRU. Also, - * check to see if the entry is a whiteout; indicate this to - * the componentname, if so. - */ - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + cache_negative_hit(ncp); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, @@ -759,15 +795,13 @@ cache_enter_time(struct vnode *dvp, stru TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); } else { - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - numneg--; + cache_negative_remove(ncp); } if (vp != NULL) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); } else { - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - numneg++; + cache_negative_insert(ncp); } ncp->nc_vp = vp; CACHE_WUNLOCK(); @@ -893,17 +927,12 @@ cache_enter_time(struct vnode *dvp, stru } else { if (cnp->cn_flags & ISWHITEOUT) ncp->nc_flag |= NCF_WHITE; - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - numneg++; + cache_negative_insert(ncp); SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, nc_get_name(ncp)); } - if (numneg * ncnegfactor > numcache) { - ncp = TAILQ_FIRST(&ncneg); - KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", - ncp, ncp->nc_vp)); - cache_zap(ncp); - } + if (numneg * ncnegfactor > numcache) + cache_negative_zap_one(); CACHE_WUNLOCK(); } From owner-svn-src-head@freebsd.org Sun Sep 4 08:58: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 DB450BCED41; Sun, 4 Sep 2016 08:58:36 +0000 (UTC) (envelope-from mjg@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 947C3E1F; Sun, 4 Sep 2016 08:58:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u848wZ9g055340; Sun, 4 Sep 2016 08:58:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848wZgt055339; Sun, 4 Sep 2016 08:58:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609040858.u848wZgt055339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 08:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305379 - 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.22 Precedence: list List-Id: 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, 04 Sep 2016 08:58:37 -0000 Author: mjg Date: Sun Sep 4 08:58:35 2016 New Revision: 305379 URL: https://svnweb.freebsd.org/changeset/base/305379 Log: cache: manage negative entry list with a dedicated lock Since negative entries are managed with a LRU list, a hit requires a modificaton. Currently the code tries to upgrade the global lock if needed and is forced to retry the lookup if it fails. Provide a dedicated lock for use when the cache is only shared-locked. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 08:55:15 2016 (r305378) +++ head/sys/kern/vfs_cache.c Sun Sep 4 08:58:35 2016 (r305379) @@ -186,6 +186,9 @@ RW_SYSINIT(vfscache, &cache_lock, "Name #define CACHE_WLOCK() rw_wlock(&cache_lock) #define CACHE_WUNLOCK() rw_wunlock(&cache_lock) +static struct mtx_padalign ncneg_mtx; +MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "Name Cache neg", MTX_DEF); + /* * UMA zones for the VFS cache. * @@ -436,12 +439,21 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n * Negative entries management */ static void -cache_negative_hit(struct namecache *ncp) +cache_negative_hit(struct namecache *ncp, int wlocked) { - rw_assert(&cache_lock, RA_WLOCKED); + if (!wlocked) { + rw_assert(&cache_lock, RA_RLOCKED); + mtx_lock(&ncneg_mtx); + } else { + rw_assert(&cache_lock, RA_WLOCKED); + } + TAILQ_REMOVE(&ncneg, ncp, nc_dst); TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + + if (!wlocked) + mtx_unlock(&ncneg_mtx); } static void @@ -680,16 +692,17 @@ negative_success: return (0); } - if (!wlocked && !CACHE_UPGRADE_LOCK()) - goto wlock; counter_u64_add(numneghits, 1); - cache_negative_hit(ncp); + cache_negative_hit(ncp, wlocked); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, nc_get_name(ncp)); cache_out_ts(ncp, tsp, ticksp); - CACHE_WUNLOCK(); + if (wlocked) + CACHE_WUNLOCK(); + else + CACHE_RUNLOCK(); return (ENOENT); wlock: From owner-svn-src-head@freebsd.org Sun Sep 4 12:01: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 79862A9D8E8; Sun, 4 Sep 2016 12:01:33 +0000 (UTC) (envelope-from bde@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 4CD22937; Sun, 4 Sep 2016 12:01:33 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84C1WmK023928; Sun, 4 Sep 2016 12:01:32 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84C1W0o023927; Sun, 4 Sep 2016 12:01:32 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041201.u84C1W0o023927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 12:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305380 - head/lib/msun/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.23 Precedence: list List-Id: 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, 04 Sep 2016 12:01:33 -0000 Author: bde Date: Sun Sep 4 12:01:32 2016 New Revision: 305380 URL: https://svnweb.freebsd.org/changeset/base/305380 Log: Fix missing fmodl() on arches with 53-bit long doubles. PR: 199422, 211965 MFC after: 1 week Modified: head/lib/msun/src/e_fmod.c Modified: head/lib/msun/src/e_fmod.c ============================================================================== --- head/lib/msun/src/e_fmod.c Sun Sep 4 08:58:35 2016 (r305379) +++ head/lib/msun/src/e_fmod.c Sun Sep 4 12:01:32 2016 (r305380) @@ -20,6 +20,8 @@ __FBSDID("$FreeBSD$"); * Method: shift and subtract */ +#include + #include "math.h" #include "math_private.h" @@ -130,3 +132,7 @@ __ieee754_fmod(double x, double y) } return x; /* exact output */ } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(fmod, fmodl); +#endif From owner-svn-src-head@freebsd.org Sun Sep 4 12:17:59 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 DE6D0A9DCEC; Sun, 4 Sep 2016 12:17:59 +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 A03C1FE8; Sun, 4 Sep 2016 12:17:59 +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 u84CHwmj031660; Sun, 4 Sep 2016 12:17:58 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84CHww3031651; Sun, 4 Sep 2016 12:17:58 GMT (envelope-from des@FreeBSD.org) Message-Id: <201609041217.u84CHww3031651@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: Sun, 4 Sep 2016 12:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305381 - in head: contrib/unbound contrib/unbound/cachedb contrib/unbound/compat contrib/unbound/daemon contrib/unbound/dns64 contrib/unbound/dnstap contrib/unbound/doc contrib/unbound... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 12:18:00 -0000 Author: des Date: Sun Sep 4 12:17:57 2016 New Revision: 305381 URL: https://svnweb.freebsd.org/changeset/base/305381 Log: Upgrade to Unbound 1.5.9. Added: head/contrib/unbound/cachedb/ - copied from r305347, vendor/unbound/dist/cachedb/ head/contrib/unbound/compat/strsep.c - copied unchanged from r305347, vendor/unbound/dist/compat/strsep.c head/contrib/unbound/util/ub_event.c - copied unchanged from r305347, vendor/unbound/dist/util/ub_event.c head/contrib/unbound/util/ub_event.h - copied, changed from r305347, vendor/unbound/dist/util/ub_event.h head/contrib/unbound/util/ub_event_pluggable.c - copied unchanged from r305347, vendor/unbound/dist/util/ub_event_pluggable.c Modified: head/contrib/unbound/Makefile.in head/contrib/unbound/acx_nlnetlabs.m4 head/contrib/unbound/compat/explicit_bzero.c head/contrib/unbound/compat/getentropy_linux.c head/contrib/unbound/config.h head/contrib/unbound/config.h.in head/contrib/unbound/configure head/contrib/unbound/configure.ac head/contrib/unbound/daemon/daemon.c head/contrib/unbound/daemon/daemon.h head/contrib/unbound/daemon/remote.c head/contrib/unbound/daemon/unbound.c head/contrib/unbound/daemon/worker.c head/contrib/unbound/dns64/dns64.c head/contrib/unbound/dnstap/dnstap.c head/contrib/unbound/doc/Changelog head/contrib/unbound/doc/README head/contrib/unbound/doc/example.conf head/contrib/unbound/doc/example.conf.in head/contrib/unbound/doc/libunbound.3 head/contrib/unbound/doc/libunbound.3.in head/contrib/unbound/doc/unbound-anchor.8 head/contrib/unbound/doc/unbound-anchor.8.in head/contrib/unbound/doc/unbound-checkconf.8 head/contrib/unbound/doc/unbound-checkconf.8.in head/contrib/unbound/doc/unbound-control.8 head/contrib/unbound/doc/unbound-control.8.in head/contrib/unbound/doc/unbound-host.1 head/contrib/unbound/doc/unbound-host.1.in head/contrib/unbound/doc/unbound.8 head/contrib/unbound/doc/unbound.8.in head/contrib/unbound/doc/unbound.conf.5 head/contrib/unbound/doc/unbound.conf.5.in head/contrib/unbound/iterator/iter_fwd.c head/contrib/unbound/iterator/iter_utils.c head/contrib/unbound/iterator/iter_utils.h head/contrib/unbound/iterator/iterator.c head/contrib/unbound/iterator/iterator.h head/contrib/unbound/libunbound/context.h head/contrib/unbound/libunbound/libunbound.c head/contrib/unbound/libunbound/libworker.c head/contrib/unbound/libunbound/libworker.h head/contrib/unbound/libunbound/python/libunbound.i head/contrib/unbound/libunbound/ubsyms.def head/contrib/unbound/libunbound/unbound-event.h head/contrib/unbound/libunbound/worker.h head/contrib/unbound/services/cache/dns.c head/contrib/unbound/services/listen_dnsport.c head/contrib/unbound/services/listen_dnsport.h head/contrib/unbound/services/localzone.c head/contrib/unbound/services/localzone.h head/contrib/unbound/services/mesh.c head/contrib/unbound/services/modstack.c head/contrib/unbound/services/outside_network.c head/contrib/unbound/services/outside_network.h head/contrib/unbound/sldns/keyraw.c head/contrib/unbound/sldns/parseutil.c head/contrib/unbound/sldns/rrdef.h head/contrib/unbound/sldns/str2wire.c head/contrib/unbound/sldns/wire2str.c head/contrib/unbound/smallapp/unbound-checkconf.c head/contrib/unbound/smallapp/unbound-control.c head/contrib/unbound/smallapp/worker_cb.c head/contrib/unbound/util/config_file.c head/contrib/unbound/util/config_file.h head/contrib/unbound/util/configlexer.lex head/contrib/unbound/util/configparser.y head/contrib/unbound/util/data/dname.c head/contrib/unbound/util/data/msgencode.c head/contrib/unbound/util/data/msgparse.c head/contrib/unbound/util/data/msgparse.h head/contrib/unbound/util/data/msgreply.c head/contrib/unbound/util/data/msgreply.h head/contrib/unbound/util/fptr_wlist.c head/contrib/unbound/util/fptr_wlist.h head/contrib/unbound/util/iana_ports.inc head/contrib/unbound/util/module.h head/contrib/unbound/util/net_help.c head/contrib/unbound/util/netevent.c head/contrib/unbound/util/netevent.h head/contrib/unbound/util/tube.c head/contrib/unbound/util/tube.h head/contrib/unbound/validator/autotrust.c head/contrib/unbound/validator/val_anchor.c head/contrib/unbound/validator/val_secalgo.c head/contrib/unbound/validator/val_secalgo.h head/lib/libunbound/Makefile head/usr.sbin/unbound/checkconf/Makefile head/usr.sbin/unbound/control/Makefile head/usr.sbin/unbound/daemon/Makefile Directory Properties: head/contrib/unbound/ (props changed) Modified: head/contrib/unbound/Makefile.in ============================================================================== --- head/contrib/unbound/Makefile.in Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/Makefile.in Sun Sep 4 12:17:57 2016 (r305381) @@ -108,11 +108,12 @@ util/fptr_wlist.c util/locks.c util/log. util/netevent.c util/net_help.c util/random.c util/rbtree.c util/regional.c \ util/rtt.c util/storage/dnstree.c util/storage/lookup3.c \ util/storage/lruhash.c util/storage/slabhash.c util/timehist.c util/tube.c \ -util/winsock_event.c validator/autotrust.c validator/val_anchor.c \ -validator/validator.c validator/val_kcache.c validator/val_kentry.c \ -validator/val_neg.c validator/val_nsec3.c validator/val_nsec.c \ -validator/val_secalgo.c validator/val_sigcrypt.c \ -validator/val_utils.c dns64/dns64.c $(CHECKLOCK_SRC) $(DNSTAP_SRC) +util/ub_event.c util/ub_event_pluggable.c util/winsock_event.c \ +validator/autotrust.c validator/val_anchor.c validator/validator.c \ +validator/val_kcache.c validator/val_kentry.c validator/val_neg.c \ +validator/val_nsec3.c validator/val_nsec.c validator/val_secalgo.c \ +validator/val_sigcrypt.c validator/val_utils.c dns64/dns64.c cachedb/cachedb.c $(CHECKLOCK_SRC) \ +$(DNSTAP_SRC) COMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \ as112.lo msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \ iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \ @@ -122,10 +123,11 @@ fptr_wlist.lo locks.lo log.lo mini_event random.lo rbtree.lo regional.lo rtt.lo dnstree.lo lookup3.lo lruhash.lo \ slabhash.lo timehist.lo tube.lo winsock_event.lo autotrust.lo val_anchor.lo \ validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \ -val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo \ +val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo \ $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ) $(DNSTAP_OBJ) -COMMON_OBJ=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ +COMMON_OBJ_WITHOUT_UB_EVENT=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ outside_network.lo +COMMON_OBJ=$(COMMON_OBJ_WITHOUT_UB_EVENT) ub_event.lo # set to $COMMON_OBJ or to "" if --enableallsymbols COMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@ COMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \ @@ -134,7 +136,8 @@ compat/memcmp.c compat/memmove.c compat/ compat/strlcpy.c compat/strptime.c compat/getentropy_linux.c \ compat/getentropy_osx.c compat/getentropy_solaris.c compat/getentropy_win.c \ compat/explicit_bzero.c compat/arc4random.c compat/arc4random_uniform.c \ -compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c +compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c \ +compat/strsep.c COMPAT_OBJ=$(LIBOBJS:.o=.lo) COMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo) COMPAT_OBJ_WITHOUT_CTIMEARC4=$(LIBOBJ_WITHOUT_CTIMEARC4:.o=.lo) @@ -177,7 +180,8 @@ daemon/worker.c daemon/acl_list.c daemon testcode/replay.c testcode/fake_event.c TESTBOUND_OBJ=testbound.lo replay.lo fake_event.lo TESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) testpkts.lo worker.lo acl_list.lo \ -daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(SLDNS_OBJ) $(COMPAT_OBJ) +daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) ub_event.lo $(SLDNS_OBJ) \ +$(COMPAT_OBJ) LOCKVERIFY_SRC=testcode/lock_verify.c LOCKVERIFY_OBJ=lock_verify.lo LOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ @@ -209,8 +213,8 @@ DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_c $(SLDNS_OBJ) LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \ libunbound/libworker.c -LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo -LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ) +LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo ub_event_pluggable.lo +LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ_WITHOUT_UB_EVENT) $(SLDNS_OBJ) $(COMPAT_OBJ) # win apps or "" if not on windows WINAPPS=@WINAPPS@ @@ -552,7 +556,7 @@ uninstall: $(PYTHONMOD_UNINSTALL) $(PYUN @echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand" iana_update: - curl -o port-numbers.tmp http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed + curl -o port-numbers.tmp https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed if file port-numbers.tmp | grep 'gzip' >/dev/null; then zcat port-numbers.tmp; else cat port-numbers.tmp; fi | awk '// {p=0;} /udp/ {p=1;} /[^u]/ {p=0;} /Decomissioned|Decommissioned|Removed|De-registered|unassigned|Unassigned|Reserved/ {u=1;} // { if(u==1) {u=0;} else { if(p==1) { match($$0,/[0-9]+/); print substr($$0, RSTART, RLENGTH) ","}}}' | sort -nu > util/iana_ports.inc rm -f port-numbers.tmp @@ -596,7 +600,6 @@ depend: rm -f $(DEPEND_TMP) $(DEPEND_TMP2) # Dependencies -as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/msgreply.h \ @@ -614,6 +617,7 @@ rrset.lo rrset.o: $(srcdir)/services/cac $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h +as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dname.lo dname.o: $(srcdir)/util/data/dname.c config.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/storage/lookup3.h $(srcdir)/sldns/sbuffer.h @@ -624,9 +628,9 @@ msgencode.lo msgencode.o: $(srcdir)/util $(srcdir)/sldns/sbuffer.h msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c config.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h \ - $(srcdir)/sldns/wire2str.h + $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \ @@ -718,7 +722,7 @@ modstack.lo modstack.o: $(srcdir)/servic $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \ - $(srcdir)/validator/val_utils.h + $(srcdir)/validator/val_utils.h $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \ $(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h @@ -762,7 +766,8 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/ut $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \ $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h + $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h \ + $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ @@ -773,12 +778,12 @@ mini_event.lo mini_event.o: $(srcdir)/ut module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h -netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ +netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/ub_event.h \ + $(srcdir)/util/log.h $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/dnstap/dnstap.h net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -808,7 +813,15 @@ tube.lo tube.o: $(srcdir)/util/tube.c co $(srcdir)/util/netevent.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h + $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/ub_event.h +ub_event.lo ub_event.o: $(srcdir)/util/ub_event.c config.h $(srcdir)/util/ub_event.h $(srcdir)/util/log.h \ + $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h +ub_event_pluggable.lo ub_event_pluggable.o: $(srcdir)/util/ub_event_pluggable.c config.h $(srcdir)/util/ub_event.h \ + $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h $(srcdir)/validator/autotrust.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -822,8 +835,8 @@ autotrust.lo autotrust.o: $(srcdir)/vali val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h $(srcdir)/validator/val_anchor.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h $(srcdir)/util/as112.h + $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/as112.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h validator.lo validator.o: $(srcdir)/validator/validator.c config.h $(srcdir)/validator/validator.h \ $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -880,7 +893,7 @@ val_utils.lo val_utils.o: $(srcdir)/vali $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h + $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h dns64.lo dns64.o: $(srcdir)/dns64/dns64.c config.h $(srcdir)/dns64/dns64.h $(srcdir)/util/module.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ @@ -888,6 +901,14 @@ dns64.lo dns64.o: $(srcdir)/dns64/dns64. $(srcdir)/util/storage/slabhash.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h +cachedb.lo cachedb.o: $(srcdir)/cachedb/cachedb.c config.h $(srcdir)/cachedb/cachedb.h $(srcdir)/util/module.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \ + $(srcdir)/util/data/msgencode.h $(srcdir)/services/cache/dns.h $(srcdir)/validator/val_neg.h \ + $(srcdir)/util/rbtree.h $(srcdir)/validator/val_secalgo.h $(srcdir)/iterator/iter_utils.h \ + $(srcdir)/iterator/iter_resptype.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \ + $(srcdir)/sldns/sbuffer.h checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/testcode/checklocks.h unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ @@ -994,7 +1015,7 @@ unbound.lo unbound.o: $(srcdir)/daemon/u $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/util/ub_event.h worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ @@ -1020,7 +1041,7 @@ testbound.lo testbound.o: $(srcdir)/test $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h @@ -1101,7 +1122,7 @@ unbound-checkconf.lo unbound-checkconf.o $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/localzone.h \ - $(srcdir)/sldns/sbuffer.h + $(srcdir)/sldns/sbuffer.h $(PYTHONMOD_HEADER) worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -1121,9 +1142,10 @@ libunbound.lo libunbound.o: $(srcdir)/li $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/services/localzone.h \ - $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/util/ub_event.h \ + $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/sldns/sbuffer.h libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ @@ -1163,14 +1185,15 @@ pythonmod_utils.lo pythonmod_utils.o: $( $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \ $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h \ + win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \ $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/winsock_event.h + $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/ub_event.h w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h unbound-service-install.lo unbound-service-install.o: $(srcdir)/winrc/unbound-service-install.c config.h \ $(srcdir)/winrc/w_inst.h @@ -1202,6 +1225,7 @@ snprintf.lo snprintf.o: $(srcdir)/compat strlcat.lo strlcat.o: $(srcdir)/compat/strlcat.c config.h strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h strptime.lo strptime.o: $(srcdir)/compat/strptime.c config.h +strsep.lo strsep.o: $(srcdir)/compat/strsep.c config.h getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c config.h getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c config.h getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c config.h Modified: head/contrib/unbound/acx_nlnetlabs.m4 ============================================================================== --- head/contrib/unbound/acx_nlnetlabs.m4 Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/acx_nlnetlabs.m4 Sun Sep 4 12:17:57 2016 (r305381) @@ -2,7 +2,9 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 32 +# Version 34 +# 2016-03-21 Check -ldl -pthread for libcrypto for ldns and openssl 1.1.0. +# 2016-03-21 Use HMAC_Update instead of HMAC_CTX_Init (for openssl-1.1.0). # 2016-01-04 -D_DEFAULT_SOURCE defined with -D_BSD_SOURCE for Linux glibc 2.20 # 2015-12-11 FLTO check for new OSX, clang. # 2015-11-18 spelling check fix. @@ -671,16 +673,16 @@ AC_DEFUN([ACX_SSL_CHECKS], [ ACX_RUNTIME_PATH_ADD([$ssldir/lib]) fi - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + AC_MSG_CHECKING([for HMAC_Update in -lcrypto]) LIBS="$LIBS -lcrypto" LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ], [ AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) ], [ AC_MSG_RESULT(no) # check if -lwsock32 or -lgdi32 are needed. @@ -690,11 +692,11 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) @@ -704,15 +706,30 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -ldl" AC_MSG_CHECKING([if -lcrypto needs -ldl]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl -pthread" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread" + AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread]) + AC_TRY_LINK([], [ + int HMAC_Update(void); + (void)HMAC_Update(); + ],[ + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + ]) ]) ]) ]) Modified: head/contrib/unbound/compat/explicit_bzero.c ============================================================================== --- head/contrib/unbound/compat/explicit_bzero.c Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/compat/explicit_bzero.c Sun Sep 4 12:17:57 2016 (r305381) @@ -6,7 +6,11 @@ #include "config.h" #include +#ifdef HAVE_ATTR_WEAK __attribute__((weak)) void +#else +void +#endif __explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) { } Modified: head/contrib/unbound/compat/getentropy_linux.c ============================================================================== --- head/contrib/unbound/compat/getentropy_linux.c Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/compat/getentropy_linux.c Sun Sep 4 12:17:57 2016 (r305381) @@ -94,7 +94,7 @@ int getentropy(void *buf, size_t len); extern int main(int, char *argv[]); #endif static int gotdata(char *buf, size_t len); -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len); #endif static int getentropy_urandom(void *buf, size_t len); @@ -113,7 +113,7 @@ getentropy(void *buf, size_t len) return -1; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) /* * Try descriptor-less getrandom() */ @@ -209,7 +209,7 @@ gotdata(char *buf, size_t len) return 0; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len) { Copied: head/contrib/unbound/compat/strsep.c (from r305347, vendor/unbound/dist/compat/strsep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/unbound/compat/strsep.c Sun Sep 4 12:17:57 2016 (r305381, copy of r305347, vendor/unbound/dist/compat/strsep.c) @@ -0,0 +1,65 @@ +/** + * strsep implementation for compatibility. + * + * LICENSE + * Copyright (c) 2016, NLnet Labs + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of NLnetLabs nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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. + **/ + +#include "config.h" + +/** see if character is in the delimiter array */ +static int +in_delim(char c, const char* delim) +{ + const char* p; + if(!delim) + return 0; + for(p=delim; *p; p++) { + if(*p == c) + return 1; + } + return 0; +} + +char *strsep(char **stringp, const char *delim) +{ + char* s; + char* orig; + if(stringp == NULL || *stringp == NULL) + return NULL; + orig = *stringp; + s = *stringp; + while(*s && !in_delim(*s, delim)) + s++; + if(*s) { + *s = 0; + *stringp = s+1; + } else { + *stringp = NULL; + } + return orig; +} Modified: head/contrib/unbound/config.h ============================================================================== --- head/contrib/unbound/config.h Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/config.h Sun Sep 4 12:17:57 2016 (r305381) @@ -43,6 +43,9 @@ /* Whether the C compiler accepts the "unused" attribute */ #define HAVE_ATTR_UNUSED 1 +/* Whether the C compiler accepts the "weak" attribute */ +#define HAVE_ATTR_WEAK 1 + /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 @@ -126,6 +129,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_EVENT_H */ +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +/* #undef HAVE_EVP_MD_CTX_NEW */ + /* Define to 1 if you have the `EVP_sha1' function. */ #define HAVE_EVP_SHA1 1 @@ -189,8 +195,8 @@ /* Define to 1 if you have the header file. */ #define HAVE_GRP_H 1 -/* If you have HMAC_CTX_init */ -#define HAVE_HMAC_CTX_INIT 1 +/* If you have HMAC_Update */ +#define HAVE_HMAC_UPDATE 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 @@ -378,6 +384,9 @@ /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 +/* Define to 1 if you have the `strsep' function. */ +#define HAVE_STRSEP 1 + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ /* #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST */ @@ -515,7 +524,7 @@ #define PACKAGE_NAME "unbound" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "unbound 1.5.8" +#define PACKAGE_STRING "unbound 1.5.9" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "unbound" @@ -524,7 +533,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.5.8" +#define PACKAGE_VERSION "1.5.9" /* default pidfile location */ #define PIDFILE "/var/unbound/unbound.pid" @@ -543,7 +552,7 @@ #define ROOT_CERT_FILE "/var/unbound/icannbundle.pem" /* version number for resource files */ -#define RSRC_PACKAGE_VERSION 1,5,8,0 +#define RSRC_PACKAGE_VERSION 1,5,9,0 /* Directory to chdir to */ #define RUN_DIR "/var/unbound" @@ -581,9 +590,15 @@ /* define this to enable debug checks. */ /* #undef UNBOUND_DEBUG */ +/* Define to 1 to use cachedb support */ +/* #undef USE_CACHEDB */ + /* Define to 1 to enable dnstap support */ /* #undef USE_DNSTAP */ +/* Define this to enable DSA support. */ +#define USE_DSA 1 + /* Define this to enable ECDSA support. */ #define USE_ECDSA 1 @@ -980,6 +995,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: head/contrib/unbound/config.h.in ============================================================================== --- head/contrib/unbound/config.h.in Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/config.h.in Sun Sep 4 12:17:57 2016 (r305381) @@ -42,6 +42,9 @@ /* Whether the C compiler accepts the "unused" attribute */ #undef HAVE_ATTR_UNUSED +/* Whether the C compiler accepts the "weak" attribute */ +#undef HAVE_ATTR_WEAK + /* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN @@ -125,6 +128,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_EVENT_H +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +#undef HAVE_EVP_MD_CTX_NEW + /* Define to 1 if you have the `EVP_sha1' function. */ #undef HAVE_EVP_SHA1 @@ -188,8 +194,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT +/* If you have HMAC_Update */ +#undef HAVE_HMAC_UPDATE /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON @@ -377,6 +383,9 @@ /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST @@ -580,9 +589,15 @@ /* define this to enable debug checks. */ #undef UNBOUND_DEBUG +/* Define to 1 to use cachedb support */ +#undef USE_CACHEDB + /* Define to 1 to enable dnstap support */ #undef USE_DNSTAP +/* Define this to enable DSA support. */ +#undef USE_DSA + /* Define this to enable ECDSA support. */ #undef USE_ECDSA @@ -979,6 +994,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: head/contrib/unbound/configure ============================================================================== --- head/contrib/unbound/configure Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/configure Sun Sep 4 12:17:57 2016 (r305381) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unbound 1.5.8. +# Generated by GNU Autoconf 2.69 for unbound 1.5.9. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unbound' PACKAGE_TARNAME='unbound' -PACKAGE_VERSION='1.5.8' -PACKAGE_STRING='unbound 1.5.8' +PACKAGE_VERSION='1.5.9' +PACKAGE_STRING='unbound 1.5.9' PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl' PACKAGE_URL='' @@ -832,6 +832,7 @@ with_ssl enable_sha2 enable_gost enable_ecdsa +enable_dsa enable_event_api with_libevent with_libexpat @@ -842,6 +843,7 @@ enable_dnstap with_dnstap_socket_path with_protobuf_c with_libfstrm +enable_cachedb with_libunbound_only ' ac_precious_vars='build_alias @@ -1397,7 +1399,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unbound 1.5.8 to adapt to many kinds of systems. +\`configure' configures unbound 1.5.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1462,7 +1464,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unbound 1.5.8:";; + short | recursive ) echo "Configuration of unbound 1.5.9:";; esac cat <<\_ACEOF @@ -1495,8 +1497,9 @@ Optional Features: --disable-sha2 Disable SHA256 and SHA512 RRSIG support --disable-gost Disable GOST support --disable-ecdsa Disable ECDSA support - --enable-event-api Enable (experimental) libevent-based libunbound API - installed to unbound-event.h + --disable-dsa Disable DSA support + --enable-event-api Enable (experimental) pluggable event base + libunbound API installed to unbound-event.h --enable-static-exe enable to compile executables statically against (event) libs, for debug purposes --enable-lock-checks enable to check lock and unlock calls, for debug @@ -1505,6 +1508,8 @@ Optional Features: to it, smaller install size but libunbound export table is polluted by internal symbols --enable-dnstap Enable dnstap support (requires fstrm, protobuf-c) + --enable-cachedb enable cachedb module that can use external cache + storage Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1647,7 +1652,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unbound configure 1.5.8 +unbound configure 1.5.9 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2356,7 +2361,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unbound $as_me 1.5.8, which was +It was created by unbound $as_me 1.5.9, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2708,11 +2713,11 @@ UNBOUND_VERSION_MAJOR=1 UNBOUND_VERSION_MINOR=5 -UNBOUND_VERSION_MICRO=8 +UNBOUND_VERSION_MICRO=9 LIBUNBOUND_CURRENT=6 -LIBUNBOUND_REVISION=0 +LIBUNBOUND_REVISION=1 LIBUNBOUND_AGE=4 # 1.0.0 had 0:12:0 # 1.0.1 had 0:13:0 @@ -2760,6 +2765,7 @@ LIBUNBOUND_AGE=4 # 1.5.6 had 5:9:3 # 1.5.7 had 5:10:3 # 1.5.8 had 6:0:4 # adds ub_ctx_set_stub +# 1.5.9 had 6:1:4 # Current -- the number of the binary API that we're implementing # Revision -- which iteration of the implementation of the binary @@ -6117,6 +6123,48 @@ $as_echo "#define HAVE_ATTR_UNUSED 1" >> fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"weak\" attribute" >&5 +$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"weak\" attribute... " >&6; } +if ${ac_cv_c_weak_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_weak_attribute=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +__attribute__((weak)) void f(int x) { printf("%d", x); } + +int +main () +{ + + f(1); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_weak_attribute="yes" +else + ac_cv_c_weak_attribute="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_weak_attribute" >&5 +$as_echo "$ac_cv_c_weak_attribute" >&6; } +if test $ac_cv_c_weak_attribute = yes; then + +$as_echo "#define HAVE_ATTR_WEAK 1" >>confdefs.h + +fi + + if test "$srcdir" != "."; then CPPFLAGS="$CPPFLAGS -I$srcdir" fi @@ -17064,8 +17112,8 @@ $as_echo "found in $ssldir" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Update in -lcrypto" >&5 +$as_echo_n "checking for HMAC_Update in -lcrypto... " >&6; } LIBS="$LIBS -lcrypto" LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17075,8 +17123,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17087,7 +17135,7 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h else @@ -17108,8 +17156,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17118,7 +17166,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -17140,8 +17188,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17150,7 +17198,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -17159,7 +17207,43 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl -pthread" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5 +$as_echo_n "checking if -lcrypto needs -ldl -pthread... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_Update(void); + (void)HMAC_Update(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ @@ -17404,7 +17488,7 @@ fi done -for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode +for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17771,15 +17855,46 @@ _ACEOF ;; esac +# Check whether --enable-dsa was given. +if test "${enable_dsa+set}" = set; then : + enableval=$enable_dsa; +fi + +use_dsa="no" +case "$enable_ecdsa" in + no) + ;; + *) + # detect if DSA is supported, and turn it off if not. + ac_fn_c_check_func "$LINENO" "EVP_dss1" "ac_cv_func_EVP_dss1" +if test "x$ac_cv_func_EVP_dss1" = xyes; then : + + +cat >>confdefs.h <<_ACEOF +#define USE_DSA 1 +_ACEOF + + +else + if test "x$enable_dsa" = "xyes"; then as_fn_error $? "OpenSSL does not support DSA and you used --enable-dsa." "$LINENO" 5 + fi +fi + + ;; +esac + + # Check whether --enable-event-api was given. if test "${enable_event_api+set}" = set; then : enableval=$enable_event_api; fi -use_unbound_event="no" case "$enable_event_api" in yes) - use_unbound_event="yes" + UNBOUND_EVENT_INSTALL=unbound-event-install + + UNBOUND_EVENT_UNINSTALL=unbound-event-uninstall + ;; *) ;; @@ -18126,12 +18241,6 @@ done if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi - if test "$use_unbound_event" = "yes"; then - UNBOUND_EVENT_INSTALL=unbound-event-install - - UNBOUND_EVENT_UNINSTALL=unbound-event-uninstall - - fi else $as_echo "#define USE_MINI_EVENT 1" >>confdefs.h @@ -19237,6 +19346,20 @@ esac fi +ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" +if test "x$ac_cv_func_strsep" = xyes; then : + $as_echo "#define HAVE_STRSEP 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" strsep.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strsep.$ac_objext" + ;; +esac + +fi + + # Check whether --enable-allsymbols was given. if test "${enable_allsymbols+set}" = set; then : @@ -19520,6 +19643,23 @@ _ACEOF fi *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Sep 4 12:22: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 E4822A9D05F; Sun, 4 Sep 2016 12:22:15 +0000 (UTC) (envelope-from bde@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 A853169D; Sun, 4 Sep 2016 12:22:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84CMEsH033142; Sun, 4 Sep 2016 12:22:14 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84CMEdM033135; Sun, 4 Sep 2016 12:22:14 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041222.u84CMEdM033135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 12:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305382 - in head/lib/msun: amd64 i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 12:22:16 -0000 Author: bde Date: Sun Sep 4 12:22:14 2016 New Revision: 305382 URL: https://svnweb.freebsd.org/changeset/base/305382 Log: Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm versions of fmodf() amd fmodl() on i387. fmod is similar to remainder, and the C versions are 3 to 9 times slower than the asm versions on x86 for both, but we had the strange mixture of all 6 variants of remainder in asm and only 1 of 6 variants of fmod in asm. Added: head/lib/msun/amd64/e_fmod.S (contents, props changed) head/lib/msun/amd64/e_fmodf.S (contents, props changed) head/lib/msun/amd64/e_fmodl.S (contents, props changed) head/lib/msun/i387/e_fmodf.S (contents, props changed) head/lib/msun/i387/e_fmodl.S (contents, props changed) Modified: head/lib/msun/amd64/Makefile.inc head/lib/msun/i387/Makefile.inc Modified: head/lib/msun/amd64/Makefile.inc ============================================================================== --- head/lib/msun/amd64/Makefile.inc Sun Sep 4 12:17:57 2016 (r305381) +++ head/lib/msun/amd64/Makefile.inc Sun Sep 4 12:22:14 2016 (r305382) @@ -1,6 +1,7 @@ # $FreeBSD$ -ARCH_SRCS = e_remainder.S e_remainderf.S e_remainderl.S \ +ARCH_SRCS = e_fmod.S e_fmodf.S e_fmodl.S \ + e_remainder.S e_remainderf.S e_remainderl.S \ e_sqrt.S e_sqrtf.S e_sqrtl.S \ s_llrint.S s_llrintf.S s_llrintl.S \ s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \ Added: head/lib/msun/amd64/e_fmod.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. 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. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmod) + movsd %xmm0,-8(%rsp) + movsd %xmm1,-16(%rsp) + fldl -16(%rsp) + fldl -8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 + fstp %st + ret +END(fmod) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/amd64/e_fmodf.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmodf.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,24 @@ +/* + * Based on the i387 version written by J.T. Conklin . + * Public domain. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodf) + movss %xmm0,-4(%rsp) + movss %xmm1,-8(%rsp) + flds -8(%rsp) + flds -4(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstps -4(%rsp) + movss -4(%rsp),%xmm0 + fstp %st + ret +END(fmodf) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/amd64/e_fmodl.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmodl.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. 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. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodl) + fldt 24(%rsp) + fldt 8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstp %st(1) + ret +END(fmodl) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/Makefile.inc ============================================================================== --- head/lib/msun/i387/Makefile.inc Sun Sep 4 12:17:57 2016 (r305381) +++ head/lib/msun/i387/Makefile.inc Sun Sep 4 12:22:14 2016 (r305382) @@ -7,13 +7,14 @@ ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_l s_trunc.S # float counterparts -ARCH_SRCS+= e_log10f.S e_logf.S e_remainderf.S \ +ARCH_SRCS+= e_fmodf.S e_log10f.S e_logf.S e_remainderf.S \ e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S \ s_llrintf.S s_logbf.S s_lrintf.S \ s_remquof.S s_rintf.S s_scalbnf.S s_significandf.S s_truncf.S # long double counterparts -ARCH_SRCS+= e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \ +ARCH_SRCS+= e_fmodl.S \ + e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \ s_floorl.S s_llrintl.S \ s_logbl.S s_lrintl.S s_remquol.S s_rintl.S s_scalbnl.S s_truncl.S Added: head/lib/msun/i387/e_fmodf.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/i387/e_fmodf.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,24 @@ +/* + * Based on the i387 version written by J.T. Conklin . + * Public domain. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodf) + movss %xmm0,-4(%rsp) + movss %xmm1,-8(%rsp) + flds -8(%rsp) + flds -4(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstps -4(%rsp) + movss -4(%rsp),%xmm0 + fstp %st + ret +END(fmodf) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/i387/e_fmodl.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/i387/e_fmodl.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. 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. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodl) + fldt 24(%rsp) + fldt 8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstp %st(1) + ret +END(fmodl) + + .section .note.GNU-stack,"",%progbits From owner-svn-src-head@freebsd.org Sun Sep 4 13:31:59 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 32DA6A9D271; Sun, 4 Sep 2016 13:31:59 +0000 (UTC) (envelope-from mjg@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 00C74918; Sun, 4 Sep 2016 13:31:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84DVwBd061145; Sun, 4 Sep 2016 13:31:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84DVwIX061144; Sun, 4 Sep 2016 13:31:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609041331.u84DVwIX061144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 13:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305383 - 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.23 Precedence: list List-Id: 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, 04 Sep 2016 13:31:59 -0000 Author: mjg Date: Sun Sep 4 13:31:57 2016 New Revision: 305383 URL: https://svnweb.freebsd.org/changeset/base/305383 Log: fd: fix up fdeget_file It was supposed to return NULL if a fp is not installed. Facepalm-by: mjg Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd static __inline struct filedescent * fdeget_locked(struct filedesc *fdp, int fd) { + struct filedescent *fde; FILEDESC_LOCK_ASSERT(fdp); if (fd < 0 || fd > fdp->fd_lastfile) return (NULL); - return (&fdp->fd_ofiles[fd]); + fde = &fdp->fd_ofiles[fd]; + if (fde->fde_file == NULL) + return (NULL); + + return (fde); } static __inline bool From owner-svn-src-head@freebsd.org Sun Sep 4 14:12:20 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 BDB1DA9D9FC; Sun, 4 Sep 2016 14:12:20 +0000 (UTC) (envelope-from bde@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 8DF37AC8; Sun, 4 Sep 2016 14:12:20 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84ECJtD074227; Sun, 4 Sep 2016 14:12:19 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84ECJo7074226; Sun, 4 Sep 2016 14:12:19 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041412.u84ECJo7074226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 14:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305384 - head/lib/msun/i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 14:12:20 -0000 Author: bde Date: Sun Sep 4 14:12:19 2016 New Revision: 305384 URL: https://svnweb.freebsd.org/changeset/base/305384 Log: Disconnect the "optimized" asm variants of cos(), sin() and tan() from the build on i386. Leave them in the source tree for regression tests. The asm functions were always much less accurate (by a factor of more than 10**18 in the worst case). They were faster on old CPUs. But with each new generation of CPUs they get relatively slower. The double precision C version's average advantage is about a factor of 2 on Haswell. The asm functions were already intentionally avoided in float and long double precision on i386 and in all precisions on amd64. Float precision and amd64 give larger advantages to the C version. The long double precision C code and compilers' understanding of long double precision are not so good, so the i387 is still slightly faster for long double precision, except for the unimportant subcase of huge args where the sub-optimal C code now somehow beats the i387 by about a factor of 2. Modified: head/lib/msun/i387/Makefile.inc Modified: head/lib/msun/i387/Makefile.inc ============================================================================== --- head/lib/msun/i387/Makefile.inc Sun Sep 4 13:31:57 2016 (r305383) +++ head/lib/msun/i387/Makefile.inc Sun Sep 4 14:12:19 2016 (r305384) @@ -2,8 +2,8 @@ ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \ e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \ - s_cos.S s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \ - s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S \ + s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \ + s_remquo.S s_rint.S s_scalbn.S s_significand.S \ s_trunc.S # float counterparts From owner-svn-src-head@freebsd.org Sun Sep 4 14:49: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 772ABA9D4EA; Sun, 4 Sep 2016 14:49:07 +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 07E08F56; Sun, 4 Sep 2016 14:49:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u84Emxw9065173 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 4 Sep 2016 17:48:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u84Emxw9065173 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u84Emxjo065172; Sun, 4 Sep 2016 17:48:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 4 Sep 2016 17:48:59 +0300 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305382 - in head/lib/msun: amd64 i387 Message-ID: <20160904144859.GC83214@kib.kiev.ua> References: <201609041222.u84CMEdM033135@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201609041222.u84CMEdM033135@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) 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.23 Precedence: list List-Id: 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, 04 Sep 2016 14:49:07 -0000 On Sun, Sep 04, 2016 at 12:22:14PM +0000, Bruce Evans wrote: > Author: bde > Date: Sun Sep 4 12:22:14 2016 > New Revision: 305382 > URL: https://svnweb.freebsd.org/changeset/base/305382 > > Log: > Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm > versions of fmodf() amd fmodl() on i387. > > fmod is similar to remainder, and the C versions are 3 to 9 times > slower than the asm versions on x86 for both, but we had the strange > mixture of all 6 variants of remainder in asm and only 1 of 6 > variants of fmod in asm. > > Added: > head/lib/msun/amd64/e_fmod.S (contents, props changed) > head/lib/msun/amd64/e_fmodf.S (contents, props changed) > head/lib/msun/amd64/e_fmodl.S (contents, props changed) > head/lib/msun/i387/e_fmodf.S (contents, props changed) It seems that wrong version of i387/f_fmodf.S, it is identical to the amd64 version. > Added: head/lib/msun/amd64/e_fmod.S > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) > +ENTRY(fmod) > + movsd %xmm0,-8(%rsp) > + movsd %xmm1,-16(%rsp) > + fldl -16(%rsp) > + fldl -8(%rsp) > +1: fprem > + fstsw %ax > + testw $0x400,%ax > + jne 1b > + fstpl -8(%rsp) > + movsd -8(%rsp),%xmm0 > + fstp %st > + ret > +END(fmod) I see that this is not a new approach in the amd64 subdirectory, to use x87 FPU on amd64. Please note that it might have non-obvious effects on the performance, in particular, on the speed of the context switches and handling of #NM exception. Newer Intel and possibly AMD CPUs have an optimization which allows coprocessor code to save and restore state to not save and restore state which was not changed. In other words, for typical amd64 binary which uses %xmm register file but did not touched %st nor %ymm, only %xmm bits are spilled and then loaded. Touching %st defeats the optimization, possible for the whole lifetime of the thread. This feature (XSAVEOPT) is available at least starting from Haswell microarchitecture, not sure about IvyBridge. From owner-svn-src-head@freebsd.org Sun Sep 4 15:08: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 3E371A9D9BE; Sun, 4 Sep 2016 15:08:16 +0000 (UTC) (envelope-from bde@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 0EB51BAF; Sun, 4 Sep 2016 15:08:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84F8F6x096083; Sun, 4 Sep 2016 15:08:15 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84F8F5k096081; Sun, 4 Sep 2016 15:08:15 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041508.u84F8F5k096081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 15:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305385 - head/lib/msun/i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 15:08:16 -0000 Author: bde Date: Sun Sep 4 15:08:14 2016 New Revision: 305385 URL: https://svnweb.freebsd.org/changeset/base/305385 Log: Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was actually the amd64 version. Modified: head/lib/msun/i387/e_fmodf.S head/lib/msun/i387/e_fmodl.S Modified: head/lib/msun/i387/e_fmodf.S ============================================================================== --- head/lib/msun/i387/e_fmodf.S Sun Sep 4 14:12:19 2016 (r305384) +++ head/lib/msun/i387/e_fmodf.S Sun Sep 4 15:08:14 2016 (r305385) @@ -1,5 +1,5 @@ /* - * Based on the i387 version written by J.T. Conklin . + * Written by J.T. Conklin . * Public domain. */ @@ -7,17 +7,13 @@ __FBSDID("$FreeBSD$") ENTRY(fmodf) - movss %xmm0,-4(%rsp) - movss %xmm1,-8(%rsp) - flds -8(%rsp) - flds -4(%rsp) + flds 8(%esp) + flds 4(%esp) 1: fprem fstsw %ax - testw $0x400,%ax - jne 1b - fstps -4(%rsp) - movss -4(%rsp),%xmm0 - fstp %st + sahf + jp 1b + fstp %st(1) ret END(fmodf) Modified: head/lib/msun/i387/e_fmodl.S ============================================================================== --- head/lib/msun/i387/e_fmodl.S Sun Sep 4 14:12:19 2016 (r305384) +++ head/lib/msun/i387/e_fmodl.S Sun Sep 4 15:08:14 2016 (r305385) @@ -29,7 +29,7 @@ */ /* - * Based on the i387 version written by: + * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ @@ -37,12 +37,12 @@ __FBSDID("$FreeBSD$") ENTRY(fmodl) - fldt 24(%rsp) - fldt 8(%rsp) + fldt 16(%esp) + fldt 4(%esp) 1: fprem fstsw %ax - testw $0x400,%ax - jne 1b + sahf + jp 1b fstp %st(1) ret END(fmodl) From owner-svn-src-head@freebsd.org Sun Sep 4 15:56: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 F21B8A9D7CD; Sun, 4 Sep 2016 15:56:52 +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 88538391; Sun, 4 Sep 2016 15:56:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id C727DD485B9; Mon, 5 Sep 2016 01:56:48 +1000 (AEST) Date: Mon, 5 Sep 2016 01:56:48 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r305382 - in head/lib/msun: amd64 i387 In-Reply-To: <20160904144859.GC83214@kib.kiev.ua> Message-ID: <20160905012859.L6221@besplex.bde.org> References: <201609041222.u84CMEdM033135@repo.freebsd.org> <20160904144859.GC83214@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=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=djm5zUDtHYgCdv4C8OwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 15:56:53 -0000 On Sun, 4 Sep 2016, Konstantin Belousov wrote: > On Sun, Sep 04, 2016 at 12:22:14PM +0000, Bruce Evans wrote: > ... >> Log: >> Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm >> versions of fmodf() amd fmodl() on i387. >> ... > It seems that wrong version of i387/f_fmodf.S, it is identical to the > amd64 version. Indeed. Fixed. >> Added: head/lib/msun/amd64/e_fmod.S >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) >> +ENTRY(fmod) >> + movsd %xmm0,-8(%rsp) >> + movsd %xmm1,-16(%rsp) >> + fldl -16(%rsp) >> + fldl -8(%rsp) >> +1: fprem >> + fstsw %ax >> + testw $0x400,%ax >> + jne 1b >> + fstpl -8(%rsp) >> + movsd -8(%rsp),%xmm0 >> + fstp %st >> + ret >> +END(fmod) > > I see that this is not a new approach in the amd64 subdirectory, to use > x87 FPU on amd64. Please note that it might have non-obvious effects on > the performance, in particular, on the speed of the context switches and > handling of #NM exception. For long double functions, the i387 gets used anyway. This function is very slow even with the i387. It takes about 500 cycles per call on args uniformly distributed in double precision space, but this distribution is very non-average since it gives many huge args. The loop iterates many times on huge args. This is still better the the C code which takes 3 or more times longer or > 1500 cycles. It does a loop on the bits using integer code. The C code is relatively even slower when there are fewer bits (something like 9 times slower for args uniformly distributed in float precision space). > Newer Intel and possibly AMD CPUs have an optimization which allows > coprocessor code to save and restore state to not save and restore state > which was not changed. In other words, for typical amd64 binary which > uses %xmm register file but did not touched %st nor %ymm, only %xmm > bits are spilled and then loaded. Touching %st defeats the optimization, > possible for the whole lifetime of the thread. > > This feature (XSAVEOPT) is available at least starting from Haswell > microarchitecture, not sure about IvyBridge. Isn't the i386 space too small to matter much? There should be the same number of NM#'s and just 100 bytes extra to save. Avoiding use of larger register sets by using only the i387 might save more :-). The other amd64 asm uses of the i387 for floats and doubles are: - 3 files for remainder and 3 files for remquo. Needed for the same reason as for fmod - s_scalbn.S, s_scalbnf.S. To use i387 fscale. Probably a mistake. The functions themselves are too slow to be very useful too. libm almost never uses them internally, and in optimized functions like exp* the exponent scaling is done inline using special integer code. I have spent many hours fighting the compiler to stop it pessimizing the memory accesses to give pipeline stalls for this integer code. Using fscale probably tends to give another type of pipeline stall. I plan to remove many more i387 uses on i386, but there aren't many more on amd64. Bruce From owner-svn-src-head@freebsd.org Sun Sep 4 16:00:45 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 B7A0BA9D9C4; Sun, 4 Sep 2016 16:00:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F3628BF; Sun, 4 Sep 2016 16:00:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id e124so114064276ith.0; Sun, 04 Sep 2016 09:00:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=wfhgXsTgz7fcU5FK2rbTaBXPEtaGMJgdaRHhH6ye0FY=; b=M54OdEzOMzee2bB2zZQtfuvrgu1Kv3GXwKJi29DqD5g9vWtz+nhSCaXKI19OIPAyHe XVb1VNEQcMepr8pZ/W+l08CN6xOYscjRYWDm2f3+vKdzb6nAnbbCq3ZwgnLNnuTZSneO oL4uItSG6HVP9riRAtkX9aywCusPpkclJZ+J9fe8kj4NFieO8HDoXz+5kseaf3hmsT13 2Ml0Z5nQryfjoI2KeIiAoQmXGcuACY5cXxfq2C9Gm+jZYInPryir4N+tgV6eUZXztsE6 myo10M4Bm042JqRWhH+AqexRF4MVx2ezTOAWS9kaTaTtG38p9CJv26X5L8Rm4OVdC6HD r65w== X-Gm-Message-State: AE9vXwPDTsoIxzfgfiwOc4yY/Ov/jyQu/w4ugFn4+FvhCqAh2o0QYC9EwwftrkJyPaMhaQ== X-Received: by 10.36.196.133 with SMTP id v127mr17066686itf.84.1473004839534; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com. [209.85.214.42]) by smtp.gmail.com with ESMTPSA id v124sm7505824ita.22.2016.09.04.09.00.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 09:00:39 -0700 (PDT) Received: by mail-it0-f42.google.com with SMTP id e124so113274933ith.0; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) X-Received: by 10.36.227.73 with SMTP id d70mr16394560ith.97.1473004839057; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 09:00:38 -0700 (PDT) In-Reply-To: <201609041331.u84DVwIX061144@repo.freebsd.org> References: <201609041331.u84DVwIX061144@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 09:00:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305383 - head/sys/sys To: Mateusz Guzik Cc: 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.23 Precedence: list List-Id: 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, 04 Sep 2016 16:00:45 -0000 Do you know which revision this was introduced (i.e. what revision range should be avoided)? The most relevant commit seems to be r305093 but I'm not sure how that would have broken this (nothing in that diff was checking fde_file before). Best, Conrad On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik wrote: > Author: mjg > Date: Sun Sep 4 13:31:57 2016 > New Revision: 305383 > URL: https://svnweb.freebsd.org/changeset/base/305383 > > Log: > fd: fix up fdeget_file > > It was supposed to return NULL if a fp is not installed. > > Facepalm-by: mjg > > Modified: > head/sys/sys/filedesc.h > > Modified: head/sys/sys/filedesc.h > ============================================================================== > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > static __inline struct filedescent * > fdeget_locked(struct filedesc *fdp, int fd) > { > + struct filedescent *fde; > > FILEDESC_LOCK_ASSERT(fdp); > > if (fd < 0 || fd > fdp->fd_lastfile) > return (NULL); > > - return (&fdp->fd_ofiles[fd]); > + fde = &fdp->fd_ofiles[fd]; > + if (fde->fde_file == NULL) > + return (NULL); > + > + return (fde); > } > > static __inline bool > From owner-svn-src-head@freebsd.org Sun Sep 4 16:05: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 70936A9DAAF; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) 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 0085FC5D; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id 1so101051045wmz.1; Sun, 04 Sep 2016 09:05:52 -0700 (PDT) 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-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=sQQ9yoaSo/kDXt/o9FNp41+/tedCG0kT48ibDzxRJxIuuL7IGO1hPl5JPjMwD+TOzG YpaLarV0ogs4MPi217OgxN8+M5wfY89mgqJvSSfWp7H4ypaTeYa4OB55d4f+2IWtcIk/ 0D3seIXvFE8JKI3NfyTpZp5MBy3qJPznRMIYQO+aWdJ10Qvjkvihoi0UmkfGEwjhzV+4 sTVs19SWneBVMQJzAhd4mo08zwnpeymsOnBXu0k73J8b4Aq+Uw+7BK3zJwmOCoh8yOAM lTxeilvXOQ+w1bQjauNgWaITsdt+GaVAMJQWF2M+FHW2w69AX4tR6S/WIAbMKmnUfHTJ NHhg== 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-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=eSkfmvDAiFpxfCdXckOko2HHdmIwEcLvKcZzc6qOYaX5xZzqU858LqTWeQht3PkslS ZyUtFlQretfFr+u5BEtA+CdRu3dRYQ7T4LOJGxUI5ng00kxdjhaT8hvfXCCmi2FpCHrV n5GE/C5aM5tvtO7rijc+O6ugA9rhh4iXhH1TsaVH36CgMOkYUAIcmI7LwO8l9vxV5TzX bS1BJk1oRsUMcGyzZWouTwdKKVdkgg+bRAGQXxk7OUP2CGFo/AfjyWyWxYEtu7pCh75w 6R+r1HasiR/oWOzY1/uGZCVYD8Lfix8jBkCbyqmSbRcXgYTMN7rNuWoMoCZMmdpcx4yR eDdA== X-Gm-Message-State: AE9vXwOiLvNsW7dWj0k1dPCpSgH2rSvjyVVZF2RvV9bRg66jgb7bAud2VFpm9oAp47YIUQ== X-Received: by 10.194.112.233 with SMTP id it9mr4358546wjb.176.1473005150958; Sun, 04 Sep 2016 09:05:50 -0700 (PDT) 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 u7sm13949263wmf.8.2016.09.04.09.05.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 04 Sep 2016 09:05:50 -0700 (PDT) Date: Sun, 4 Sep 2016 18:05:48 +0200 From: Mateusz Guzik To: Conrad Meyer Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305383 - head/sys/sys Message-ID: <20160904160547.GD25473@dft-labs.eu> References: <201609041331.u84DVwIX061144@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 16:05:53 -0000 On Sun, Sep 04, 2016 at 09:00:38AM -0700, Conrad Meyer wrote: > Do you know which revision this was introduced (i.e. what revision > range should be avoided)? The most relevant commit seems to be > r305093 but I'm not sure how that would have broken this (nothing in > that diff was checking fde_file before). > The problem was present since r305093 to this very commit. The problem affects weird programs which do F_GETFD to see if they got given fd installed, like bash. Prior to r305093 they would get EBADF. But due to incorrect test in fdeget_locked, they would get 0 instead. > Best, > Conrad > > On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik wrote: > > Author: mjg > > Date: Sun Sep 4 13:31:57 2016 > > New Revision: 305383 > > URL: https://svnweb.freebsd.org/changeset/base/305383 > > > > Log: > > fd: fix up fdeget_file > > > > It was supposed to return NULL if a fp is not installed. > > > > Facepalm-by: mjg > > > > Modified: > > head/sys/sys/filedesc.h > > > > Modified: head/sys/sys/filedesc.h > > ============================================================================== > > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > > static __inline struct filedescent * > > fdeget_locked(struct filedesc *fdp, int fd) > > { > > + struct filedescent *fde; > > > > FILEDESC_LOCK_ASSERT(fdp); > > > > if (fd < 0 || fd > fdp->fd_lastfile) > > return (NULL); > > > > - return (&fdp->fd_ofiles[fd]); > > + fde = &fdp->fd_ofiles[fd]; > > + if (fde->fde_file == NULL) > > + return (NULL); > > + > > + return (fde); > > } > > > > static __inline bool > > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sun Sep 4 16:52: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 538EDA9D925; Sun, 4 Sep 2016 16:52:15 +0000 (UTC) (envelope-from mjg@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 2C77A8AA; Sun, 4 Sep 2016 16:52:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84GqErY037276; Sun, 4 Sep 2016 16:52:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84GqE5s037275; Sun, 4 Sep 2016 16:52:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609041652.u84GqE5s037275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 16:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305386 - 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.23 Precedence: list List-Id: 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, 04 Sep 2016 16:52:15 -0000 Author: mjg Date: Sun Sep 4 16:52:14 2016 New Revision: 305386 URL: https://svnweb.freebsd.org/changeset/base/305386 Log: cache: defer freeing entries until after the global lock is dropped This also defers vdrop for held vnodes. Glanced at by: kib Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 15:08:14 2016 (r305385) +++ head/sys/kern/vfs_cache.c Sun Sep 4 16:52:14 2016 (r305386) @@ -131,6 +131,7 @@ struct namecache_ts { #define NCF_ISDOTDOT 0x02 #define NCF_TS 0x04 #define NCF_DTS 0x08 +#define NCF_DVDROP 0x10 /* * Name caching works as follows: @@ -227,6 +228,8 @@ cache_free(struct namecache *ncp) if (ncp == NULL) return; ts = ncp->nc_flag & NCF_TS; + if ((ncp->nc_flag & NCF_DVDROP) != 0) + vdrop(ncp->nc_dvp); if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { if (ts) uma_zfree(cache_zone_small_ts, ncp); @@ -476,7 +479,7 @@ cache_negative_remove(struct namecache * numneg--; } -static void +static struct namecache * cache_negative_zap_one(void) { struct namecache *ncp; @@ -486,6 +489,7 @@ cache_negative_zap_one(void) KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", ncp, ncp->nc_vp)); cache_zap(ncp); + return (ncp); } /* @@ -497,7 +501,6 @@ cache_negative_zap_one(void) static void cache_zap(struct namecache *ncp) { - struct vnode *vp; rw_assert(&cache_lock, RA_WLOCKED); CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); @@ -508,7 +511,6 @@ cache_zap(struct namecache *ncp) SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, nc_get_name(ncp)); } - vp = NULL; LIST_REMOVE(ncp, nc_hash); if (ncp->nc_flag & NCF_ISDOTDOT) { if (ncp == ncp->nc_dvp->v_cache_dd) @@ -516,7 +518,7 @@ cache_zap(struct namecache *ncp) } else { LIST_REMOVE(ncp, nc_src); if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { - vp = ncp->nc_dvp; + ncp->nc_flag |= NCF_DVDROP; numcachehv--; } } @@ -528,9 +530,6 @@ cache_zap(struct namecache *ncp) cache_negative_remove(ncp); } numcache--; - cache_free(ncp); - if (vp != NULL) - vdrop(vp); } /* @@ -611,10 +610,14 @@ retry_wlocked: if ((cnp->cn_flags & MAKEENTRY) == 0) { if (!wlocked && !CACHE_UPGRADE_LOCK()) goto wlock; - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) - cache_zap(dvp->v_cache_dd); + ncp = NULL; + if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) { + ncp = dvp->v_cache_dd; + cache_zap(ncp); + } dvp->v_cache_dd = NULL; CACHE_WUNLOCK(); + cache_free(ncp); return (0); } ncp = dvp->v_cache_dd; @@ -666,6 +669,7 @@ retry_wlocked: goto wlock; cache_zap(ncp); CACHE_WUNLOCK(); + cache_free(ncp); return (0); } @@ -689,6 +693,7 @@ negative_success: goto wlock; cache_zap(ncp); CACHE_WUNLOCK(); + cache_free(ncp); return (0); } @@ -767,7 +772,7 @@ void cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct timespec *tsp, struct timespec *dtsp) { - struct namecache *ncp, *n2; + struct namecache *ncp, *n2, *ndd, *nneg; struct namecache_ts *n3; struct nchashhead *ncpp; uint32_t hash; @@ -789,6 +794,7 @@ cache_enter_time(struct vnode *dvp, stru if (numcache >= desiredvnodes * ncsizefactor) return; + ndd = nneg = NULL; flag = 0; if (cnp->cn_nameptr[0] == '.') { if (cnp->cn_namelen == 1) @@ -905,9 +911,12 @@ cache_enter_time(struct vnode *dvp, stru * directory name in it and the name ".." for the * directory's parent. */ - if ((n2 = vp->v_cache_dd) != NULL && - (n2->nc_flag & NCF_ISDOTDOT) != 0) - cache_zap(n2); + if ((ndd = vp->v_cache_dd) != NULL) { + if ((ndd->nc_flag & NCF_ISDOTDOT) != 0) + cache_zap(ndd); + else + ndd = NULL; + } vp->v_cache_dd = ncp; } } else { @@ -945,8 +954,10 @@ cache_enter_time(struct vnode *dvp, stru nc_get_name(ncp)); } if (numneg * ncnegfactor > numcache) - cache_negative_zap_one(); + nneg = cache_negative_zap_one(); CACHE_WUNLOCK(); + cache_free(ndd); + cache_free(nneg); } /* @@ -1034,21 +1045,35 @@ cache_changesize(int newmaxvnodes) void cache_purge(struct vnode *vp) { + TAILQ_HEAD(, namecache) ncps; + struct namecache *ncp, *nnp; CTR1(KTR_VFS, "cache_purge(%p)", vp); SDT_PROBE1(vfs, namecache, purge, done, vp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); - while (!LIST_EMPTY(&vp->v_cache_src)) - cache_zap(LIST_FIRST(&vp->v_cache_src)); - while (!TAILQ_EMPTY(&vp->v_cache_dst)) - cache_zap(TAILQ_FIRST(&vp->v_cache_dst)); + while (!LIST_EMPTY(&vp->v_cache_src)) { + ncp = LIST_FIRST(&vp->v_cache_src); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + } + while (!TAILQ_EMPTY(&vp->v_cache_dst)) { + ncp = TAILQ_FIRST(&vp->v_cache_dst); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + } if (vp->v_cache_dd != NULL) { - KASSERT(vp->v_cache_dd->nc_flag & NCF_ISDOTDOT, + ncp = vp->v_cache_dd; + KASSERT(ncp->nc_flag & NCF_ISDOTDOT, ("lost dotdot link")); - cache_zap(vp->v_cache_dd); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } KASSERT(vp->v_cache_dd == NULL, ("incomplete purge")); CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* @@ -1057,16 +1082,23 @@ cache_purge(struct vnode *vp) void cache_purge_negative(struct vnode *vp) { - struct namecache *cp, *ncp; + TAILQ_HEAD(, namecache) ncps; + struct namecache *ncp, *nnp; CTR1(KTR_VFS, "cache_purge_negative(%p)", vp); SDT_PROBE1(vfs, namecache, purge_negative, done, vp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); - LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) { - if (cp->nc_vp == NULL) - cache_zap(cp); + LIST_FOREACH_SAFE(ncp, &vp->v_cache_src, nc_src, nnp) { + if (ncp->nc_vp != NULL) + continue; + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* @@ -1075,19 +1107,26 @@ cache_purge_negative(struct vnode *vp) void cache_purgevfs(struct mount *mp) { + TAILQ_HEAD(, namecache) ncps; struct nchashhead *ncpp; struct namecache *ncp, *nnp; /* Scan hash tables for applicable entries */ SDT_PROBE1(vfs, namecache, purgevfs, done, mp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { - if (ncp->nc_dvp->v_mount == mp) - cache_zap(ncp); + if (ncp->nc_dvp->v_mount != mp) + continue; + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } } CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* From owner-svn-src-head@freebsd.org Sun Sep 4 16:59: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 09F64A9DCC8; Sun, 4 Sep 2016 16:59:37 +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 B6D3CC57; Sun, 4 Sep 2016 16:59:36 +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 u84GxZ6q037812; Sun, 4 Sep 2016 16:59:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84GxZi5037811; Sun, 4 Sep 2016 16:59:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041659.u84GxZi5037811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 16:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305388 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 16:59:37 -0000 Author: dim Date: Sun Sep 4 16:59:35 2016 New Revision: 305388 URL: https://svnweb.freebsd.org/changeset/base/305388 Log: With clang 3.9.0, compiling uplcom results in the following warnings: sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion] if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~ sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE' #define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ This is because UT_READ is 0x80, so the int8_t argument is wrapped to a negative value. Fix this by using uint8_t instead. Reviewed by: imp, hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7776 Modified: head/sys/dev/usb/serial/uplcom.c Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Sun Sep 4 16:54:55 2016 (r305387) +++ head/sys/dev/usb/serial/uplcom.c Sun Sep 4 16:59:35 2016 (r305388) @@ -166,7 +166,7 @@ struct uplcom_softc { /* prototypes */ static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *); -static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t, +static usb_error_t uplcom_pl2303_do(struct usb_device *, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t); static int uplcom_pl2303_init(struct usb_device *, uint8_t); static void uplcom_free(struct ucom_softc *); @@ -514,7 +514,7 @@ uplcom_reset(struct uplcom_softc *sc, st } static usb_error_t -uplcom_pl2303_do(struct usb_device *udev, int8_t req_type, uint8_t request, +uplcom_pl2303_do(struct usb_device *udev, uint8_t req_type, uint8_t request, uint16_t value, uint16_t index, uint16_t length) { struct usb_device_request req; From owner-svn-src-head@freebsd.org Sun Sep 4 17:23: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 AEFFEB711DD; Sun, 4 Sep 2016 17:23:11 +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 822359B4; Sun, 4 Sep 2016 17:23:11 +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 u84HNA98048692; Sun, 4 Sep 2016 17:23:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HNAda048691; Sun, 4 Sep 2016 17:23:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041723.u84HNAda048691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305389 - 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.23 Precedence: list List-Id: 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, 04 Sep 2016 17:23:11 -0000 Author: dim Date: Sun Sep 4 17:23:10 2016 New Revision: 305389 URL: https://svnweb.freebsd.org/changeset/base/305389 Log: With clang 3.9.0, compiling sys/netinet/igmp.c results in the following warning: sys/netinet/igmp.c:546:21: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion] p->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ ~ ^~~~~~~~ sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA' #define IPOPT_RA 148 /* router alert */ ^~~ This is because ipopt_list is an array of char, so IPOPT_RA is wrapped to a negative value. It would be nice to change ipopt_list to an array of u_char, but it changes the signature of the public struct ipoption, so add an explicit cast to suppress the warning. Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7777 Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Sep 4 16:59:35 2016 (r305388) +++ head/sys/netinet/igmp.c Sun Sep 4 17:23:10 2016 (r305389) @@ -543,10 +543,10 @@ igmp_ra_alloc(void) m = m_get(M_WAITOK, MT_DATA); p = mtod(m, struct ipoption *); p->ipopt_dst.s_addr = INADDR_ANY; - p->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ - p->ipopt_list[1] = 0x04; /* 4 bytes long */ - p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */ - p->ipopt_list[3] = 0x00; /* pad byte */ + p->ipopt_list[0] = (char)IPOPT_RA; /* Router Alert Option */ + p->ipopt_list[1] = 0x04; /* 4 bytes long */ + p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */ + p->ipopt_list[3] = 0x00; /* pad byte */ m->m_len = sizeof(p->ipopt_dst) + p->ipopt_list[1]; return (m); From owner-svn-src-head@freebsd.org Sun Sep 4 17:50:24 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 BC4C5B71856; Sun, 4 Sep 2016 17:50:24 +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 8F2817DD; Sun, 4 Sep 2016 17:50:24 +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 u84HoNGR056565; Sun, 4 Sep 2016 17:50:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HoNtn056564; Sun, 4 Sep 2016 17:50:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609041750.u84HoNtn056564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 4 Sep 2016 17:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305391 - 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.23 Precedence: list List-Id: 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, 04 Sep 2016 17:50:24 -0000 Author: andrew Date: Sun Sep 4 17:50:23 2016 New Revision: 305391 URL: https://svnweb.freebsd.org/changeset/base/305391 Log: Enable superpages on arm64 by default. These seem to be stable, having survived multiple world and kernel builds, and of poudriere building full package sets. I have observed a 3% reduction in buildworld times with superpages enabled, however further testing is needed to see if this is observed in other workloads. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Sep 4 17:26:42 2016 (r305390) +++ head/sys/arm64/arm64/pmap.c Sun Sep 4 17:50:23 2016 (r305391) @@ -242,7 +242,7 @@ extern pt_entry_t pagetable_dmap[]; static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); -static int superpages_enabled = 0; +static int superpages_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &superpages_enabled, 0, "Are large page mappings enabled?"); From owner-svn-src-head@freebsd.org Sun Sep 4 17:55: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 38D65B719AF; Sun, 4 Sep 2016 17:55:23 +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 0227DBB4; Sun, 4 Sep 2016 17:55:22 +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 u84HtMV3060051; Sun, 4 Sep 2016 17:55:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HtMa5060050; Sun, 4 Sep 2016 17:55:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041755.u84HtMa5060050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305392 - 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.23 Precedence: list List-Id: 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, 04 Sep 2016 17:55:23 -0000 Author: dim Date: Sun Sep 4 17:55:22 2016 New Revision: 305392 URL: https://svnweb.freebsd.org/changeset/base/305392 Log: For kernel builds, instead of suppressing certain clang warnings, make them non-fatal, so there is some incentive to fix them eventually. Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # kernel where fixing them is more trouble than it is worth, or where there is # a false positive. .if ${COMPILER_TYPE} == "clang" -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow -NO_WSELF_ASSIGN= -Wno-self-assign -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow +NO_WSELF_ASSIGN= -Wno-error-self-assign +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized -NO_WCAST_QUAL= -Wno-cast-qual +NO_WCAST_QUAL= -Wno-error-cast-qual # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. From owner-svn-src-head@freebsd.org Sun Sep 4 17:56:56 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 90384B71A93; Sun, 4 Sep 2016 17:56:56 +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 495CAD49; Sun, 4 Sep 2016 17:56:56 +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 u84HutIc060146; Sun, 4 Sep 2016 17:56:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84Hut9d060144; Sun, 4 Sep 2016 17:56:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041756.u84Hut9d060144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305393 - in head/sys: conf modules/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 17:56:56 -0000 Author: dim Date: Sun Sep 4 17:56:55 2016 New Revision: 305393 URL: https://svnweb.freebsd.org/changeset/base/305393 Log: Make some additional -Wconstant-conversion warnings from clang 3.9.0 in bwn(4) non-fatal for now. Modified: head/sys/conf/files head/sys/modules/bwn/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Sep 4 17:55:22 2016 (r305392) +++ head/sys/conf/files Sun Sep 4 17:56:55 2016 (r305393) @@ -1211,13 +1211,13 @@ dev/bwi/bwiphy.c optional bwi dev/bwi/bwirf.c optional bwi dev/bwi/if_bwi.c optional bwi dev/bwi/if_bwi_pci.c optional bwi pci -# XXX Work around clang warning, until maintainer approves fix. +# XXX Work around clang warnings, until maintainer approves fix. dev/bwn/if_bwn.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bwn/if_bwn_pci.c optional bwn pci bhnd dev/bwn/if_bwn_phy_common.c optional bwn siba_bwn dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \ - compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" + compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION}" dev/bwn/if_bwn_phy_lp.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bwn/if_bwn_phy_n.c optional bwn siba_bwn Modified: head/sys/modules/bwn/Makefile ============================================================================== --- head/sys/modules/bwn/Makefile Sun Sep 4 17:55:22 2016 (r305392) +++ head/sys/modules/bwn/Makefile Sun Sep 4 17:56:55 2016 (r305393) @@ -28,7 +28,7 @@ SRCS+= device_if.h bus_if.h pci_if.h opt .include -# XXX Work around clang warning, until maintainer approves fix. +# XXX Work around clang warnings, until maintainer approves fix. CWARNFLAGS.if_bwn.c= ${NO_WSOMETIMES_UNINITIALIZED} -CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED} +CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION} CWARNFLAGS.if_bwn_phy_lp.c= ${NO_WSOMETIMES_UNINITIALIZED} From owner-svn-src-head@freebsd.org Sun Sep 4 18:02:48 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 3938AB71C70; Sun, 4 Sep 2016 18:02:48 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01ABD283; Sun, 4 Sep 2016 18:02:47 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.15.0.59/8.15.0.59) with SMTP id u84I1Atf019146; Sun, 4 Sep 2016 13:02:45 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 257sjj0av3-1; Sun, 04 Sep 2016 13:02:45 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-205.lightspeed.hstntx.sbcglobal.net [108.254.203.205]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id 48C3740434; Sun, 4 Sep 2016 13:02:45 -0500 (CDT) Subject: Re: svn commit: r305391 - head/sys/arm64/arm64 To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609041750.u84HoNtn056564@repo.freebsd.org> From: Alan Cox Message-ID: <61bfdc1a-24f6-a63d-7f33-b02d8c92dd21@rice.edu> Date: Sun, 4 Sep 2016 13:02:44 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609041750.u84HoNtn056564@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609040276 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 18:02:48 -0000 On 09/04/2016 12:50, Andrew Turner wrote: > Author: andrew > Date: Sun Sep 4 17:50:23 2016 > New Revision: 305391 > URL: https://svnweb.freebsd.org/changeset/base/305391 > > Log: > Enable superpages on arm64 by default. These seem to be stable, havin= g > survived multiple world and kernel builds, and of poudriere building = full > package sets. > =20 > I have observed a 3% reduction in buildworld times with superpages en= abled, > however further testing is needed to see if this is observed in other= > workloads. > =20 Is the starting address of the text section on arm64 superpage aligned, like it is on amd64? If so, I expect that the reduction will increase if you implement support for superpage mappings in pmap_enter_object(). From owner-svn-src-head@freebsd.org Sun Sep 4 19:03: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 74573A9DC47; Sun, 4 Sep 2016 19:03:58 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 443F6FDC; Sun, 4 Sep 2016 19:03:58 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id c198so118953613ith.1; Sun, 04 Sep 2016 12:03:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=e2zggkQK7AzZxFk0H4+fiVQX180axxHMntO9vDkto5M=; b=M0J63y6LN3/ogTOPqhVdTNud67X+s+H1RSXrgghahjZC6CmvLIYHBLONnm835n5iHS TSW7NWpmRW7dHg4pRc7VEB6/U80V8ZlihFMZIlYoCwtQboWqo2CUonMWsu3zseRGIlY+ 5PjmMv5+boYtnaWChxIQpH/mx29R1ub+ZJFYJ/czWk8DqT0oD6KJLQFnee7zvjcYyRhR uuA5WCIiplRX9VTCUazeeWUxr9oMSnuBl2mn+lKJGWF5x5LrNtTVP1xV2ZpgjsQedz/f 4wcKYt+EZDpnMAGUAURgLSg/mtDtGraSkfJhFtf7B9I4zuyS+inh0uaDC+wT6O4W0zkG fV3Q== X-Gm-Message-State: AE9vXwOCp/7f7ZjqG6CoXGURt6baXg4/cWhABdtxt01fR7Eon27hbNg9eOd5A11yg28kfw== X-Received: by 10.36.238.134 with SMTP id b128mr17477980iti.72.1473015434441; Sun, 04 Sep 2016 11:57:14 -0700 (PDT) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com. [209.85.214.51]) by smtp.gmail.com with ESMTPSA id r124sm7912111itc.19.2016.09.04.11.57.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 11:57:14 -0700 (PDT) Received: by mail-it0-f51.google.com with SMTP id i184so117865006itf.1; Sun, 04 Sep 2016 11:57:14 -0700 (PDT) X-Received: by 10.36.227.73 with SMTP id d70mr17167870ith.97.1473015433978; Sun, 04 Sep 2016 11:57:13 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 11:57:13 -0700 (PDT) In-Reply-To: <201609041755.u84HtMa5060050@repo.freebsd.org> References: <201609041755.u84HtMa5060050@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 11:57:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305392 - head/sys/conf To: Dimitry Andric Cc: 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.23 Precedence: list List-Id: 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, 04 Sep 2016 19:03:58 -0000 On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: > Author: dim > Date: Sun Sep 4 17:55:22 2016 > New Revision: 305392 > URL: https://svnweb.freebsd.org/changeset/base/305392 > > Log: > For kernel builds, instead of suppressing certain clang warnings, make > them non-fatal, so there is some incentive to fix them eventually. > > Modified: > head/sys/conf/kern.mk > > Modified: head/sys/conf/kern.mk > ============================================================================== > --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) > +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) > @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn > # kernel where fixing them is more trouble than it is worth, or where there is > # a false positive. > .if ${COMPILER_TYPE} == "clang" > -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion > -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative > -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow > -NO_WSELF_ASSIGN= -Wno-self-assign > -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration > +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion > +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative > +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow > +NO_WSELF_ASSIGN= -Wno-error-self-assign > +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration > NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized > -NO_WCAST_QUAL= -Wno-cast-qual > +NO_WCAST_QUAL= -Wno-error-cast-qual I like goal of the change. Shouldn't these be -Wno-error=cast-qual, etc., though? Best, Conrad From owner-svn-src-head@freebsd.org Sun Sep 4 19:31: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 02830B712AC; Sun, 4 Sep 2016 19:31:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8982DF9; Sun, 4 Sep 2016 19:31:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::cc0e:18d9:a9a1:d549] (unknown [IPv6:2001:7b8:3a7:0:cc0e:18d9:a9a1:d549]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 4D24545418; Sun, 4 Sep 2016 21:31:25 +0200 (CEST) Subject: Re: svn commit: r305392 - head/sys/conf Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6.1 From: Dimitry Andric In-Reply-To: Date: Sun, 4 Sep 2016 21:31:19 +0200 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201609041755.u84HtMa5060050@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 19:31:29 -0000 --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >=20 > On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric = wrote: >> Author: dim >> Date: Sun Sep 4 17:55:22 2016 >> New Revision: 305392 >> URL: https://svnweb.freebsd.org/changeset/base/305392 >>=20 >> Log: >> For kernel builds, instead of suppressing certain clang warnings, = make >> them non-fatal, so there is some incentive to fix them eventually. >>=20 >> Modified: >> head/sys/conf/kern.mk >>=20 >> Modified: head/sys/conf/kern.mk >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 = (r305391) >> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 = (r305392) >> @@ -17,13 +17,13 @@ CWARNFLAGS?=3D -Wall -Wredundant-decls -Wn >> # kernel where fixing them is more trouble than it is worth, or where = there is >> # a false positive. >> .if ${COMPILER_TYPE} =3D=3D "clang" >> -NO_WCONSTANT_CONVERSION=3D -Wno-constant-conversion >> -NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-shift-count-negative >> -NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-shift-count-overflow >> -NO_WSELF_ASSIGN=3D -Wno-self-assign >> -NO_WUNNEEDED_INTERNAL_DECL=3D -Wno-unneeded-internal-declaration >> +NO_WCONSTANT_CONVERSION=3D -Wno-error-constant-conversion >> +NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-error-shift-count-negative >> +NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-error-shift-count-overflow >> +NO_WSELF_ASSIGN=3D -Wno-error-self-assign >> +NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-error-unneeded-internal-declaration >> NO_WSOMETIMES_UNINITIALIZED=3D -Wno-error-sometimes-uninitialized >> -NO_WCAST_QUAL=3D -Wno-cast-qual >> +NO_WCAST_QUAL=3D -Wno-error-cast-qual >=20 > I like goal of the change. Shouldn't these be -Wno-error=3Dcast-qual, > etc., though? That's how gcc spells them. Clang accepts both forms, there is no functional difference. -Dimitry --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlfMdowACgkQsF6jCi4glqPnhACdFylP/bc8HHq32x9433fJ/5/8 nTAAoMICtdS+0AMgU0F+hmi/ZXbwNn2H =SbgV -----END PGP SIGNATURE----- --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5-- From owner-svn-src-head@freebsd.org Sun Sep 4 20:03:06 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 529D6B71858; Sun, 4 Sep 2016 20:03:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (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 25E49B3D; Sun, 4 Sep 2016 20:03:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id e124so119051447ith.0; Sun, 04 Sep 2016 13:03:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=lP2z6S0SJchlQDso0ieY+ysOzATYPINlZ0g9NaZHYwA=; b=biHgSKCuF658WavkaS8UQzI21K7YEOuP5t+9NAvFNNR6negcmgmRAXVxE6ABOxcXKS ZKKh69gJdGBga34nOQZEewoisgRha7PUFHTAiywS7tsOHEyUCjWRqsVg0GkJsObxmHZG ueuv/ZwBlOzTZmsj8ZVkNlHOoYrqy4Wezc95hwZaiK9hrXF3JsY295PFDQLA2/sXDk6m xxYQpzCZEYvcPRUzZ91cOqHajZ0xXkgUqcM+5BZX6wKoEiyj96DTnconWmaTN0TzSvgq uO6/RzsHKglSVUvmaLWUCGFkJfsIpnpl8sEC+a0wjaRH7yueIXNImDPlT1HH4nYPTaVJ twew== X-Gm-Message-State: AE9vXwOy1N0i4XLRPjVzfYaKoJ/BvOVAO8uhiJVRywFZZeYO8bCIfFCERRUhtf5yhxMoWw== X-Received: by 10.36.57.215 with SMTP id l206mr19735837ita.5.1473019384639; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com. [209.85.214.50]) by smtp.gmail.com with ESMTPSA id f2sm4465604ite.20.2016.09.04.13.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 13:03:04 -0700 (PDT) Received: by mail-it0-f50.google.com with SMTP id i184so119175504itf.1; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) X-Received: by 10.36.189.68 with SMTP id x65mr17345010ite.97.1473019384143; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 13:03:03 -0700 (PDT) In-Reply-To: References: <201609041755.u84HtMa5060050@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 13:03:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305392 - head/sys/conf To: Dimitry Andric Cc: 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.23 Precedence: list List-Id: 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, 04 Sep 2016 20:03:06 -0000 Assuming we'd like to enable building with both compilers for now, isn't it better to use a form both accept? Best, Conrad On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric wrote: > On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >> >> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: >>> Author: dim >>> Date: Sun Sep 4 17:55:22 2016 >>> New Revision: 305392 >>> URL: https://svnweb.freebsd.org/changeset/base/305392 >>> >>> Log: >>> For kernel builds, instead of suppressing certain clang warnings, make >>> them non-fatal, so there is some incentive to fix them eventually. >>> >>> Modified: >>> head/sys/conf/kern.mk >>> >>> Modified: head/sys/conf/kern.mk >>> ============================================================================== >>> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) >>> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) >>> @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn >>> # kernel where fixing them is more trouble than it is worth, or where there is >>> # a false positive. >>> .if ${COMPILER_TYPE} == "clang" >>> -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion >>> -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative >>> -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow >>> -NO_WSELF_ASSIGN= -Wno-self-assign >>> -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration >>> +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion >>> +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative >>> +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow >>> +NO_WSELF_ASSIGN= -Wno-error-self-assign >>> +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration >>> NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized >>> -NO_WCAST_QUAL= -Wno-cast-qual >>> +NO_WCAST_QUAL= -Wno-error-cast-qual >> >> I like goal of the change. Shouldn't these be -Wno-error=cast-qual, >> etc., though? > > That's how gcc spells them. Clang accepts both forms, there is no > functional difference. > > -Dimitry > From owner-svn-src-head@freebsd.org Sun Sep 4 20:36: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 CEACCB71034; Sun, 4 Sep 2016 20:36:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C03A938; Sun, 4 Sep 2016 20:36:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::cc0e:18d9:a9a1:d549] (unknown [IPv6:2001:7b8:3a7:0:cc0e:18d9:a9a1:d549]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 634BB2F749; Sun, 4 Sep 2016 22:36:15 +0200 (CEST) Subject: Re: svn commit: r305392 - head/sys/conf Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6.1 From: Dimitry Andric In-Reply-To: Date: Sun, 4 Sep 2016 22:36:03 +0200 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <000B5E66-D804-4317-9957-8BDEDBD6B7F6@FreeBSD.org> References: <201609041755.u84HtMa5060050@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 20:36:18 -0000 --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Not in this particular case, as the section is exclusively meant for clang. Most of these warning options are completely different from gcc's. The gcc related section is just below this part in kern.mk. -Dimitry > On 04 Sep 2016, at 22:03, Conrad Meyer wrote: >=20 > Assuming we'd like to enable building with both compilers for now, > isn't it better to use a form both accept? >=20 > Best, > Conrad >=20 > On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric = wrote: >> On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >>>=20 >>> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric = wrote: >>>> Author: dim >>>> Date: Sun Sep 4 17:55:22 2016 >>>> New Revision: 305392 >>>> URL: https://svnweb.freebsd.org/changeset/base/305392 >>>>=20 >>>> Log: >>>> For kernel builds, instead of suppressing certain clang warnings, = make >>>> them non-fatal, so there is some incentive to fix them eventually. >>>>=20 >>>> Modified: >>>> head/sys/conf/kern.mk >>>>=20 >>>> Modified: head/sys/conf/kern.mk >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 = (r305391) >>>> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 = (r305392) >>>> @@ -17,13 +17,13 @@ CWARNFLAGS?=3D -Wall -Wredundant-decls = -Wn >>>> # kernel where fixing them is more trouble than it is worth, or = where there is >>>> # a false positive. >>>> .if ${COMPILER_TYPE} =3D=3D "clang" >>>> -NO_WCONSTANT_CONVERSION=3D -Wno-constant-conversion >>>> -NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-shift-count-negative >>>> -NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-shift-count-overflow >>>> -NO_WSELF_ASSIGN=3D -Wno-self-assign >>>> -NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-unneeded-internal-declaration >>>> +NO_WCONSTANT_CONVERSION=3D -Wno-error-constant-conversion >>>> +NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-error-shift-count-negative >>>> +NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-error-shift-count-overflow >>>> +NO_WSELF_ASSIGN=3D -Wno-error-self-assign >>>> +NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-error-unneeded-internal-declaration >>>> NO_WSOMETIMES_UNINITIALIZED=3D -Wno-error-sometimes-uninitialized >>>> -NO_WCAST_QUAL=3D -Wno-cast-qual >>>> +NO_WCAST_QUAL=3D -Wno-error-cast-qual >>>=20 >>> I like goal of the change. Shouldn't these be -Wno-error=3Dcast-qual,= >>> etc., though? >>=20 >> That's how gcc spells them. Clang accepts both forms, there is no >> functional difference. >>=20 >> -Dimitry >>=20 --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlfMhb4ACgkQsF6jCi4glqPQMACgxdHRlWFuIBabA/Dv2tbiwnod JvwAnRlpczNqvpT0/3ES5XNnRzy24mCh =KuBb -----END PGP SIGNATURE----- --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C-- From owner-svn-src-head@freebsd.org Sun Sep 4 20:55: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 A2015B714F9; Sun, 4 Sep 2016 20:55:29 +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 72841153; Sun, 4 Sep 2016 20:55:29 +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 u84KtSgE027390; Sun, 4 Sep 2016 20:55:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84KtSUu027382; Sun, 4 Sep 2016 20:55:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201609042055.u84KtSUu027382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 4 Sep 2016 20:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305395 - in head: lib/libifconfig share/examples/libifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 20:55:29 -0000 Author: kp Date: Sun Sep 4 20:55:27 2016 New Revision: 305395 URL: https://svnweb.freebsd.org/changeset/base/305395 Log: libifconfig: style(9) fixes Also switch from BSD 3-clause to 2-clause license where possible, and consolidate duplicate 3-clause license into one. Submitted by: Marie Helene Kvello-Aune Reviewed by: cem, kp Differential Revision: https://reviews.freebsd.org/D7764 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h head/lib/libifconfig/libifconfig_internal.c head/lib/libifconfig/libifconfig_internal.h head/share/examples/libifconfig/ifcreate.c head/share/examples/libifconfig/ifdestroy.c head/share/examples/libifconfig/setdescription.c head/share/examples/libifconfig/setmtu.c Modified: head/lib/libifconfig/libifconfig.c ============================================================================== --- head/lib/libifconfig/libifconfig.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig.c Sun Sep 4 20:55:27 2016 (r305395) @@ -57,6 +57,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #include @@ -80,19 +82,17 @@ ifconfig_open(void) { struct ifconfig_handle *h; - h = calloc(1, sizeof(struct ifconfig_handle)); - + h = calloc(1, sizeof(*h)); for (int i = 0; i <= AF_MAX; i++) { h->sockets[i] = -1; } - return (h); } - void ifconfig_close(ifconfig_handle_t *h) { + for (int i = 0; i <= AF_MAX; i++) { if (h->sockets[i] != -1) { (void)close(h->sockets[i]); @@ -101,37 +101,40 @@ ifconfig_close(ifconfig_handle_t *h) free(h); } - ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_t *h) { + return (h->error.errtype); } - int ifconfig_err_errno(ifconfig_handle_t *h) { + return (h->error.errcode); } - unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h) { + return (h->error.ioctl_request); } - int -ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description) +ifconfig_get_description(ifconfig_handle_t *h, const char *name, + char **description) { struct ifreq ifr; - char *descr = NULL; - size_t descrlen = 64; + char *descr; + size_t descrlen; - memset(&ifr, 0, sizeof(struct ifreq)); + descr = NULL; + descrlen = 64; + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + for (;;) { if ((descr = reallocf(descr, descrlen)) == NULL) { h->error.errtype = OTHER; @@ -141,8 +144,7 @@ ifconfig_get_description(ifconfig_handle ifr.ifr_buffer.buffer = descr; ifr.ifr_buffer.length = descrlen; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, - &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { return (-1); } @@ -164,7 +166,6 @@ ifconfig_get_description(ifconfig_handle return (-1); } - int ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription) @@ -172,7 +173,7 @@ ifconfig_set_description(ifconfig_handle struct ifreq ifr; int desclen; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); desclen = strlen(newdescription); /* @@ -184,46 +185,49 @@ ifconfig_set_description(ifconfig_handle } (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_buffer.length = desclen + 1; ifr.ifr_buffer.buffer = strdup(newdescription); + if (ifr.ifr_buffer.buffer == NULL) { h->error.errtype = OTHER; h->error.errcode = ENOMEM; return (-1); } - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, + &ifr) != 0) { free(ifr.ifr_buffer.buffer); return (-1); } + free(ifr.ifr_buffer.buffer); return (0); } - -int ifconfig_unset_description(ifconfig_handle_t *h, const char *name) +int +ifconfig_unset_description(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_buffer.length = 0; ifr.ifr_buffer.buffer = NULL; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname) +int +ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname) { struct ifreq ifr; char *tmpname; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); tmpname = strdup(newname); if (tmpname == NULL) { h->error.errtype = OTHER; @@ -233,82 +237,96 @@ int ifconfig_set_name(ifconfig_handle_t (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_data = tmpname; - - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, + &ifr) != 0) { free(tmpname); return (-1); } + free(tmpname); return (0); } - -int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu) +int +ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, + &ifr) < 0) { return (-1); } + return (0); } - -int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu) +int +ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, + &ifr) == -1) { return (-1); } + *mtu = ifr.ifr_mtu; return (0); } - -int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) +int +ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, + &ifr) < 0) { return (-1); } + return (0); } - -int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric) +int +ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, + &ifr) == -1) { return (-1); } + *metric = ifr.ifr_metric; return (0); } - -int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, +int +ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability) { struct ifreq ifr; struct ifconfig_capabilities ifcap; - int flags; - int value; + int flags, value; - memset(&ifr, 0, sizeof(struct ifreq)); - if (ifconfig_get_capability(h, name, &ifcap) != 0) { + memset(&ifr, 0, sizeof(ifr)); + + if (ifconfig_get_capability(h, name, + &ifcap) != 0) { return (-1); } @@ -329,22 +347,24 @@ int ifconfig_set_capability(ifconfig_han * set for this request. */ ifr.ifr_reqcap = flags; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, +int +ifconfig_get_capability(ifconfig_handle_t *h, const char *name, struct ifconfig_capabilities *capability) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, + &ifr) < 0) { return (-1); } capability->curcap = ifr.ifr_curcap; @@ -352,26 +372,27 @@ int ifconfig_get_capability(ifconfig_han return (0); } - -int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) +int +ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname) +int +ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); /* @@ -379,19 +400,22 @@ int ifconfig_create_interface(ifconfig_h * Insert special snowflake handling here. See GitHub issue #12 for details. * In the meantime, hard-nosupport interfaces that need special handling. */ - if ((strncmp(name, "wlan", strlen("wlan")) == 0) || - (strncmp(name, "vlan", strlen("vlan")) == 0) || - (strncmp(name, "vxlan", strlen("vxlan")) == 0)) { + if ((strncmp(name, "wlan", + strlen("wlan")) == 0) || + (strncmp(name, "vlan", + strlen("vlan")) == 0) || + (strncmp(name, "vxlan", + strlen("vxlan")) == 0)) { h->error.errtype = OTHER; h->error.errcode = ENOSYS; return (-1); } /* No special handling for this interface type. */ - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { return (-1); } + *ifname = strdup(ifr.ifr_name); return (0); } Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig.h Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -50,7 +46,6 @@ struct ifconfig_capabilities { int reqcap; }; - /** Retrieves a new state object for use in other API calls. * Example usage: *{@code @@ -80,19 +75,18 @@ int ifconfig_err_errno(ifconfig_handle_t /** If error type was IOCTL, this identifies which request failed. */ unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); - int ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description); int ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription); int ifconfig_unset_description(ifconfig_handle_t *h, const char *name); -int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname); +int ifconfig_set_name(ifconfig_handle_t *h, const char *name, + const char *newname); int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); - -int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric); +int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, + const int metric); int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); - int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability); int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, Modified: head/lib/libifconfig/libifconfig_internal.c ============================================================================== --- head/lib/libifconfig/libifconfig_internal.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig_internal.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -30,31 +26,32 @@ * $FreeBSD$ */ +#include #include #include #include #include -#include #include - #include "libifconfig.h" // Needed for ifconfig_errstate #include "libifconfig_internal.h" + int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode) { + if (rcode != 0) { h->error.errtype = IOCTL; h->error.ioctl_request = request; h->error.errcode = errno; } + return (rcode); } - int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, unsigned long request, struct ifreq *ifr) @@ -69,13 +66,14 @@ ifconfig_ioctlwrap(ifconfig_handle_t *h, return (ifconfig_ioctlwrap_ret(h, request, rcode)); } - /* * Function to get socket for the specified address family. * If the socket doesn't already exist, attempt to create it. */ -int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) +int +ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) { + if (addressfamily > AF_MAX) { h->error.errtype = SOCKET; h->error.errcode = EINVAL; Modified: head/lib/libifconfig/libifconfig_internal.h ============================================================================== --- head/lib/libifconfig/libifconfig_internal.h Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig_internal.h Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -80,7 +76,8 @@ struct ifconfig_handle { int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s); /** Function used by other wrapper functions to populate _errstate when appropriate.*/ -int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode); +int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, + int rcode); /** Function to wrap ioctl() and automatically populate ifconfig_errstate when appropriate.*/ int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, Modified: head/share/examples/libifconfig/ifcreate.c ============================================================================== --- head/share/examples/libifconfig/ifcreate.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/ifcreate.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -40,16 +36,17 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname, *ifactualname; + if (argc != 2) { errx(EINVAL, "Invalid number of arguments." " Only one argument is accepted, and it should be the name" " of the interface to be created."); } - char *ifname, *ifactualname; - /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); @@ -63,31 +60,31 @@ int main(int argc, char *argv[]) free(ifname); free(ifactualname); return (0); - } else { - switch (ifconfig_err_errtype(lifh)) { - case SOCKET: - warnx("couldn't create socket. This shouldn't happen.\n"); - break; - case IOCTL: - if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { - warnx( - "Failed to create interface (SIOCIFCREATE2)\n"); - } - break; - default: + } + + switch (ifconfig_err_errtype(lifh)) { + case SOCKET: + warnx("couldn't create socket. This shouldn't happen.\n"); + break; + case IOCTL: + if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { warnx( - "This is a thorough example accommodating for temporary" - " 'not implemented yet' errors. That's likely what happened" - " now. If not, your guess is as good as mine. ;)" - " Error code: %d\n", ifconfig_err_errno( - lifh)); - break; + "Failed to create interface (SIOCIFCREATE2)\n"); } - - ifconfig_close(lifh); - lifh = NULL; - free(ifname); - free(ifactualname); - return (-1); + break; + default: + warnx( + "This is a thorough example accommodating for temporary" + " 'not implemented yet' errors. That's likely what happened" + " now. If not, your guess is as good as mine. ;)" + " Error code: %d\n", ifconfig_err_errno( + lifh)); + break; } + + ifconfig_close(lifh); + lifh = NULL; + free(ifname); + free(ifactualname); + return (-1); } Modified: head/share/examples/libifconfig/ifdestroy.c ============================================================================== --- head/share/examples/libifconfig/ifdestroy.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/ifdestroy.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -40,16 +36,17 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname; + if (argc != 2) { errx(EINVAL, "Invalid number of arguments." " Only one argument is accepted, and it should be the name" " of the interface to be destroyed."); } - char *ifname; - /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); @@ -62,26 +59,26 @@ int main(int argc, char *argv[]) lifh = NULL; free(ifname); return (0); - } else { - switch (ifconfig_err_errtype(lifh)) { - case SOCKET: - warnx("couldn't create socket. This shouldn't happen.\n"); - break; - case IOCTL: - if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { - warnx( - "Failed to destroy interface (SIOCIFDESTROY)\n"); - } - break; - default: + } + + switch (ifconfig_err_errtype(lifh)) { + case SOCKET: + warnx("couldn't create socket. This shouldn't happen.\n"); + break; + case IOCTL: + if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { warnx( - "Should basically never end up here in this example.\n"); - break; + "Failed to destroy interface (SIOCIFDESTROY)\n"); } - - ifconfig_close(lifh); - lifh = NULL; - free(ifname); - return (-1); + break; + default: + warnx( + "Should basically never end up here in this example.\n"); + break; } + + ifconfig_close(lifh); + lifh = NULL; + free(ifname); + return (-1); } Modified: head/share/examples/libifconfig/setdescription.c ============================================================================== --- head/share/examples/libifconfig/setdescription.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/setdescription.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * * 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 @@ -38,15 +34,17 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname, *ifdescr, *curdescr; + if (argc != 3) { errx(EINVAL, "Invalid number of arguments." " First argument should be interface name, second argument" " should be the description to set."); } - char *ifname, *ifdescr, *curdescr; /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); ifdescr = strdup(argv[2]); Modified: head/share/examples/libifconfig/setmtu.c ============================================================================== --- head/share/examples/libifconfig/setmtu.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/setmtu.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,9 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, @@ -40,17 +37,18 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname, *ptr; + int mtu; + if (argc != 3) { errx(EINVAL, "Invalid number of arguments." " First argument should be interface name, second argument" " should be the MTU to set."); } - char *ifname, *ptr; - int mtu; - /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); mtu = (int)strtol(argv[2], &ptr, 10); @@ -65,30 +63,30 @@ int main(int argc, char *argv[]) lifh = NULL; free(ifname); return (0); - } else { - switch (ifconfig_err_errtype(lifh)) { - case SOCKET: - warnx("couldn't create socket. This shouldn't happen.\n"); - break; - case IOCTL: - if (ifconfig_err_ioctlreq(lifh) == SIOCSIFMTU) { - warnx("Failed to set MTU (SIOCSIFMTU)\n"); - } else { - warnx( - "Failed to set MTU due to error in unexpected ioctl() call %lu. Error code: %i.\n", - ifconfig_err_ioctlreq(lifh), - ifconfig_err_errno(lifh)); - } - break; - default: + } + + switch (ifconfig_err_errtype(lifh)) { + case SOCKET: + warnx("couldn't create socket. This shouldn't happen.\n"); + break; + case IOCTL: + if (ifconfig_err_ioctlreq(lifh) == SIOCSIFMTU) { + warnx("Failed to set MTU (SIOCSIFMTU)\n"); + } else { warnx( - "Should basically never end up here in this example.\n"); - break; + "Failed to set MTU due to error in unexpected ioctl() call %lu. Error code: %i.\n", + ifconfig_err_ioctlreq(lifh), + ifconfig_err_errno(lifh)); } - - ifconfig_close(lifh); - lifh = NULL; - free(ifname); - return (-1); + break; + default: + warnx( + "Should basically never end up here in this example.\n"); + break; } + + ifconfig_close(lifh); + lifh = NULL; + free(ifname); + return (-1); } From owner-svn-src-head@freebsd.org Sun Sep 4 20:57: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 472ADB7158A; Sun, 4 Sep 2016 20:57:50 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (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 187C3306; Sun, 4 Sep 2016 20:57:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f43.google.com with SMTP id e124so120756962ith.0; Sun, 04 Sep 2016 13:57:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=VlbMcH6/qRQs4HRvc5cqsVmPKFT7TT7NQHgBW6WARus=; b=fENFzziXI6I206jiqjVfTGyfiM+mBfDW5lFsS+6NTNCUPRsEmJLF9sjQ1XbepUyAa1 qJob4KDjuIyW86Gj6A1ct4bsBKpGXnPURF8IO54eZ4PV5ApF+jhYIVvezftiTKXdCqqj t6VniwwUVcWLenWPkwWXzM9NIoKfl8dBZGUBoAY9qRuMsA+9afTn9IYJf2WmExuqR+K+ COTOMp9SEM77mKO/Kzj5wGl6vSmGPK8epF/FZw8IjMvjaDNyKuxa8dwxnXa22Ps9ziX/ ACSJf7F4xtmW1nKL59i9LQq60LJsCYGd00r4o5TNBdMEKADWFL0Yul0Gac70m5KCPbvi KCrw== X-Gm-Message-State: AE9vXwPfRuxR/YlXrp2urCMcKqooV9QQj8U+GEdHdPGa4wqnHzW7ZNb9rkmeQ0PaGI60xw== X-Received: by 10.36.147.2 with SMTP id y2mr19477719itd.67.1473022663097; Sun, 04 Sep 2016 13:57:43 -0700 (PDT) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id 140sm8227121itl.4.2016.09.04.13.57.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 13:57:43 -0700 (PDT) Received: by mail-it0-f49.google.com with SMTP id c198so121129080ith.1; Sun, 04 Sep 2016 13:57:42 -0700 (PDT) X-Received: by 10.36.212.132 with SMTP id x126mr19712393itg.34.1473022662721; Sun, 04 Sep 2016 13:57:42 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 13:57:42 -0700 (PDT) In-Reply-To: <000B5E66-D804-4317-9957-8BDEDBD6B7F6@FreeBSD.org> References: <201609041755.u84HtMa5060050@repo.freebsd.org> <000B5E66-D804-4317-9957-8BDEDBD6B7F6@FreeBSD.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 13:57:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305392 - head/sys/conf To: Dimitry Andric Cc: 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.23 Precedence: list List-Id: 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, 04 Sep 2016 20:57:50 -0000 Hm, the GCC 5.3 manual page mentions at least -Wshift-count-negative, -Wshift-count-overflow, and -Wcast-qual. Best, Conrad On Sun, Sep 4, 2016 at 1:36 PM, Dimitry Andric wrote: > Not in this particular case, as the section is exclusively meant for > clang. Most of these warning options are completely different from > gcc's. The gcc related section is just below this part in kern.mk. > > -Dimitry > >> On 04 Sep 2016, at 22:03, Conrad Meyer wrote: >> >> Assuming we'd like to enable building with both compilers for now, >> isn't it better to use a form both accept? >> >> Best, >> Conrad >> >> On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric wrote: >>> On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >>>> >>>> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: >>>>> Author: dim >>>>> Date: Sun Sep 4 17:55:22 2016 >>>>> New Revision: 305392 >>>>> URL: https://svnweb.freebsd.org/changeset/base/305392 >>>>> >>>>> Log: >>>>> For kernel builds, instead of suppressing certain clang warnings, make >>>>> them non-fatal, so there is some incentive to fix them eventually. >>>>> >>>>> Modified: >>>>> head/sys/conf/kern.mk >>>>> >>>>> Modified: head/sys/conf/kern.mk >>>>> ============================================================================== >>>>> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) >>>>> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) >>>>> @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn >>>>> # kernel where fixing them is more trouble than it is worth, or where there is >>>>> # a false positive. >>>>> .if ${COMPILER_TYPE} == "clang" >>>>> -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion >>>>> -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative >>>>> -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow >>>>> -NO_WSELF_ASSIGN= -Wno-self-assign >>>>> -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration >>>>> +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion >>>>> +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative >>>>> +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow >>>>> +NO_WSELF_ASSIGN= -Wno-error-self-assign >>>>> +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration >>>>> NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized >>>>> -NO_WCAST_QUAL= -Wno-cast-qual >>>>> +NO_WCAST_QUAL= -Wno-error-cast-qual >>>> >>>> I like goal of the change. Shouldn't these be -Wno-error=cast-qual, >>>> etc., though? >>> >>> That's how gcc spells them. Clang accepts both forms, there is no >>> functional difference. >>> >>> -Dimitry >>> > From owner-svn-src-head@freebsd.org Sun Sep 4 21:48:59 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 A801EA9D418; Sun, 4 Sep 2016 21:48:59 +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 73F823EE; Sun, 4 Sep 2016 21:48:59 +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 u84LmwGY046165; Sun, 4 Sep 2016 21:48:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84Lmw9I046164; Sun, 4 Sep 2016 21:48:58 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609042148.u84Lmw9I046164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 21:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305396 - head/contrib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 04 Sep 2016 21:48:59 -0000 Author: dim Date: Sun Sep 4 21:48:58 2016 New Revision: 305396 URL: https://svnweb.freebsd.org/changeset/base/305396 Log: Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header. This value is used in newer versions of compiler-rt. MFC after: 3 days Modified: head/contrib/libcxxrt/unwind-arm.h Modified: head/contrib/libcxxrt/unwind-arm.h ============================================================================== --- head/contrib/libcxxrt/unwind-arm.h Sun Sep 4 20:55:27 2016 (r305395) +++ head/contrib/libcxxrt/unwind-arm.h Sun Sep 4 21:48:58 2016 (r305396) @@ -28,7 +28,7 @@ { _URC_OK = 0, /* operation completed successfully */ _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_END_OF_STACK = 5, + _URC_END_OF_STACK = 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, _URC_CONTINUE_UNWIND = 8, @@ -43,10 +43,12 @@ typedef uint32_t _Unwind_State; static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1; static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2; +static const _Unwind_State _US_ACTION_MASK = 3; #else // GCC fails at knowing what a constant expression is # define _US_VIRTUAL_UNWIND_FRAME 0 # define _US_UNWIND_FRAME_STARTING 1 -# define _US_UNWIND_FRAME_RESUME 2 +# define _US_UNWIND_FRAME_RESUME 2 +# define _US_ACTION_MASK 3 #endif typedef struct _Unwind_Context _Unwind_Context; From owner-svn-src-head@freebsd.org Sun Sep 4 22:08:06 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 0C64FA9DA6A; Sun, 4 Sep 2016 22:08:06 +0000 (UTC) (envelope-from alc@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 B5BBF184; Sun, 4 Sep 2016 22:08:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84M84Jp053576; Sun, 4 Sep 2016 22:08:04 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84M84GR053575; Sun, 4 Sep 2016 22:08:04 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201609042208.u84M84GR053575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 4 Sep 2016 22:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305398 - head/sys/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.23 Precedence: list List-Id: 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, 04 Sep 2016 22:08:06 -0000 Author: alc Date: Sun Sep 4 22:08:04 2016 New Revision: 305398 URL: https://svnweb.freebsd.org/changeset/base/305398 Log: Replace the number 4 in pmap_ts_referenced() by PMAP_TS_REFERENCED_MAX, like we've done elsewhere, e.g., amd64. As an optimization to the machine-independent layer, change the machine- dependent pmap_ts_referenced() so that it updates the page's dirty field if a modified bit is found while counting reference bits. This opportunistic update can be performed at low cost and can eliminate the need for some future calls to pmap_is_modified() by the machine- independent layer. MFC after: 3 weeks Modified: head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sun Sep 4 21:54:24 2016 (r305397) +++ head/sys/sparc64/sparc64/pmap.c Sun Sep 4 22:08:04 2016 (r305398) @@ -2073,6 +2073,8 @@ pmap_page_is_mapped(vm_page_t m) return (rv); } +#define PMAP_TS_REFERENCED_MAX 5 + /* * Return a count of reference bits for a page, clearing those bits. * It is not necessary for every reference bit to be cleared, but it @@ -2082,6 +2084,14 @@ pmap_page_is_mapped(vm_page_t m) * XXX: The exact number of bits to check and clear is a matter that * should be tested and standardized at some point in the future for * optimal aging of shared pages. + * + * As an optimization, update the page's dirty field if a modified bit is + * found while counting reference bits. This opportunistic update can be + * performed at low cost and can eliminate the need for some future calls + * to pmap_is_modified(). However, since this function stops after + * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some + * dirty pages. Those dirty pages will only be detected by a future call + * to pmap_is_modified(). */ int pmap_ts_referenced(vm_page_t m) @@ -2105,7 +2115,10 @@ pmap_ts_referenced(vm_page_t m) if ((tp->tte_data & TD_PV) == 0) continue; data = atomic_clear_long(&tp->tte_data, TD_REF); - if ((data & TD_REF) != 0 && ++count > 4) + if ((data & TD_W) != 0) + vm_page_dirty(m); + if ((data & TD_REF) != 0 && ++count >= + PMAP_TS_REFERENCED_MAX) break; } while ((tp = tpn) != NULL && tp != tpf); } From owner-svn-src-head@freebsd.org Sun Sep 4 22:30:47 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 97008A9DDDA; Sun, 4 Sep 2016 22:30:47 +0000 (UTC) (envelope-from jmcneill@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 68176B81; Sun, 4 Sep 2016 22:30:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84MUkkk061704; Sun, 4 Sep 2016 22:30:46 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84MUkub061703; Sun, 4 Sep 2016 22:30:46 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609042230.u84MUkub061703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 4 Sep 2016 22:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305399 - head/sys/boot/fdt/dts/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.23 Precedence: list List-Id: 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, 04 Sep 2016 22:30:47 -0000 Author: jmcneill Date: Sun Sep 4 22:30:46 2016 New Revision: 305399 URL: https://svnweb.freebsd.org/changeset/base/305399 Log: A64 thermal sensor IRQ is GIC_SPI 31, not 41. Modified: head/sys/boot/fdt/dts/arm64/a64.dtsi Modified: head/sys/boot/fdt/dts/arm64/a64.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm64/a64.dtsi Sun Sep 4 22:08:04 2016 (r305398) +++ head/sys/boot/fdt/dts/arm64/a64.dtsi Sun Sep 4 22:30:46 2016 (r305399) @@ -110,7 +110,7 @@ rtp: rtp@01c25000 { compatible = "allwinner,sun50i-a64-ts"; reg = <0x01c25000 0x400>; - interrupts = ; + interrupts = ; clocks = <&bus_gates 72>, <&ths_clk>; clock-names = "ahb", "ths"; resets = <&ahb_rst 136>; From owner-svn-src-head@freebsd.org Mon Sep 5 02:24: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 C1645A9DC88; Mon, 5 Sep 2016 02:24:13 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-ua0-x22a.google.com (mail-ua0-x22a.google.com [IPv6:2607:f8b0:400c:c08::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 4BBA9FEC; Mon, 5 Sep 2016 02:24:13 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: by mail-ua0-x22a.google.com with SMTP id 49so32795501uat.3; Sun, 04 Sep 2016 19:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=l79rZDSBF3NCVCkx6Yj56W/sfHrTEnwCVwbn2G4Z2RA=; b=Smtq33aMVWN9bcMhebh5yZ9MAwzVFIhOEG2z0O9ScDMrrV8OvCbhPiejT41SppCzyR DJGpp9WcIUfXO01wGQifBAVyMJ4TwInhsyuvlYjv6HqtCBYtJhiR5dlXLTZ7+7RSSrzA mxnrDksb1KZtwpHtU71dTmJFe2fJngsH7Htc9YCiTTdxNbvTqf5o51rypsx5qQe1WRJ+ zU2lBN39SgURvuSYRoED9ti7yJd0k8S3aKSfLR7IDTRackM6TSHjjD+tD7CnILmAmhiE CTZK/cnuQSjm910U7r8ERlMjzCfIU0OTH1X+yA8Owcpy7p+4oOjYDY4/V3ORJJOkPjii aSIg== 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:from :date:message-id:subject:to:cc; bh=l79rZDSBF3NCVCkx6Yj56W/sfHrTEnwCVwbn2G4Z2RA=; b=AT5X2Y4zLPK0hhX+586jaMQE6rISFPin1KKSOYtdkacAaH9VjMqURR7MUGXvlGrF2n PJgrcZu45KrTcaHwsz9UD1mKM0l5Z7PsRgXzJaq8NAHiiM3k8WnNA814jNLYLopJ0PMj nkVsN3xUSlZ2diRGG+h93rcsbCkjlcWZETVwUc8rkWAv4JFMZifgySc+blAjLBYhRV63 X2ewZTFw/i/BQFLO9QVeUnhEkVV5+HwKt8LhwxYgdRQIl3BG1k9hLITATrzte0qzTpy5 55/nvOjfrQCU6DWO6UAOQV7VxBmUUh6DHkaLmdNztnjIpICu15Vy3vj+LAWIA1LzCe1P 9xuw== X-Gm-Message-State: AE9vXwNI6QF9oVQMC/4ihHFYSsVTzjzceeytAHil4RTxDxqQaQFmIhtqiKzwqe8ojmjmzpnfurim0ojvZ5xEyA== X-Received: by 10.176.64.161 with SMTP id i30mr16842105uad.107.1473042251708; Sun, 04 Sep 2016 19:24:11 -0700 (PDT) MIME-Version: 1.0 Sender: crodr001@gmail.com Received: by 10.103.31.134 with HTTP; Sun, 4 Sep 2016 19:24:10 -0700 (PDT) In-Reply-To: <201609031811.u83IBnmt080798@repo.freebsd.org> References: <201609031811.u83IBnmt080798@repo.freebsd.org> From: Craig Rodrigues Date: Sun, 4 Sep 2016 19:24:10 -0700 X-Google-Sender-Auth: 8EC2OTC0LsnZrQo6duNW5G8PZas Message-ID: Subject: Re: svn commit: r305358 - in head: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencrypto ... To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , "freebsd-testing@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 02:24:13 -0000 Hi, The tests in libc are broken after this commit. lib/libc/test/db/Makefile defines "PROGS = h_lfsr" but the test is trying to execute a binary "h_db" which no longer exists. Can you fix this? Thanks. -- Craig On Sat, Sep 3, 2016 at 11:11 AM, Ngie Cooper wrote: > Author: ngie > Date: Sat Sep 3 18:11:48 2016 > New Revision: 305358 > URL: https://svnweb.freebsd.org/changeset/base/305358 > > Log: > Update contrib/netbsd-tests with new content from NetBSD > > This updates the snapshot from 09/30/2014 to 08/11/2016 > > This brings in a number of new testcases from upstream, most > notably: > > - bin/cat > - lib/libc > - lib/msun > - lib/libthr > - usr.bin/sort > > lib/libc/tests/stdio/open_memstream_test.c was moved to > lib/libc/tests/stdio/open_memstream2_test.c to accomodate > the new open_memstream test from NetBSD. > > MFC after: 2 months > Tested on: amd64 (VMware fusion VM; various bare metal platforms); > i386 (VMware fusion VM); make tinderbox > Sponsored by: EMC / Isilon Storage Division > > Added: > head/contrib/netbsd-tests/bin/cat/d_se_output.in > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/cat/d_se_output.in > head/contrib/netbsd-tests/bin/cat/d_se_output.out > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/cat/d_se_output.out > head/contrib/netbsd-tests/bin/sh/t_arith.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_arith.sh > head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_cmdsub.sh > head/contrib/netbsd-tests/bin/sh/t_option.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_option.sh > head/contrib/netbsd-tests/bin/sh/t_redir.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_redir.sh > head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_redircloexec.sh > head/contrib/netbsd-tests/bin/sh/t_shift.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_shift.sh > head/contrib/netbsd-tests/bin/sh/t_varval.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_varval.sh > head/contrib/netbsd-tests/dev/fss/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/dev/fss/ > head/contrib/netbsd-tests/dev/usb/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/dev/usb/ > head/contrib/netbsd-tests/include/sys/t_pslist.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/include/sys/t_pslist.c > head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/kernel/kqueue/t_vnode.c > head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/db/h_lfsr.c > head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c > head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c > head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c > head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c > head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc > head/contrib/netbsd-tests/lib/libc/sys/t_bind.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/sys/t_bind.c > head/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c > head/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c > head/contrib/netbsd-tests/lib/libc/sys/t_wait.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libc/sys/t_wait.c > head/contrib/netbsd-tests/lib/libm/t_fenv.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libm/t_fenv.c > head/contrib/netbsd-tests/lib/libm/t_hypot.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libm/t_hypot.c > head/contrib/netbsd-tests/lib/libusbhid/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/lib/libusbhid/ > head/contrib/netbsd-tests/net/arp/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/arp/ > head/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh > head/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh > head/contrib/netbsd-tests/net/if/ifconf.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if/ifconf.c > head/contrib/netbsd-tests/net/if/t_ifconf.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if/t_ifconf.sh > head/contrib/netbsd-tests/net/if/t_ifconfig.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if/t_ifconfig.sh > head/contrib/netbsd-tests/net/if_gif/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if_gif/ > head/contrib/netbsd-tests/net/if_pppoe/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if_pppoe/ > head/contrib/netbsd-tests/net/if_tap/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/if_tap/ > head/contrib/netbsd-tests/net/in_cksum/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/in_cksum/ > head/contrib/netbsd-tests/net/mcast/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/mcast/ > head/contrib/netbsd-tests/net/mpls/t_mpls_fw6.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/mpls/t_mpls_fw6.sh > head/contrib/netbsd-tests/net/mpls/t_mpls_fw64.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/mpls/t_mpls_fw64.sh > head/contrib/netbsd-tests/net/ndp/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/ndp/ > head/contrib/netbsd-tests/net/net/t_forwarding.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/net/t_forwarding.sh > head/contrib/netbsd-tests/net/net/t_ipaddress.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/net/t_ipaddress.sh > head/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh > head/contrib/netbsd-tests/net/net/t_ipv6address.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/net/t_ipv6address.sh > head/contrib/netbsd-tests/net/route/t_flags.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/route/t_flags.sh > head/contrib/netbsd-tests/net/route/t_flags6.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/route/t_flags6.sh > head/contrib/netbsd-tests/net/route/t_route.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/net/route/t_route.sh > head/contrib/netbsd-tests/sbin/gpt/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sbin/gpt/ > head/contrib/netbsd-tests/sbin/resize_ffs/t_check.sh > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sbin/resize_ffs/t_check.sh > head/contrib/netbsd-tests/sys/net/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sys/net/ > head/contrib/netbsd-tests/sys/netatalk/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sys/netatalk/ > head/contrib/netbsd-tests/sys/netinet/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sys/netinet/ > head/contrib/netbsd-tests/sys/netinet6/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/sys/netinet6/ > head/contrib/netbsd-tests/usr.bin/config/d_min > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/config/d_min > head/contrib/netbsd-tests/usr.bin/gdb/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/gdb/ > head/contrib/netbsd-tests/usr.bin/ld/ > - copied from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/ld/ > head/contrib/netbsd-tests/usr.bin/netpgpverify/Testspec > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/netpgpverify/Testspec > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_ > compound_literal_comma.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c > head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c > head/lib/libc/tests/stdio/open_memstream2_test.c > - copied unchanged from r305318, projects/netbsd-tests-update- > 12/lib/libc/tests/stdio/open_memstream2_test.c > Deleted: > head/contrib/netbsd-tests/bin/sh/t_compexit.sh > head/contrib/netbsd-tests/fs/nfs/nfsservice/mountd.c > head/contrib/netbsd-tests/fs/nfs/nfsservice/nfsd.c > head/lib/libc/tests/stdio/open_memstream_test.c > Modified: > head/bin/cat/tests/Makefile > head/contrib/netbsd-tests/bin/cat/d_align.in > head/contrib/netbsd-tests/bin/cat/d_align.out > head/contrib/netbsd-tests/bin/cat/t_cat.sh > head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command > head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh > head/contrib/netbsd-tests/bin/sh/t_evaltested.sh > head/contrib/netbsd-tests/bin/sh/t_exit.sh > head/contrib/netbsd-tests/bin/sh/t_expand.sh > head/contrib/netbsd-tests/bin/sh/t_fsplit.sh > head/contrib/netbsd-tests/bin/sh/t_here.sh > head/contrib/netbsd-tests/bin/sh/t_set_e.sh > head/contrib/netbsd-tests/bin/sh/t_ulimit.sh > head/contrib/netbsd-tests/bin/sh/t_varquote.sh > head/contrib/netbsd-tests/bin/sh/t_wait.sh > head/contrib/netbsd-tests/crypto/opencrypto/t_opencrypto.sh > head/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue > head/contrib/netbsd-tests/dev/dm/h_dm.c > head/contrib/netbsd-tests/dev/sysmon/t_swsensor.sh > head/contrib/netbsd-tests/dev/sysmon/t_swwdog.c > head/contrib/netbsd-tests/fs/common/fstest_lfs.c > head/contrib/netbsd-tests/fs/common/h_fsmacros.h > head/contrib/netbsd-tests/fs/nfs/nfsservice/rumpnfsd.c > head/contrib/netbsd-tests/fs/nfs/t_rquotad.sh > head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh > head/contrib/netbsd-tests/fs/vfs/t_io.c > head/contrib/netbsd-tests/fs/vfs/t_renamerace.c > head/contrib/netbsd-tests/fs/vfs/t_unpriv.c > head/contrib/netbsd-tests/fs/vfs/t_vnops.c > head/contrib/netbsd-tests/games/t_factor.sh > head/contrib/netbsd-tests/h_macros.h > head/contrib/netbsd-tests/include/sys/t_bitops.c > head/contrib/netbsd-tests/include/sys/t_cdefs.c > head/contrib/netbsd-tests/include/sys/t_socket.c > head/contrib/netbsd-tests/include/t_paths.c > head/contrib/netbsd-tests/ipf/expected/n14 > head/contrib/netbsd-tests/ipf/expected/n14_6 > head/contrib/netbsd-tests/ipf/t_filter_parse.sh > head/contrib/netbsd-tests/ipf/t_nat_exec.sh > head/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c > head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c > head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c > head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c > head/contrib/netbsd-tests/kernel/t_rnd.c > head/contrib/netbsd-tests/lib/libbpfjit/t_bpfjit.c > head/contrib/netbsd-tests/lib/libc/arch/ia64/return_one.S > head/contrib/netbsd-tests/lib/libc/arch/powerpc/return_one.S > head/contrib/netbsd-tests/lib/libc/arch/riscv/return_one.S > head/contrib/netbsd-tests/lib/libc/db/t_db.sh > head/contrib/netbsd-tests/lib/libc/gen/execve/t_execve.c > head/contrib/netbsd-tests/lib/libc/gen/isqemu.h > head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawn.c > head/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c > head/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c > head/contrib/netbsd-tests/lib/libc/gen/t_randomid.c > head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c > head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c > head/contrib/netbsd-tests/lib/libc/gen/t_time.c > head/contrib/netbsd-tests/lib/libc/gen/t_vis.c > head/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c > head/contrib/netbsd-tests/lib/libc/net/t_servent.sh > head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c > head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c > head/contrib/netbsd-tests/lib/libc/stdlib/t_posix_memalign.c > head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c > head/contrib/netbsd-tests/lib/libc/stdlib/t_strtol.c > head/contrib/netbsd-tests/lib/libc/string/t_memset.c > head/contrib/netbsd-tests/lib/libc/sys/t_connect.c > head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c > head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c > head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c > head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c > head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c > head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c > head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c > head/contrib/netbsd-tests/lib/libc/time/t_strptime.c > head/contrib/netbsd-tests/lib/libcurses/director/testlang_parse.y > head/contrib/netbsd-tests/lib/libm/t_exp.c > head/contrib/netbsd-tests/lib/libm/t_fmod.c > head/contrib/netbsd-tests/lib/libm/t_log.c > head/contrib/netbsd-tests/lib/libm/t_pow.c > head/contrib/netbsd-tests/lib/libpthread/t_cond.c > head/contrib/netbsd-tests/lib/libpthread/t_mutex.c > head/contrib/netbsd-tests/lib/libpthread/t_rwlock.c > head/contrib/netbsd-tests/lib/librumpclient/t_exec.sh > head/contrib/netbsd-tests/lib/librumpclient/t_fd.c > head/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh > head/contrib/netbsd-tests/lib/libutil/t_parsedate.c > head/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c > head/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c > head/contrib/netbsd-tests/net/icmp/t_forward.c > head/contrib/netbsd-tests/net/icmp/t_ping.c > head/contrib/netbsd-tests/net/icmp/t_ping2.sh > head/contrib/netbsd-tests/net/if_bridge/t_bridge.sh > head/contrib/netbsd-tests/net/mpls/t_ldp_regen.sh > head/contrib/netbsd-tests/net/mpls/t_mpls_fw.sh > head/contrib/netbsd-tests/net/mpls/t_rfc4182.sh > head/contrib/netbsd-tests/net/net/t_tcp.c > head/contrib/netbsd-tests/net/route/t_change.sh > head/contrib/netbsd-tests/rump/modautoload/t_modautoload.c > head/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c > head/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c > head/contrib/netbsd-tests/rump/rumpkern/t_sp.sh > head/contrib/netbsd-tests/rump/rumpnet/t_shmif.sh > head/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c > head/contrib/netbsd-tests/sbin/resize_ffs/common.sh > head/contrib/netbsd-tests/sbin/resize_ffs/t_grow.sh > head/contrib/netbsd-tests/sbin/resize_ffs/t_grow_swapped.sh > head/contrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh > head/contrib/netbsd-tests/sbin/resize_ffs/t_shrink_swapped.sh > head/contrib/netbsd-tests/sbin/sysctl/t_perm.sh > head/contrib/netbsd-tests/share/mk/t_lib.sh > head/contrib/netbsd-tests/share/mk/t_prog.sh > head/contrib/netbsd-tests/share/mk/t_test.sh > head/contrib/netbsd-tests/usr.bin/cc/t_hello.sh > head/contrib/netbsd-tests/usr.bin/config/support/conf/files > head/contrib/netbsd-tests/usr.bin/config/t_config.sh > head/contrib/netbsd-tests/usr.bin/make/t_make.sh > head/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh > head/contrib/netbsd-tests/usr.bin/sed/t_sed.sh > head/contrib/netbsd-tests/usr.bin/sort/d_any_char_dflag_out.txt > (contents, props changed) > head/contrib/netbsd-tests/usr.bin/sort/d_any_char_fflag_out.txt > (contents, props changed) > head/contrib/netbsd-tests/usr.bin/sort/d_any_char_iflag_out.txt > (contents, props changed) > head/contrib/netbsd-tests/usr.sbin/traceroute/t_traceroute.sh > head/lib/libc/tests/db/Makefile > head/lib/libc/tests/hash/Makefile > head/lib/libc/tests/inet/Makefile > head/lib/libc/tests/stdio/Makefile > head/lib/libc/tests/stdlib/Makefile > head/lib/libc/tests/sys/Makefile > head/lib/msun/tests/Makefile > Directory Properties: > head/ (props changed) > head/contrib/netbsd-tests/ (props changed) > > Modified: head/bin/cat/tests/Makefile > ============================================================ > ================== > --- head/bin/cat/tests/Makefile Sat Sep 3 17:59:46 2016 (r305357) > +++ head/bin/cat/tests/Makefile Sat Sep 3 18:11:48 2016 (r305358) > @@ -6,7 +6,15 @@ NETBSD_ATF_TESTS_SH= cat_test > > ${PACKAGE}FILES+= d_align.in > ${PACKAGE}FILES+= d_align.out > +${PACKAGE}FILES+= d_se_output.in > +${PACKAGE}FILES+= d_se_output.out > > .include > > +d_align.out: ${TESTSRC}/d_align.out > + sed -E -e 's,^[[:space:]]{7}\$$$$,\$$,' < ${.ALLSRC} > > ${.TARGET}.tmp > + mv ${.TARGET}.tmp ${.TARGET} > + > +CLEANFILES+= d_align.out d_align.out.tmp > + > .include > > Modified: head/contrib/netbsd-tests/bin/cat/d_align.in > ============================================================ > ================== > --- head/contrib/netbsd-tests/bin/cat/d_align.in Sat Sep 3 > 17:59:46 2016 (r305357) > +++ head/contrib/netbsd-tests/bin/cat/d_align.in Sat Sep 3 > 18:11:48 2016 (r305358) > @@ -1,3 +1,5 @@ > a b c > + > 1 2 3 > + > x y z > > Modified: head/contrib/netbsd-tests/bin/cat/d_align.out > ============================================================ > ================== > --- head/contrib/netbsd-tests/bin/cat/d_align.out Sat Sep 3 > 17:59:46 2016 (r305357) > +++ head/contrib/netbsd-tests/bin/cat/d_align.out Sat Sep 3 > 18:11:48 2016 (r305358) > @@ -1,3 +1,5 @@ > 1 a b c$ > + $ > 2 1 2 3$ > + $ > 3 x y z$ > > Copied: head/contrib/netbsd-tests/bin/cat/d_se_output.in (from r305318, > projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/ > d_se_output.in) > ============================================================ > ================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/contrib/netbsd-tests/bin/cat/d_se_output.in Sat Sep 3 > 18:11:48 2016 (r305358, copy of r305318, > projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/ > d_se_output.in) > @@ -0,0 +1,3 @@ > + > +Of course it runs NetBSD > + > > Copied: head/contrib/netbsd-tests/bin/cat/d_se_output.out (from r305318, > projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/ > cat/d_se_output.out) > ============================================================ > ================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/contrib/netbsd-tests/bin/cat/d_se_output.out Sat Sep 3 > 18:11:48 2016 (r305358, copy of r305318, > projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/ > cat/d_se_output.out) > @@ -0,0 +1,3 @@ > +$ > +Of course it runs NetBSD$ > +$ > > Modified: head/contrib/netbsd-tests/bin/cat/t_cat.sh > ============================================================ > ================== > --- head/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Sep 3 17:59:46 2016 > (r305357) > +++ head/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Sep 3 18:11:48 2016 > (r305358) > @@ -1,4 +1,4 @@ > -# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $ > +# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $ > # > # Copyright (c) 2012 The NetBSD Foundation, Inc. > # All rights reserved. > @@ -52,8 +52,20 @@ nonexistent_body() { > -x "cat /some/name/that/does/not/exist" > } > > +atf_test_case se_output > +se_output_head() { > + atf_set "descr" "Test that cat(1) prints a $ sign " \ > + "on blank lines with options '-se' (PR bin/51250)" > +} > + > +se_output_body() { > + atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \ > + -x "cat -se $(atf_get_srcdir)/d_se_output.in" > +} > + > atf_init_test_cases() > { > atf_add_test_case align > atf_add_test_case nonexistent > + atf_add_test_case se_output > } > > Modified: head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command > ============================================================ > ================== > --- head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Sep > 3 17:59:46 2016 (r305357) > +++ head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Sep > 3 18:11:48 2016 (r305358) > @@ -1,6 +1,6 @@ > #!/bin/sh > # > -# $NetBSD: scoped_command,v 1.1 2014/05/31 14:29:06 christos Exp $ > +# $NetBSD: scoped_command,v 1.2 2016/03/27 14:57:50 christos Exp $ > # > # Copyright (c) 2014 The NetBSD Foundation, Inc. > # All rights reserved. > @@ -30,6 +30,27 @@ > # POSSIBILITY OF SUCH DAMAGE. > # > > +: ${TEST_SH:=/bin/sh} > + > +sane_sh() > +{ > + set -- ${TEST_SH} > + case "$#" in > + (0) set /bin/sh;; > + (1|2) ;; > + (*) set "$1";; # Just ignore options if we cannot make them > work > + esac > + > + case "$1" in > + /*) TEST_SH="$1${2+ }$2";; > + ./*) TEST_SH="${PWD}${1#.}${2+ }$2";; > + */*) TEST_SH="${PWD}/$1${2+ }$2";; > + *) TEST_SH="$( command -v "$1" )${2+ }$2";; > + esac > +} > + > +sane_sh > + > set -e > > # USAGE: > @@ -52,7 +73,7 @@ cmd="echo 'before ${3}' > ${2} > echo 'after ${3}, return value:' ${?}" > > -echo "#!/bin/sh" > +echo "#!${TEST_SH}" > > [ 'func' = "${1}" ] && cat < func() > > Modified: head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh > ============================================================ > ================== > --- head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh Sat Sep 3 > 17:59:46 2016 (r305357) > +++ head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh Sat Sep 3 > 18:11:48 2016 (r305358) > @@ -1,4 +1,4 @@ > -# $NetBSD: t_dotcmd.sh,v 1.1 2014/05/31 14:29:06 christos Exp $ > +# $NetBSD: t_dotcmd.sh,v 1.2 2016/03/27 14:57:50 christos Exp $ > # > # Copyright (c) 2014 The NetBSD Foundation, Inc. > # All rights reserved. > @@ -33,6 +33,10 @@ > # in C/C++ so, for example, if the dotcmd is in a loop's body, a break in > # the sourced file can be used to break out of that loop. > > +# Note that the standard does not require this, and allows lexically > +# scoped interpretation of break/continue (and permits dynamic scope > +# as an optional extension.) > + > cmds='return break continue' > scopes='case compound file for func subshell until while' > > > Copied: head/contrib/netbsd-tests/bin/sh/t_arith.sh (from r305318, > projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_arith.sh) > ============================================================ > ================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/contrib/netbsd-tests/bin/sh/t_arith.sh Sat Sep 3 18:11:48 2016 > (r305358, copy of r305318, projects/netbsd-tests-update- > 12/contrib/netbsd-tests/bin/sh/t_arith.sh) > @@ -0,0 +1,1035 @@ > +# $NetBSD: t_arith.sh,v 1.5 2016/05/12 14:25:11 kre Exp $ > +# > +# Copyright (c) 2016 The NetBSD Foundation, Inc. > +# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. > +# > +# the implementation of "sh" to test > +: ${TEST_SH:="/bin/sh"} > + > +# Requirement is to support at least "signed long" whatever that means > +# (number of bits in "long" is not specified - but should be at least 32). > + > +# These tests use -o inline:"..." rather than -o match:'...' as we have > +# only digits to examine, and it is good to be sure that 1 + 1 really > gives 2 > +# and that 42 or 123 don't look like success because there is a 2 in them. > + > +ARITH_BITS='?' > +discover_range() > +{ > + # cannot use arithmetic "test" operators, range of test in > + # ATF_SHELL (or even TEST_SH) might not be as big as that > + # supported by $(( )) in TEST_SH > + > + if ! ${TEST_SH} -c ': $(( 0x10000 ))' 2>/dev/null > + then > + # 16 bits or less, or hex unsupported, just give up... > + return > + fi > + test $( ${TEST_SH} -c 'echo $(( 0x1FFFF ))' ) = 131071 || return > + > + # when attempting to exceed the number of available bits > + # the shell may react in any of 3 (rational) ways > + # 1. syntax error (maybe even core dump...) and fail > + # 2. represent a positive number input as negative value > + # 3. keep the number positive, but not the value expected > + # (perhaps pegged at the max possible value) > + # any of those may be accompanied by a message to stderr > + > + # Must check all 3 possibilities for each plausible size > + # Tests do not use 0x8000... because that value can have weird > + # other side effects that are not relevant to discover here. > + # But we do want to try and force the sign bit set. > + > + if ! ${TEST_SH} -c ': $(( 0xC0000000 ))' 2>/dev/null > + then > + # proobably shell detected overflow and complained > + ARITH_BITS=32 > + return > + fi > + if ${TEST_SH} 2>/dev/null \ > + -c 'case $(( 0xC0000000 )); in (-*) exit 0;; esac; exit 1' > + then > + ARITH_BITS=32 > + return > + fi > + if ${TEST_SH} -c '[ $(( 0xC0000000 )) != 3221225472 ]' 2>/dev/null > + then > + ARITH_BITS=32 > + return > + fi > + > + if ! ${TEST_SH} -c ': $(( 0xC000000000000000 ))' 2>/dev/null > + then > + ARITH_BITS=64 > + return > + fi > + if ${TEST_SH} 2>/dev/null \ > + -c 'case $(( 0xC000000000000000 )); in (-*) exit 0;; esac; > exit 1' > + then > + ARITH_BITS=64 > + return > + fi > + if ${TEST_SH} 2>/dev/null \ > + -c '[ $((0xC000000000000000)) != 13835058055282163712 ]' > + then > + ARITH_BITS=64 > + return > + fi > + > + if ${TEST_SH} 2>/dev/null -c \ > + '[ $((0x123456781234567812345678)) = > 5634002657842756053938493048 ]' > + then > + # just assume... (for now anyway, revisit when it > happens...) > + ARITH_BITS=96 > + return > + fi > +} > + > +atf_test_case constants > +constants_head() > +{ > + atf_set "descr" "Tests that arithmetic expansion can handle > constants" > +} > +constants_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $((0x0))' > + > + # atf_expect_fail "PR bin/50959" > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $((0X0))' > + # atf_expect_pass > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $((000))' > + > + atf_check -s exit:0 -o inline:'1\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 000000001 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 0x000000 ))' > + > + atf_check -s exit:0 -o inline:'99999\n' -e empty \ > + ${TEST_SH} -c 'echo $((99999))' > + > + [ ${ARITH_BITS} -gt 44 ] && > + atf_check -s exit:0 -o inline:'9191919191919\n' -e empty \ > + ${TEST_SH} -c 'echo $((9191919191919))' > + > + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xD ))' > + atf_check -s exit:0 -o inline:'11\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 013 ))' > + atf_check -s exit:0 -o inline:'7\n' -e empty ${TEST_SH} -c \ > + 'x=7;echo $(($x))' > + atf_check -s exit:0 -o inline:'9\n' -e empty ${TEST_SH} -c \ > + 'x=9;echo $((x))' > + > + atf_check -s exit:0 -o inline:'11\n' -e empty \ > + ${TEST_SH} -c 'x=0xB; echo $(( $x ))' > + atf_check -s exit:0 -o inline:'27\n' -e empty \ > + ${TEST_SH} -c 'x=0X1B; echo $(( x ))' > + atf_check -s exit:0 -o inline:'27\n' -e empty \ > + ${TEST_SH} -c 'X=033; echo $(( $X ))' > + atf_check -s exit:0 -o inline:'219\n' -e empty \ > + ${TEST_SH} -c 'X=0333; echo $(( X ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty \ > + ${TEST_SH} -c 'NULL=; echo $(( NULL ))' > + > + # Not clear if this is 0, nothing, or an error, so omit for now > + # atf_check -s exit:0 -o inline:'0\n' -e empty \ > + # ${TEST_SH} -c 'echo $(( ))' > + > + # not clear whether this should return 0 or an error, so omit for > now > + # atf_check -s exit:0 -o inline:'0\n' -e empty \ > + # ${TEST_SH} -c 'echo $(( UNDEFINED_VAR ))' > +} > + > + > +atf_test_case do_unary_plus > +do_unary_plus_head() > +{ > + atf_set "descr" "Tests that unary plus works as expected" > +} > +do_unary_plus_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( +0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( +1 ))' > + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ > + 'echo $(( + 6 ))' > + atf_check -s exit:0 -o inline:'4321\n' -e empty ${TEST_SH} -c \ > + 'echo $(( + 4321 ))' > + atf_check -s exit:0 -o inline:'17185\n' -e empty ${TEST_SH} -c \ > + 'echo $(( + 0x4321 ))' > +} > + > +atf_test_case do_unary_minus > +do_unary_minus_head() > +{ > + atf_set "descr" "Tests that unary minus works as expected" > +} > +do_unary_minus_body() > +{ > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( - 0 ))' > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( - 1 ))' > + atf_check -s exit:0 -o inline:'-6\n' -e empty ${TEST_SH} -c \ > + 'echo $(( - 6 ))' > + atf_check -s exit:0 -o inline:'-4321\n' -e empty ${TEST_SH} -c \ > + 'echo $(( - 4321 ))' > + atf_check -s exit:0 -o inline:'-2257\n' -e empty ${TEST_SH} -c \ > + 'echo $(( - 04321 ))' > + atf_check -s exit:0 -o inline:'-7\n' -e empty ${TEST_SH} -c \ > + 'echo $((-7))' > +} > + > +atf_test_case do_unary_not > +do_unary_not_head() > +{ > + atf_set "descr" "Tests that unary not (boolean) works as expected" > +} > +do_unary_not_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ! 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ! 0 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( !1234 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( !0xFFFF ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ! 000000 ))' > +} > + > +atf_test_case do_unary_tilde > +do_unary_tilde_head() > +{ > + atf_set "descr" "Tests that unary not (bitwise) works as expected" > +} > +do_unary_tilde_body() > +{ > + # definitely 2's complement arithmetic here... > + > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ~ 0 ))' > + atf_check -s exit:0 -o inline:'-2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ~ 1 ))' > + > + atf_check -s exit:0 -o inline:'-1235\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ~1234 ))' > + atf_check -s exit:0 -o inline:'-256\n' -e empty ${TEST_SH} -c \ > + 'echo $(( ~0xFF ))' > +} > + > +atf_test_case elementary_add > +elementary_add_head() > +{ > + atf_set "descr" "Tests that simple addition works as expected" > +} > +elementary_add_body() > +{ > + # some of these tests actually test unary ops & op precedence... > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 + 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 + 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 + 1 ))' > + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 + 1 ))' > + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 4 + 6 ))' > + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 6 + 4 ))' > + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1234 + 4321 ))' > + atf_check -s exit:0 -o inline:'3333\n' -e empty ${TEST_SH} -c \ > + 'echo $((1111+2222))' > + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ > + 'echo $((+3333+2222))' > + atf_check -s exit:0 -o inline:'7777\n' -e empty ${TEST_SH} -c \ > + 'echo $((+3333 + +4444))' > + atf_check -s exit:0 -o inline:'-7777\n' -e empty ${TEST_SH} -c \ > + 'echo -$((+4125+ +3652))' > +} > + > +atf_test_case elementary_sub > +elementary_sub_head() > +{ > + atf_set "descr" "Tests that simple subtraction works as expected" > +} > +elementary_sub_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 - 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 - 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 - 1 ))' > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 - 1 ))' > + atf_check -s exit:0 -o inline:'488\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1066 - 578 ))' > + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2016-5678 ))' > + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2016+-5678 ))' > + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2016-+5678 ))' > + atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -2016-5678 ))' > + atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \ > + 'echo -$(( -1018 - -1017 ))' > +} > + > +atf_test_case elementary_mul > +elementary_mul_head() > +{ > + atf_set "descr" "Tests that simple multiplication works as > expected" > +} > +elementary_mul_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 * 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 * 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 * 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 * 1 ))' > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 * 1 ))' > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 * -1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 * -1 ))' > + atf_check -s exit:0 -o inline:'391\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 17 * 23 ))' > + atf_check -s exit:0 -o inline:'169\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 13*13 ))' > + atf_check -s exit:0 -o inline:'-11264\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -11 *1024 ))' > + atf_check -s exit:0 -o inline:'-16983\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 17* -999 ))' > + atf_check -s exit:0 -o inline:'9309\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -29*-321 ))' > +} > + > +atf_test_case elementary_div > +elementary_div_head() > +{ > + atf_set "descr" "Tests that simple division works as expected" > +} > +elementary_div_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 / 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 / 1 ))' > + test ${ARITH_BITS} -ge 38 && > + atf_check -s exit:0 -o inline:'99999999999\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 99999999999 / 1 ))' > + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 / 1 ))' > + > + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 / 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 / 2 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 / 3 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 / 4 ))' > + > + atf_check -s exit:0 -o inline:'173\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 123456 / 713 ))' > + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 169 / 13 ))' > +} > + > +atf_test_case elementary_rem > +elementary_rem_head() > +{ > + atf_set "descr" "Tests that simple modulus works as expected" > +} > +elementary_rem_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 % 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 % 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 % 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 9999 % 1 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 % 2 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 % 2 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 % 2 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xFFFF % 2 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 % 3 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 % 3 ))' > + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 % 3 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 % 3 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3123 % 3 ))' > + > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 9999 % 2 ))' > + > + atf_check -s exit:0 -o inline:'107\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 123456%173 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $((169%13))' > +} > + > +atf_test_case elementary_shl > +elementary_shl_head() > +{ > + atf_set "descr" "Tests that simple shift left works as expected" > +} > +elementary_shl_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 << 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 << 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 << 17 ))' > + > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 << 0 ))' > + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 << 1 ))' > + atf_check -s exit:0 -o inline:'131072\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 << 17 ))' > + > + atf_check -s exit:0 -o inline:'2021161080\n' -e empty ${TEST_SH} > -c \ > + 'echo $(( 0x3C3C3C3C << 1 ))' > + > + test "${ARITH_BITS}" -ge 40 && > + atf_check -s exit:0 -o inline:'129354309120\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 7 ))' > + test "${ARITH_BITS}" -ge 72 && > + atf_check -s exit:0 -o inline:'1111145054534149079040\n' \ > + -e empty ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 40 ))' > + > + return 0 > +} > + > +atf_test_case elementary_shr > +elementary_shr_head() > +{ > + atf_set "descr" "Tests that simple shift right works as expected" > +} > +elementary_shr_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 >> 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 >> 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 >> 17 ))' > + > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 >> 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 >> 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 >> 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 >> 1 ))' > + > + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x10 >> 2 ))' > + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 022 >> 2 ))' > + > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 131072 >> 17 ))' > + > + test ${ARITH_BITS} -ge 40 && > + atf_check -s exit:0 -o inline:'8\n' -e empty ${TEST_SH} -c > \ > + 'echo $(( 0x4000000000 >> 35 ))' > + test ${ARITH_BITS} -ge 80 && > + atf_check -s exit:0 -o inline:'4464\n' -e empty ${TEST_SH} > -c \ > + 'echo $(( 0x93400FACE005C871000 >> 64 ))' > + > + return 0 > +} > + > +atf_test_case elementary_eq > +elementary_eq_head() > +{ > + atf_set "descr" "Tests that simple equality test works as > expected" > +} > +elementary_eq_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 0000 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 0x00 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 == 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'X=30; Y=0x1E; echo $(( X == Y ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1234 == 4660 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1234 == 011064 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 0000000000000001 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 == 0x10000000000000 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 == 2 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'X=3; Y=7; echo $(( X == Y ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1234 == 0x4660 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 01234 == 0x11064 ))' > +} > +atf_test_case elementary_ne > +elementary_ne_head() > +{ > + atf_set "descr" "Tests that simple inequality test works as > expected" > +} > +elementary_ne_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 != 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x71 != 17 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1234 != 01234 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1234 != 01234 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'X=3; echo $(( X != 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'X=3; Y=0x11; echo $(( X != Y ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 3 != 3 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 != 0x0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xA != 012 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'X=1; echo $(( X != 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'X=0xC; Y=014; echo $(( X != Y ))' > +} > +atf_test_case elementary_lt > +elementary_lt_head() > +{ > + atf_set "descr" "Tests that simple less than test works as > expected" > +} > +elementary_lt_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 < 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 < 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 < 10 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 100 < 101 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xA1 < 200 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 < 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 < 0 ))' > + > + test ${ARITH_BITS} -ge 40 && > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1BEEFF00D < 0x1FACECAFE ))' > + > + return 0 > +} > +atf_test_case elementary_le > +elementary_le_head() > +{ > + atf_set "descr" "Tests that simple less or equal test works as > expected" > +} > +elementary_le_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 <= 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 <= 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 <= 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 <= 10 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 100 <= 101 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xA1 <= 161 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 <= 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -100 <= -200 ))' > + > + test ${ARITH_BITS} -ge 40 && > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'cost=; AUD=; echo $(( $cost 0x2FEEDBABE <= $AUD > 12866927294 ))' > + > + return 0 > +} > +atf_test_case elementary_gt > +elementary_gt_head() > +{ > + atf_set "descr" "Tests that simple greater than works as expected" > +} > +elementary_gt_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 > 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 > -1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 11 > 012 ))' > + > + # atf_expect_fail "PR bin/50959" > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2147483647 > 0X7FFFFF0 ))' > + # atf_expect_pass > + > + test ${ARITH_BITS} -gt 32 && > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x80000000 > 0x7FFFFFFF ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 > 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 > 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 > 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 > 10 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2015 > 2016 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xA1 > 200 ))' > + > + test ${ARITH_BITS} -ge 44 && > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x7F07F07F0 > 34099628014 ))' > + > + return 0 > +} > +atf_test_case elementary_ge > +elementary_ge_head() > +{ > + atf_set "descr" "Tests that simple greater or equal works as > expected" > +} > +elementary_ge_body() > +{ > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 >= 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 >= 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -100 >= -101 ))' > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( -1 >= 0 ))' > +} > + > +atf_test_case fiddle_bits_and > +fiddle_bits_and_head() > +{ > + atf_set "descr" "Test bitwise and operations in arithmetic > expressions" > +} > +fiddle_bits_and_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 & 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 & 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 & 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 & 1 ))' > + > + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xFF & 0xFF ))' > + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xFFFF & 0377 ))' > + > + test "${ARITH_BITS}" -ge 48 && > + atf_check -s exit:0 -o inline:'70377641607203\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 & 0x42871357BAB3 ))' > + > + return 0 > +} > +atf_test_case fiddle_bits_or > +fiddle_bits_or_head() > +{ > + atf_set "descr" "Test bitwise or operations in arithmetic > expressions" > +} > +fiddle_bits_or_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 | 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 | 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 | 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 | 1 ))' > + > + atf_check -s exit:0 -o inline:'4369\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1111 | 0x1111 ))' > + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xAA | 0125 ))' > + > + test "${ARITH_BITS}" -ge 48 && > + atf_check -s exit:0 -o inline:'95348271856563\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 | 0x42871357BAB3 ))' > + > + return 0 > +} > +atf_test_case fiddle_bits_xor > +fiddle_bits_xor_head() > +{ > + atf_set "descr" "Test bitwise xor operations in arithmetic > expressions" > +} > +fiddle_bits_xor_body() > +{ > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 ^ 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 ^ 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 ^ 1 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 ^ 1 ))' > + > + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xF0 ^ 0x0F ))' > + atf_check -s exit:0 -o inline:'15\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xF0 ^ 0xFF ))' > + > + test "${ARITH_BITS}" -ge 48 && > + atf_check -s exit:0 -o inline:'24970630249360\n' -e empty \ > + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 ^ 0x42871357BAB3 ))' > + > + return 0 > +} > + > +atf_test_case logical_and > +logical_and_head() > +{ > + atf_set "descr" "Test logical and operations in arithmetic > expressions" > +} > +logical_and_body() > +{ > + # cannot test short-circuit eval until sh implements side > effects... > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 && 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 && 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 && 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 && 1 ))' > + > + # atf_expect_fail "PR bin/50960" > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1111 && 01234 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0xFFFF && 0xF0F0 ))' > +} > +atf_test_case logical_or > +logical_or_head() > +{ > + atf_set "descr" "Test logical or operations in arithmetic > expressions" > +} > +logical_or_body() > +{ > + # cannot test short-circuit eval until sh implements side > effects... > + > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 || 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 || 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 || 1 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 || 1 ))' > + > + # atf_expect_fail "PR bin/50960" > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1111 || 01234 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x33 || 0xF0F0 ))' > +} > + > +atf_test_case make_selection > +make_selection_head() > +{ > + atf_set "descr" "Test ?: operator in arithmetic expressions" > +} > +make_selection_body() > +{ > + # atf_expect_fail "PR bin/50958" > + > + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0 ? 2 : 3 ))' > + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 ? 2 : 3 ))' > + > + atf_check -s exit:0 -o inline:'111\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 0x1234 ? 111 : 222 ))' > + > + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 < 2 ? -1 : 1 > 2 ? 1 : 0 ))' > + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 < 1 ? -1 : 1 > 1 ? 1 : 0 ))' > + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 2 < 1 ? -1 : 2 > 1 ? 1 : 0 ))' > +} > + > +atf_test_case operator_precedence > +operator_precedence_head() > +{ > + atf_set "descr" "Test operator precedence without parentheses" > +} > +operator_precedence_body() > +{ > + # NB: apart from $(( )) ** NO ** parentheses in the expressions. > + > + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ > + 'echo $(( 1 + 2 + 3 ))' > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > From owner-svn-src-head@freebsd.org Mon Sep 5 03:18: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 05BC6AC45E1; Mon, 5 Sep 2016 03:18:55 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::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 BB3F9C03; Mon, 5 Sep 2016 03:18:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id p64so60496071pfb.1; Sun, 04 Sep 2016 20:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AuuE6IaBJo/BQsHSuaDMzZfWIV2Tibu+IiUU7yOsfuM=; b=muIj79vMfthOMZ6FLooW8oYUkgZTsIdV03YsIZhFQTagAgIUSsf8vFKaEZeFTghxdv tTtDItBg/M3ikAHKDqvnqpi2JkxrxmlZAsE9b6eX7Jx/KWQwnfLrW4plisl/mFgQu1au igfPb7jHavO+E6ceK/rYSYgZyqUc08zj1kdlrv/d4OBbI9n1zuBllkuBjg4bu5yFsuhv QtwIA14fVcyNQlg6gClHSJbqGU4+5z+jIIdGL9gwSzUMrV/LBSTjlR8K11cBiFYtpGaV nlfxE056dNdmRnQ030eC/YbdtDkkYva/fReZPi8CErR4XxallBb4dDHrMgU9z45zn1Ig 2SUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AuuE6IaBJo/BQsHSuaDMzZfWIV2Tibu+IiUU7yOsfuM=; b=aPM+j6OmQJzE63ujouDyt7sm+PYfXN9AnJBB6icFADUKbQV7vQTYIgYSfpWQlsdwwn bbK4HkufvPFAHjxYG+yEadi5VHna/FGNLpfHTSq2fW/xa3q0/QB2PTfxJlwocVmg2mKk RhNzJH2QXf3qcHGtOaB3j1Q1UOcHQO399sr1R3uXuDYk0vnyKNtmn77AqVLvbSK3urKd gcpRIo8v4D+/VDyIGiOosbV1HrFqQGAOB00WC76bZiYbQszGJ35/X8GE2yRpyLePMAmZ opO65MGsae8cNEymrWxPm2nBVHoJbFaknZisKXw2CEqjj9ccxrGM13kpMCG7JwdJ+gpU 3u/w== X-Gm-Message-State: AE9vXwN2GXAI1U6DRBr7C9hHxB2EHrveYxBz3jwe4RYRjFLl86B/hTEFi8MdRCE/aX5fqw== X-Received: by 10.98.64.93 with SMTP id n90mr59859111pfa.29.1473045533433; Sun, 04 Sep 2016 20:18:53 -0700 (PDT) Received: from [21.180.225.16] ([172.56.42.239]) by smtp.gmail.com with ESMTPSA id w76sm29808747pfd.69.2016.09.04.20.18.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Sep 2016 20:18:48 -0700 (PDT) Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r305358 - in head: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencrypto ... From: Ngie Cooper X-Mailer: iPhone Mail (13G36) In-Reply-To: Date: Sun, 4 Sep 2016 20:18:44 -0700 Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , "freebsd-testing@freebsd.org" Message-Id: References: <201609031811.u83IBnmt080798@repo.freebsd.org> To: Craig Rodrigues Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 03:18:55 -0000 > On Sep 4, 2016, at 19:24, Craig Rodrigues wrote: >=20 > Hi, >=20 > The tests in libc are broken after this commit. > lib/libc/test/db/Makefile defines "PROGS =3D h_lfsr" > but the test is trying to execute a binary "h_db" > which no longer exists. >=20 > Can you fix this? >=20 > Thanks. There's also the lib/libc/rpc tests that assume that rpcbind is up and runni= ng. I ran into this on some of my systems that didn't run rpcbind -- I was h= oping it had been started with the bhyve slaves but that doesn't seem to be t= he case. Thanks for the note.. I'll probably get to it tomorrow. Cheers! -Ngie >=20 >=20 >> On Sat, Sep 3, 2016 at 11:11 AM, Ngie Cooper wrote: >> Author: ngie >> Date: Sat Sep 3 18:11:48 2016 >> New Revision: 305358 >> URL: https://svnweb.freebsd.org/changeset/base/305358 >>=20 >> Log: >> Update contrib/netbsd-tests with new content from NetBSD >>=20 >> This updates the snapshot from 09/30/2014 to 08/11/2016 >>=20 >> This brings in a number of new testcases from upstream, most >> notably: >>=20 >> - bin/cat >> - lib/libc >> - lib/msun >> - lib/libthr >> - usr.bin/sort >>=20 >> lib/libc/tests/stdio/open_memstream_test.c was moved to >> lib/libc/tests/stdio/open_memstream2_test.c to accomodate >> the new open_memstream test from NetBSD. >>=20 >> MFC after: 2 months >> Tested on: amd64 (VMware fusion VM; various bare metal platforms); i= 386 (VMware fusion VM); make tinderbox >> Sponsored by: EMC / Isilon Storage Division >>=20 >> Added: >> head/contrib/netbsd-tests/bin/cat/d_se_output.in >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/cat/d_se_output.in >> head/contrib/netbsd-tests/bin/cat/d_se_output.out >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/cat/d_se_output.out >> head/contrib/netbsd-tests/bin/sh/t_arith.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_arith.sh >> head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_cmdsub.sh >> head/contrib/netbsd-tests/bin/sh/t_option.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_option.sh >> head/contrib/netbsd-tests/bin/sh/t_redir.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_redir.sh >> head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_redircloexec.sh >> head/contrib/netbsd-tests/bin/sh/t_shift.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_shift.sh >> head/contrib/netbsd-tests/bin/sh/t_varval.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/bin/sh/t_varval.sh >> head/contrib/netbsd-tests/dev/fss/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/dev/fss/ >> head/contrib/netbsd-tests/dev/usb/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/dev/usb/ >> head/contrib/netbsd-tests/include/sys/t_pslist.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/include/sys/t_pslist.c >> head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/kernel/kqueue/t_vnode.c >> head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/db/h_lfsr.c >> head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/db/t_db_hash_seq.c >> head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/inet/t_inet_addr.c >> head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/stdio/t_open_memstream.c >> head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/stdlib/t_strtoi.c >> head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc >> head/contrib/netbsd-tests/lib/libc/sys/t_bind.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/sys/t_bind.c >> head/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/sys/t_getsockname.c >> head/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c >> head/contrib/netbsd-tests/lib/libc/sys/t_wait.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libc/sys/t_wait.c >> head/contrib/netbsd-tests/lib/libm/t_fenv.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libm/t_fenv.c >> head/contrib/netbsd-tests/lib/libm/t_hypot.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/lib/libm/t_hypot.c >> head/contrib/netbsd-tests/lib/libusbhid/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/lib/libusbhid/ >> head/contrib/netbsd-tests/net/arp/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/arp/ >> head/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/icmp/t_icmp6_redirect.sh >> head/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/icmp/t_icmp_redirect.sh >> head/contrib/netbsd-tests/net/if/ifconf.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/if/ifconf.c >> head/contrib/netbsd-tests/net/if/t_ifconf.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/if/t_ifconf.sh >> head/contrib/netbsd-tests/net/if/t_ifconfig.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/if/t_ifconfig.sh >> head/contrib/netbsd-tests/net/if_gif/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/if_gif/ >> head/contrib/netbsd-tests/net/if_pppoe/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/if_pppoe/ >> head/contrib/netbsd-tests/net/if_tap/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/if_tap/ >> head/contrib/netbsd-tests/net/in_cksum/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/in_cksum/ >> head/contrib/netbsd-tests/net/mcast/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/mcast/ >> head/contrib/netbsd-tests/net/mpls/t_mpls_fw6.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/mpls/t_mpls_fw6.sh >> head/contrib/netbsd-tests/net/mpls/t_mpls_fw64.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/mpls/t_mpls_fw64.sh >> head/contrib/netbsd-tests/net/ndp/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/net/ndp/ >> head/contrib/netbsd-tests/net/net/t_forwarding.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/net/t_forwarding.sh >> head/contrib/netbsd-tests/net/net/t_ipaddress.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/net/t_ipaddress.sh >> head/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/net/t_ipv6_lifetime.sh >> head/contrib/netbsd-tests/net/net/t_ipv6address.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/net/t_ipv6address.sh >> head/contrib/netbsd-tests/net/route/t_flags.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/route/t_flags.sh >> head/contrib/netbsd-tests/net/route/t_flags6.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/route/t_flags6.sh >> head/contrib/netbsd-tests/net/route/t_route.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/net/route/t_route.sh >> head/contrib/netbsd-tests/sbin/gpt/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/sbin/gpt/ >> head/contrib/netbsd-tests/sbin/resize_ffs/t_check.sh >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/sbin/resize_ffs/t_check.sh >> head/contrib/netbsd-tests/sys/net/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/sys/net/ >> head/contrib/netbsd-tests/sys/netatalk/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/sys/netatalk/ >> head/contrib/netbsd-tests/sys/netinet/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/sys/netinet/ >> head/contrib/netbsd-tests/sys/netinet6/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/sys/netinet6/ >> head/contrib/netbsd-tests/usr.bin/config/d_min >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/config/d_min >> head/contrib/netbsd-tests/usr.bin/gdb/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/usr.bin/gdb/ >> head/contrib/netbsd-tests/usr.bin/ld/ >> - copied from r305318, projects/netbsd-tests-update-12/contrib/netbs= d-tests/usr.bin/ld/ >> head/contrib/netbsd-tests/usr.bin/netpgpverify/Testspec >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/netpgpverify/Testspec >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_co= mma.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c= >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c >> head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/con= trib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c >> head/lib/libc/tests/stdio/open_memstream2_test.c >> - copied unchanged from r305318, projects/netbsd-tests-update-12/lib= /libc/tests/stdio/open_memstream2_test.c >> Deleted: >> head/contrib/netbsd-tests/bin/sh/t_compexit.sh >> head/contrib/netbsd-tests/fs/nfs/nfsservice/mountd.c >> head/contrib/netbsd-tests/fs/nfs/nfsservice/nfsd.c >> head/lib/libc/tests/stdio/open_memstream_test.c >> Modified: >> head/bin/cat/tests/Makefile >> head/contrib/netbsd-tests/bin/cat/d_align.in >> head/contrib/netbsd-tests/bin/cat/d_align.out >> head/contrib/netbsd-tests/bin/cat/t_cat.sh >> head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command >> head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh >> head/contrib/netbsd-tests/bin/sh/t_evaltested.sh >> head/contrib/netbsd-tests/bin/sh/t_exit.sh >> head/contrib/netbsd-tests/bin/sh/t_expand.sh >> head/contrib/netbsd-tests/bin/sh/t_fsplit.sh >> head/contrib/netbsd-tests/bin/sh/t_here.sh >> head/contrib/netbsd-tests/bin/sh/t_set_e.sh >> head/contrib/netbsd-tests/bin/sh/t_ulimit.sh >> head/contrib/netbsd-tests/bin/sh/t_varquote.sh >> head/contrib/netbsd-tests/bin/sh/t_wait.sh >> head/contrib/netbsd-tests/crypto/opencrypto/t_opencrypto.sh >> head/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue >> head/contrib/netbsd-tests/dev/dm/h_dm.c >> head/contrib/netbsd-tests/dev/sysmon/t_swsensor.sh >> head/contrib/netbsd-tests/dev/sysmon/t_swwdog.c >> head/contrib/netbsd-tests/fs/common/fstest_lfs.c >> head/contrib/netbsd-tests/fs/common/h_fsmacros.h >> head/contrib/netbsd-tests/fs/nfs/nfsservice/rumpnfsd.c >> head/contrib/netbsd-tests/fs/nfs/t_rquotad.sh >> head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh >> head/contrib/netbsd-tests/fs/vfs/t_io.c >> head/contrib/netbsd-tests/fs/vfs/t_renamerace.c >> head/contrib/netbsd-tests/fs/vfs/t_unpriv.c >> head/contrib/netbsd-tests/fs/vfs/t_vnops.c >> head/contrib/netbsd-tests/games/t_factor.sh >> head/contrib/netbsd-tests/h_macros.h >> head/contrib/netbsd-tests/include/sys/t_bitops.c >> head/contrib/netbsd-tests/include/sys/t_cdefs.c >> head/contrib/netbsd-tests/include/sys/t_socket.c >> head/contrib/netbsd-tests/include/t_paths.c >> head/contrib/netbsd-tests/ipf/expected/n14 >> head/contrib/netbsd-tests/ipf/expected/n14_6 >> head/contrib/netbsd-tests/ipf/t_filter_parse.sh >> head/contrib/netbsd-tests/ipf/t_nat_exec.sh >> head/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c >> head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c >> head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c >> head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c >> head/contrib/netbsd-tests/kernel/t_rnd.c >> head/contrib/netbsd-tests/lib/libbpfjit/t_bpfjit.c >> head/contrib/netbsd-tests/lib/libc/arch/ia64/return_one.S >> head/contrib/netbsd-tests/lib/libc/arch/powerpc/return_one.S >> head/contrib/netbsd-tests/lib/libc/arch/riscv/return_one.S >> head/contrib/netbsd-tests/lib/libc/db/t_db.sh >> head/contrib/netbsd-tests/lib/libc/gen/execve/t_execve.c >> head/contrib/netbsd-tests/lib/libc/gen/isqemu.h >> head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawn.c >> head/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c >> head/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c >> head/contrib/netbsd-tests/lib/libc/gen/t_randomid.c >> head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c >> head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c >> head/contrib/netbsd-tests/lib/libc/gen/t_time.c >> head/contrib/netbsd-tests/lib/libc/gen/t_vis.c >> head/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c >> head/contrib/netbsd-tests/lib/libc/net/t_servent.sh >> head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c >> head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c >> head/contrib/netbsd-tests/lib/libc/stdlib/t_posix_memalign.c >> head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c >> head/contrib/netbsd-tests/lib/libc/stdlib/t_strtol.c >> head/contrib/netbsd-tests/lib/libc/string/t_memset.c >> head/contrib/netbsd-tests/lib/libc/sys/t_connect.c >> head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c >> head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c >> head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c >> head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c >> head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c >> head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c >> head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c >> head/contrib/netbsd-tests/lib/libc/time/t_strptime.c >> head/contrib/netbsd-tests/lib/libcurses/director/testlang_parse.y >> head/contrib/netbsd-tests/lib/libm/t_exp.c >> head/contrib/netbsd-tests/lib/libm/t_fmod.c >> head/contrib/netbsd-tests/lib/libm/t_log.c >> head/contrib/netbsd-tests/lib/libm/t_pow.c >> head/contrib/netbsd-tests/lib/libpthread/t_cond.c >> head/contrib/netbsd-tests/lib/libpthread/t_mutex.c >> head/contrib/netbsd-tests/lib/libpthread/t_rwlock.c >> head/contrib/netbsd-tests/lib/librumpclient/t_exec.sh >> head/contrib/netbsd-tests/lib/librumpclient/t_fd.c >> head/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh >> head/contrib/netbsd-tests/lib/libutil/t_parsedate.c >> head/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c >> head/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c >> head/contrib/netbsd-tests/net/icmp/t_forward.c >> head/contrib/netbsd-tests/net/icmp/t_ping.c >> head/contrib/netbsd-tests/net/icmp/t_ping2.sh >> head/contrib/netbsd-tests/net/if_bridge/t_bridge.sh >> head/contrib/netbsd-tests/net/mpls/t_ldp_regen.sh >> head/contrib/netbsd-tests/net/mpls/t_mpls_fw.sh >> head/contrib/netbsd-tests/net/mpls/t_rfc4182.sh >> head/contrib/netbsd-tests/net/net/t_tcp.c >> head/contrib/netbsd-tests/net/route/t_change.sh >> head/contrib/netbsd-tests/rump/modautoload/t_modautoload.c >> head/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c >> head/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c >> head/contrib/netbsd-tests/rump/rumpkern/t_sp.sh >> head/contrib/netbsd-tests/rump/rumpnet/t_shmif.sh >> head/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c >> head/contrib/netbsd-tests/sbin/resize_ffs/common.sh >> head/contrib/netbsd-tests/sbin/resize_ffs/t_grow.sh >> head/contrib/netbsd-tests/sbin/resize_ffs/t_grow_swapped.sh >> head/contrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh >> head/contrib/netbsd-tests/sbin/resize_ffs/t_shrink_swapped.sh >> head/contrib/netbsd-tests/sbin/sysctl/t_perm.sh >> head/contrib/netbsd-tests/share/mk/t_lib.sh >> head/contrib/netbsd-tests/share/mk/t_prog.sh >> head/contrib/netbsd-tests/share/mk/t_test.sh >> head/contrib/netbsd-tests/usr.bin/cc/t_hello.sh >> head/contrib/netbsd-tests/usr.bin/config/support/conf/files >> head/contrib/netbsd-tests/usr.bin/config/t_config.sh >> head/contrib/netbsd-tests/usr.bin/make/t_make.sh >> head/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh >> head/contrib/netbsd-tests/usr.bin/sed/t_sed.sh >> head/contrib/netbsd-tests/usr.bin/sort/d_any_char_dflag_out.txt (cont= ents, props changed) >> head/contrib/netbsd-tests/usr.bin/sort/d_any_char_fflag_out.txt (cont= ents, props changed) >> head/contrib/netbsd-tests/usr.bin/sort/d_any_char_iflag_out.txt (cont= ents, props changed) >> head/contrib/netbsd-tests/usr.sbin/traceroute/t_traceroute.sh >> head/lib/libc/tests/db/Makefile >> head/lib/libc/tests/hash/Makefile >> head/lib/libc/tests/inet/Makefile >> head/lib/libc/tests/stdio/Makefile >> head/lib/libc/tests/stdlib/Makefile >> head/lib/libc/tests/sys/Makefile >> head/lib/msun/tests/Makefile >> Directory Properties: >> head/ (props changed) >> head/contrib/netbsd-tests/ (props changed) >>=20 >> Modified: head/bin/cat/tests/Makefile >> =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/bin/cat/tests/Makefile Sat Sep 3 17:59:46 2016 (r305357)= >> +++ head/bin/cat/tests/Makefile Sat Sep 3 18:11:48 2016 (r305358)= >> @@ -6,7 +6,15 @@ NETBSD_ATF_TESTS_SH=3D cat_test >>=20 >> ${PACKAGE}FILES+=3D d_align.in >> ${PACKAGE}FILES+=3D d_align.out >> +${PACKAGE}FILES+=3D d_se_output.in >> +${PACKAGE}FILES+=3D d_se_output.out >>=20 >> .include >>=20 >> +d_align.out: ${TESTSRC}/d_align.out >> + sed -E -e 's,^[[:space:]]{7}\$$$$,\$$,' < ${.ALLSRC} > ${.TARGET}= .tmp >> + mv ${.TARGET}.tmp ${.TARGET} >> + >> +CLEANFILES+=3D d_align.out d_align.out.tmp >> + >> .include >>=20 >> Modified: head/contrib/netbsd-tests/bin/cat/d_align.in >> =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/contrib/netbsd-tests/bin/cat/d_align.in Sat Sep 3 17:59:= 46 2016 (r305357) >> +++ head/contrib/netbsd-tests/bin/cat/d_align.in Sat Sep 3 18:11:= 48 2016 (r305358) >> @@ -1,3 +1,5 @@ >> a b c >> + >> 1 2 3 >> + >> x y z >>=20 >> Modified: head/contrib/netbsd-tests/bin/cat/d_align.out >> =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/contrib/netbsd-tests/bin/cat/d_align.out Sat Sep 3 17:59:= 46 2016 (r305357) >> +++ head/contrib/netbsd-tests/bin/cat/d_align.out Sat Sep 3 18:11:= 48 2016 (r305358) >> @@ -1,3 +1,5 @@ >> 1 a b c$ >> + $ >> 2 1 2 3$ >> + $ >> 3 x y z$ >>=20 >> Copied: head/contrib/netbsd-tests/bin/cat/d_se_output.in (from r305318, p= rojects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.in) >> =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 >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/contrib/netbsd-tests/bin/cat/d_se_output.in Sat Sep 3 18:11:= 48 2016 (r305358, copy of r305318, projects/netbsd-tests-update-12/co= ntrib/netbsd-tests/bin/cat/d_se_output.in) >> @@ -0,0 +1,3 @@ >> + >> +Of course it runs NetBSD >> + >>=20 >> Copied: head/contrib/netbsd-tests/bin/cat/d_se_output.out (from r305318, p= rojects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.out)= >> =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 >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/contrib/netbsd-tests/bin/cat/d_se_output.out Sat Sep 3 18:11:= 48 2016 (r305358, copy of r305318, projects/netbsd-tests-update-12/co= ntrib/netbsd-tests/bin/cat/d_se_output.out) >> @@ -0,0 +1,3 @@ >> +$ >> +Of course it runs NetBSD$ >> +$ >>=20 >> Modified: head/contrib/netbsd-tests/bin/cat/t_cat.sh >> =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/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Sep 3 17:59:46 2016 = (r305357) >> +++ head/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Sep 3 18:11:48 2016 = (r305358) >> @@ -1,4 +1,4 @@ >> -# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $ >> +# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $ >> # >> # Copyright (c) 2012 The NetBSD Foundation, Inc. >> # All rights reserved. >> @@ -52,8 +52,20 @@ nonexistent_body() { >> -x "cat /some/name/that/does/not/exist" >> } >>=20 >> +atf_test_case se_output >> +se_output_head() { >> + atf_set "descr" "Test that cat(1) prints a $ sign " \ >> + "on blank lines with options '-se' (PR bin/51250)= " >> +} >> + >> +se_output_body() { >> + atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \ >> + -x "cat -se $(atf_get_srcdir)/d_se_output.in" >> +} >> + >> atf_init_test_cases() >> { >> atf_add_test_case align >> atf_add_test_case nonexistent >> + atf_add_test_case se_output >> } >>=20 >> Modified: head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command >> =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/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Sep 3= 17:59:46 2016 (r305357) >> +++ head/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Sep 3= 18:11:48 2016 (r305358) >> @@ -1,6 +1,6 @@ >> #!/bin/sh >> # >> -# $NetBSD: scoped_command,v 1.1 2014/05/31 14:29:06 christos Exp $ >> +# $NetBSD: scoped_command,v 1.2 2016/03/27 14:57:50 christos Exp $ >> # >> # Copyright (c) 2014 The NetBSD Foundation, Inc. >> # All rights reserved. >> @@ -30,6 +30,27 @@ >> # POSSIBILITY OF SUCH DAMAGE. >> # >>=20 >> +: ${TEST_SH:=3D/bin/sh} >> + >> +sane_sh() >> +{ >> + set -- ${TEST_SH} >> + case "$#" in >> + (0) set /bin/sh;; >> + (1|2) ;; >> + (*) set "$1";; # Just ignore options if we cannot make them w= ork >> + esac >> + >> + case "$1" in >> + /*) TEST_SH=3D"$1${2+ }$2";; >> + ./*) TEST_SH=3D"${PWD}${1#.}${2+ }$2";; >> + */*) TEST_SH=3D"${PWD}/$1${2+ }$2";; >> + *) TEST_SH=3D"$( command -v "$1" )${2+ }$2";; >> + esac >> +} >> + >> +sane_sh >> + >> set -e >>=20 >> # USAGE: >> @@ -52,7 +73,7 @@ cmd=3D"echo 'before ${3}' >> ${2} >> echo 'after ${3}, return value:' ${?}" >>=20 >> -echo "#!/bin/sh" >> +echo "#!${TEST_SH}" >>=20 >> [ 'func' =3D "${1}" ] && cat <> func() >>=20 >> Modified: head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh >> =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/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh Sat Sep 3 17:59:= 46 2016 (r305357) >> +++ head/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh Sat Sep 3 18:11:= 48 2016 (r305358) >> @@ -1,4 +1,4 @@ >> -# $NetBSD: t_dotcmd.sh,v 1.1 2014/05/31 14:29:06 christos Exp $ >> +# $NetBSD: t_dotcmd.sh,v 1.2 2016/03/27 14:57:50 christos Exp $ >> # >> # Copyright (c) 2014 The NetBSD Foundation, Inc. >> # All rights reserved. >> @@ -33,6 +33,10 @@ >> # in C/C++ so, for example, if the dotcmd is in a loop's body, a break i= n >> # the sourced file can be used to break out of that loop. >>=20 >> +# Note that the standard does not require this, and allows lexically >> +# scoped interpretation of break/continue (and permits dynamic scope >> +# as an optional extension.) >> + >> cmds=3D'return break continue' >> scopes=3D'case compound file for func subshell until while' >>=20 >>=20 >> Copied: head/contrib/netbsd-tests/bin/sh/t_arith.sh (from r305318, projec= ts/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_arith.sh) >> =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 >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/contrib/netbsd-tests/bin/sh/t_arith.sh Sat Sep 3 18:11:48 2016 = (r305358, copy of r305318, projects/netbsd-tests-update-12/contrib/ne= tbsd-tests/bin/sh/t_arith.sh) >> @@ -0,0 +1,1035 @@ >> +# $NetBSD: t_arith.sh,v 1.5 2016/05/12 14:25:11 kre Exp $ >> +# >> +# Copyright (c) 2016 The NetBSD Foundation, Inc. >> +# 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 NETBSD FOUNDATION, INC. AND CONTRIBUT= ORS >> +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LI= MITED >> +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC= ULAR >> +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUT= ORS >> +# 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 BUSINE= SS >> +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER I= N >> +# 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. >> +# >> +# the implementation of "sh" to test >> +: ${TEST_SH:=3D"/bin/sh"} >> + >> +# Requirement is to support at least "signed long" whatever that means >> +# (number of bits in "long" is not specified - but should be at least 32= ). >> + >> +# These tests use -o inline:"..." rather than -o match:'...' as we have >> +# only digits to examine, and it is good to be sure that 1 + 1 really gi= ves 2 >> +# and that 42 or 123 don't look like success because there is a 2 in the= m. >> + >> +ARITH_BITS=3D'?' >> +discover_range() >> +{ >> + # cannot use arithmetic "test" operators, range of test in >> + # ATF_SHELL (or even TEST_SH) might not be as big as that >> + # supported by $(( )) in TEST_SH >> + >> + if ! ${TEST_SH} -c ': $(( 0x10000 ))' 2>/dev/null >> + then >> + # 16 bits or less, or hex unsupported, just give up... >> + return >> + fi >> + test $( ${TEST_SH} -c 'echo $(( 0x1FFFF ))' ) =3D 131071 || retur= n >> + >> + # when attempting to exceed the number of available bits >> + # the shell may react in any of 3 (rational) ways >> + # 1. syntax error (maybe even core dump...) and fail >> + # 2. represent a positive number input as negative value >> + # 3. keep the number positive, but not the value expected >> + # (perhaps pegged at the max possible value) >> + # any of those may be accompanied by a message to stderr >> + >> + # Must check all 3 possibilities for each plausible size >> + # Tests do not use 0x8000... because that value can have weird >> + # other side effects that are not relevant to discover here. >> + # But we do want to try and force the sign bit set. >> + >> + if ! ${TEST_SH} -c ': $(( 0xC0000000 ))' 2>/dev/null >> + then >> + # proobably shell detected overflow and complained >> + ARITH_BITS=3D32 >> + return >> + fi >> + if ${TEST_SH} 2>/dev/null \ >> + -c 'case $(( 0xC0000000 )); in (-*) exit 0;; esac; exit 1' >> + then >> + ARITH_BITS=3D32 >> + return >> + fi >> + if ${TEST_SH} -c '[ $(( 0xC0000000 )) !=3D 3221225472 ]' 2>/dev/n= ull >> + then >> + ARITH_BITS=3D32 >> + return >> + fi >> + >> + if ! ${TEST_SH} -c ': $(( 0xC000000000000000 ))' 2>/dev/null >> + then >> + ARITH_BITS=3D64 >> + return >> + fi >> + if ${TEST_SH} 2>/dev/null \ >> + -c 'case $(( 0xC000000000000000 )); in (-*) exit 0;; esac; ex= it 1' >> + then >> + ARITH_BITS=3D64 >> + return >> + fi >> + if ${TEST_SH} 2>/dev/null \ >> + -c '[ $((0xC000000000000000)) !=3D 13835058055282163712 ]' >> + then >> + ARITH_BITS=3D64 >> + return >> + fi >> + >> + if ${TEST_SH} 2>/dev/null -c \ >> + '[ $((0x123456781234567812345678)) =3D 56340026578427560539384= 93048 ]' >> + then >> + # just assume... (for now anyway, revisit when it happens= ...) >> + ARITH_BITS=3D96 >> + return >> + fi >> +} >> + >> +atf_test_case constants >> +constants_head() >> +{ >> + atf_set "descr" "Tests that arithmetic expansion can handle cons= tants" >> +} >> +constants_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $((0x0))' >> + >> + # atf_expect_fail "PR bin/50959" >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $((0X0))' >> + # atf_expect_pass >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $((000))' >> + >> + atf_check -s exit:0 -o inline:'1\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 000000001 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 0x000000 ))' >> + >> + atf_check -s exit:0 -o inline:'99999\n' -e empty \ >> + ${TEST_SH} -c 'echo $((99999))' >> + >> + [ ${ARITH_BITS} -gt 44 ] && >> + atf_check -s exit:0 -o inline:'9191919191919\n' -e empty \= >> + ${TEST_SH} -c 'echo $((9191919191919))' >> + >> + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xD ))' >> + atf_check -s exit:0 -o inline:'11\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 013 ))' >> + atf_check -s exit:0 -o inline:'7\n' -e empty ${TEST_SH} -c \ >> + 'x=3D7;echo $(($x))' >> + atf_check -s exit:0 -o inline:'9\n' -e empty ${TEST_SH} -c \ >> + 'x=3D9;echo $((x))' >> + >> + atf_check -s exit:0 -o inline:'11\n' -e empty \ >> + ${TEST_SH} -c 'x=3D0xB; echo $(( $x ))' >> + atf_check -s exit:0 -o inline:'27\n' -e empty \ >> + ${TEST_SH} -c 'x=3D0X1B; echo $(( x ))' >> + atf_check -s exit:0 -o inline:'27\n' -e empty \ >> + ${TEST_SH} -c 'X=3D033; echo $(( $X ))' >> + atf_check -s exit:0 -o inline:'219\n' -e empty \ >> + ${TEST_SH} -c 'X=3D0333; echo $(( X ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty \ >> + ${TEST_SH} -c 'NULL=3D; echo $(( NULL ))' >> + >> + # Not clear if this is 0, nothing, or an error, so omit for now >> + # atf_check -s exit:0 -o inline:'0\n' -e empty \ >> + # ${TEST_SH} -c 'echo $(( ))' >> + >> + # not clear whether this should return 0 or an error, so omit for= now >> + # atf_check -s exit:0 -o inline:'0\n' -e empty \ >> + # ${TEST_SH} -c 'echo $(( UNDEFINED_VAR ))' >> +} >> + >> + >> +atf_test_case do_unary_plus >> +do_unary_plus_head() >> +{ >> + atf_set "descr" "Tests that unary plus works as expected" >> +} >> +do_unary_plus_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( +0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( +1 ))' >> + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( + 6 ))' >> + atf_check -s exit:0 -o inline:'4321\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( + 4321 ))' >> + atf_check -s exit:0 -o inline:'17185\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( + 0x4321 ))' >> +} >> + >> +atf_test_case do_unary_minus >> +do_unary_minus_head() >> +{ >> + atf_set "descr" "Tests that unary minus works as expected" >> +} >> +do_unary_minus_body() >> +{ >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( - 0 ))' >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( - 1 ))' >> + atf_check -s exit:0 -o inline:'-6\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( - 6 ))' >> + atf_check -s exit:0 -o inline:'-4321\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( - 4321 ))' >> + atf_check -s exit:0 -o inline:'-2257\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( - 04321 ))' >> + atf_check -s exit:0 -o inline:'-7\n' -e empty ${TEST_SH} -c \ >> + 'echo $((-7))' >> +} >> + >> +atf_test_case do_unary_not >> +do_unary_not_head() >> +{ >> + atf_set "descr" "Tests that unary not (boolean) works as expecte= d" >> +} >> +do_unary_not_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ! 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ! 0 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( !1234 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( !0xFFFF ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ! 000000 ))' >> +} >> + >> +atf_test_case do_unary_tilde >> +do_unary_tilde_head() >> +{ >> + atf_set "descr" "Tests that unary not (bitwise) works as expecte= d" >> +} >> +do_unary_tilde_body() >> +{ >> + # definitely 2's complement arithmetic here... >> + >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ~ 0 ))' >> + atf_check -s exit:0 -o inline:'-2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ~ 1 ))' >> + >> + atf_check -s exit:0 -o inline:'-1235\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ~1234 ))' >> + atf_check -s exit:0 -o inline:'-256\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( ~0xFF ))' >> +} >> + >> +atf_test_case elementary_add >> +elementary_add_head() >> +{ >> + atf_set "descr" "Tests that simple addition works as expected" >> +} >> +elementary_add_body() >> +{ >> + # some of these tests actually test unary ops & op precedence...= >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 + 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 + 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 + 1 ))' >> + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 + 1 ))' >> + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 4 + 6 ))' >> + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 6 + 4 ))' >> + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1234 + 4321 ))' >> + atf_check -s exit:0 -o inline:'3333\n' -e empty ${TEST_SH} -c \ >> + 'echo $((1111+2222))' >> + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ >> + 'echo $((+3333+2222))' >> + atf_check -s exit:0 -o inline:'7777\n' -e empty ${TEST_SH} -c \ >> + 'echo $((+3333 + +4444))' >> + atf_check -s exit:0 -o inline:'-7777\n' -e empty ${TEST_SH} -c \ >> + 'echo -$((+4125+ +3652))' >> +} >> + >> +atf_test_case elementary_sub >> +elementary_sub_head() >> +{ >> + atf_set "descr" "Tests that simple subtraction works as expected= " >> +} >> +elementary_sub_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 - 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 - 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 - 1 ))' >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 - 1 ))' >> + atf_check -s exit:0 -o inline:'488\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1066 - 578 ))' >> + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2016-5678 ))' >> + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2016+-5678 ))' >> + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2016-+5678 ))' >> + atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -2016-5678 ))' >> + atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \ >> + 'echo -$(( -1018 - -1017 ))' >> +} >> + >> +atf_test_case elementary_mul >> +elementary_mul_head() >> +{ >> + atf_set "descr" "Tests that simple multiplication works as expec= ted" >> +} >> +elementary_mul_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 * 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 * 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 * 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 * 1 ))' >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 * 1 ))' >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 * -1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 * -1 ))' >> + atf_check -s exit:0 -o inline:'391\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 17 * 23 ))' >> + atf_check -s exit:0 -o inline:'169\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 13*13 ))' >> + atf_check -s exit:0 -o inline:'-11264\n' -e empty ${TEST_SH} -c \= >> + 'echo $(( -11 *1024 ))' >> + atf_check -s exit:0 -o inline:'-16983\n' -e empty ${TEST_SH} -c \= >> + 'echo $(( 17* -999 ))' >> + atf_check -s exit:0 -o inline:'9309\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -29*-321 ))' >> +} >> + >> +atf_test_case elementary_div >> +elementary_div_head() >> +{ >> + atf_set "descr" "Tests that simple division works as expected" >> +} >> +elementary_div_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 / 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 / 1 ))' >> + test ${ARITH_BITS} -ge 38 && >> + atf_check -s exit:0 -o inline:'99999999999\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 99999999999 / 1 ))' >> + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 / 1 ))' >> + >> + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 / 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 / 2 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 / 3 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 / 4 ))' >> + >> + atf_check -s exit:0 -o inline:'173\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 123456 / 713 ))' >> + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 169 / 13 ))' >> +} >> + >> +atf_test_case elementary_rem >> +elementary_rem_head() >> +{ >> + atf_set "descr" "Tests that simple modulus works as expected" >> +} >> +elementary_rem_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 % 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 % 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 % 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 9999 % 1 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 % 2 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 % 2 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 % 2 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xFFFF % 2 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 % 3 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 % 3 ))' >> + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 % 3 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 % 3 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3123 % 3 ))' >> + >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 9999 % 2 ))' >> + >> + atf_check -s exit:0 -o inline:'107\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 123456%173 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $((169%13))' >> +} >> + >> +atf_test_case elementary_shl >> +elementary_shl_head() >> +{ >> + atf_set "descr" "Tests that simple shift left works as expected"= >> +} >> +elementary_shl_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 << 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 << 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 << 17 ))' >> + >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 << 0 ))' >> + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 << 1 ))' >> + atf_check -s exit:0 -o inline:'131072\n' -e empty ${TEST_SH} -c \= >> + 'echo $(( 1 << 17 ))' >> + >> + atf_check -s exit:0 -o inline:'2021161080\n' -e empty ${TEST_SH} -= c \ >> + 'echo $(( 0x3C3C3C3C << 1 ))' >> + >> + test "${ARITH_BITS}" -ge 40 && >> + atf_check -s exit:0 -o inline:'129354309120\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 7 ))' >> + test "${ARITH_BITS}" -ge 72 && >> + atf_check -s exit:0 -o inline:'1111145054534149079040\n' \ >> + -e empty ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 40 ))' >> + >> + return 0 >> +} >> + >> +atf_test_case elementary_shr >> +elementary_shr_head() >> +{ >> + atf_set "descr" "Tests that simple shift right works as expected= " >> +} >> +elementary_shr_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 >> 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 >> 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 >> 17 ))' >> + >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 >> 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 >> 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 >> 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 >> 1 ))' >> + >> + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x10 >> 2 ))' >> + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 022 >> 2 ))' >> + >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 131072 >> 17 ))' >> + >> + test ${ARITH_BITS} -ge 40 && >> + atf_check -s exit:0 -o inline:'8\n' -e empty ${TEST_SH} -= c \ >> + 'echo $(( 0x4000000000 >> 35 ))' >> + test ${ARITH_BITS} -ge 80 && >> + atf_check -s exit:0 -o inline:'4464\n' -e empty ${TEST_SH= } -c \ >> + 'echo $(( 0x93400FACE005C871000 >> 64 ))' >> + >> + return 0 >> +} >> + >> +atf_test_case elementary_eq >> +elementary_eq_head() >> +{ >> + atf_set "descr" "Tests that simple equality test works as expect= ed" >> +} >> +elementary_eq_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 0000 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 0x00 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 =3D=3D 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'X=3D30; Y=3D0x1E; echo $(( X =3D=3D Y ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1234 =3D=3D 4660 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1234 =3D=3D 011064 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 0000000000000001 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 =3D=3D 0x10000000000000 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 =3D=3D 2 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'X=3D3; Y=3D7; echo $(( X =3D=3D Y ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1234 =3D=3D 0x4660 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 01234 =3D=3D 0x11064 ))' >> +} >> +atf_test_case elementary_ne >> +elementary_ne_head() >> +{ >> + atf_set "descr" "Tests that simple inequality test works as expe= cted" >> +} >> +elementary_ne_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 !=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x71 !=3D 17 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1234 !=3D 01234 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1234 !=3D 01234 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'X=3D3; echo $(( X !=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'X=3D3; Y=3D0x11; echo $(( X !=3D Y ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 3 !=3D 3 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 !=3D 0x0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xA !=3D 012 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'X=3D1; echo $(( X !=3D 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'X=3D0xC; Y=3D014; echo $(( X !=3D Y ))' >> +} >> +atf_test_case elementary_lt >> +elementary_lt_head() >> +{ >> + atf_set "descr" "Tests that simple less than test works as expec= ted" >> +} >> +elementary_lt_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 < 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 < 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 < 10 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 100 < 101 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xA1 < 200 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 < 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 < 0 ))' >> + >> + test ${ARITH_BITS} -ge 40 && >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1BEEFF00D < 0x1FACECAFE ))' >> + >> + return 0 >> +} >> +atf_test_case elementary_le >> +elementary_le_head() >> +{ >> + atf_set "descr" "Tests that simple less or equal test works as e= xpected" >> +} >> +elementary_le_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 <=3D 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 <=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 <=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 <=3D 10 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 100 <=3D 101 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xA1 <=3D 161 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 <=3D 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -100 <=3D -200 ))' >> + >> + test ${ARITH_BITS} -ge 40 && >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'cost=3D; AUD=3D; echo $(( $cost 0x2FEEDBABE <=3D $AUD 12= 866927294 ))' >> + >> + return 0 >> +} >> +atf_test_case elementary_gt >> +elementary_gt_head() >> +{ >> + atf_set "descr" "Tests that simple greater than works as expecte= d" >> +} >> +elementary_gt_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 > 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 > -1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 11 > 012 ))' >> + >> + # atf_expect_fail "PR bin/50959" >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2147483647 > 0X7FFFFF0 ))' >> + # atf_expect_pass >> + >> + test ${ARITH_BITS} -gt 32 && >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x80000000 > 0x7FFFFFFF ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 > 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 > 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 > 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 > 10 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2015 > 2016 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xA1 > 200 ))' >> + >> + test ${ARITH_BITS} -ge 44 && >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x7F07F07F0 > 34099628014 ))' >> + >> + return 0 >> +} >> +atf_test_case elementary_ge >> +elementary_ge_head() >> +{ >> + atf_set "descr" "Tests that simple greater or equal works as exp= ected" >> +} >> +elementary_ge_body() >> +{ >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 >=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 >=3D 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -100 >=3D -101 ))' >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( -1 >=3D 0 ))' >> +} >> + >> +atf_test_case fiddle_bits_and >> +fiddle_bits_and_head() >> +{ >> + atf_set "descr" "Test bitwise and operations in arithmetic expres= sions" >> +} >> +fiddle_bits_and_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 & 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 & 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 & 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 & 1 ))' >> + >> + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xFF & 0xFF ))' >> + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xFFFF & 0377 ))' >> + >> + test "${ARITH_BITS}" -ge 48 && >> + atf_check -s exit:0 -o inline:'70377641607203\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 & 0x42871357BAB3 )= )' >> + >> + return 0 >> +} >> +atf_test_case fiddle_bits_or >> +fiddle_bits_or_head() >> +{ >> + atf_set "descr" "Test bitwise or operations in arithmetic express= ions" >> +} >> +fiddle_bits_or_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 | 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 | 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 | 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 | 1 ))' >> + >> + atf_check -s exit:0 -o inline:'4369\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1111 | 0x1111 ))' >> + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xAA | 0125 ))' >> + >> + test "${ARITH_BITS}" -ge 48 && >> + atf_check -s exit:0 -o inline:'95348271856563\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 | 0x42871357BAB3 )= )' >> + >> + return 0 >> +} >> +atf_test_case fiddle_bits_xor >> +fiddle_bits_xor_head() >> +{ >> + atf_set "descr" "Test bitwise xor operations in arithmetic expres= sions" >> +} >> +fiddle_bits_xor_body() >> +{ >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 ^ 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 ^ 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 ^ 1 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 ^ 1 ))' >> + >> + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xF0 ^ 0x0F ))' >> + atf_check -s exit:0 -o inline:'15\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xF0 ^ 0xFF ))' >> + >> + test "${ARITH_BITS}" -ge 48 && >> + atf_check -s exit:0 -o inline:'24970630249360\n' -e empty \ >> + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 ^ 0x42871357BAB3 )= )' >> + >> + return 0 >> +} >> + >> +atf_test_case logical_and >> +logical_and_head() >> +{ >> + atf_set "descr" "Test logical and operations in arithmetic expres= sions" >> +} >> +logical_and_body() >> +{ >> + # cannot test short-circuit eval until sh implements side effects= ... >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 && 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 && 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 && 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 && 1 ))' >> + >> + # atf_expect_fail "PR bin/50960" >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1111 && 01234 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0xFFFF && 0xF0F0 ))' >> +} >> +atf_test_case logical_or >> +logical_or_head() >> +{ >> + atf_set "descr" "Test logical or operations in arithmetic express= ions" >> +} >> +logical_or_body() >> +{ >> + # cannot test short-circuit eval until sh implements side effects= ... >> + >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 || 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 || 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 || 1 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 || 1 ))' >> + >> + # atf_expect_fail "PR bin/50960" >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1111 || 01234 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x33 || 0xF0F0 ))' >> +} >> + >> +atf_test_case make_selection >> +make_selection_head() >> +{ >> + atf_set "descr" "Test ?: operator in arithmetic expressions" >> +} >> +make_selection_body() >> +{ >> + # atf_expect_fail "PR bin/50958" >> + >> + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0 ? 2 : 3 ))' >> + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 ? 2 : 3 ))' >> + >> + atf_check -s exit:0 -o inline:'111\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 0x1234 ? 111 : 222 ))' >> + >> + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 < 2 ? -1 : 1 > 2 ? 1 : 0 ))' >> + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 < 1 ? -1 : 1 > 1 ? 1 : 0 ))' >> + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 2 < 1 ? -1 : 2 > 1 ? 1 : 0 ))' >> +} >> + >> +atf_test_case operator_precedence >> +operator_precedence_head() >> +{ >> + atf_set "descr" "Test operator precedence without parentheses" >> +} >> +operator_precedence_body() >> +{ >> + # NB: apart from $(( )) ** NO ** parentheses in the expressions.= >> + >> + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ >> + 'echo $(( 1 + 2 + 3 ))' >>=20 >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >=20 From owner-svn-src-head@freebsd.org Mon Sep 5 03:21: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 E183CAC46C2; Mon, 5 Sep 2016 03:21:32 +0000 (UTC) (envelope-from sephe@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 BF939157; Mon, 5 Sep 2016 03:21:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u853LWad069330; Mon, 5 Sep 2016 03:21:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u853LVYa069328; Mon, 5 Sep 2016 03:21:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609050321.u853LVYa069328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 5 Sep 2016 03:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305405 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 03:21:33 -0000 Author: sephe Date: Mon Sep 5 03:21:31 2016 New Revision: 305405 URL: https://svnweb.freebsd.org/changeset/base/305405 Log: hyperv/vmbus: Stringent header length and total length check. While I'm here, minor style changes. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7752 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Sep 5 02:00:35 2016 (r305404) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Sep 5 03:21:31 2016 (r305405) @@ -721,7 +721,20 @@ vmbus_chan_recv(struct vmbus_channel *ch error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) - return error; + return (error); + + if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { + device_printf(chan->ch_dev, "invalid hlen %u\n", + pkt.cph_hlen); + /* XXX this channel is dead actually. */ + return (EIO); + } + if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { + device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + pkt.cph_hlen, pkt.cph_tlen); + /* XXX this channel is dead actually. */ + return (EIO); + } hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; @@ -729,7 +742,7 @@ vmbus_chan_recv(struct vmbus_channel *ch if (*dlen0 < dlen) { /* Return the size of this packet's data. */ *dlen0 = dlen; - return ENOBUFS; + return (ENOBUFS); } *xactid = pkt.cph_xactid; @@ -739,7 +752,7 @@ vmbus_chan_recv(struct vmbus_channel *ch error = vmbus_rxbr_read(&chan->ch_rxbr, data, dlen, hlen); KASSERT(!error, ("vmbus_rxbr_read failed")); - return 0; + return (0); } int @@ -751,13 +764,26 @@ vmbus_chan_recv_pkt(struct vmbus_channel error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) - return error; + return (error); + + if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { + device_printf(chan->ch_dev, "invalid hlen %u\n", + pkt.cph_hlen); + /* XXX this channel is dead actually. */ + return (EIO); + } + if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { + device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + pkt.cph_hlen, pkt.cph_tlen); + /* XXX this channel is dead actually. */ + return (EIO); + } pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); if (*pktlen0 < pktlen) { /* Return the size of this packet. */ *pktlen0 = pktlen; - return ENOBUFS; + return (ENOBUFS); } *pktlen0 = pktlen; @@ -765,7 +791,7 @@ vmbus_chan_recv_pkt(struct vmbus_channel error = vmbus_rxbr_read(&chan->ch_rxbr, pkt0, pktlen, 0); KASSERT(!error, ("vmbus_rxbr_read failed")); - return 0; + return (0); } static void Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Sep 5 02:00:35 2016 (r305404) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Sep 5 03:21:31 2016 (r305405) @@ -153,6 +153,9 @@ do { \ #define VMBUS_CHANPKT_TOTLEN(tlen) \ roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) +#define VMBUS_CHANPKT_HLEN_MIN \ + (sizeof(struct vmbus_chanpkt_hdr) >> VMBUS_CHANPKT_SIZE_SHIFT) + struct vmbus_chanpkt { struct vmbus_chanpkt_hdr cp_hdr; } __packed; From owner-svn-src-head@freebsd.org Mon Sep 5 03:37: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 C50BEAC4A23; Mon, 5 Sep 2016 03:37:29 +0000 (UTC) (envelope-from ache@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 7A2F6978; Mon, 5 Sep 2016 03:37:29 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u853bSSU076448; Mon, 5 Sep 2016 03:37:28 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u853bSmC076447; Mon, 5 Sep 2016 03:37:28 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609050337.u853bSmC076447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 5 Sep 2016 03:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305406 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 03:37:29 -0000 Author: ache Date: Mon Sep 5 03:37:28 2016 New Revision: 305406 URL: https://svnweb.freebsd.org/changeset/base/305406 Log: Fix errors handling. MFC after: 3 days Modified: head/lib/libc/stdio/fgetws.c Modified: head/lib/libc/stdio/fgetws.c ============================================================================== --- head/lib/libc/stdio/fgetws.c Mon Sep 5 03:21:31 2016 (r305405) +++ head/lib/libc/stdio/fgetws.c Mon Sep 5 03:37:28 2016 (r305406) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); wchar_t * fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t locale) { + int sret; wchar_t *wsp; size_t nconv; const char *src; @@ -56,23 +57,27 @@ fgetws_l(wchar_t * __restrict ws, int n, ORIENT(fp, 1); if (n <= 0) { + fp->_flags |= __SERR; errno = EINVAL; goto error; } if (fp->_r <= 0 && __srefill(fp)) - /* EOF */ + /* EOF or ferror */ goto error; wsp = ws; + sret = 0; do { src = fp->_p; nl = memchr(fp->_p, '\n', fp->_r); nconv = l->__mbsnrtowcs(wsp, &src, nl != NULL ? (nl - fp->_p + 1) : fp->_r, n - 1, &fp->_mbstate); - if (nconv == (size_t)-1) + if (nconv == (size_t)-1) { /* Conversion error */ + fp->_flags |= __SERR; goto error; + } if (src == NULL) { /* * We hit a null byte. Increment the character count, @@ -89,12 +94,18 @@ fgetws_l(wchar_t * __restrict ws, int n, n -= nconv; wsp += nconv; } while (wsp[-1] != L'\n' && n > 1 && (fp->_r > 0 || - __srefill(fp) == 0)); - if (wsp == ws) - /* EOF */ + (sret = __srefill(fp)) == 0)); + if (sret && !__sfeof(fp)) + /* ferror */ goto error; - if (!l->__mbsinit(&fp->_mbstate)) + if (!l->__mbsinit(&fp->_mbstate)) { /* Incomplete character */ + fp->_flags |= __SERR; + errno = EILSEQ; + goto error; + } + if (sret) + /* EOF */ goto error; *wsp = L'\0'; FUNLOCKFILE(fp); @@ -105,6 +116,7 @@ error: FUNLOCKFILE(fp); return (NULL); } + wchar_t * fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp) { From owner-svn-src-head@freebsd.org Mon Sep 5 03:39:05 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 9AE1FAC4B45; Mon, 5 Sep 2016 03:39:05 +0000 (UTC) (envelope-from sephe@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 6839FB2E; Mon, 5 Sep 2016 03:39:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u853d4Hb076542; Mon, 5 Sep 2016 03:39:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u853d4Jh076541; Mon, 5 Sep 2016 03:39:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609050339.u853d4Jh076541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 5 Sep 2016 03:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305407 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 03:39:05 -0000 Author: sephe Date: Mon Sep 5 03:39:04 2016 New Revision: 305407 URL: https://svnweb.freebsd.org/changeset/base/305407 Log: hyperv/hn: Stringent NVS notification length check. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7753 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 5 03:37:28 2016 (r305406) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 5 03:39:04 2016 (r305407) @@ -816,7 +816,12 @@ hn_proc_notify(struct hn_softc *sc, cons { const struct hn_nvs_hdr *hdr; + if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { + if_printf(sc->hn_ifp, "invalid nvs notify\n"); + return; + } hdr = VMBUS_CHANPKT_CONST_DATA(pkt); + if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { /* Useless; ignore */ return; From owner-svn-src-head@freebsd.org Mon Sep 5 04:47: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 E55B0B71790; Mon, 5 Sep 2016 04:47:32 +0000 (UTC) (envelope-from sephe@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 9D1FA685; Mon, 5 Sep 2016 04:47:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u854lVAv003514; Mon, 5 Sep 2016 04:47:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u854lVZ6003513; Mon, 5 Sep 2016 04:47:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609050447.u854lVZ6003513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 5 Sep 2016 04:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305408 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 04:47:33 -0000 Author: sephe Date: Mon Sep 5 04:47:31 2016 New Revision: 305408 URL: https://svnweb.freebsd.org/changeset/base/305408 Log: hyperv/hn: Stringent NVS RNDIS packets length checks. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7755 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 5 03:39:04 2016 (r305407) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 5 04:47:31 2016 (r305408) @@ -742,32 +742,53 @@ hv_nv_on_receive(struct hn_softc *sc, st { const struct vmbus_chanpkt_rxbuf *pkt; const struct hn_nvs_hdr *nvs_hdr; - int count = 0; - int i = 0; + int count, i, hlen; - /* Make sure that this is a RNDIS message. */ + if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { + if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); + return; + } nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + + /* Make sure that this is a RNDIS message. */ if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", nvs_hdr->nvs_type); return; } - + + hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); + if (__predict_false(hlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); + return; + } pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { - if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", + if (__predict_false(pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID)) { + if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", pkt->cp_rxbuf_id); return; } count = pkt->cp_rxbuf_cnt; + if (__predict_false(hlen < + __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { + if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); + return; + } /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ - for (i = 0; i < count; i++) { - hv_rf_on_receive(sc, rxr, - rxr->hn_rxbuf + pkt->cp_rxbuf[i].rb_ofs, - pkt->cp_rxbuf[i].rb_len); + for (i = 0; i < count; ++i) { + int ofs, len; + + ofs = pkt->cp_rxbuf[i].rb_ofs; + len = pkt->cp_rxbuf[i].rb_len; + if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " + "ofs %d, len %d\n", i, ofs, len); + continue; + } + hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); } /* From owner-svn-src-head@freebsd.org Mon Sep 5 04:50: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 26164B7185A; Mon, 5 Sep 2016 04:50:00 +0000 (UTC) (envelope-from ache@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 E7D32880; Mon, 5 Sep 2016 04:49:59 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u854nxHe003672; Mon, 5 Sep 2016 04:49:59 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u854nxfp003671; Mon, 5 Sep 2016 04:49:59 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609050449.u854nxfp003671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 5 Sep 2016 04:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305409 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 04:50:00 -0000 Author: ache Date: Mon Sep 5 04:49:58 2016 New Revision: 305409 URL: https://svnweb.freebsd.org/changeset/base/305409 Log: 1) Prevent out of bounds access to ws[-1] (passed buffer) which happens when the first mb sequence is incomplete and there are not enougn chars in the read buffer. ws[-1] may lead to memory faults or false results, in case the memory here contains '\n'. 2) Fix EOF checking I mess in my previos r305406 commit. MFC after: 3 days Modified: head/lib/libc/stdio/fgetws.c Modified: head/lib/libc/stdio/fgetws.c ============================================================================== --- head/lib/libc/stdio/fgetws.c Mon Sep 5 04:47:31 2016 (r305408) +++ head/lib/libc/stdio/fgetws.c Mon Sep 5 04:49:58 2016 (r305409) @@ -93,7 +93,7 @@ fgetws_l(wchar_t * __restrict ws, int n, fp->_p = (unsigned char *)src; n -= nconv; wsp += nconv; - } while (wsp[-1] != L'\n' && n > 1 && (fp->_r > 0 || + } while ((wsp == ws || wsp[-1] != L'\n') && n > 1 && (fp->_r > 0 || (sret = __srefill(fp)) == 0)); if (sret && !__sfeof(fp)) /* ferror */ @@ -104,7 +104,7 @@ fgetws_l(wchar_t * __restrict ws, int n, errno = EILSEQ; goto error; } - if (sret) + if (wsp == ws) /* EOF */ goto error; *wsp = L'\0'; From owner-svn-src-head@freebsd.org Mon Sep 5 04:56:57 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 D2B98B71AD9; Mon, 5 Sep 2016 04:56:57 +0000 (UTC) (envelope-from sephe@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 A30DED62; Mon, 5 Sep 2016 04:56:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u854uu1c007320; Mon, 5 Sep 2016 04:56:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u854uuB0007319; Mon, 5 Sep 2016 04:56:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609050456.u854uuB0007319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 5 Sep 2016 04:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305410 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 04:56:57 -0000 Author: sephe Date: Mon Sep 5 04:56:56 2016 New Revision: 305410 URL: https://svnweb.freebsd.org/changeset/base/305410 Log: net/rndis: Define RNDIS status message, which could be sent by device. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7757 Modified: head/sys/net/rndis.h Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Mon Sep 5 04:49:58 2016 (r305409) +++ head/sys/net/rndis.h Mon Sep 5 04:56:56 2016 (r305410) @@ -295,9 +295,28 @@ struct rndis_reset_comp { uint32_t rm_adrreset; }; -/* 802.3 link-state or undefined message error. */ +/* 802.3 link-state or undefined message error. Sent by device. */ #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 +struct rndis_status_msg { + uint32_t rm_type; + uint32_t rm_len; + uint32_t rm_status; + uint32_t rm_stbuflen; + uint32_t rm_stbufoffset; + /* rndis_diag_info */ +}; + +/* + * Immediately after rndis_status_msg.rm_stbufoffset, if a control + * message is malformatted, or a packet message contains inappropriate + * content. + */ +struct rndis_diag_info { + uint32_t rm_diagstatus; + uint32_t rm_erroffset; +}; + /* Keepalive messsage. May be sent by device. */ #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 From owner-svn-src-head@freebsd.org Mon Sep 5 05:07:41 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 E5154B71CF0; Mon, 5 Sep 2016 05:07:41 +0000 (UTC) (envelope-from sephe@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 BDF421C6; Mon, 5 Sep 2016 05:07:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8557ewb011331; Mon, 5 Sep 2016 05:07:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8557e7H011329; Mon, 5 Sep 2016 05:07:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609050507.u8557e7H011329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 5 Sep 2016 05:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305411 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 05:07:42 -0000 Author: sephe Date: Mon Sep 5 05:07:40 2016 New Revision: 305411 URL: https://svnweb.freebsd.org/changeset/base/305411 Log: hyperv/hn: Stringent RNDIS control message length check. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7758 Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Sep 5 04:56:56 2016 (r305410) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Sep 5 05:07:40 2016 (r305411) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); * Forward declarations */ static void hv_rf_receive_indicate_status(struct hn_softc *sc, - const rndis_msg *response); + const void *data, int dlen); static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen); static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr); @@ -131,21 +131,29 @@ hv_set_rppi_data(rndis_msg *rndis_mesg, * RNDIS filter receive indicate status */ static void -hv_rf_receive_indicate_status(struct hn_softc *sc, const rndis_msg *response) +hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) { - const rndis_indicate_status *indicate = &response->msg.indicate_status; - - switch(indicate->status) { + const struct rndis_status_msg *msg; + + if (dlen < sizeof(*msg)) { + if_printf(sc->hn_ifp, "invalid RNDIS status\n"); + return; + } + msg = data; + + switch (msg->rm_status) { case RNDIS_STATUS_MEDIA_CONNECT: netvsc_linkstatus_callback(sc, 1); break; + case RNDIS_STATUS_MEDIA_DISCONNECT: netvsc_linkstatus_callback(sc, 0); break; + default: /* TODO: */ - if_printf(sc->hn_ifp, - "unknown status %d received\n", indicate->status); + if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", + msg->rm_status); break; } } @@ -283,34 +291,41 @@ hv_rf_receive_data(struct hn_rx_ring *rx /* * RNDIS filter on receive */ -int +void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen) { - const rndis_msg *rndis_hdr; const struct rndis_comp_hdr *comp; + const struct rndis_msghdr *hdr; + + if (__predict_false(dlen < sizeof(*hdr))) { + if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); + return; + } + hdr = data; - rndis_hdr = data; - switch (rndis_hdr->ndis_msg_type) { - /* data message */ + switch (hdr->rm_type) { case REMOTE_NDIS_PACKET_MSG: hv_rf_receive_data(rxr, data, dlen); break; - /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: - case REMOTE_NDIS_KEEPALIVE_CMPLT: + case REMOTE_NDIS_KEEPALIVE_CMPLT: /* unused */ + if (dlen < sizeof(*comp)) { + if_printf(rxr->hn_ifp, "invalid RNDIS cmplt\n"); + return; + } comp = data; + KASSERT(comp->rm_rid > HN_RNDIS_RID_COMPAT_MAX, - ("invalid rid 0x%08x\n", comp->rm_rid)); + ("invalid RNDIS rid 0x%08x\n", comp->rm_rid)); vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen); break; - /* notification message */ case REMOTE_NDIS_INDICATE_STATUS_MSG: - hv_rf_receive_indicate_status(sc, rndis_hdr); + hv_rf_receive_indicate_status(sc, data, dlen); break; case REMOTE_NDIS_RESET_CMPLT: @@ -321,15 +336,14 @@ hv_rf_on_receive(struct hn_softc *sc, st * RESET is not issued by hn(4), so this message should * _not_ be observed. */ - if_printf(sc->hn_ifp, "RESET CMPLT received\n"); + if_printf(rxr->hn_ifp, "RESET cmplt received\n"); break; default: - if_printf(sc->hn_ifp, "unknown RNDIS message 0x%x\n", - rndis_hdr->ndis_msg_type); + if_printf(rxr->hn_ifp, "unknown RNDIS msg 0x%x\n", + hdr->rm_type); break; } - return (0); } /* Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Sep 5 04:56:56 2016 (r305410) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Sep 5 05:07:40 2016 (r305411) @@ -40,7 +40,7 @@ */ struct hn_rx_ring; -int hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, +void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, From owner-svn-src-head@freebsd.org Mon Sep 5 06:10: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 0D70DB96601; Mon, 5 Sep 2016 06:10:53 +0000 (UTC) (envelope-from ache@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 C5C24973; Mon, 5 Sep 2016 06:10:52 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u856ApTi033742; Mon, 5 Sep 2016 06:10:51 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u856AphK033741; Mon, 5 Sep 2016 06:10:51 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609050610.u856AphK033741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 5 Sep 2016 06:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305412 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 06:10:53 -0000 Author: ache Date: Mon Sep 5 06:10:51 2016 New Revision: 305412 URL: https://svnweb.freebsd.org/changeset/base/305412 Log: Fix n == 1 case. Here should be no physical read (fill buffer) attempt (we read n - 1 chars with the room for NUL, see fgets()), and no NULL return. MFC after: 3 days Modified: head/lib/libc/stdio/fgetws.c Modified: head/lib/libc/stdio/fgetws.c ============================================================================== --- head/lib/libc/stdio/fgetws.c Mon Sep 5 05:07:40 2016 (r305411) +++ head/lib/libc/stdio/fgetws.c Mon Sep 5 06:10:51 2016 (r305412) @@ -62,10 +62,14 @@ fgetws_l(wchar_t * __restrict ws, int n, goto error; } + wsp = ws; + if (n == 1) + goto ok; + if (fp->_r <= 0 && __srefill(fp)) /* EOF or ferror */ goto error; - wsp = ws; + sret = 0; do { src = fp->_p; @@ -107,9 +111,9 @@ fgetws_l(wchar_t * __restrict ws, int n, if (wsp == ws) /* EOF */ goto error; +ok: *wsp = L'\0'; FUNLOCKFILE(fp); - return (ws); error: From owner-svn-src-head@freebsd.org Mon Sep 5 06:46:05 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 A865CB96991; Mon, 5 Sep 2016 06:46:05 +0000 (UTC) (envelope-from ache@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 686927BB; Mon, 5 Sep 2016 06:46:05 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u856k4VP048495; Mon, 5 Sep 2016 06:46:04 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u856k4D2048494; Mon, 5 Sep 2016 06:46:04 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609050646.u856k4D2048494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 5 Sep 2016 06:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305413 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 06:46:05 -0000 Author: ache Date: Mon Sep 5 06:46:04 2016 New Revision: 305413 URL: https://svnweb.freebsd.org/changeset/base/305413 Log: Fix error handling. MFC after: 3 days Modified: head/lib/libc/stdio/fgets.c Modified: head/lib/libc/stdio/fgets.c ============================================================================== --- head/lib/libc/stdio/fgets.c Mon Sep 5 06:10:51 2016 (r305412) +++ head/lib/libc/stdio/fgets.c Mon Sep 5 06:46:04 2016 (r305413) @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fgets.c 8.2 __FBSDID("$FreeBSD$"); #include "namespace.h" +#include #include #include #include "un-namespace.h" @@ -55,11 +56,16 @@ fgets(char * __restrict buf, int n, FILE char *s; unsigned char *p, *t; - if (n <= 0) /* sanity check */ - return (NULL); - FLOCKFILE(fp); ORIENT(fp, -1); + + if (n <= 0) { /* sanity check */ + fp->_flags |= __SERR; + errno = EINVAL; + FUNLOCKFILE(fp); + return (NULL); + } + s = buf; n--; /* leave space for NUL */ while (n != 0) { @@ -69,7 +75,7 @@ fgets(char * __restrict buf, int n, FILE if ((len = fp->_r) <= 0) { if (__srefill(fp)) { /* EOF/error: stop with partial or no line */ - if (s == buf) { + if (!__sfeof(fp) || s == buf) { FUNLOCKFILE(fp); return (NULL); } From owner-svn-src-head@freebsd.org Mon Sep 5 08:27:05 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 EDC37A9D3A7; Mon, 5 Sep 2016 08:27:05 +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 C932879C; Mon, 5 Sep 2016 08:27:05 +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 u858R5x4085596; Mon, 5 Sep 2016 08:27:05 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u858R4bu085591; Mon, 5 Sep 2016 08:27:04 GMT (envelope-from des@FreeBSD.org) Message-Id: <201609050827.u858R4bu085591@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: Mon, 5 Sep 2016 08:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305414 - in head: contrib/top usr.bin/top X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 08:27:06 -0000 Author: des Date: Mon Sep 5 08:27:04 2016 New Revision: 305414 URL: https://svnweb.freebsd.org/changeset/base/305414 Log: Add a toggle to display the approximate amount of swap used by each process. We don't *quite* pull that number out of our backside, as the actual number is difficult to determine without modifying the VM system to report it, but it's still useful to get an idea of what's going on when a machine unexpectedly starts swapping. MFC after: 1 week Modified: head/contrib/top/commands.c head/contrib/top/machine.h head/contrib/top/top.c head/contrib/top/top.xs head/usr.bin/top/machine.c Modified: head/contrib/top/commands.c ============================================================================== --- head/contrib/top/commands.c Mon Sep 5 06:46:04 2016 (r305413) +++ head/contrib/top/commands.c Mon Sep 5 08:27:04 2016 (r305414) @@ -104,6 +104,7 @@ S - toggle the displaying of syste a - toggle the displaying of process titles\n\ t - toggle the display of this process\n\ u - display processes for only one user (+ selects all users)\n\ +w - toggle the display of swap use for each process\n\ z - toggle the displaying of the system idle process\n\ \n\ \n", stdout); Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Mon Sep 5 06:46:04 2016 (r305413) +++ head/contrib/top/machine.h Mon Sep 5 08:27:04 2016 (r305414) @@ -72,6 +72,7 @@ struct process_select int wcpu; /* show weighted cpu */ int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ + int swap; /* show swap usage */ int kidle; /* show per-CPU idle threads */ char *command; /* only this command (unless == NULL) */ }; @@ -82,8 +83,8 @@ char *format_header(); char *format_next_process(); void toggle_pcpustats(void); void get_system_info(struct system_info *si); -int machine_init(struct statics *statics, char do_unames); -int proc_owner(int pid); +int machine_init(struct statics *statics, char do_unames); +int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ char *printable(); Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Mon Sep 5 06:46:04 2016 (r305413) +++ head/contrib/top/top.c Mon Sep 5 08:27:04 2016 (r305414) @@ -188,9 +188,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwo"; #else - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJ"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJw"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -219,8 +219,9 @@ char *argv[]; #define CMD_kidletog 22 #define CMD_pcputog 23 #define CMD_jail 24 +#define CMD_swaptog 25 #ifdef ORDER -#define CMD_order 25 +#define CMD_order 26 #endif /* set the buffer for stdout */ @@ -254,6 +255,7 @@ char *argv[]; ps.wcpu = 1; ps.jid = -1; ps.jail = No; + ps.swap = No; ps.kidle = Yes; ps.command = NULL; @@ -280,7 +282,7 @@ char *argv[]; optind = 1; } - while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:t")) != EOF) + while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:tw")) != EOF) { switch(i) { @@ -418,6 +420,10 @@ char *argv[]; pcpu_stats = !pcpu_stats; break; + case 'w': + ps.swap = 1; + break; + case 'z': ps.kidle = !ps.kidle; break; @@ -1141,6 +1147,15 @@ restart: reset_display(); putchar('\r'); break; + case CMD_swaptog: + ps.swap = !ps.swap; + new_message(MT_standout | MT_delayed, + " %sisplaying per-process swap usage.", + ps.swap ? "D" : "Not d"); + header_text = format_header(uname_field); + reset_display(); + putchar('\r'); + break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); putchar('\r'); Modified: head/contrib/top/top.xs ============================================================================== --- head/contrib/top/top.xs Mon Sep 5 06:46:04 2016 (r305413) +++ head/contrib/top/top.xs Mon Sep 5 08:27:04 2016 (r305414) @@ -10,7 +10,7 @@ top \- display and update information ab .SH SYNOPSIS .B top [ -.B \-abCHIijnPqStuvz +.B \-abCHIijnPqStuvwz ] [ .BI \-d count ] [ @@ -148,6 +148,9 @@ Write version number information to stde No other processing takes place when this option is used. To see current revision information while top is running, use the help command \*(lq?\*(rq. .TP +.B \-w +Display approximate swap usage for each process. +.TP .B \-z Do not display the system idle process. .TP @@ -167,11 +170,12 @@ Set the delay between screen updates to seconds. The default delay between updates is \nD seconds. .TP .BI \-o field -Sort the process display area on the specified field. The field name is -the name of the column as seen in the output, but in lower case. Likely -values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq, -but may vary on different operating systems. Note that -not all operating systems support this option. +Sort the process display area on the specified field. The field name +is the name of the column as seen in the output, but in lower case: +\*(lqcpu\*(lq, \*(rqsize\*(lq, \*(rqres\*(lq, \*(rqtime\*(lq, +\*(rqpri\*(lq, \*(rqthreads\*(lq, \*(lqtotal\*(lq, \*(rqread\*(lq, +\*(rqwrite\*(lq, \*(rqfault\*(lq, \*(rqvcsw\*(lq, \*(rqivcsw\*(lq, +\*(lqjid\*(lq, \*(rqswap\*(lq or \*(rqpid\*(lq. .TP .BI \-J jail Show only those processes owned by @@ -226,6 +230,7 @@ The options .BR \-S , .BR \-t , .BR \-u , +.BR \-w , and .B \-z are actually toggles. A second specification of any of these options @@ -346,6 +351,9 @@ Toggle the display of the .I top process. .TP +.B w +Toggle the display of swap usage. +.TP .B z Toggle the display of the system idle process. .SH "THE DISPLAY" @@ -379,8 +387,9 @@ is specified, a UID column will be subst PRI is the current priority of the process, NICE is the nice amount (in the range \-20 to 20), SIZE is the total size of the process (text, data, and stack), -RES is the current amount of resident memory (both SIZE and RES are -given in kilobytes), +RES is the current amount of resident memory, +SWAP is the approximate amount of swap, if enabled +(SIZE, RES and SWAP are given in kilobytes), STATE is the current state (one of \*(lqSTART\*(rq, \*(lqRUN\*(rq (shown as \*(lqCPUn\*(rq on SMP systems), \*(lqSLEEP\*(rq, \*(lqSTOP\*(rq, \*(lqZOMB\*(rq, \*(lqWAIT\*(rq, \*(lqLOCK\*(rq or the event on which the Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon Sep 5 06:46:04 2016 (r305413) +++ head/usr.bin/top/machine.c Mon Sep 5 08:27:04 2016 (r305414) @@ -69,7 +69,9 @@ static int namelength = 8; #endif /* TOP_JID_LEN based on max of 999999 */ #define TOP_JID_LEN 7 +#define TOP_SWAP_LEN 6 static int jidlength; +static int swaplength; static int cmdlengthdelta; /* Prototypes for top internals */ @@ -111,20 +113,20 @@ static char io_header[] = "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s" static char smp_header_thr[] = - " PID%*s %-*.*s THR PRI NICE SIZE RES STATE C TIME %7s COMMAND"; + " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; static char smp_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES STATE C TIME %7s COMMAND"; + " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; #define smp_Proc_format \ - "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s %2d%7s %6.2f%% %.*s" + "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s %2d%7s %6.2f%% %.*s" static char up_header_thr[] = - " PID%*s %-*.*s THR PRI NICE SIZE RES STATE TIME %7s COMMAND"; + " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; static char up_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES STATE TIME %7s COMMAND"; + " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; #define up_Proc_format \ - "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s%.0d%7s %6.2f%% %.*s" + "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s%.0d%7s %6.2f%% %.*s" /* process state names for the "STATE" column of the display */ @@ -227,6 +229,10 @@ static int pageshift; /* log base 2 of #define pagetok(size) ((size) << pageshift) +/* swap usage */ +#define ki_swap(kip) \ + ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 0) + /* useful externals */ long percentages(); @@ -237,7 +243,7 @@ long percentages(); char *ordernames[] = { "cpu", "size", "res", "time", "pri", "threads", "total", "read", "write", "fault", "vcsw", "ivcsw", - "jid", "pid", NULL + "jid", "swap", "pid", NULL }; #endif @@ -252,6 +258,7 @@ static long *pcpu_cp_old; static long *pcpu_cp_diff; static int *pcpu_cpu_states; +static int compare_swap(const void *a, const void *b); static int compare_jid(const void *a, const void *b); static int compare_pid(const void *a, const void *b); static int compare_tid(const void *a, const void *b); @@ -412,6 +419,11 @@ format_header(char *uname_field) else jidlength = 0; + if (ps.swap) + swaplength = TOP_SWAP_LEN + 1; /* +1 for extra left space */ + else + swaplength = 0; + switch (displaymode) { case DISP_CPU: /* @@ -426,6 +438,7 @@ format_header(char *uname_field) snprintf(Header, sizeof(Header), prehead, jidlength, ps.jail ? " JID" : "", namelength, namelength, uname_field, + swaplength, ps.swap ? " SWAP" : "", ps.wcpu ? "WCPU" : "CPU"); break; case DISP_IO: @@ -902,7 +915,8 @@ format_next_process(caddr_t handle, char int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; - char *proc_fmt, thr_buf[6], jid_buf[TOP_JID_LEN + 1]; + char *proc_fmt, thr_buf[6]; + char jid_buf[TOP_JID_LEN + 1], swap_buf[TOP_SWAP_LEN + 1]; char *cmdbuf = NULL; char **args; const int cmdlen = 128; @@ -1061,6 +1075,13 @@ format_next_process(caddr_t handle, char snprintf(jid_buf, sizeof(jid_buf), "%*d", jidlength - 1, pp->ki_jid); + if (ps.swap == 0) + swap_buf[0] = '\0'; + else + snprintf(swap_buf, sizeof(swap_buf), "%*s", + swaplength - 1, + format_k2(pagetok(ki_swap(pp)))); /* XXX */ + if (displaymode == DISP_IO) { oldp = get_old_proc(pp); if (oldp != NULL) { @@ -1122,6 +1143,7 @@ format_next_process(caddr_t handle, char format_nice(pp), format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), + swaplength, swaplength, swap_buf, status, cpu, format_time(cputime), @@ -1309,6 +1331,12 @@ static int sorted_state[] = { return (diff > 0 ? 1 : -1); \ } while (0) +#define ORDERKEY_SWAP(a, b) do { \ + int diff = (int)ki_swap(b) - (int)ki_swap(a); \ + if (diff != 0) \ + return (diff > 0 ? 1 : -1); \ +} while (0) + /* compare_cpu - the comparison function for sorting by cpu percentage */ int @@ -1357,6 +1385,7 @@ int (*compares[])() = { compare_vcsw, compare_ivcsw, compare_jid, + compare_swap, NULL }; @@ -1467,6 +1496,24 @@ compare_jid(const void *arg1, const void return (0); } + +/* compare_swap - the comparison function for sorting by swap */ +static int +compare_swap(const void *arg1, const void *arg2) +{ + struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; + struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + + ORDERKEY_SWAP(p1, p2); + ORDERKEY_PCTCPU(p1, p2); + ORDERKEY_CPTICKS(p1, p2); + ORDERKEY_STATE(p1, p2); + ORDERKEY_PRIO(p1, p2); + ORDERKEY_RSSIZE(p1, p2); + ORDERKEY_MEM(p1, p2); + + return (0); +} #endif /* ORDER */ /* assorted comparison functions for sorting by i/o */ From owner-svn-src-head@freebsd.org Mon Sep 5 08:42: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 E41E0A9D76E; Mon, 5 Sep 2016 08:42:37 +0000 (UTC) (envelope-from wma@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 9D297E6B; Mon, 5 Sep 2016 08:42:37 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u858gaAO093191; Mon, 5 Sep 2016 08:42:36 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u858galT093190; Mon, 5 Sep 2016 08:42:36 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609050842.u858galT093190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 5 Sep 2016 08:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305415 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 08:42:38 -0000 Author: wma Date: Mon Sep 5 08:42:36 2016 New Revision: 305415 URL: https://svnweb.freebsd.org/changeset/base/305415 Log: bsdinstall: add warning when unsupported partition is modified Right now is possible to modify bootable partition type to non-bootable type without getting warning from partedit. Example: if you auto parition drive for arm64, you will get freebsd-ufs as bootable partition; now you are able to change bootable partition type to freebsd-zfs; there will be no warning and the system will install but will not be bootable afterwards. After this fix, partedit will issue the same warning it does when user attempts to create bootable partition of not supported type, notyfing a user about incoming problem and allowing to think the decision over before commiting the schema. This has been tested on amd64 and arm64. Obtained from: Semihalf Submitted by: Dominik Ermel Sponsored by: Cavium Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D6879 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Mon Sep 5 08:27:04 2016 (r305414) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Mon Sep 5 08:42:36 2016 (r305415) @@ -617,6 +617,20 @@ editpart: if (choice) /* Cancel pressed */ goto endedit; + /* If this is the root partition, check that this fs is bootable */ + if (strcmp(items[2].text, "/") == 0 && !is_fs_bootable(scheme, + items[0].text)) { + char message[512]; + sprintf(message, "This file system (%s) is not bootable " + "on this system. Are you sure you want to proceed?", + items[0].text); + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", message, 0, 0); + dialog_vars.defaultno = FALSE; + if (choice == 1) /* cancel */ + goto editpart; + } + /* Check if the label has a / in it */ if (strchr(items[3].text, '/') != NULL) { dialog_msgbox("Error", "Label contains a /, which is not an " From owner-svn-src-head@freebsd.org Mon Sep 5 11:05: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 D534EB96448; Mon, 5 Sep 2016 11:05:15 +0000 (UTC) (envelope-from jmcneill@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 944679E6; Mon, 5 Sep 2016 11:05:15 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85B5EAc045418; Mon, 5 Sep 2016 11:05:14 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85B5EY5045415; Mon, 5 Sep 2016 11:05:14 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609051105.u85B5EY5045415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 5 Sep 2016 11:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305416 - in head/sys/arm/allwinner: . clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 11:05:15 -0000 Author: jmcneill Date: Mon Sep 5 11:05:14 2016 New Revision: 305416 URL: https://svnweb.freebsd.org/changeset/base/305416 Log: Add support for the Allwinner H3 Thermal Sensor Controller. The H3 embeds a single thermal sensor located in the CPU. Modified: head/sys/arm/allwinner/aw_thermal.c head/sys/arm/allwinner/clk/aw_thsclk.c head/sys/arm/allwinner/files.allwinner Modified: head/sys/arm/allwinner/aw_thermal.c ============================================================================== --- head/sys/arm/allwinner/aw_thermal.c Mon Sep 5 08:42:36 2016 (r305415) +++ head/sys/arm/allwinner/aw_thermal.c Mon Sep 5 11:05:14 2016 (r305416) @@ -82,16 +82,26 @@ __FBSDID("$FreeBSD$"); #define A83T_FILTER 0x4 #define A83T_INTC 0x1000 #define A83T_TEMP_BASE 2719000 +#define A83T_TEMP_MUL 1000 #define A83T_TEMP_DIV 14186 #define A83T_CLK_RATE 24000000 #define A64_ADC_ACQUIRE_TIME 0x190 #define A64_FILTER 0x6 -#define A64_INTC 0x18000 +#define A64_INTC 0x18000 #define A64_TEMP_BASE 2170000 +#define A64_TEMP_MUL 1000 #define A64_TEMP_DIV 8560 #define A64_CLK_RATE 4000000 +#define H3_ADC_ACQUIRE_TIME 0x3f +#define H3_FILTER 0x6 +#define H3_INTC 0x191000 +#define H3_TEMP_BASE 217000000 +#define H3_TEMP_MUL 121168 +#define H3_TEMP_DIV 1000000 +#define H3_CLK_RATE 4000000 + #define TEMP_C_TO_K 273 #define SENSOR_ENABLE_ALL (SENSOR0_EN|SENSOR1_EN|SENSOR2_EN) #define SHUT_INT_ALL (SHUT_INT0_STS|SHUT_INT1_STS|SHUT_INT2_STS) @@ -110,8 +120,10 @@ struct aw_thermal_config { uint32_t adc_acquire_time; uint32_t filter; uint32_t intc; - uint32_t temp_base; - uint32_t temp_div; + int temp_base; + int temp_mul; + int temp_div; + int calib; }; static const struct aw_thermal_config a83t_config = { @@ -135,7 +147,9 @@ static const struct aw_thermal_config a8 .filter = A83T_FILTER, .intc = A83T_INTC, .temp_base = A83T_TEMP_BASE, + .temp_mul = A83T_TEMP_MUL, .temp_div = A83T_TEMP_DIV, + .calib = 1, }; static const struct aw_thermal_config a64_config = { @@ -159,11 +173,30 @@ static const struct aw_thermal_config a6 .filter = A64_FILTER, .intc = A64_INTC, .temp_base = A64_TEMP_BASE, + .temp_mul = A64_TEMP_MUL, .temp_div = A64_TEMP_DIV, }; +static const struct aw_thermal_config h3_config = { + .nsensors = 1, + .sensors = { + [0] = { + .name = "cpu", + .desc = "CPU temperature", + }, + }, + .clk_rate = H3_CLK_RATE, + .adc_acquire_time = H3_ADC_ACQUIRE_TIME, + .filter = H3_FILTER, + .intc = H3_INTC, + .temp_base = H3_TEMP_BASE, + .temp_mul = H3_TEMP_MUL, + .temp_div = H3_TEMP_DIV, +}; + static struct ofw_compat_data compat_data[] = { { "allwinner,sun8i-a83t-ts", (uintptr_t)&a83t_config }, + { "allwinner,sun8i-h3-ts", (uintptr_t)&h3_config }, { "allwinner,sun50i-a64-ts", (uintptr_t)&a64_config }, { NULL, (uintptr_t)NULL } }; @@ -191,14 +224,16 @@ aw_thermal_init(struct aw_thermal_softc uint32_t calib0, calib1; int error; - /* Read calibration settings from SRAM */ - error = aw_sid_read_tscalib(&calib0, &calib1); - if (error != 0) - return (error); - - /* Write calibration settings to thermal controller */ - WR4(sc, THS_CALIB0, calib0); - WR4(sc, THS_CALIB1, calib1); + if (sc->conf->calib) { + /* Read calibration settings from SRAM */ + error = aw_sid_read_tscalib(&calib0, &calib1); + if (error != 0) + return (error); + + /* Write calibration settings to thermal controller */ + WR4(sc, THS_CALIB0, calib0); + WR4(sc, THS_CALIB1, calib1); + } /* Configure ADC acquire time (CLK_IN/(N+1)) and enable sensors */ WR4(sc, THS_CTRL1, ADC_CALI_EN); @@ -221,7 +256,8 @@ aw_thermal_init(struct aw_thermal_softc static int aw_thermal_reg_to_temp(struct aw_thermal_softc *sc, uint32_t val) { - return ((sc->conf->temp_base - val * 1000) / sc->conf->temp_div); + return ((sc->conf->temp_base - (val * sc->conf->temp_mul)) / + sc->conf->temp_div); } static int Modified: head/sys/arm/allwinner/clk/aw_thsclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_thsclk.c Mon Sep 5 08:42:36 2016 (r305415) +++ head/sys/arm/allwinner/clk/aw_thsclk.c Mon Sep 5 11:05:14 2016 (r305416) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define CLK_DIV_RATIO_MAX 3 static struct ofw_compat_data compat_data[] = { + { "allwinner,sun8i-h3-ths-clk", 1 }, { "allwinner,sun50i-a64-ths-clk", 1 }, { NULL, 0 } }; Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Mon Sep 5 08:42:36 2016 (r305415) +++ head/sys/arm/allwinner/files.allwinner Mon Sep 5 11:05:14 2016 (r305416) @@ -52,4 +52,5 @@ arm/allwinner/clk/aw_modclk.c standard arm/allwinner/clk/aw_mmcclk.c standard arm/allwinner/clk/aw_oscclk.c standard arm/allwinner/clk/aw_pll.c standard +arm/allwinner/clk/aw_thsclk.c standard arm/allwinner/clk/aw_usbclk.c standard From owner-svn-src-head@freebsd.org Mon Sep 5 12: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 A2C80A9D1C4; Mon, 5 Sep 2016 12:36:55 +0000 (UTC) (envelope-from jmcneill@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 80C788DA; Mon, 5 Sep 2016 12:36:55 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85CasQB079788; Mon, 5 Sep 2016 12:36:54 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85CasD6079787; Mon, 5 Sep 2016 12:36:54 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609051236.u85CasD6079787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 5 Sep 2016 12:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305417 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 12:36:55 -0000 Author: jmcneill Date: Mon Sep 5 12:36:54 2016 New Revision: 305417 URL: https://svnweb.freebsd.org/changeset/base/305417 Log: Add support for Allwinner H3 PLL_CPUX. The H3 PLL_CPUX register looks exactly like the one found in A23, but we need to follow a specific protocol when making adjustments to the clock. Modified: head/sys/arm/allwinner/clk/aw_pll.c Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Mon Sep 5 11:05:14 2016 (r305416) +++ head/sys/arm/allwinner/clk/aw_pll.c Mon Sep 5 12:36:54 2016 (r305417) @@ -187,6 +187,7 @@ static struct aw_pll_factor aw_a23_pll1_ PLLFACTOR(16, 1, 0, 0, 816000000), PLLFACTOR(20, 1, 0, 0, 1008000000), PLLFACTOR(24, 1, 0, 0, 1200000000), + PLLFACTOR(26, 1, 0, 0, 1296000000), }; enum aw_pll_type { @@ -201,6 +202,7 @@ enum aw_pll_type { AWPLL_A31_PLL6, AWPLL_A64_PLLHSIC, AWPLL_A80_PLL4, + AWPLL_H3_PLL1, }; struct aw_pll_sc { @@ -627,6 +629,72 @@ a23_pll1_recalc(struct aw_pll_sc *sc, ui } static int +h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout, + int flags) +{ + struct aw_pll_factor *f; + uint32_t val, n, k, m, p; + int i; + + f = NULL; + for (i = 0; i < nitems(aw_a23_pll1_factors); i++) { + if (aw_a23_pll1_factors[i].freq == *fout) { + f = &aw_a23_pll1_factors[i]; + break; + } + } + if (f == NULL) + return (EINVAL); + + DEVICE_LOCK(sc); + PLL_READ(sc, &val); + + n = (val & A23_PLL1_FACTOR_N) >> A23_PLL1_FACTOR_N_SHIFT; + k = (val & A23_PLL1_FACTOR_K) >> A23_PLL1_FACTOR_K_SHIFT; + m = (val & A23_PLL1_FACTOR_M) >> A23_PLL1_FACTOR_M_SHIFT; + p = (val & A23_PLL1_FACTOR_P) >> A23_PLL1_FACTOR_P_SHIFT; + + if (p < f->p) { + val &= ~A23_PLL1_FACTOR_P; + val |= (f->p << A23_PLL1_FACTOR_P_SHIFT); + PLL_WRITE(sc, val); + DELAY(2000); + } + + if (m < f->m) { + val &= ~A23_PLL1_FACTOR_M; + val |= (f->m << A23_PLL1_FACTOR_M_SHIFT); + PLL_WRITE(sc, val); + DELAY(2000); + } + + val &= ~(A23_PLL1_FACTOR_N|A23_PLL1_FACTOR_K); + val |= (f->n << A23_PLL1_FACTOR_N_SHIFT); + val |= (f->k << A23_PLL1_FACTOR_K_SHIFT); + PLL_WRITE(sc, val); + DELAY(2000); + + if (m > f->m) { + val &= ~A23_PLL1_FACTOR_M; + val |= (f->m << A23_PLL1_FACTOR_M_SHIFT); + PLL_WRITE(sc, val); + DELAY(2000); + } + + if (p > f->p) { + val &= ~A23_PLL1_FACTOR_P; + val |= (f->p << A23_PLL1_FACTOR_P_SHIFT); + PLL_WRITE(sc, val); + DELAY(2000); + } + + DEVICE_UNLOCK(sc); + + return (0); + +} + +static int a31_pll1_recalc(struct aw_pll_sc *sc, uint64_t *freq) { uint32_t val, m, n, k; @@ -775,6 +843,7 @@ static struct aw_pll_funcs aw_pll_func[] PLL(AWPLL_A31_PLL6, a31_pll6_recalc, NULL, a31_pll6_init), PLL(AWPLL_A80_PLL4, a80_pll4_recalc, NULL, NULL), PLL(AWPLL_A64_PLLHSIC, a64_pllhsic_recalc, NULL, a64_pllhsic_init), + PLL(AWPLL_H3_PLL1, a23_pll1_recalc, h3_pll1_set_freq, NULL), }; static struct ofw_compat_data compat_data[] = { @@ -787,6 +856,7 @@ static struct ofw_compat_data compat_dat { "allwinner,sun6i-a31-pll1-clk", AWPLL_A31_PLL1 }, { "allwinner,sun6i-a31-pll6-clk", AWPLL_A31_PLL6 }, { "allwinner,sun8i-a23-pll1-clk", AWPLL_A23_PLL1 }, + { "allwinner,sun8i-h3-pll1-clk", AWPLL_H3_PLL1 }, { "allwinner,sun9i-a80-pll4-clk", AWPLL_A80_PLL4 }, { "allwinner,sun50i-a64-pllhsic-clk", AWPLL_A64_PLLHSIC }, { NULL, 0 } From owner-svn-src-head@freebsd.org Mon Sep 5 13:39: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 CDB00B962AD; Mon, 5 Sep 2016 13:39:55 +0000 (UTC) (envelope-from jmcneill@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 91B819FB; Mon, 5 Sep 2016 13:39:55 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85DdsKH003152; Mon, 5 Sep 2016 13:39:54 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85DdsEN003151; Mon, 5 Sep 2016 13:39:54 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609051339.u85DdsEN003151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 5 Sep 2016 13:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305418 - head/sys/dev/iicbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 13:39:55 -0000 Author: jmcneill Date: Mon Sep 5 13:39:54 2016 New Revision: 305418 URL: https://svnweb.freebsd.org/changeset/base/305418 Log: Add driver for Silergy Corp. SY8106A buck regulator. Added: head/sys/dev/iicbus/sy8106a.c (contents, props changed) Added: head/sys/dev/iicbus/sy8106a.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/sy8106a.c Mon Sep 5 13:39:54 2016 (r305418) @@ -0,0 +1,302 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Silergy Corp. SY8106A buck regulator + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "iicbus_if.h" +#include "regdev_if.h" + +#define VOUT1_SEL 0x01 +#define SEL_GO (1 << 7) +#define SEL_VOLTAGE_MASK 0x7f +#define SEL_VOLTAGE_BASE 680000 /* uV */ +#define SEL_VOLTAGE_STEP 10000 /* uV */ +#define VOUT_COM 0x02 +#define COM_DISABLE (1 << 0) +#define SYS_STATUS 0x06 + +static struct ofw_compat_data compat_data[] = { + { "silergy,sy8106a", 1 }, + { NULL, 0 } +}; + +struct sy8106a_reg_sc { + struct regnode *regnode; + device_t base_dev; + phandle_t xref; + struct regnode_std_param *param; +}; + +struct sy8106a_softc { + uint16_t addr; + + /* Regulator */ + struct sy8106a_reg_sc *reg; +}; + +static int +sy8106a_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) +{ + struct sy8106a_softc *sc; + struct iic_msg msg[2]; + + sc = device_get_softc(dev); + + msg[0].slave = sc->addr; + msg[0].flags = IIC_M_WR; + msg[0].len = 1; + msg[0].buf = ® + + msg[1].slave = sc->addr; + msg[1].flags = IIC_M_RD; + msg[1].len = size; + msg[1].buf = data; + + return (iicbus_transfer(dev, msg, 2)); +} + +static int +sy8106a_write(device_t dev, uint8_t reg, uint8_t val) +{ + struct sy8106a_softc *sc; + struct iic_msg msg; + uint8_t buffer[2]; + + sc = device_get_softc(dev); + + buffer[0] = reg; + buffer[1] = val; + + msg.slave = sc->addr; + msg.flags = IIC_M_WR; + msg.len = 2; + msg.buf = buffer; + + return (iicbus_transfer(dev, &msg, 1)); +} + +static int +sy8106a_regnode_init(struct regnode *regnode) +{ + return (0); +} + +static int +sy8106a_regnode_enable(struct regnode *regnode, bool enable, int *udelay) +{ + struct sy8106a_reg_sc *sc; + uint8_t val; + + sc = regnode_get_softc(regnode); + + sy8106a_read(sc->base_dev, VOUT_COM, &val, 1); + if (enable) + val &= ~COM_DISABLE; + else + val |= COM_DISABLE; + sy8106a_write(sc->base_dev, VOUT_COM, val); + + *udelay = sc->param->ramp_delay; + + return (0); +} + +static int +sy8106a_regnode_set_voltage(struct regnode *regnode, int min_uvolt, + int max_uvolt, int *udelay) +{ + struct sy8106a_reg_sc *sc; + int cur_uvolt; + uint8_t val, oval; + + sc = regnode_get_softc(regnode); + + /* Get current voltage */ + sy8106a_read(sc->base_dev, VOUT1_SEL, &oval, 1); + cur_uvolt = (oval & SEL_VOLTAGE_MASK) * SEL_VOLTAGE_STEP + + SEL_VOLTAGE_BASE; + + /* Set new voltage */ + val = SEL_GO | ((min_uvolt - SEL_VOLTAGE_BASE) / SEL_VOLTAGE_STEP); + sy8106a_write(sc->base_dev, VOUT1_SEL, val); + + /* Time to delay is based on the number of voltage steps */ + *udelay = sc->param->ramp_delay * + (abs(cur_uvolt - min_uvolt) / SEL_VOLTAGE_STEP); + + return (0); +} + +static int +sy8106a_regnode_get_voltage(struct regnode *regnode, int *uvolt) +{ + struct sy8106a_reg_sc *sc; + uint8_t val; + + sc = regnode_get_softc(regnode); + + sy8106a_read(sc->base_dev, VOUT1_SEL, &val, 1); + *uvolt = (val & SEL_VOLTAGE_MASK) * SEL_VOLTAGE_STEP + + SEL_VOLTAGE_BASE; + + return (0); +} + +static regnode_method_t sy8106a_regnode_methods[] = { + /* Regulator interface */ + REGNODEMETHOD(regnode_init, sy8106a_regnode_init), + REGNODEMETHOD(regnode_enable, sy8106a_regnode_enable), + REGNODEMETHOD(regnode_set_voltage, sy8106a_regnode_set_voltage), + REGNODEMETHOD(regnode_get_voltage, sy8106a_regnode_get_voltage), + REGNODEMETHOD_END +}; +DEFINE_CLASS_1(sy8106a_regnode, sy8106a_regnode_class, sy8106a_regnode_methods, + sizeof(struct sy8106a_reg_sc), regnode_class); + +static struct sy8106a_reg_sc * +sy8106a_reg_attach(device_t dev, phandle_t node) +{ + struct sy8106a_reg_sc *reg_sc; + struct regnode_init_def initdef; + struct regnode *regnode; + + memset(&initdef, 0, sizeof(initdef)); + regulator_parse_ofw_stdparam(dev, node, &initdef); + initdef.id = 0; + initdef.ofw_node = node; + regnode = regnode_create(dev, &sy8106a_regnode_class, &initdef); + if (regnode == NULL) { + device_printf(dev, "cannot create regulator\n"); + return (NULL); + } + + reg_sc = regnode_get_softc(regnode); + reg_sc->regnode = regnode; + reg_sc->base_dev = dev; + reg_sc->xref = OF_xref_from_node(node); + reg_sc->param = regnode_get_stdparam(regnode); + + regnode_register(regnode); + + return (reg_sc); +} + +static int +sy8106a_regdev_map(device_t dev, phandle_t xref, int ncells, pcell_t *cells, + intptr_t *num) +{ + struct sy8106a_softc *sc; + + sc = device_get_softc(dev); + + if (sc->reg->xref != xref) + return (ENXIO); + + *num = 0; + + return (0); +} + +static int +sy8106a_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Silergy SY8106A regulator"); + + return (BUS_PROBE_DEFAULT); +} + +static int +sy8106a_attach(device_t dev) +{ + struct sy8106a_softc *sc; + phandle_t node; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + + sc->addr = iicbus_get_addr(dev); + + sc->reg = sy8106a_reg_attach(dev, node); + if (sc->reg == NULL) { + device_printf(dev, "cannot attach regulator\n"); + return (ENXIO); + } + + return (0); +} + +static device_method_t sy8106a_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, sy8106a_probe), + DEVMETHOD(device_attach, sy8106a_attach), + + /* Regdev interface */ + DEVMETHOD(regdev_map, sy8106a_regdev_map), + + DEVMETHOD_END +}; + +static driver_t sy8106a_driver = { + "sy8106a", + sy8106a_methods, + sizeof(struct sy8106a_softc), +}; + +static devclass_t sy8106a_devclass; + +EARLY_DRIVER_MODULE(sy8106a, iicbus, sy8106a_driver, sy8106a_devclass, 0, 0, + BUS_PASS_RESOURCE); +MODULE_VERSION(sy8106a, 1); +MODULE_DEPEND(sy8106a, iicbus, 1, 1, 1); From owner-svn-src-head@freebsd.org Mon Sep 5 13:45: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 9F2C7B96441; Mon, 5 Sep 2016 13:45:46 +0000 (UTC) (envelope-from jmcneill@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 6BB94E10; Mon, 5 Sep 2016 13:45:46 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85Djj5G006932; Mon, 5 Sep 2016 13:45:45 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85DjjJ6006930; Mon, 5 Sep 2016 13:45:45 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609051345.u85DjjJ6006930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 5 Sep 2016 13:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305419 - in head/sys/arm: allwinner 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.23 Precedence: list List-Id: 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, 05 Sep 2016 13:45:46 -0000 Author: jmcneill Date: Mon Sep 5 13:45:45 2016 New Revision: 305419 URL: https://svnweb.freebsd.org/changeset/base/305419 Log: Add sy8106a to Allwinner kernel. This regulator is used to control VDD_CPUX and is connected to R_TWI on some H3-based Orange Pi boards. Modified: head/sys/arm/allwinner/files.allwinner head/sys/arm/conf/ALLWINNER Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Mon Sep 5 13:39:54 2016 (r305418) +++ head/sys/arm/allwinner/files.allwinner Mon Sep 5 13:45:45 2016 (r305419) @@ -28,6 +28,7 @@ dev/usb/controller/generic_ohci.c option dev/usb/controller/generic_usb_if.m optional ohci arm/allwinner/aw_sid.c standard arm/allwinner/aw_thermal.c standard +dev/iicbus/sy8106a.c optional sy8106a #arm/allwinner/console.c standard arm/allwinner/a10_fb.c optional vt Modified: head/sys/arm/conf/ALLWINNER ============================================================================== --- head/sys/arm/conf/ALLWINNER Mon Sep 5 13:39:54 2016 (r305418) +++ head/sys/arm/conf/ALLWINNER Mon Sep 5 13:45:45 2016 (r305419) @@ -81,6 +81,7 @@ device twsi device rsb device axp209 # AXP209 Power Management Unit device axp81x # AXP813/818 Power Management Unit +device sy8106a # SY8106A Buck Regulator # GPIO device gpio From owner-svn-src-head@freebsd.org Mon Sep 5 15:36: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 E473BA9D349; Mon, 5 Sep 2016 15:36:00 +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 BCDCBD41; Mon, 5 Sep 2016 15:36:00 +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 u85FZxgv049251; Mon, 5 Sep 2016 15:35:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85FZxOY049242; Mon, 5 Sep 2016 15:35:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609051535.u85FZxOY049242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 5 Sep 2016 15:35:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305421 - in head/sys: dev/usb dev/usb/template 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.23 Precedence: list List-Id: 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, 05 Sep 2016 15:36:01 -0000 Author: hselasky Date: Mon Sep 5 15:35:58 2016 New Revision: 305421 URL: https://svnweb.freebsd.org/changeset/base/305421 Log: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@ MFC after: 1 week Modified: head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usb_util.c head/sys/sys/param.h Modified: head/sys/dev/usb/template/usb_template.c ============================================================================== --- head/sys/dev/usb/template/usb_template.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/template/usb_template.c Mon Sep 5 15:35:58 2016 (r305421) @@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev, return (0); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); uts = udev->scratch.temp_setup; @@ -1324,7 +1324,7 @@ done: if (error) usb_temp_unsetup(udev); if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_device.c Mon Sep 5 15:35:58 2016 (r305421) @@ -1585,6 +1585,7 @@ usb_alloc_device(device_t parent_dev, st /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); + sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); cv_init(&udev->ctrlreq_cv, "WCTRL"); cv_init(&udev->ref_cv, "UGONE"); @@ -1770,7 +1771,7 @@ usb_alloc_device(device_t parent_dev, st */ /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); scratch_ptr = udev->scratch.data; @@ -1821,7 +1822,7 @@ usb_alloc_device(device_t parent_dev, st } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; @@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev, sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); + sx_destroy(&udev->ctrl_sx); cv_destroy(&udev->ctrlreq_cv); cv_destroy(&udev->ref_cv); @@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic uint8_t do_unlock; /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_ptr = (char *)udev->scratch.data; temp_size = sizeof(udev->scratch.data); @@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); } /* @@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u } /* + * The following function is used to serialize access to USB control + * transfers and the USB scratch area. If the lock is already grabbed + * this function returns zero. Else a value of one is returned. + */ +uint8_t +usbd_ctrl_lock(struct usb_device *udev) +{ + if (sx_xlocked(&udev->ctrl_sx)) + return (0); + sx_xlock(&udev->ctrl_sx); + + /* + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_unlock(udev); + return (1); +} + +void +usbd_ctrl_unlock(struct usb_device *udev) +{ + sx_xunlock(&udev->ctrl_sx); + + /* + * Restore the suspend and resume lock after we have unlocked + * the USB control transfer lock to avoid LOR: + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_lock(udev); +} + +/* * The following function is used to set the per-interface specific * plug and play information. The string referred to by the pnpinfo * argument can safely be freed after calling this function. The Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_device.h Mon Sep 5 15:35:58 2016 (r305421) @@ -162,7 +162,7 @@ struct usb_temp_setup { /* * The scratch area for USB devices. Access to this structure is - * protected by the enumeration SX lock. + * protected by the control SX lock. */ union usb_device_scratch { struct usb_hw_ep_scratch hw_ep_scratch[1]; @@ -183,6 +183,7 @@ struct usb_device { struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; + struct sx ctrl_sx; struct mtx device_mtx; struct cv ctrlreq_cv; struct cv ref_cv; @@ -320,6 +321,8 @@ uint8_t usbd_enum_lock_sig(struct usb_de void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); +uint8_t usbd_ctrl_lock(struct usb_device *); +void usbd_ctrl_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); #if USB_HAVE_TT_SUPPORT Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_generic.c Mon Sep 5 15:35:58 2016 (r305421) @@ -714,16 +714,16 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } -/* - * This function is called having the enumeration SX locked which - * protects the scratch area used. - */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr; uint16_t size; int error; + uint8_t do_unlock; + + /* Protect scratch area */ + do_unlock = usbd_ctrl_lock(f->udev); ptr = f->udev->scratch.data; size = sizeof(f->udev->scratch.data); @@ -744,6 +744,9 @@ ugen_get_sdesc(struct usb_fifo *f, struc error = copyout(ptr, ugd->ugd_data, size); } + if (do_unlock) + usbd_ctrl_unlock(f->udev); + return (error); } Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_request.c Mon Sep 5 15:35:58 2016 (r305421) @@ -460,16 +460,9 @@ usbd_do_request_flags(struct usb_device } /* - * Grab the USB device enumeration SX-lock serialization is - * achieved when multiple threads are involved: + * Serialize access to this function: */ - do_unlock = usbd_enum_lock(udev); - - /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! - */ - usbd_sr_unlock(udev); + do_unlock = usbd_ctrl_lock(udev); hr_func = usbd_get_hr_func(udev); @@ -713,10 +706,8 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - usbd_sr_lock(udev); - if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_transfer.c Mon Sep 5 15:35:58 2016 (r305421) @@ -953,7 +953,7 @@ usbd_transfer_setup(struct usb_device *u return (error); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); refcount = 0; info = NULL; @@ -1274,7 +1274,7 @@ done: error = parm->err; if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: head/sys/dev/usb/usb_util.c ============================================================================== --- head/sys/dev/usb/usb_util.c Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/dev/usb/usb_util.c Mon Sep 5 15:35:58 2016 (r305421) @@ -98,7 +98,7 @@ device_set_usb_desc(device_t dev) } /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_p = (char *)udev->scratch.data; @@ -115,7 +115,7 @@ device_set_usb_desc(device_t dev) } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); device_set_desc_copy(dev, temp_p); device_printf(dev, "<%s> on %s\n", temp_p, Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Sep 5 15:20:55 2016 (r305420) +++ head/sys/sys/param.h Mon Sep 5 15:35:58 2016 (r305421) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200006 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200007 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Mon Sep 5 15:40: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 5589AA9D455; Mon, 5 Sep 2016 15:40:43 +0000 (UTC) (envelope-from mm@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 251BB97; Mon, 5 Sep 2016 15:40:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85FegsH049459; Mon, 5 Sep 2016 15:40:42 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85Fefxt049453; Mon, 5 Sep 2016 15:40:41 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201609051540.u85Fefxt049453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 5 Sep 2016 15:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305422 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 15:40:43 -0000 Author: mm Date: Mon Sep 5 15:40:41 2016 New Revision: 305422 URL: https://svnweb.freebsd.org/changeset/base/305422 Log: MFV r305420: Sync libarchive with vendor Vendor issues fixed: PR #777: Multiple bugfixes for setup_acls() This includes a bugfix for a bug that caused ACLs not to be read properly for files and directories inside subdirectories and as a result not being stored or being incorrectly stored in tar archives. MFC after: 3 days Added: head/contrib/libarchive/README.md - copied unchanged from r305420, vendor/libarchive/dist/README.md Deleted: head/contrib/libarchive/README Modified: head/contrib/libarchive/libarchive/archive_acl.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c head/lib/libarchive/config_freebsd.h Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/libarchive/ (props changed) Copied: head/contrib/libarchive/README.md (from r305420, vendor/libarchive/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/README.md Mon Sep 5 15:40:41 2016 (r305422, copy of r305420, vendor/libarchive/dist/README.md) @@ -0,0 +1,222 @@ +# Welcome to libarchive! + +The libarchive project develops a portable, efficient C library that +can read and write streaming archives in a variety of formats. It +also includes implementations of the common `tar`, `cpio`, and `zcat` +command-line tools that use the libarchive library. + +## Questions? Issues? + +* http://www.libarchive.org is the home for ongoing + libarchive development, including documentation, + and links to the libarchive mailing lists. +* To report an issue, use the issue tracker at + https://github.com/libarchive/libarchive/issues +* To submit an enhancement to libarchive, please + submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls + +## Contents of the Distribution + +This distribution bundle includes the following major components: + +* **libarchive**: a library for reading and writing streaming archives +* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive +* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality +* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such +* **examples**: Some small example programs that you may find useful. +* **examples/minitar**: a compact sample demonstrating use of libarchive. +* **contrib**: Various items sent to me by third parties; please contact the authors with any questions. + +The top-level directory contains the following information files: + +* **NEWS** - highlights of recent changes +* **COPYING** - what you can do with this +* **INSTALL** - installation instructions +* **README** - this file +* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL +* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`). + +The following files in the top-level directory are used by the 'configure' script: +* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers +* `Makefile.in`, `config.h.in` - templates used by configure script + +## Documentation + +In addition to the informational articles and documentation +in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki), +the distribution also includes a number of manual pages: + + * bsdtar.1 explains the use of the bsdtar program + * bsdcpio.1 explains the use of the bsdcpio program + * bsdcat.1 explains the use of the bsdcat program + * libarchive.3 gives an overview of the library as a whole + * archive_read.3, archive_write.3, archive_write_disk.3, and + archive_read_disk.3 provide detailed calling sequences for the read + and write APIs + * archive_entry.3 details the "struct archive_entry" utility class + * archive_internals.3 provides some insight into libarchive's + internal structure and operation. + * libarchive-formats.5 documents the file formats supported by the library + * cpio.5, mtree.5, and tar.5 provide detailed information about these + popular archive formats, including hard-to-find details about + modern cpio and tar variants. + +The manual pages above are provided in the 'doc' directory in +a number of different formats. + +You should also read the copious comments in `archive.h` and the +source code for the sample programs for more details. Please let us +know about any errors or omissions you find. + +## Supported Formats + +Currently, the library automatically detects and reads the following fomats: + * Old V7 tar archives + * POSIX ustar + * GNU tar format (including GNU long filenames, long link names, and sparse files) + * Solaris 9 extended tar format (including ACLs) + * POSIX pax interchange format + * POSIX octet-oriented cpio + * SVR4 ASCII cpio + * POSIX octet-oriented cpio + * Binary cpio (big-endian or little-endian) + * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) + * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) + * GNU and BSD 'ar' archives + * 'mtree' format + * 7-Zip archives + * Microsoft CAB format + * LHA and LZH archives + * RAR archives (with some limitations due to RAR's proprietary status) + * XAR archives + +The library also detects and handles any of the following before evaluating the archive: + * uuencoded files + * files with RPM wrapper + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +The library can create archives in any of the following formats: + * POSIX ustar + * POSIX pax interchange format + * "restricted" pax format, which will create ustar archives except for + entries that require pax extensions (for long filenames, ACLs, etc). + * Old GNU tar format + * Old V7 tar format + * POSIX octet-oriented cpio + * SVR4 "newc" cpio + * shar archives + * ZIP archives (with uncompressed or "deflate" compressed entries) + * GNU and BSD 'ar' archives + * 'mtree' format + * ISO9660 format + * 7-Zip archives + * XAR archives + +When creating archives, the result can be filtered with any of the following: + * uuencode + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +## Notes about the Library Design + +The following notes address many of the most common +questions we are asked about libarchive: + +* This is a heavily stream-oriented system. That means that + it is optimized to read or write the archive in a single + pass from beginning to end. For example, this allows + libarchive to process archives too large to store on disk + by processing them on-the-fly as they are read from or + written to a network or tape drive. This also makes + libarchive useful for tools that need to produce + archives on-the-fly (such as webservers that provide + archived contents of a users account). + +* In-place modification and random access to the contents + of an archive are not directly supported. For some formats, + this is not an issue: For example, tar.gz archives are not + designed for random access. In some other cases, libarchive + can re-open an archive and scan it from the beginning quickly + enough to provide the needed abilities even without true + random access. Of course, some applications do require true + random access; those applications should consider alternatives + to libarchive. + +* The library is designed to be extended with new compression and + archive formats. The only requirement is that the format be + readable or writable as a stream and that each archive entry be + independent. There are articles on the libarchive Wiki explaining + how to extend libarchive. + +* On read, compression and format are always detected automatically. + +* The same API is used for all formats; in particular, it's very + easy for software using libarchive to transparently handle + any of libarchive's archiving formats. + +* Libarchive's automatic support for decompression can be used + without archiving by explicitly selecting the "raw" and "empty" + formats. + +* I've attempted to minimize static link pollution. If you don't + explicitly invoke a particular feature (such as support for a + particular compression or format), it won't get pulled in to + statically-linked programs. In particular, if you don't explicitly + enable a particular compression or decompression support, you won't + need to link against the corresponding compression or decompression + libraries. This also reduces the size of statically-linked + binaries in environments where that matters. + +* The library is generally _thread safe_ depending on the platform: + it does not define any global variables of its own. However, some + platforms do not provide fully thread-safe versions of key C library + functions. On those platforms, libarchive will use the non-thread-safe + functions. Patches to improve this are of great interest to us. + +* In particular, libarchive's modules to read or write a directory + tree do use `chdir()` to optimize the directory traversals. This + can cause problems for programs that expect to do disk access from + multiple threads. Of course, those modules are completely + optional and you can use the rest of libarchive without them. + +* The library is _not_ thread aware, however. It does no locking + or thread management of any kind. If you create a libarchive + object and need to access it from multiple threads, you will + need to provide your own locking. + +* On read, the library accepts whatever blocks you hand it. + Your read callback is free to pass the library a byte at a time + or mmap the entire archive and give it to the library at once. + On write, the library always produces correctly-blocked output. + +* The object-style approach allows you to have multiple archive streams + open at once. bsdtar uses this in its "@archive" extension. + +* The archive itself is read/written using callback functions. + You can read an archive directly from an in-memory buffer or + write it to a socket, if you wish. There are some utility + functions to provide easy-to-use "open file," etc, capabilities. + +* The read/write APIs are designed to allow individual entries + to be read or written to any data source: You can create + a block of data in memory and add it to a tar archive without + first writing a temporary file. You can also read an entry from + an archive and write the data directly to a socket. If you want + to read/write entries to disk, there are convenience functions to + make this especially easy. + +* Note: The "pax interchange format" is a POSIX standard extended tar + format that should be used when the older _ustar_ format is not + appropriate. It has many advantages over other tar formats + (including the legacy GNU tar format) and is widely supported by + current tar implementations. + Modified: head/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_acl.c Mon Sep 5 15:35:58 2016 (r305421) +++ head/contrib/libarchive/libarchive/archive_acl.c Mon Sep 5 15:40:41 2016 (r305422) @@ -707,10 +707,11 @@ archive_acl_text_l(struct archive_acl *a if (r != 0) return (-1); *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { id = ap->id; - else + } else { id = -1; + } append_entry(&p, NULL, ap->tag, name, ap->permset, id); count++; Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 5 15:35:58 2016 (r305421) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 5 15:40:41 2016 (r305422) @@ -419,12 +419,32 @@ setup_acls(struct archive_read_disk *a, if (accpath == NULL) accpath = archive_entry_pathname(entry); + if (*fd < 0 && a->tree != NULL) { + if (a->follow_symlinks || + archive_entry_filetype(entry) != AE_IFLNK) + *fd = a->open_on_current_dir(a->tree, + accpath, O_RDONLY | O_NONBLOCK); + if (*fd < 0) { + if (a->tree_enter_working_dir(a->tree) != 0) { + archive_set_error(&a->archive, errno, + "Couldn't access %s", accpath); + return (ARCHIVE_FAILED); + } + } + } + archive_entry_acl_clear(entry); + acl = NULL; + #ifdef ACL_TYPE_NFS4 /* Try NFS4 ACL first. */ if (*fd >= 0) +#if HAVE_ACL_GET_FD_NP + acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4); +#else acl = acl_get_fd(*fd); +#endif #if HAVE_ACL_GET_LINK_NP else if (!a->follow_symlinks) acl = acl_get_link_np(accpath, ACL_TYPE_NFS4); @@ -437,12 +457,19 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_NFS4); + #if HAVE_ACL_IS_TRIVIAL_NP - /* Ignore "trivial" ACLs that just mirror the file mode. */ - acl_is_trivial_np(acl, &r); - if (r) { - acl_free(acl); - acl = NULL; + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (r) { + acl_free(acl); + acl = NULL; + /* + * Simultaneous NFSv4 and POSIX.1e ACLs for the same + * entry are not allowed, so we should return here + */ + return (ARCHIVE_OK); + } } #endif if (acl != NULL) { @@ -450,7 +477,7 @@ setup_acls(struct archive_read_disk *a, acl_free(acl); return (ARCHIVE_OK); } -#endif +#endif /* ACL_TYPE_NFS4 */ /* Retrieve access ACL from file. */ if (*fd >= 0) @@ -467,10 +494,22 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_ACCESS); + +#if HAVE_ACL_IS_TRIVIAL_NP + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + if (r) { + acl_free(acl); + acl = NULL; + } + } +#endif + if (acl != NULL) { translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); acl_free(acl); + acl = NULL; } /* Only directories can have default ACLs. */ Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 5 15:35:58 2016 (r305421) +++ head/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 5 15:40:41 2016 (r305422) @@ -1504,10 +1504,19 @@ setup_current_filesystem(struct archive_ struct tree *t = a->tree; struct statfs sfs; #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC) -# if defined(HAVE_STRUCT_VFSCONF) - struct vfsconf vfc; -# else +/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make + * this accurate; some platforms have both and we need the one that's + * used by getvfsbyname() + * + * Then the following would become: + * #if defined(GETVFSBYNAME_ARG_TYPE) + * GETVFSBYNAME_ARG_TYPE vfc; + * #endif + */ +# if defined(HAVE_STRUCT_XVFSCONF) struct xvfsconf vfc; +# else + struct vfsconf vfc; # endif #endif int r, xr = 0; Modified: head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 5 15:35:58 2016 (r305421) +++ head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 5 15:40:41 2016 (r305422) @@ -70,15 +70,9 @@ set_acls(struct archive_entry *ae, struc } static int -acl_match(acl_entry_t aclent, struct myacl_t *myacl) -{ - gid_t g, *gp; - uid_t u, *up; - acl_tag_t tag_type; - acl_permset_t opaque_ps; +acl_entry_get_perm(acl_entry_t aclent) { int permset = 0; - - acl_get_tag_type(aclent, &tag_type); + acl_permset_t opaque_ps; /* translate the silly opaque permset to a bitmap */ acl_get_permset(aclent, &opaque_ps); @@ -88,10 +82,61 @@ acl_match(acl_entry_t aclent, struct mya permset |= ARCHIVE_ENTRY_ACL_WRITE; if (acl_get_perm_np(opaque_ps, ACL_READ)) permset |= ARCHIVE_ENTRY_ACL_READ; + return permset; +} + +#if 0 +static int +acl_get_specific_entry(acl_t acl, acl_tag_t requested_tag_type, int requested_tag) { + int entry_id = ACL_FIRST_ENTRY; + acl_entry_t acl_entry; + acl_tag_t acl_tag_type; + + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* If this matches, return perm mask */ + acl_get_tag_type(acl_entry, &acl_tag_type); + if (acl_tag_type == requested_tag_type) { + switch (acl_tag_type) { + case ACL_USER_OBJ: + if ((uid_t)requested_tag == *(uid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_GROUP_OBJ: + if ((gid_t)requested_tag == *(gid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_USER: + case ACL_GROUP: + case ACL_OTHER: + return acl_entry_get_perm(acl_entry); + default: + failure("Unexpected ACL tag type"); + assert(0); + } + } + - if (permset != myacl->permset) + } + return -1; +} +#endif + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + gid_t g, *gp; + uid_t u, *up; + acl_tag_t tag_type; + + if (myacl->permset != acl_entry_get_perm(aclent)) return (0); + acl_get_tag_type(aclent, &tag_type); switch (tag_type) { case ACL_USER_OBJ: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); @@ -190,7 +235,7 @@ compare_acls(acl_t acl, struct myacl_t * * Verify ACL restore-to-disk. This test is FreeBSD-specific. */ -DEFINE_TEST(test_acl_freebsd_posix1e) +DEFINE_TEST(test_acl_freebsd_posix1e_restore) { #if !defined(__FreeBSD__) skipping("FreeBSD-specific ACL restore test"); @@ -263,3 +308,111 @@ DEFINE_TEST(test_acl_freebsd_posix1e) acl_free(acl); #endif } + +/* + * Verify ACL reaed-from-disk. This test is FreeBSD-specific. + */ +DEFINE_TEST(test_acl_freebsd_posix1e_read) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL read test"); +#elif __FreeBSD__ < 5 + skipping("ACL read supported only on FreeBSD 5.0 and later"); +#else + struct archive *a; + struct archive_entry *ae; + int n, fd; + const char *acl1_text, *acl2_text; + acl_t acl1, acl2; + + /* + * Manually construct a directory and two files with + * different ACLs. This also serves to verify that ACLs + * are supported on the local filesystem. + */ + + /* Create a test file f1 with acl1 */ + acl1_text = "user::rwx,group::rwx,other::rwx,user:1:rw-,group:15:r-x,mask::rwx"; + acl1 = acl_from_text(acl1_text); + assert((void *)acl1 != NULL); + fd = open("f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl1); + return; + } + n = acl_set_fd(fd, acl1); + acl_free(acl1); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + assertMakeDir("d", 0700); + + /* + * Create file d/f1 with acl2 + * + * This differs from acl1 in the u:1: and g:15: permissions. + * + * This file deliberately has the same name but a different ACL. + * Github Issue #777 explains how libarchive's directory traversal + * did not always correctly enter directories before attempting + * to read ACLs, resulting in reading the ACL from a like-named + * file in the wrong directory. + */ + acl2_text = "user::rwx,group::rwx,other::---,user:1:r--,group:15:r--,mask::rwx"; + acl2 = acl_from_text(acl2_text); + assert((void *)acl2 != NULL); + fd = open("d/f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl2); + return; + } + n = acl_set_fd(fd, acl2); + acl_free(acl2); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + /* Create a read-from-disk object. */ + assert(NULL != (a = archive_read_disk_new())); + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, ".")); + assert(NULL != (ae = archive_entry_new())); + + /* Walk the dir until we see both of the files */ + while (ARCHIVE_OK == archive_read_next_header2(a, ae)) { + archive_read_disk_descend(a); + if (strcmp(archive_entry_pathname(ae), "./f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl1_text); + + } else if (strcmp(archive_entry_pathname(ae), "./d/f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl2_text); + } + } + + archive_free(a); +#endif +} Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Mon Sep 5 15:35:58 2016 (r305421) +++ head/lib/libarchive/config_freebsd.h Mon Sep 5 15:40:41 2016 (r305422) @@ -30,6 +30,7 @@ /* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_FD_NP 1 #define HAVE_ACL_GET_LINK_NP 1 #define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 @@ -45,6 +46,7 @@ #define HAVE_EXTATTR_LIST_FILE 1 #define HAVE_EXTATTR_SET_FD 1 #define HAVE_EXTATTR_SET_FILE 1 +#define HAVE_STRUCT_XVFSCONF 1 #define HAVE_SYS_ACL_H 1 #define HAVE_SYS_EXTATTR_H 1 #endif From owner-svn-src-head@freebsd.org Mon Sep 5 16: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 01B1CA9DB26; Mon, 5 Sep 2016 16:04:42 +0000 (UTC) (envelope-from markj@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 C8744C3; Mon, 5 Sep 2016 16:04:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85G4fKn060621; Mon, 5 Sep 2016 16:04:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85G4fmP060620; Mon, 5 Sep 2016 16:04:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609051604.u85G4fmP060620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 5 Sep 2016 16:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305425 - 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.23 Precedence: list List-Id: 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, 05 Sep 2016 16:04:42 -0000 Author: markj Date: Mon Sep 5 16:04:40 2016 New Revision: 305425 URL: https://svnweb.freebsd.org/changeset/base/305425 Log: Remove an unreachable return state from ARM's minidumpsys(). Submitted by: Dominik Ermel MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7787 Modified: head/sys/arm/arm/minidump_machdep.c Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Mon Sep 5 15:50:40 2016 (r305424) +++ head/sys/arm/arm/minidump_machdep.c Mon Sep 5 16:04:40 2016 (r305425) @@ -369,7 +369,6 @@ fail: else printf("\n** DUMP FAILED (ERROR %d) **\n", error); return (error); - return (0); } void From owner-svn-src-head@freebsd.org Mon Sep 5 16:06: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 A76D0A9DC0E; Mon, 5 Sep 2016 16:06:53 +0000 (UTC) (envelope-from mizhka@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 723372C3; Mon, 5 Sep 2016 16:06:53 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85G6qDM060741; Mon, 5 Sep 2016 16:06:52 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85G6qnm060736; Mon, 5 Sep 2016 16:06:52 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201609051606.u85G6qnm060736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Mon, 5 Sep 2016 16:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305426 - in head/sys: dev/bhnd/cores/usb mips/broadcom mips/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.23 Precedence: list List-Id: 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, 05 Sep 2016 16:06:53 -0000 Author: mizhka Date: Mon Sep 5 16:06:52 2016 New Revision: 305426 URL: https://svnweb.freebsd.org/changeset/base/305426 Log: [BHND/USB] Port of EHCI/OHCI support from ZRouter This patch adds driver implementation for BHND USB core. Driver has been imported from ZRouter project with small adaptions for FreeBSD 11. Also it's enabled for BroadCom MIPS74k boards by default. It's fully tested on Asus boards (RT-N16: external USB, RT-N53: USB bus between SoC and WiFi chips). Reviewed by: adrian (mentor), ray Approved by: adrian (mentor) Obtained from: ZRouter Differential Revision: https://reviews.freebsd.org/D7781 Added: head/sys/dev/bhnd/cores/usb/ head/sys/dev/bhnd/cores/usb/bhnd_ehci.c (contents, props changed) head/sys/dev/bhnd/cores/usb/bhnd_ohci.c (contents, props changed) head/sys/dev/bhnd/cores/usb/bhnd_usb.c (contents, props changed) head/sys/dev/bhnd/cores/usb/bhnd_usbvar.h (contents, props changed) Modified: head/sys/mips/broadcom/files.broadcom head/sys/mips/conf/BCM Added: head/sys/dev/bhnd/cores/usb/bhnd_ehci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/cores/usb/bhnd_ehci.c Mon Sep 5 16:06:52 2016 (r305426) @@ -0,0 +1,267 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * Copyright (c) 2010, Aleksandr Rybalko + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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$"); + +/* + * BHND attachment driver for the USB Enhanced Host Controller. + * Ported from ZRouter with insignificant adaptations for FreeBSD11. + */ + +#include "opt_bus.h" + +#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 EHCI_HC_DEVSTR "Broadcom EHCI" + +#define USB_BRIDGE_INTR_CAUSE 0x210 +#define USB_BRIDGE_INTR_MASK 0x214 + +static device_attach_t bhnd_ehci_attach; +static device_detach_t bhnd_ehci_detach; + +static int bhnd_ehci_probe(device_t self); +static void bhnd_ehci_post_reset(struct ehci_softc *ehci_softc); + +static int +bhnd_ehci_probe(device_t self) +{ + + device_set_desc(self, EHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static void +bhnd_ehci_post_reset(struct ehci_softc *ehci_softc) +{ + uint32_t usbmode; + + /* Force HOST mode */ + usbmode = EOREAD4(ehci_softc, EHCI_USBMODE_NOLPM); + usbmode &= ~EHCI_UM_CM; + usbmode |= EHCI_UM_CM_HOST; + EOWRITE4(ehci_softc, EHCI_USBMODE_NOLPM, usbmode); +} + +static int +bhnd_ehci_attach(device_t self) +{ + ehci_softc_t *sc; + int err; + int rid; + + sc = device_get_softc(self); + /* initialise some bus fields */ + sc->sc_bus.parent = self; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.usbrev = USB_REV_2_0; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if ((err = usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), + &ehci_iterate_hw_softc)) != 0) { + BHND_ERROR_DEV(self, "can't allocate DMA memory: %d", err); + return (ENOMEM); + } + + rid = 0; + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_io_res) { + BHND_ERROR_DEV(self, "Could not map memory"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + + if (sc->sc_irq_res == NULL) { + BHND_ERROR_DEV(self, "Could not allocate error irq"); + bhnd_ehci_detach(self); + return (ENXIO); + } + + sc->sc_bus.bdev = device_add_child(self, "usbus", -1); + if (!sc->sc_bus.bdev) { + BHND_ERROR_DEV(self, "Could not add USB device"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR); + + sprintf(sc->sc_vendor, "Broadcom"); + + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + BHND_ERROR_DEV(self, "Could not setup irq, %d", err); + sc->sc_intr_hdl = NULL; + goto error; + } + + sc->sc_flags |= EHCI_SCFLG_LOSTINTRBUG; + sc->sc_vendor_post_reset = bhnd_ehci_post_reset; + + err = ehci_init(sc); + if (!err) { + err = device_probe_and_attach(sc->sc_bus.bdev); + } + if (err) { + BHND_ERROR_DEV(self, "USB init failed err=%d", err); + goto error; + } + return (0); + +error: + bhnd_ehci_detach(self); + return (ENXIO); +} + +static int +bhnd_ehci_detach(device_t self) +{ + ehci_softc_t *sc; + device_t bdev; + int err; + + sc = device_get_softc(self); + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(self, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(self); + + /* + * disable interrupts that might have been switched on in ehci_init + */ +#ifdef notyet + if (sc->sc_io_res) { + EWRITE4(sc, EHCI_USBINTR, 0); + EWRITE4(sc, USB_BRIDGE_INTR_MASK, 0); + } +#endif + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call ehci_detach() after ehci_init() + */ + ehci_detach(sc); + + err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); + + if (err) + /* XXX or should we panic? */ + BHND_ERROR_DEV(self, "Could not tear down irq, %d", err); + + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, 0, sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + + return (0); +} + +static device_method_t ehci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bhnd_ehci_probe), + DEVMETHOD(device_attach, bhnd_ehci_attach), + DEVMETHOD(device_detach, bhnd_ehci_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + + {0, 0} +}; + +static driver_t ehci_driver = { + "ehci", + ehci_methods, + sizeof(ehci_softc_t), +}; + +static devclass_t ehci_devclass; + +DRIVER_MODULE(ehci, bhnd_usb, ehci_driver, ehci_devclass, 0, 0); +MODULE_DEPEND(ehci, usb, 1, 1, 1); Added: head/sys/dev/bhnd/cores/usb/bhnd_ohci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/cores/usb/bhnd_ohci.c Mon Sep 5 16:06:52 2016 (r305426) @@ -0,0 +1,228 @@ +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 2010, Aleksandr Rybalko + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (augustss@carlstedt.se) at + * Carlstedt Research & Technology. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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$"); + +/* + * USB Open Host Controller driver. + * + * OHCI spec: http://www.intel.com/design/usb/ohci11d.pdf + */ + +/* The low level controller code for OHCI has been split into + * SIBA probes and OHCI specific code. This was done to facilitate the + * sharing of code between *BSD's + */ + +#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 + +static device_probe_t bhnd_ohci_probe; +static device_attach_t bhnd_ohci_attach; +static device_detach_t bhnd_ohci_detach; + +static int +bhnd_ohci_probe(device_t self) +{ + device_set_desc(self, "Broadcom OHCI"); + return (0); +} + +static int +bhnd_ohci_attach(device_t self) +{ + ohci_softc_t *sc; + int rid; + int err; + + sc = device_get_softc(self); + /* initialise some bus fields */ + sc->sc_bus.parent = self; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), + &ohci_iterate_hw_softc)) { + return (ENOMEM); + } + sc->sc_dev = self; + + rid = 0; + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_io_res) { + device_printf(self, "Could not map memory\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(self, "Could not allocate irq\n"); + goto error; + } + sc->sc_bus.bdev = device_add_child(self, "usbus", -1); + if (!sc->sc_bus.bdev) { + device_printf(self, "Could not add USB device\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + + strlcpy(sc->sc_vendor, "Broadcom", sizeof(sc->sc_vendor)); + + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ohci_interrupt, sc, &sc->sc_intr_hdl); + + if (err) { + device_printf(self, "Could not setup irq, %d\n", err); + sc->sc_intr_hdl = NULL; + goto error; + } + err = ohci_init(sc); + if (!err) { + err = device_probe_and_attach(sc->sc_bus.bdev); + } + if (err) { + device_printf(self, "USB init failed\n"); + goto error; + } + return (0); + +error: + bhnd_ohci_detach(self); + return (ENXIO); +} + +static int +bhnd_ohci_detach(device_t self) +{ + ohci_softc_t *sc; + device_t bdev; + + sc = device_get_softc(self); + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(self, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(self); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call ohci_detach() after ohci_init() + */ + ohci_detach(sc); + + int err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); + + if (err) { + /* XXX or should we panic? */ + device_printf(self, "Could not tear down irq, %d\n", + err); + } + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc); + + return (0); +} + +static device_method_t bhnd_ohci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bhnd_ohci_probe), + DEVMETHOD(device_attach, bhnd_ohci_attach), + DEVMETHOD(device_detach, bhnd_ohci_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t ohci_driver = { + .name = "ohci", + .methods = bhnd_ohci_methods, + .size = sizeof(struct ohci_softc), +}; + +static devclass_t ohci_devclass; + +DRIVER_MODULE(ohci, bhnd_usb, ohci_driver, ohci_devclass, 0, 0); +MODULE_DEPEND(ohci, usb, 1, 1, 1); Added: head/sys/dev/bhnd/cores/usb/bhnd_usb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/cores/usb/bhnd_usb.c Mon Sep 5 16:06:52 2016 (r305426) @@ -0,0 +1,487 @@ +/*- + * Copyright (c) 2010, Aleksandr Rybalko + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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$"); + +/* + * Ported version of BroadCom USB core driver from ZRouter project + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "bhnd_usbvar.h" + +/****************************** Variables ************************************/ +static const struct bhnd_device bhnd_usb_devs[] = { + BHND_DEVICE(BCM, USB, "USB1.1 Host/Device core", NULL), + BHND_DEVICE(BCM, USB20H, "USB2.0 Host core", NULL), + BHND_DEVICE(BCM, USB20D, "USB2.0 Device core", NULL), + BHND_DEVICE(BCM, USB11H, "USB1.1 Host core", NULL), + BHND_DEVICE(BCM, USB11D, "USB1.1 Device core", NULL), + BHND_DEVICE_END +}; + +/****************************** Prototypes ***********************************/ + +static int bhnd_usb_attach(device_t); +static int bhnd_usb_probe(device_t); +static device_t bhnd_usb_add_child(device_t dev, u_int order, const char *name, + int unit); +static int bhnd_usb_print_all_resources(device_t dev); +static int bhnd_usb_print_child(device_t bus, device_t child); + +static struct resource * bhnd_usb_alloc_resource(device_t bus, + device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); +static int bhnd_usb_release_resource(device_t dev, + device_t child, int type, int rid, + struct resource *r); + +static struct resource_list * bhnd_usb_get_reslist(device_t dev, + device_t child); + +static int +bhnd_usb_probe(device_t dev) +{ + const struct bhnd_device *id; + + id = bhnd_device_lookup(dev, bhnd_usb_devs, sizeof(bhnd_usb_devs[0])); + if (id == NULL) + return (ENXIO); + + device_set_desc(dev, id->desc); + return (BUS_PROBE_DEFAULT); +} + +static int +bhnd_usb_attach(device_t dev) +{ + struct bhnd_usb_softc *sc; + int rid; + uint32_t tmp; + int tries, err; + + sc = device_get_softc(dev); + + BHND_BUS_RESET_CORE(device_get_parent(dev), dev, 0); + + /* + * Allocate the resources which the parent bus has already + * determined for us. + * XXX: There are few windows (usually 2), RID should be chip-specific + */ + rid = 0; + sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->sc_mem == NULL) { + BHND_ERROR_DEV(dev, "unable to allocate memory"); + return (ENXIO); + } + + sc->sc_bt = rman_get_bustag(sc->sc_mem); + sc->sc_bh = rman_get_bushandle(sc->sc_mem); + sc->sc_maddr = rman_get_start(sc->sc_mem); + sc->sc_msize = rman_get_size(sc->sc_mem); + + rid = 0; + sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq == NULL) { + BHND_ERROR_DEV(dev, "unable to allocate IRQ"); + return (ENXIO); + } + + sc->sc_irqn = rman_get_start(sc->sc_irq); + + sc->mem_rman.rm_start = sc->sc_maddr; + sc->mem_rman.rm_end = sc->sc_maddr + sc->sc_msize - 1; + sc->mem_rman.rm_type = RMAN_ARRAY; + sc->mem_rman.rm_descr = "BHND USB core I/O memory addresses"; + if (rman_init(&sc->mem_rman) != 0 || + rman_manage_region(&sc->mem_rman, sc->mem_rman.rm_start, + sc->mem_rman.rm_end) != 0) { + panic("%s: sc->mem_rman", __func__); + } + + sc->irq_rman.rm_start = sc->sc_irqn; + sc->irq_rman.rm_end = sc->sc_irqn; + sc->irq_rman.rm_type = RMAN_ARRAY; + sc->irq_rman.rm_descr = "BHND USB core IRQ"; + /* + * BHND USB share same IRQ between OHCI and EHCI + */ + if (rman_init(&sc->irq_rman) != 0 || + rman_manage_region(&sc->irq_rman, sc->irq_rman.rm_start, + sc->irq_rman.rm_end) != 0) + panic("%s: failed to set up IRQ rman", __func__); + + /* TODO: macros for registers */ + bus_write_4(sc->sc_mem, 0x200, 0x7ff); + DELAY(100); + +#define OHCI_CONTROL 0x04 + bus_write_4(sc->sc_mem, OHCI_CONTROL, 0); + + if ( bhnd_get_device(dev) == BHND_COREID_USB20H) { + + uint32_t rev; + BHND_INFO_DEV(dev, "USB HOST 2.0 setup for rev %d", rev); + rev = bhnd_get_hwrev(dev); + if (rev == 1/* ? == 2 */) { + /* SiBa code */ + + /* Change Flush control reg */ + tmp = bus_read_4(sc->sc_mem, 0x400) & ~0x8; + bus_write_4(sc->sc_mem, 0x400, tmp); + tmp = bus_read_4(sc->sc_mem, 0x400); + BHND_DEBUG_DEV(dev, "USB20H fcr: 0x%x", tmp); + + /* Change Shim control reg */ + tmp = bus_read_4(sc->sc_mem, 0x304) & ~0x100; + bus_write_4(sc->sc_mem, 0x304, tmp); + tmp = bus_read_4(sc->sc_mem, 0x304); + BHND_DEBUG_DEV(dev, "USB20H shim: 0x%x", tmp); + } else if (rev >= 5) { + /* BCMA code */ + err = bhnd_alloc_pmu(dev); + if(err) { + BHND_ERROR_DEV(dev, "can't alloc pmu: %d", err); + return (err); + } + + err = bhnd_request_ext_rsrc(dev, 1); + if(err) { + BHND_ERROR_DEV(dev, "can't req ext: %d", err); + return (err); + } + /* Take out of resets */ + bus_write_4(sc->sc_mem, 0x200, 0x4ff); + DELAY(25); + bus_write_4(sc->sc_mem, 0x200, 0x6ff); + DELAY(25); + + /* Make sure digital and AFE are locked in USB PHY */ + bus_write_4(sc->sc_mem, 0x524, 0x6b); + DELAY(50); + bus_read_4(sc->sc_mem, 0x524); + DELAY(50); + bus_write_4(sc->sc_mem, 0x524, 0xab); + DELAY(50); + bus_read_4(sc->sc_mem, 0x524); + DELAY(50); + bus_write_4(sc->sc_mem, 0x524, 0x2b); + DELAY(50); + bus_read_4(sc->sc_mem, 0x524); + DELAY(50); + bus_write_4(sc->sc_mem, 0x524, 0x10ab); + DELAY(50); + bus_read_4(sc->sc_mem, 0x524); + + tries = 10000; + for (;;) { + DELAY(10); + tmp = bus_read_4(sc->sc_mem, 0x528); + if (tmp & 0xc000) + break; + if (--tries != 0) + continue; + + tmp = bus_read_4(sc->sc_mem, 0x528); + BHND_ERROR_DEV(dev, "USB20H mdio_rddata 0x%08x", tmp); + } + + /* XXX: Puzzle code */ + bus_write_4(sc->sc_mem, 0x528, 0x80000000); + bus_read_4(sc->sc_mem, 0x314); + DELAY(265); + bus_write_4(sc->sc_mem, 0x200, 0x7ff); + DELAY(10); + + /* Take USB and HSIC out of non-driving modes */ + bus_write_4(sc->sc_mem, 0x510, 0); + } + } + + bus_generic_probe(dev); + + if (bhnd_get_device(dev) == BHND_COREID_USB20H && + ( bhnd_get_hwrev(dev) > 0)) + bhnd_usb_add_child(dev, 0, "ehci", -1); + bhnd_usb_add_child(dev, 1, "ohci", -1); + + bus_generic_attach(dev); + + return (0); +} + +static struct resource * +bhnd_usb_alloc_resource(device_t bus, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) +{ + struct resource *rv; + struct resource_list *rl; + struct resource_list_entry *rle; + int isdefault, needactivate; + struct bhnd_usb_softc *sc = device_get_softc(bus); + + isdefault = RMAN_IS_DEFAULT_RANGE(start,end); + needactivate = flags & RF_ACTIVE; + rl = BUS_GET_RESOURCE_LIST(bus, child); + rle = NULL; + + if (isdefault) { + BHND_INFO_DEV(bus, "trying allocate def %d - %d for %s", type, + *rid, device_get_nameunit(child) ); + rle = resource_list_find(rl, type, *rid); + if (rle == NULL) + return (NULL); + if (rle->res != NULL) + panic("%s: resource entry is busy", __func__); + start = rle->start; + end = rle->end; + count = rle->count; + } else { + BHND_INFO_DEV(bus, "trying allocate %d - %d (%jx-%jx) for %s", type, + *rid, start, end, device_get_nameunit(child) ); + } + + /* + * If the request is for a resource which we manage, + * attempt to satisfy the allocation ourselves. + */ + if (type == SYS_RES_MEMORY) { + + rv = rman_reserve_resource(&sc->mem_rman, start, end, count, + flags, child); + if (rv == 0) { + BHND_ERROR_DEV(bus, "could not reserve resource"); + return (0); + } + + rman_set_rid(rv, *rid); + + if (needactivate && + bus_activate_resource(child, type, *rid, rv)) { + BHND_ERROR_DEV(bus, "could not activate resource"); + rman_release_resource(rv); + return (0); + } + + return (rv); + } + + if (type == SYS_RES_IRQ) { + + rv = rman_reserve_resource(&sc->irq_rman, start, end, count, + flags, child); + if (rv == 0) { + BHND_ERROR_DEV(bus, "could not reserve resource"); + return (0); + } + + rman_set_rid(rv, *rid); + + if (needactivate && + bus_activate_resource(child, type, *rid, rv)) { + BHND_ERROR_DEV(bus, "could not activate resource"); + rman_release_resource(rv); + return (0); + } + + return (rv); + } + + /* + * Pass the request to the parent. + */ + return (resource_list_alloc(rl, bus, child, type, rid, + start, end, count, flags)); +} + +static struct resource_list * +bhnd_usb_get_reslist(device_t dev, device_t child) +{ + struct bhnd_usb_devinfo *sdi; + + sdi = device_get_ivars(child); + + return (&sdi->sdi_rl); +} + +static int +bhnd_usb_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r) +{ + struct resource_list *rl; + struct resource_list_entry *rle; + + rl = bhnd_usb_get_reslist(dev, child); + if (rl == NULL) + return (EINVAL); + rle = resource_list_find(rl, type, rid); + if (rle == NULL) + return (EINVAL); + rman_release_resource(r); + rle->res = NULL; + + return (0); +} + +static int +bhnd_usb_print_all_resources(device_t dev) +{ + struct bhnd_usb_devinfo *sdi; + struct resource_list *rl; + int retval; + + retval = 0; + sdi = device_get_ivars(dev); + rl = &sdi->sdi_rl; + + if (STAILQ_FIRST(rl)) + retval += printf(" at"); + + retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%jx"); + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); + + return (retval); +} + +static int +bhnd_usb_print_child(device_t bus, device_t child) +{ + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += bhnd_usb_print_all_resources(child); + if (device_get_flags(child)) + retval += printf(" flags %#x", device_get_flags(child)); + retval += printf(" on %s\n", device_get_nameunit(bus)); + + return (retval); +} + +static device_t +bhnd_usb_add_child(device_t dev, u_int order, const char *name, int unit) +{ + struct bhnd_usb_softc *sc; + struct bhnd_usb_devinfo *sdi; + device_t child; + + sc = device_get_softc(dev); + child = device_add_child_ordered(dev, order, name, unit); + + if (child == NULL) + return (NULL); + + sdi = malloc(sizeof(struct bhnd_usb_devinfo), M_DEVBUF, M_NOWAIT|M_ZERO); + if (sdi == NULL) + return (NULL); + + if (strncmp(name, "ohci", 4) == 0) + { + sdi->sdi_maddr = sc->sc_maddr + 0x000; + sdi->sdi_msize = 0x200; + sdi->sdi_irq = sc->sc_irqn; + BHND_INFO_DEV(dev, "ohci: irq=%d maddr=0x%jx", sdi->sdi_irq, + sdi->sdi_maddr); + } + else if (strncmp(name, "ehci", 4) == 0) + { + sdi->sdi_maddr = sc->sc_maddr + 0x000; + sdi->sdi_msize = 0x1000; + sdi->sdi_irq = sc->sc_irqn; + BHND_INFO_DEV(dev, "ehci: irq=%d maddr=0x%jx", sdi->sdi_irq, + sdi->sdi_maddr); + } + else + { + panic("Unknown subdevice"); + /* Unknown subdevice */ + sdi->sdi_maddr = 1; + sdi->sdi_msize = 1; + sdi->sdi_irq = 1; + } + + resource_list_init(&sdi->sdi_rl); + + /* + * Determine memory window on bus and irq if one is needed. + */ + resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, 0, + sdi->sdi_maddr, sdi->sdi_maddr + sdi->sdi_msize - 1, sdi->sdi_msize); + + resource_list_add(&sdi->sdi_rl, SYS_RES_IRQ, 0, + sdi->sdi_irq, sdi->sdi_irq, 1); + + device_set_ivars(child, sdi); + return (child); + +} + +static device_method_t bhnd_usb_methods[] = { + /* Device interface */ + DEVMETHOD(device_attach, bhnd_usb_attach), + DEVMETHOD(device_probe, bhnd_usb_probe), + + /* Bus interface */ + DEVMETHOD(bus_add_child, bhnd_usb_add_child), + DEVMETHOD(bus_alloc_resource, bhnd_usb_alloc_resource), + DEVMETHOD(bus_get_resource_list, bhnd_usb_get_reslist), + DEVMETHOD(bus_print_child, bhnd_usb_print_child), + DEVMETHOD(bus_release_resource, bhnd_usb_release_resource), + /* Bus interface: generic part */ + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + DEVMETHOD_END +}; + +static devclass_t bhnd_usb_devclass; + +DEFINE_CLASS_0(bhnd_usb, bhnd_usb_driver, bhnd_usb_methods, + sizeof(struct bhnd_usb_softc)); +DRIVER_MODULE(bhnd_usb, bhnd, bhnd_usb_driver, bhnd_usb_devclass, 0, 0); + +MODULE_VERSION(bhnd_usb, 1); Added: head/sys/dev/bhnd/cores/usb/bhnd_usbvar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/cores/usb/bhnd_usbvar.h Mon Sep 5 16:06:52 2016 (r305426) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2010, Aleksandr Rybalko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Sep 5 17:44:57 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 8F86DB96567; Mon, 5 Sep 2016 17:44:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (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 66B48DD2; Mon, 5 Sep 2016 17:44:55 +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 mail.baldwin.cx (Postfix) with ESMTPSA id 2C1ED10AF43; Mon, 5 Sep 2016 13:44:48 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305368 - head/sys/kern Date: Mon, 05 Sep 2016 10:30:24 -0700 Message-ID: <2134943.hUK9aHv09Y@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201609040029.u840Tn5D019584@repo.freebsd.org> References: <201609040029.u840Tn5D019584@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.4.3 (mail.baldwin.cx); Mon, 05 Sep 2016 13:44:48 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 17:44:57 -0000 On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote: > Author: markj > Date: Sun Sep 4 00:29:48 2016 > New Revision: 305368 > URL: https://svnweb.freebsd.org/changeset/base/305368 > > Log: > Micro-optimize sleepq_signal(). > > Lift a comparison out of the loop that finds the highest-priority thread > on the queue. > > MFC after: 1 week Could this safely use TAILQ_FOREACH_FROM? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Sep 5 18:02: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 9A275B969DA; Mon, 5 Sep 2016 18:02:38 +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 6D1ADB35; Mon, 5 Sep 2016 18:02:38 +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 u85I2bfs006759; Mon, 5 Sep 2016 18:02:37 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85I2bFp006758; Mon, 5 Sep 2016 18:02:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609051802.u85I2bFp006758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 5 Sep 2016 18:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305430 - head/contrib/gcclibs/libcpp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 18:02:38 -0000 Author: dim Date: Mon Sep 5 18:02:37 2016 New Revision: 305430 URL: https://svnweb.freebsd.org/changeset/base/305430 Log: Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable way. MFC after: 3 days Modified: head/contrib/gcclibs/libcpp/system.h Modified: head/contrib/gcclibs/libcpp/system.h ============================================================================== --- head/contrib/gcclibs/libcpp/system.h Mon Sep 5 17:56:52 2016 (r305429) +++ head/contrib/gcclibs/libcpp/system.h Mon Sep 5 18:02:37 2016 (r305430) @@ -347,9 +347,12 @@ extern void abort (void); ??? C99 designated initializers are not supported by most C++ compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) -#define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) +# if (!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ + ||(__STDC_VERSION__ >= 199901L) +# define HAVE_DESIGNATED_INITIALIZERS 1 +# else +# define HAVE_DESIGNATED_INITIALIZERS 0 +# endif #endif /* Be conservative and only use enum bitfields with GCC. From owner-svn-src-head@freebsd.org Mon Sep 5 18:04: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 2CBDAB96B2B; Mon, 5 Sep 2016 18:04:12 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf0-x229.google.com (mail-pf0-x229.google.com [IPv6:2607:f8b0:400e:c00::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0D96DF5; Mon, 5 Sep 2016 18:04:11 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf0-x229.google.com with SMTP id g202so43232303pfb.0; Mon, 05 Sep 2016 11:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MwCKYQ/c+m0UpwWX0E3qYgeZfra9PegBLQc87motGpo=; b=uMHTBp059fEaUJ3bTuJ/yhhVN1ABhDQra77P89t0GCOw3YklJQGW7fg0ylsBDY17B5 ltPgBB8GlsF+dUoHXbPDCN1LNBudk1ioGHNS+NoT0DJcNzz3BMK0QuvtBUW4wyogXs3K mC6vcBhjbkA+CWHXnO6Z8BVrNjggb9dMlnUXhVYUoqBRUeaZsP3TEX3wvW+RxkEKHYB1 70qRJcOIwmN2pITlgSrVZEXEYpt8wPJjT/9//ow27SImKoxi4cyqrrBTjkCT748zCspL Kj1eFh2oIiVcnRxmOjP6PSR5ZsjBvin/3HuTSqORKIoQXeezG3yI3hr93SuBg6lGDEn7 VaHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=MwCKYQ/c+m0UpwWX0E3qYgeZfra9PegBLQc87motGpo=; b=JHMfOkJK34snqK72d2D/a5SLmcXTAc93/K/suhPrZq91osHOuwjF67BfkSBqffKGEU l/BL/1YQfOtHwabMS4SJqedqyPlO4Gc9o/LnFlNllv/DCGzm1939rpM1Oq/LqF/q0zXM DSou1Yt9oAwHSHzZaffl7+ZwYPd7/2Oes+vfV4GZK9pf1wiWf84HxKV2N93YuoQy0yvJ O3bZ6bC4R55dm+aHi4Q46hDAU5VtJQlcathzzcnR8C8X3RnSIvz7cThox+ZGcocIAfpJ vAac1wxjx5sdgSzptPkg1HpgKrYOZZB3bY/IkbmSfhbzbn2cdTN8/tZ7pLH+XNknHghq /iIw== X-Gm-Message-State: AE9vXwMdq2mu3+n1ehRyu0N3YLSN/A8yeFb2mvKFtlYp2kitbRhjyXCA9rPiJFarw2rgaQ== X-Received: by 10.98.216.129 with SMTP id e123mr14282560pfg.123.1473098651455; Mon, 05 Sep 2016 11:04:11 -0700 (PDT) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id n80sm20613506pfi.25.2016.09.05.11.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Sep 2016 11:04:10 -0700 (PDT) Sender: Mark Johnston Date: Mon, 5 Sep 2016 11:09:17 -0700 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305368 - head/sys/kern Message-ID: <20160905180917.GC70066@wkstn-mjohnston.west.isilon.com> References: <201609040029.u840Tn5D019584@repo.freebsd.org> <2134943.hUK9aHv09Y@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2134943.hUK9aHv09Y@ralph.baldwin.cx> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 18:04:12 -0000 On Mon, Sep 05, 2016 at 10:30:24AM -0700, John Baldwin wrote: > On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote: > > Author: markj > > Date: Sun Sep 4 00:29:48 2016 > > New Revision: 305368 > > URL: https://svnweb.freebsd.org/changeset/base/305368 > > > > Log: > > Micro-optimize sleepq_signal(). > > > > Lift a comparison out of the loop that finds the highest-priority thread > > on the queue. > > > > MFC after: 1 week > > Could this safely use TAILQ_FOREACH_FROM? Are you suggesting something like this? besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); td = TAILQ_NEXT(besttd, td_slpq); TAILQ_FOREACH_FROM(td, &sq->sq_blocked[queue], td_slpq) { ... I think that would work, and it avoids visiting the first element unnecessarily when the queue contains more than one element. If the queue contains one element, we'd visit it because of TAILQ_FOREACH_FROM's surprising behaviour of iterating over the entire queue when the listelem is NULL. From owner-svn-src-head@freebsd.org Mon Sep 5 18:42: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 F2353B96428; Mon, 5 Sep 2016 18:42:22 +0000 (UTC) (envelope-from loos@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 AF9D25E2; Mon, 5 Sep 2016 18:42:22 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85IgL8M021462; Mon, 5 Sep 2016 18:42:21 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85IgLGa021459; Mon, 5 Sep 2016 18:42:21 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201609051842.u85IgLGa021459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 5 Sep 2016 18:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305432 - in head/sys/arm/ti: am335x cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 18:42:23 -0000 Author: loos Date: Mon Sep 5 18:42:21 2016 New Revision: 305432 URL: https://svnweb.freebsd.org/changeset/base/305432 Log: Revert r305119, move the control module register data to am335x_scm.h and fix if_cpsw.c to include the correct header. Discussed with: bz Modified: head/sys/arm/ti/am335x/am335x_scm.h head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/cpsw/if_cpswreg.h Modified: head/sys/arm/ti/am335x/am335x_scm.h ============================================================================== --- head/sys/arm/ti/am335x/am335x_scm.h Mon Sep 5 18:05:45 2016 (r305431) +++ head/sys/arm/ti/am335x/am335x_scm.h Mon Sep 5 18:42:21 2016 (r305432) @@ -42,6 +42,8 @@ #define SCM_USB_STS0 0x624 #define SCM_USB_CTRL1 0x628 #define SCM_USB_STS1 0x62C +#define SCM_MAC_ID0_LO 0x630 +#define SCM_MAC_ID0_HI 0x634 #define SCM_PWMSS_CTRL 0x664 #endif /* __AM335X_SCM_H__ */ Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Mon Sep 5 18:05:45 2016 (r305431) +++ head/sys/arm/ti/cpsw/if_cpsw.c Mon Sep 5 18:42:21 2016 (r305432) @@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -87,8 +90,6 @@ __FBSDID("$FreeBSD$"); #include "if_cpswreg.h" #include "if_cpswvar.h" - -#include #include "miibus_if.h" @@ -1019,14 +1020,14 @@ cpswp_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); /* Get high part of MAC address from control module (mac_id[0|1]_hi) */ - ti_scm_reg_read_4(CPSW_MAC_ID0_HI + sc->unit * 8, ®); + ti_scm_reg_read_4(SCM_MAC_ID0_HI + sc->unit * 8, ®); mac_addr[0] = reg & 0xFF; mac_addr[1] = (reg >> 8) & 0xFF; mac_addr[2] = (reg >> 16) & 0xFF; mac_addr[3] = (reg >> 24) & 0xFF; /* Get low part of MAC address from control module (mac_id[0|1]_lo) */ - ti_scm_reg_read_4(CPSW_MAC_ID0_LO + sc->unit * 8, ®); + ti_scm_reg_read_4(SCM_MAC_ID0_LO + sc->unit * 8, ®); mac_addr[4] = reg & 0xFF; mac_addr[5] = (reg >> 8) & 0xFF; Modified: head/sys/arm/ti/cpsw/if_cpswreg.h ============================================================================== --- head/sys/arm/ti/cpsw/if_cpswreg.h Mon Sep 5 18:05:45 2016 (r305431) +++ head/sys/arm/ti/cpsw/if_cpswreg.h Mon Sep 5 18:42:21 2016 (r305432) @@ -46,9 +46,6 @@ #define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100)) #define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100)) -#define CPSW_MAC_ID0_LO 0x0630 -#define CPSW_MAC_ID0_HI 0x0634 - #define CPSW_CPDMA_OFFSET 0x0800 #define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04) #define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08) From owner-svn-src-head@freebsd.org Mon Sep 5 19:37:48 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 46368B960FF; Mon, 5 Sep 2016 19:37:48 +0000 (UTC) (envelope-from np@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 17861F2C; Mon, 5 Sep 2016 19:37:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85JblqS044496; Mon, 5 Sep 2016 19:37:47 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85Jblb7044495; Mon, 5 Sep 2016 19:37:47 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609051937.u85Jblb7044495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 5 Sep 2016 19:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305433 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 19:37:48 -0000 Author: np Date: Mon Sep 5 19:37:47 2016 New Revision: 305433 URL: https://svnweb.freebsd.org/changeset/base/305433 Log: cxgbe/t4_tom: toepcb should be all-zero on allocation because the code that cleans up on failure assumes that non-NULL values indicate initialized items. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_connect.c Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Mon Sep 5 18:42:21 2016 (r305432) +++ head/sys/dev/cxgbe/tom/t4_connect.c Mon Sep 5 19:37:47 2016 (r305433) @@ -332,7 +332,7 @@ t4_connect(struct toedev *tod, struct so else DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP); - toep = alloc_toepcb(vi, -1, -1, M_NOWAIT); + toep = alloc_toepcb(vi, -1, -1, M_NOWAIT | M_ZERO); if (toep == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); From owner-svn-src-head@freebsd.org Mon Sep 5 19:42: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 F3561B962FA; Mon, 5 Sep 2016 19:42:36 +0000 (UTC) (envelope-from avos@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 C2B381311; Mon, 5 Sep 2016 19:42:36 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85Jga4m048252; Mon, 5 Sep 2016 19:42:36 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85JgapE048251; Mon, 5 Sep 2016 19:42:36 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609051942.u85JgapE048251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 5 Sep 2016 19:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305434 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 19:42:37 -0000 Author: avos Date: Mon Sep 5 19:42:35 2016 New Revision: 305434 URL: https://svnweb.freebsd.org/changeset/base/305434 Log: rum: do not restart device when protmode / rtsthreshold is changed. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Mon Sep 5 19:37:47 2016 (r305433) +++ head/sys/dev/usb/wlan/if_rum.c Mon Sep 5 19:42:35 2016 (r305434) @@ -2692,6 +2692,8 @@ rum_reset(struct ieee80211vap *vap, u_lo switch (cmd) { case IEEE80211_IOC_POWERSAVE: + case IEEE80211_IOC_PROTMODE: + case IEEE80211_IOC_RTSTHRESHOLD: error = 0; break; case IEEE80211_IOC_POWERSAVESLEEP: From owner-svn-src-head@freebsd.org Mon Sep 5 20:48: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 86095B96ADA; Mon, 5 Sep 2016 20:48:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9B37B5; Mon, 5 Sep 2016 20:48:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA21361; Mon, 05 Sep 2016 23:48:27 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bh0od-000KTn-0x; Mon, 05 Sep 2016 23:48:27 +0300 Subject: Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs To: Alexander Motin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201609031004.u83A4bI0097105@repo.freebsd.org> From: Andriy Gapon Message-ID: Date: Mon, 5 Sep 2016 23:47:30 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609031004.u83A4bI0097105@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 20:48:30 -0000 On 03/09/2016 13:04, Alexander Motin wrote: > Author: mav > Date: Sat Sep 3 10:04:37 2016 > New Revision: 305331 > URL: https://svnweb.freebsd.org/changeset/base/305331 > > Log: > MFV r304155: 7090 zfs should improve allocation order and throttle allocations > > illumos/illumos-gate@0f7643c7376dd69a08acbfc9d1d7d548b10c846a > https://github.com/illumos/illumos-gate/commit/0f7643c7376dd69a08acbfc9d1d7d548b > 10c846a > > https://www.illumos.org/issues/7090 > When write I/Os are issued, they are issued in block order but the ZIO pipelin > e > will drive them asynchronously through the allocation stage which can result i > n > blocks being allocated out-of-order. It would be nice to preserve as much of > the logical order as possible. > In addition, the allocations are equally scattered across all top-level VDEVs > but not all top-level VDEVs are created equally. The pipeline should be able t > o > detect devices that are more capable of handling allocations and should > allocate more blocks to those devices. This allows for dynamic allocation > distribution when devices are imbalanced as fuller devices will tend to be > slower than empty devices. > The change includes a new pool-wide allocation queue which would throttle and > order allocations in the ZIO pipeline. The queue would be ordered by issued > time and offset and would provide an initial amount of allocation of work to > each top-level vdev. The allocation logic utilizes a reservation system to > reserve allocations that will be performed by the allocator. Once an allocatio > n > is successfully completed it's scheduled on a given top-level vdev. Each top- > level vdev maintains a maximum number of allocations that it can handle > (mg_alloc_queue_depth). The pool-wide reserved allocations (top-levels * > mg_alloc_queue_depth) are distributed across the top-level vdevs metaslab > groups and round robin across all eligible metaslab groups to distribute the > work. As top-levels complete their work, they receive additional work from the > pool-wide allocation queue until the allocation queue is emptied. > > Reviewed by: Adam Leventhal > Reviewed by: Alex Reece > Reviewed by: Christopher Siden > Reviewed by: Dan Kimmel > Reviewed by: Matthew Ahrens > Reviewed by: Paul Dagnelie > Reviewed by: Prakash Surya > Reviewed by: Sebastien Roy > Approved by: Robert Mustacchi > Author: George Wilson > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > Directory Properties: > head/sys/cddl/contrib/opensolaris/ (props changed) ... > @@ -3720,6 +3719,7 @@ spa_create(const char *pool, nvlist_t *n > spa->spa_uberblock.ub_txg = txg - 1; > spa->spa_uberblock.ub_version = version; > spa->spa_ubsync = spa->spa_uberblock; > + spa->spa_load_state = SPA_LOAD_CREATE; > > /* > * Create "The Godfather" zio to hold all async IOs > @@ -3905,6 +3905,7 @@ spa_create(const char *pool, nvlist_t *n > */ > spa_evicting_os_wait(spa); > spa->spa_minref = refcount_count(&spa->spa_refcount); > + spa->spa_load_state = SPA_LOAD_NONE; > > mutex_exit(&spa_namespace_lock); > > @@ -5615,7 +5616,7 @@ spa_nvlist_lookup_by_guid(nvlist_t **nvp ... Alexander, I belive that this commit accidentally breaks the following scenario: zpool create tank /dev/xxx zpool destroy tank zpool create tank /dev/xxx It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would try to match a device GUID, if it can be read, in addition to a name. -- Andriy Gapon From owner-svn-src-head@freebsd.org Mon Sep 5 21:03: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 9D37DB96FCD; Mon, 5 Sep 2016 21:03:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2746F281; Mon, 5 Sep 2016 21:03:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA21417; Tue, 06 Sep 2016 00:03:46 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bh13S-000KUg-8l; Tue, 06 Sep 2016 00:03:46 +0300 Subject: Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs To: Alexander Motin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201609031004.u83A4bI0097105@repo.freebsd.org> From: Andriy Gapon Message-ID: <6b3cf6b5-0bbf-c2a5-9fd1-b3e39dbadd37@FreeBSD.org> Date: Tue, 6 Sep 2016 00:03:10 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 21:03:49 -0000 On 05/09/2016 23:47, Andriy Gapon wrote: > Alexander, > > I belive that this commit accidentally breaks the following scenario: > zpool create tank /dev/xxx > zpool destroy tank > zpool create tank /dev/xxx > > It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would > try to match a device GUID, if it can be read, in addition to a name. P.S. I love hidden changes like this one in a bigger and apparently unrelated change. Old Sun style. -- Andriy Gapon From owner-svn-src-head@freebsd.org Mon Sep 5 21:18: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 A9118AC46B0; Mon, 5 Sep 2016 21:18:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7E9D8B; Mon, 5 Sep 2016 21:18:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA21474; Tue, 06 Sep 2016 00:18:40 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bh1Hs-000KVW-H0; Tue, 06 Sep 2016 00:18:40 +0300 Subject: Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs To: Alexander Motin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201609031004.u83A4bI0097105@repo.freebsd.org> From: Andriy Gapon Message-ID: Date: Tue, 6 Sep 2016 00:17:19 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 21:18:43 -0000 On 05/09/2016 23:47, Andriy Gapon wrote: > Alexander, > > I belive that this commit accidentally breaks the following scenario: > zpool create tank /dev/xxx > zpool destroy tank > zpool create tank /dev/xxx > > It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would > try to match a device GUID, if it can be read, in addition to a name. And a rather trivial (and maybe not quite correct) fix: diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index 077983ca847c8..818052ba577ec 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, if (vd->vdev_spa->spa_splitting_newspa || (vd->vdev_prevstate == VDEV_STATE_UNKNOWN && - vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) { + vd->vdev_spa->spa_load_state == SPA_LOAD_NONE || + vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) { /* * We are dealing with a vdev that hasn't been previously * opened (since boot), and we are not loading an -- Andriy Gapon From owner-svn-src-head@freebsd.org Mon Sep 5 21:48:17 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 72F60AC4E9A; Mon, 5 Sep 2016 21:48:17 +0000 (UTC) (envelope-from landonf@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 50CE210F; Mon, 5 Sep 2016 21:48:17 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85LmGWm096005; Mon, 5 Sep 2016 21:48:16 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85LmGY7096003; Mon, 5 Sep 2016 21:48:16 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609052148.u85LmGY7096003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 5 Sep 2016 21:48:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305442 - head/sys/dev/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 21:48:17 -0000 Author: landonf Date: Mon Sep 5 21:48:16 2016 New Revision: 305442 URL: https://svnweb.freebsd.org/changeset/base/305442 Log: bhnd(4): Add device classes for USB host/dev/dual-mode controller cores. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhnd_types.h Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Mon Sep 5 21:25:45 2016 (r305441) +++ head/sys/dev/bhnd/bhnd_subr.c Mon Sep 5 21:48:16 2016 (r305442) @@ -71,7 +71,7 @@ static const struct bhnd_core_desc { BHND_CDESC(BCM, MIPS, CPU, "MIPS Core"), BHND_CDESC(BCM, ENET, ENET_MAC, "Fast Ethernet MAC"), BHND_CDESC(BCM, CODEC, OTHER, "V.90 Modem Codec"), - BHND_CDESC(BCM, USB, OTHER, "USB 1.1 Device/Host Controller"), + BHND_CDESC(BCM, USB, USB_DUAL, "USB 1.1 Device/Host Controller"), BHND_CDESC(BCM, ADSL, OTHER, "ADSL Core"), BHND_CDESC(BCM, ILINE100, OTHER, "iLine100 HPNA"), BHND_CDESC(BCM, IPSEC, OTHER, "IPsec Accelerator"), @@ -86,10 +86,10 @@ static const struct bhnd_core_desc { BHND_CDESC(BCM, BPHY, WLAN_PHY, "802.11b PHY"), BHND_CDESC(BCM, GPHY, WLAN_PHY, "802.11g PHY"), BHND_CDESC(BCM, MIPS33, CPU, "MIPS3302 Core"), - BHND_CDESC(BCM, USB11H, OTHER, "USB 1.1 Host Controller"), - BHND_CDESC(BCM, USB11D, OTHER, "USB 1.1 Device Core"), - BHND_CDESC(BCM, USB20H, OTHER, "USB 2.0 Host Controller"), - BHND_CDESC(BCM, USB20D, OTHER, "USB 2.0 Device Core"), + BHND_CDESC(BCM, USB11H, USB_HOST, "USB 1.1 Host Controller"), + BHND_CDESC(BCM, USB11D, USB_DEV, "USB 1.1 Device Controller"), + BHND_CDESC(BCM, USB20H, USB_HOST, "USB 2.0 Host Controller"), + BHND_CDESC(BCM, USB20D, USB_DEV, "USB 2.0 Device Controller"), BHND_CDESC(BCM, SDIOH, OTHER, "SDIO Host Controller"), BHND_CDESC(BCM, ROBO, OTHER, "RoboSwitch"), BHND_CDESC(BCM, ATA100, OTHER, "Parallel ATA Controller"), @@ -130,8 +130,8 @@ static const struct bhnd_core_desc { BHND_CDESC(BCM, NS_PCIE2, PCIE, "PCIe Bridge (Gen2)"), BHND_CDESC(BCM, NS_DMA, OTHER, "DMA engine"), BHND_CDESC(BCM, NS_SDIO, OTHER, "SDIO 3.0 Host Controller"), - BHND_CDESC(BCM, NS_USB20H, OTHER, "USB 2.0 Host Controller"), - BHND_CDESC(BCM, NS_USB30H, OTHER, "USB 3.0 Host Controller"), + BHND_CDESC(BCM, NS_USB20H, USB_HOST, "USB 2.0 Host Controller"), + BHND_CDESC(BCM, NS_USB30H, USB_HOST, "USB 3.0 Host Controller"), BHND_CDESC(BCM, NS_A9JTAG, OTHER, "ARM Cortex A9 JTAG Interface"), BHND_CDESC(BCM, NS_DDR23_MEMC, MEMC, "Denali DDR2/DD3 Memory Controller"), BHND_CDESC(BCM, NS_ROM, NVRAM, "System ROM"), Modified: head/sys/dev/bhnd/bhnd_types.h ============================================================================== --- head/sys/dev/bhnd/bhnd_types.h Mon Sep 5 21:25:45 2016 (r305441) +++ head/sys/dev/bhnd/bhnd_types.h Mon Sep 5 21:48:16 2016 (r305442) @@ -57,8 +57,11 @@ typedef enum { BHND_DEVCLASS_SOC_BRIDGE, /**< interconnect host bridge */ BHND_DEVCLASS_EROM, /**< bus device enumeration ROM */ BHND_DEVCLASS_NVRAM, /**< nvram/flash controller */ - BHND_DEVCLASS_OTHER, /**< other / unknown */ + BHND_DEVCLASS_USB_HOST, /**< USB host controller */ + BHND_DEVCLASS_USB_DEV, /**< USB device controller */ + BHND_DEVCLASS_USB_DUAL, /**< USB host/device controller */ + BHND_DEVCLASS_OTHER = 1000, /**< other / unknown */ BHND_DEVCLASS_INVALID /**< no/invalid class */ } bhnd_devclass_t; From owner-svn-src-head@freebsd.org Mon Sep 5 21:50: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 0C558B96005; Mon, 5 Sep 2016 21:50:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.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 DF2E45E7; Mon, 5 Sep 2016 21:50: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 mail.baldwin.cx (Postfix) with ESMTPSA id A9C0210AF43; Mon, 5 Sep 2016 17:50:30 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305368 - head/sys/kern Date: Mon, 05 Sep 2016 11:42:05 -0700 Message-ID: <28893594.Z98fxgFVzW@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20160905180917.GC70066@wkstn-mjohnston.west.isilon.com> References: <201609040029.u840Tn5D019584@repo.freebsd.org> <2134943.hUK9aHv09Y@ralph.baldwin.cx> <20160905180917.GC70066@wkstn-mjohnston.west.isilon.com> 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.4.3 (mail.baldwin.cx); Mon, 05 Sep 2016 17:50:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 21:50:32 -0000 On Monday, September 05, 2016 11:09:17 AM Mark Johnston wrote: > On Mon, Sep 05, 2016 at 10:30:24AM -0700, John Baldwin wrote: > > On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote: > > > Author: markj > > > Date: Sun Sep 4 00:29:48 2016 > > > New Revision: 305368 > > > URL: https://svnweb.freebsd.org/changeset/base/305368 > > > > > > Log: > > > Micro-optimize sleepq_signal(). > > > > > > Lift a comparison out of the loop that finds the highest-priority thread > > > on the queue. > > > > > > MFC after: 1 week > > > > Could this safely use TAILQ_FOREACH_FROM? > > Are you suggesting something like this? > > besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); > td = TAILQ_NEXT(besttd, td_slpq); > TAILQ_FOREACH_FROM(td, &sq->sq_blocked[queue], td_slpq) { > ... > > I think that would work, and it avoids visiting the first element > unnecessarily when the queue contains more than one element. If the > queue contains one element, we'd visit it because of > TAILQ_FOREACH_FROM's surprising behaviour of iterating over the entire > queue when the listelem is NULL. I was hoping it was something equivalent to: for (td = TAILQ_NEXT(besttd); td != NULL; td = TAILQ_NEXT(td)) { ... } I guess what we actually want is something like TAILQ_FOREACH_AFTER(): TAILQ_FOREACH_AFTER(td, besttd, &sq->sq_blocked[queue], td_slpq) that assumed bestttd was not NULL and so avoided the whole "scan the whole thing". For now you could perhaps open-code the above loop though? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Sep 5 21:55: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 1E501B96256; Mon, 5 Sep 2016 21:55:29 +0000 (UTC) (envelope-from landonf@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 C6363B64; Mon, 5 Sep 2016 21:55:28 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85LtRF3099569; Mon, 5 Sep 2016 21:55:27 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85LtRSL099567; Mon, 5 Sep 2016 21:55:27 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609052155.u85LtRSL099567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 5 Sep 2016 21:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305443 - head/sys/dev/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 21:55:29 -0000 Author: landonf Date: Mon Sep 5 21:55:27 2016 New Revision: 305443 URL: https://svnweb.freebsd.org/changeset/base/305443 Log: bwn(4): ignore BCM4321's unpopulated USB11 host controller core. Broadcom Intensi-fi chipsets provided a common set of IP cores; on PCI/PCIe devices, the USB11 host controller is left floating. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bwn/if_bwn_pci.c head/sys/dev/bwn/if_bwn_pcivar.h Modified: head/sys/dev/bwn/if_bwn_pci.c ============================================================================== --- head/sys/dev/bwn/if_bwn_pci.c Mon Sep 5 21:48:16 2016 (r305442) +++ head/sys/dev/bwn/if_bwn_pci.c Mon Sep 5 21:55:27 2016 (r305443) @@ -84,10 +84,12 @@ static const struct bwn_pci_device siba_ BWN_BCM_DEV(BCM4318_D11A, "BCM4318 802.11a", BWN_QUIRK_UNTESTED|BWN_QUIRK_WLAN_DUALCORE), - BWN_BCM_DEV(BCM4321_D11N, "BCM4321 802.11n Dual-Band", 0), - BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz", 0), + BWN_BCM_DEV(BCM4321_D11N, "BCM4321 802.11n Dual-Band", + BWN_QUIRK_USBH_UNPOPULATED), + BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz", + BWN_QUIRK_USBH_UNPOPULATED), BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 5GHz", - BWN_QUIRK_UNTESTED), + BWN_QUIRK_UNTESTED|BWN_QUIRK_USBH_UNPOPULATED), BWN_BCM_DEV(BCM4322_D11N, "BCM4322 802.11n Dual-Band", 0), BWN_BCM_DEV(BCM4322_D11N2G, "BCM4322 802.11n 2GHz", @@ -263,6 +265,9 @@ bwn_pci_is_core_disabled(device_t dev, d case BHND_DEVCLASS_ENET_MAC: case BHND_DEVCLASS_ENET_PHY: return ((sc->quirks & BWN_QUIRK_ENET_HW_UNPOPULATED) != 0); + + case BHND_DEVCLASS_USB_HOST: + return ((sc->quirks & BWN_QUIRK_USBH_UNPOPULATED) != 0); default: return (false); Modified: head/sys/dev/bwn/if_bwn_pcivar.h ============================================================================== --- head/sys/dev/bwn/if_bwn_pcivar.h Mon Sep 5 21:48:16 2016 (r305442) +++ head/sys/dev/bwn/if_bwn_pcivar.h Mon Sep 5 21:55:27 2016 (r305443) @@ -68,6 +68,13 @@ enum { * this quirk to treat these cores as unpopulated. */ BWN_QUIRK_ENET_HW_UNPOPULATED = 1<<2, + + /** + * Some PCI/PCIe "Intensi-fi" chipsets shipped with floating USB + * host controller cores; set this quirk to treat these cores as + * unpopulated. + */ + BWN_QUIRK_USBH_UNPOPULATED = 1<<3, }; /* PCI device descriptor */ From owner-svn-src-head@freebsd.org Mon Sep 5 22:11:48 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 83CEFB9648E; Mon, 5 Sep 2016 22:11:48 +0000 (UTC) (envelope-from landonf@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 40C64299; Mon, 5 Sep 2016 22:11:48 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85MBl6b003853; Mon, 5 Sep 2016 22:11:47 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85MBk4r003838; Mon, 5 Sep 2016 22:11:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609052211.u85MBk4r003838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 5 Sep 2016 22:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305444 - in head/sys/dev: bhnd bhnd/bcma bhnd/bhndb bhnd/cores/pmu bhnd/siba bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 22:11:48 -0000 Author: landonf Date: Mon Sep 5 22:11:46 2016 New Revision: 305444 URL: https://svnweb.freebsd.org/changeset/base/305444 Log: bhnd(4): Implement backplane interrupt handling. This adds bhnd(4) bus-level support for querying backplane interrupt vector routing, and delegating machine/bridge-specific interrupt handling to the concrete bhnd(4) driver implementation. On bhndb(4) bridged PCI devices, we provide the PCI/MSI interrupt directly to attached cores. On MIPS devices, we report a backplane interrupt count of 0, effectively disabling the bus-level interrupt assignment. This allows mips/broadcom to temporarily continue using hard-coded MIPS IRQs until bhnd_mips PIC support is implemented. Reviewed by: mizhka Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_dmp.h head/sys/dev/bhnd/bcma/bcmavar.h head/sys/dev/bhnd/bhnd.c head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_nexus.c head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_pci.c head/sys/dev/bhnd/bhndb/bhndb_pcivar.h head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/dev/bhnd/siba/sibareg.h head/sys/dev/bhnd/siba/sibavar.h head/sys/dev/bwn/bwn_mac.c Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bcma/bcma.c Mon Sep 5 22:11:46 2016 (r305444) @@ -41,8 +41,11 @@ __FBSDID("$FreeBSD$"); #include "bcmavar.h" +#include "bcma_dmp.h" + #include "bcma_eromreg.h" #include "bcma_eromvar.h" + #include /* RID used when allocating EROM table */ @@ -434,6 +437,70 @@ bcma_get_region_addr(device_t dev, devic return (ENOENT); } +/** + * Default bcma(4) bus driver implementation of BHND_BUS_GET_INTR_COUNT(). + * + * This implementation consults @p child's agent register block, + * returning the number of interrupt output lines routed to @p child. + */ +int +bcma_get_intr_count(device_t dev, device_t child) +{ + struct bcma_devinfo *dinfo; + uint32_t dmpcfg, oobw; + + dinfo = device_get_ivars(child); + + /* Agent block must be mapped */ + if (dinfo->res_agent == NULL) + return (0); + + /* Agent must support OOB */ + dmpcfg = bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_CONFIG); + if (!BCMA_DMP_GET_FLAG(dmpcfg, BCMA_DMP_CFG_OOB)) + return (0); + + /* Return OOB width as interrupt count */ + oobw = bhnd_bus_read_4(dinfo->res_agent, + BCMA_DMP_OOB_OUTWIDTH(BCMA_OOB_BANK_INTR)); + if (oobw > BCMA_OOB_NUM_SEL) { + device_printf(dev, "ignoring invalid OOBOUTWIDTH for core %u: " + "%#x\n", BCMA_DINFO_COREIDX(dinfo), oobw); + return (0); + } + + return (oobw); +} + +/** + * Default bcma(4) bus driver implementation of BHND_BUS_GET_CORE_IVEC(). + * + * This implementation consults @p child's agent register block, + * returning the interrupt output line routed to @p child, at OOB selector + * @p intr. + */ +int +bcma_get_core_ivec(device_t dev, device_t child, u_int intr, uint32_t *ivec) +{ + struct bcma_devinfo *dinfo; + uint32_t oobsel; + + dinfo = device_get_ivars(child); + + /* Interrupt ID must be valid. */ + if (intr >= bcma_get_intr_count(dev, child)) + return (ENXIO); + + /* Fetch OOBSEL busline value */ + KASSERT(dinfo->res_agent != NULL, ("missing agent registers")); + oobsel = bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_OOBSELOUT( + BCMA_OOB_BANK_INTR, intr)); + *ivec = (oobsel >> BCMA_DMP_OOBSEL_SHIFT(intr)) & + BCMA_DMP_OOBSEL_BUSLINE_MASK; + + return (0); +} + static struct bhnd_devinfo * bcma_alloc_bhnd_dinfo(device_t dev) { @@ -475,6 +542,8 @@ bcma_add_children(device_t bus) /* Add all cores. */ bcma_erom = (struct bcma_erom *)erom; while ((error = bcma_erom_next_corecfg(bcma_erom, &corecfg)) == 0) { + int nintr; + /* Add the child device */ child = BUS_ADD_CHILD(bus, 0, NULL, -1); if (child == NULL) { @@ -494,6 +563,17 @@ bcma_add_children(device_t bus) if ((error = bcma_dinfo_alloc_agent(bus, child, dinfo))) goto cleanup; + /* Assign interrupts */ + nintr = bhnd_get_intr_count(child); + for (int rid = 0; rid < nintr; rid++) { + error = BHND_BUS_ASSIGN_INTR(bus, child, rid); + if (error) { + device_printf(bus, "failed to assign interrupt " + "%d to core %u: %d\n", rid, + BCMA_DINFO_COREIDX(dinfo), error); + } + } + /* If pins are floating or the hardware is otherwise * unpopulated, the device shouldn't be used. */ if (bhnd_is_hw_disabled(child)) @@ -544,6 +624,8 @@ static device_method_t bcma_methods[] = DEVMETHOD(bhnd_bus_get_port_rid, bcma_get_port_rid), DEVMETHOD(bhnd_bus_decode_port_rid, bcma_decode_port_rid), DEVMETHOD(bhnd_bus_get_region_addr, bcma_get_region_addr), + DEVMETHOD(bhnd_bus_get_intr_count, bcma_get_intr_count), + DEVMETHOD(bhnd_bus_get_core_ivec, bcma_get_core_ivec), DEVMETHOD_END }; Modified: head/sys/dev/bhnd/bcma/bcma_dmp.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_dmp.h Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bcma/bcma_dmp.h Mon Sep 5 22:11:46 2016 (r305444) @@ -37,8 +37,18 @@ * in the proprietary "NIC-301 Interconnect Device Management (PL368)" * errata publication, available to licensees as part of ARM's * CoreLink Controllers and Peripherals Engineering Errata. + * + * As such, the exact interpretation of these register definitions is + * unconfirmed, and may be incorrect. */ +#define BCMA_DMP_GET_FLAG(_value, _flag) \ + (((_value) & _flag) != 0) +#define BCMA_DMP_GET_BITS(_value, _field) \ + ((_value & _field ## _MASK) >> _field ## _SHIFT) +#define BHND_DMP_SET_BITS(_value, _field) \ + (((_value) << _field ## _SHIFT) & _field ## _MASK) + /* Out-of-band Router registers */ #define BCMA_OOB_BUSCONFIG 0x020 #define BCMA_OOB_STATUSA 0x100 @@ -71,23 +81,36 @@ #define BCMA_OOB_ITOPOOBC 0xf38 #define BCMA_OOB_ITOPOOBD 0xf3c -/* DMP wrapper registers */ -#define BCMA_DMP_OOBSELINA30 0x000 -#define BCMA_DMP_OOBSELINA74 0x004 -#define BCMA_DMP_OOBSELINB30 0x020 -#define BCMA_DMP_OOBSELINB74 0x024 -#define BCMA_DMP_OOBSELINC30 0x040 -#define BCMA_DMP_OOBSELINC74 0x044 -#define BCMA_DMP_OOBSELIND30 0x060 -#define BCMA_DMP_OOBSELIND74 0x064 -#define BCMA_DMP_OOBSELOUTA30 0x100 -#define BCMA_DMP_OOBSELOUTA74 0x104 -#define BCMA_DMP_OOBSELOUTB30 0x120 -#define BCMA_DMP_OOBSELOUTB74 0x124 -#define BCMA_DMP_OOBSELOUTC30 0x140 -#define BCMA_DMP_OOBSELOUTC74 0x144 -#define BCMA_DMP_OOBSELOUTD30 0x160 -#define BCMA_DMP_OOBSELOUTD74 0x164 +/* Common definitions */ +#define BCMA_OOB_NUM_BANKS 4 /**< number of OOB banks (A, B, C, D) */ +#define BCMA_OOB_NUM_SEL 8 /**< number of OOB selectors per bank */ +#define BCMA_OOB_NUM_BUSLINES 32 /**< number of bus lines managed by OOB core */ + +#define BCMA_OOB_BANKA 0 /**< bank A index */ +#define BCMA_OOB_BANKB 1 /**< bank B index */ +#define BCMA_OOB_BANKC 2 /**< bank C index */ +#define BCMA_OOB_BANKD 3 /**< bank D index */ + +/** OOB bank used for interrupt lines */ +#define BCMA_OOB_BANK_INTR BCMA_OOB_BANKA + +/* DMP agent registers */ +#define BCMA_DMP_OOBSELINA30 0x000 /**< A0-A3 input selectors */ +#define BCMA_DMP_OOBSELINA74 0x004 /**< A4-A7 input selectors */ +#define BCMA_DMP_OOBSELINB30 0x020 /**< B0-B3 input selectors */ +#define BCMA_DMP_OOBSELINB74 0x024 /**< B4-B7 input selectors */ +#define BCMA_DMP_OOBSELINC30 0x040 /**< C0-C3 input selectors */ +#define BCMA_DMP_OOBSELINC74 0x044 /**< C4-C7 input selectors */ +#define BCMA_DMP_OOBSELIND30 0x060 /**< D0-D3 input selectors */ +#define BCMA_DMP_OOBSELIND74 0x064 /**< D4-D7 input selectors */ +#define BCMA_DMP_OOBSELOUTA30 0x100 /**< A0-A3 output selectors */ +#define BCMA_DMP_OOBSELOUTA74 0x104 /**< A4-A7 output selectors */ +#define BCMA_DMP_OOBSELOUTB30 0x120 /**< B0-B3 output selectors */ +#define BCMA_DMP_OOBSELOUTB74 0x124 /**< B4-B7 output selectors */ +#define BCMA_DMP_OOBSELOUTC30 0x140 /**< C0-C3 output selectors */ +#define BCMA_DMP_OOBSELOUTC74 0x144 /**< C4-C7 output selectors */ +#define BCMA_DMP_OOBSELOUTD30 0x160 /**< D0-D3 output selectors */ +#define BCMA_DMP_OOBSELOUTD74 0x164 /**< D4-D7 output selectors */ #define BCMA_DMP_OOBSYNCA 0x200 #define BCMA_DMP_OOBSELOUTAEN 0x204 #define BCMA_DMP_OOBSYNCB 0x220 @@ -109,18 +132,20 @@ #define BCMA_DMP_OOBDINWIDTH 0x364 #define BCMA_DMP_OOBDOUTWIDTH 0x368 -/* The exact interpretation of these bits is unverified; these - * are our best guesses as to their use */ -#define BCMA_DMP_OOBSEL_MASK 0xFF /**< OOBSEL config mask */ -#define BCMA_DMP_OOBSEL_0_MASK BCMA_DMP_OOBSEL_MASK -#define BCMA_DMP_OOBSEL_1_MASK BCMA_DMP_OOBSEL_MASK -#define BCMA_DMP_OOBSEL_2_MASK BCMA_DMP_OOBSEL_MASK -#define BCMA_DMP_OOBSEL_3_MASK BCMA_DMP_OOBSEL_MASK -#define BCMA_DMP_OOBSEL_0_SHIFT 0 /**< first OOBSEL config */ -#define BCMA_DMP_OOBSEL_1_SHIFT 8 /**< second OOBSEL config */ -#define BCMA_DMP_OOBSEL_2_SHIFT 16 /**< third OOBSEL config */ -#define BCMA_DMP_OOBSEL_3_SHIFT 24 /**< fouth OOBSEL config */ -#define BCMA_DMP_OOBSEL_EN (1 << 7) /**< enable bit */ +#define BCMA_DMP_OOBSEL(_base, _bank, _sel) \ + (_base + (_bank * 8) + (_sel >= 4 ? 4 : 0)) + +#define BCMA_DMP_OOBSELIN(_bank, _sel) \ + BCMA_DMP_OOBSEL(BCMA_DMP_OOBSELINA30, _bank, _sel) + +#define BCMA_DMP_OOBSELOUT(_bank, _sel) \ + BCMA_DMP_OOBSEL(BCMA_DMP_OOBSELOUTA30, _bank, _sel) + +#define BCMA_DMP_OOBSYNC(_bank) (BCMA_DMP_OOBSYNCA + (_bank * 8)) +#define BCMA_DMP_OOBSELOUT_EN(_bank) (BCMA_DMP_OOBSELOUTAEN + (_bank * 8)) +#define BCMA_DMP_OOB_EXTWIDTH(_bank) (BCMA_DMP_OOBAEXTWIDTH + (_bank * 12)) +#define BCMA_DMP_OOB_INWIDTH(_bank) (BCMA_DMP_OOBAINWIDTH + (_bank * 12)) +#define BCMA_DMP_OOB_OUTWIDTH(_bank) (BCMA_DMP_OOBAOUTWIDTH + (_bank * 12)) // This was inherited from Broadcom's aidmp.h header // Is it required for any of our use-cases? @@ -192,6 +217,34 @@ #define BCMA_DMP_COMPONENTID2 0xff8 #define BCMA_DMP_COMPONENTID3 0xffc + +/* OOBSEL(IN|OUT) */ +#define BCMA_DMP_OOBSEL_MASK 0xFF /**< OOB selector mask */ +#define BCMA_DMP_OOBSEL_EN (1<<7) /**< OOB selector enable bit */ +#define BCMA_DMP_OOBSEL_SHIFT(_sel) ((_sel % BCMA_OOB_NUM_SEL) * 8) +#define BCMA_DMP_OOBSEL_BUSLINE_MASK 0x7F /**< OOB selector bus line mask */ +#define BCMA_DMP_OOBSEL_BUSLINE_SHIFT 0 + +#define BCMA_DMP_OOBSEL_0_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_1_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_2_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_3_MASK BCMA_DMP_OOBSEL_MASK + +#define BCMA_DMP_OOBSEL_4_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_5_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_6_MASK BCMA_DMP_OOBSEL_MASK +#define BCMA_DMP_OOBSEL_7_MASK BCMA_DMP_OOBSEL_MASK + +#define BCMA_DMP_OOBSEL_0_SHIFT BCMA_DMP_OOBSEL_SHIFT(0) +#define BCMA_DMP_OOBSEL_1_SHIFT BCMA_DMP_OOBSEL_SHIFT(1) +#define BCMA_DMP_OOBSEL_2_SHIFT BCMA_DMP_OOBSEL_SHIFT(2) +#define BCMA_DMP_OOBSEL_3_SHIFT BCMA_DMP_OOBSEL_SHIFT(3) + +#define BCMA_DMP_OOBSEL_4_SHIFT BCMA_DMP_OOBSEL_0_SHIFT +#define BCMA_DMP_OOBSEL_5_SHIFT BCMA_DMP_OOBSEL_1_SHIFT +#define BCMA_DMP_OOBSEL_6_SHIFT BCMA_DMP_OOBSEL_2_SHIFT +#define BCMA_DMP_OOBSEL_7_SHIFT BCMA_DMP_OOBSEL_3_SHIFT + /* resetctrl */ #define BMCA_DMP_RC_RESET 1 Modified: head/sys/dev/bhnd/bcma/bcmavar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcmavar.h Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bcma/bcmavar.h Mon Sep 5 22:11:46 2016 (r305444) @@ -74,6 +74,9 @@ struct bcma_sport; int bcma_probe(device_t dev); int bcma_attach(device_t dev); int bcma_detach(device_t dev); +int bcma_get_intr_count(device_t dev, device_t child); +int bcma_get_core_ivec(device_t dev, device_t child, + u_int intr, uint32_t *ivec); int bcma_add_children(device_t bus); Modified: head/sys/dev/bhnd/bhnd.c ============================================================================== --- head/sys/dev/bhnd/bhnd.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhnd.c Mon Sep 5 22:11:46 2016 (r305444) @@ -925,9 +925,14 @@ bhnd_generic_print_child(device_t dev, d retval += bus_print_child_header(dev, child); rl = BUS_GET_RESOURCE_LIST(dev, child); + + if (rl != NULL) { retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); + + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, + "%#jd"); } retval += printf(" at core %u", bhnd_get_core_index(child)); @@ -974,8 +979,10 @@ bhnd_generic_probe_nomatch(device_t dev, bhnd_get_device_name(child)); rl = BUS_GET_RESOURCE_LIST(dev, child); - if (rl != NULL) + if (rl != NULL) { resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); + resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%#jd"); + } printf(" at core %u (no driver attached)\n", bhnd_get_core_index(child)); Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhnd.h Mon Sep 5 22:11:46 2016 (r305444) @@ -550,6 +550,45 @@ bhnd_read_board_info(device_t dev, struc } /** + * Return the number of interrupts to be assigned to @p child via + * BHND_BUS_ASSIGN_INTR(). + * + * @param dev A bhnd bus child device. + */ +static inline int +bhnd_get_intr_count(device_t dev) +{ + return (BHND_BUS_GET_INTR_COUNT(device_get_parent(dev), dev)); +} + +/** + * Return the backplane interrupt vector corresponding to @p dev's given + * @p intr number. + * + * @param dev A bhnd bus child device. + * @param intr The interrupt number being queried. This is equivalent to the + * bus resource ID for the interrupt. + * @param[out] ivec On success, the assigned hardware interrupt vector be + * written to this pointer. + * + * On bcma(4) devices, this returns the OOB bus line assigned to the + * interrupt. + * + * On siba(4) devices, this returns the target OCP slave flag number assigned + * to the interrupt. + * + * @retval 0 success + * @retval ENXIO If @p intr exceeds the number of interrupts available + * to @p child. + */ +static inline int +bhnd_get_core_ivec(device_t dev, u_int intr, uint32_t *ivec) +{ + return (BHND_BUS_GET_CORE_IVEC(device_get_parent(dev), dev, intr, + ivec)); +} + +/** * Allocate and enable per-core PMU request handling for @p child. * * The region containing the core's PMU register block (if any) must be Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhnd_bus_if.m Mon Sep 5 22:11:46 2016 (r305444) @@ -1,5 +1,5 @@ #- -# Copyright (c) 2015 Landon Fuller +# Copyright (c) 2015-2016 Landon Fuller # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -96,7 +96,26 @@ CODE { { panic("bhnd_bus_read_boardinfo unimplemented"); } - + + static int + bhnd_bus_null_get_intr_count(device_t dev, device_t child) + { + panic("bhnd_bus_get_intr_count unimplemented"); + } + + static int + bhnd_bus_null_assign_intr(device_t dev, device_t child, int rid) + { + panic("bhnd_bus_assign_intr unimplemented"); + } + + static int + bhnd_bus_null_get_core_ivec(device_t dev, device_t child, u_int intr, + uint32_t *ivec) + { + panic("bhnd_bus_get_core_ivec unimplemented"); + } + static void bhnd_bus_null_child_added(device_t dev, device_t child) { @@ -349,6 +368,78 @@ METHOD void free_devinfo { struct bhnd_devinfo *dinfo; }; + +/** + * Return the number of interrupts to be assigned to @p child via + * BHND_BUS_ASSIGN_INTR(). + * + * @param dev The bhnd bus parent of @p child. + * @param child The bhnd device for which a count should be returned. + * + * @retval 0 If no interrupts should be assigned. + * @retval non-zero The count of interrupt resource IDs to be + * assigned, starting at rid 0. + */ +METHOD int get_intr_count { + device_t dev; + device_t child; +} DEFAULT bhnd_bus_null_get_intr_count; + +/** + * Assign an interrupt to @p child via bus_set_resource(). + * + * The default bus implementation of this method should assign backplane + * interrupt values to @p child. + * + * Bridge-attached bus implementations may instead override standard + * interconnect IRQ assignment, providing IRQs inherited from the parent bus. + * + * TODO: Once we can depend on INTRNG, investigate replacing this with a + * bridge-level interrupt controller. + * + * @param dev The bhnd bus parent of @p child. + * @param child The bhnd device to which an interrupt should be assigned. + * @param rid The interrupt resource ID to be assigned. + * + * @retval 0 If an interrupt was assigned. + * @retval non-zero If assigning an interrupt otherwise fails, a regular + * unix error code will be returned. + */ +METHOD int assign_intr { + device_t dev; + device_t child; + int rid; +} DEFAULT bhnd_bus_null_assign_intr; + +/** + * Return the backplane interrupt vector corresponding to @p child's given + * @p intr number. + * + * @param dev The bhnd bus parent of @p child. + * @param child The bhnd device for which the assigned interrupt vector should + * be queried. + * @param intr The interrupt number being queried. This is equivalent to the + * bus resource ID for the interrupt. + * @param[out] ivec On success, the assigned hardware interrupt vector be + * written to this pointer. + * + * On bcma(4) devices, this returns the OOB bus line assigned to the + * interrupt. + * + * On siba(4) devices, this returns the target OCP slave flag number assigned + * to the interrupt. + * + * @retval 0 success + * @retval ENXIO If @p intr exceeds the number of interrupts available + * to @p child. + */ +METHOD int get_core_ivec { + device_t dev; + device_t child; + u_int intr; + uint32_t *ivec; +} DEFAULT bhnd_bus_null_get_core_ivec; + /** * Notify a bhnd bus that a child was added. * Modified: head/sys/dev/bhnd/bhnd_nexus.c ============================================================================== --- head/sys/dev/bhnd/bhnd_nexus.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhnd_nexus.c Mon Sep 5 22:11:46 2016 (r305444) @@ -122,6 +122,13 @@ bhnd_nexus_deactivate_resource(device_t return (0); } +static int +bhnd_nexus_get_intr_count(device_t dev, device_t child) +{ + // TODO: arch-specific interrupt handling. + return (0); +} + static device_method_t bhnd_nexus_methods[] = { /* bhnd interface */ DEVMETHOD(bhnd_bus_activate_resource, bhnd_nexus_activate_resource), @@ -129,6 +136,8 @@ static device_method_t bhnd_nexus_method DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_nexus_is_hw_disabled), DEVMETHOD(bhnd_bus_get_attach_type, bhnd_nexus_get_attach_type), + DEVMETHOD(bhnd_bus_get_intr_count, bhnd_nexus_get_intr_count), + DEVMETHOD_END }; Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Mon Sep 5 22:11:46 2016 (r305444) @@ -93,6 +93,13 @@ bhnd_bhndb_find_hostb_device(device_t de return (bhnd_match_child(dev, &md)); } +static int +bhnd_bhndb_assign_intr(device_t dev, device_t child, int rid) +{ + /* Delegate to parent bridge */ + return (BHND_BUS_ASSIGN_INTR(device_get_parent(dev), child, rid)); +} + static bhnd_clksrc bhnd_bhndb_pwrctl_get_clksrc(device_t dev, device_t child, bhnd_clock clock) @@ -126,6 +133,7 @@ static device_method_t bhnd_bhndb_method DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_bhndb_is_hw_disabled), DEVMETHOD(bhnd_bus_find_hostb_device, bhnd_bhndb_find_hostb_device), DEVMETHOD(bhnd_bus_read_board_info, bhnd_bhndb_read_board_info), + DEVMETHOD(bhnd_bus_assign_intr, bhnd_bhndb_assign_intr), DEVMETHOD(bhnd_bus_pwrctl_get_clksrc, bhnd_bhndb_pwrctl_get_clksrc), DEVMETHOD(bhnd_bus_pwrctl_gate_clock, bhnd_bhndb_pwrctl_gate_clock), Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhndb/bhndb.c Mon Sep 5 22:11:46 2016 (r305444) @@ -993,7 +993,7 @@ bhndb_suspend_resource(device_t dev, dev sc = device_get_softc(dev); - // TODO: IRQs? + /* Non-MMIO resources (e.g. IRQs) are handled solely by our parent */ if (type != SYS_RES_MEMORY) return; @@ -1024,7 +1024,7 @@ bhndb_resume_resource(device_t dev, devi sc = device_get_softc(dev); - // TODO: IRQs? + /* Non-MMIO resources (e.g. IRQs) are handled solely by our parent */ if (type != SYS_RES_MEMORY) return (0); @@ -1040,7 +1040,6 @@ bhndb_resume_resource(device_t dev, devi rman_get_rid(r), r, NULL)); } - /** * Default bhndb(4) implementation of BUS_READ_IVAR(). */ @@ -1109,8 +1108,6 @@ bhndb_get_rman(struct bhndb_softc *sc, d case SYS_RES_MEMORY: return (&sc->bus_res->br_mem_rman); case SYS_RES_IRQ: - // TODO - // return &sc->irq_rman; return (NULL); default: return (NULL); @@ -1233,6 +1230,15 @@ bhndb_alloc_resource(device_t dev, devic isdefault = RMAN_IS_DEFAULT_RANGE(start, end); rle = NULL; + /* Fetch the resource manager */ + rm = bhndb_get_rman(sc, child, type); + if (rm == NULL) { + /* Delegate to our parent device's bus; the requested + * resource type isn't handled locally. */ + return (BUS_ALLOC_RESOURCE(device_get_parent(sc->parent_dev), + child, type, rid, start, end, count, flags)); + } + /* Populate defaults */ if (!passthrough && isdefault) { /* Fetch the resource list entry. */ @@ -1263,11 +1269,6 @@ bhndb_alloc_resource(device_t dev, devic /* Validate resource addresses */ if (start > end || count > ((end - start) + 1)) return (NULL); - - /* Fetch the resource manager */ - rm = bhndb_get_rman(sc, child, type); - if (rm == NULL) - return (NULL); /* Make our reservation */ rv = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, @@ -1310,12 +1311,21 @@ static int bhndb_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { + struct bhndb_softc *sc; struct resource_list_entry *rle; bool passthrough; int error; - + + sc = device_get_softc(dev); passthrough = (device_get_parent(child) != dev); + /* Delegate to our parent device's bus if the requested resource type + * isn't handled locally. */ + if (bhndb_get_rman(sc, child, type) == NULL) { + return (BUS_RELEASE_RESOURCE(device_get_parent(sc->parent_dev), + child, type, rid, r)); + } + /* Deactivate resources */ if (rman_get_flags(r) & RF_ACTIVE) { error = BUS_DEACTIVATE_RESOURCE(dev, child, type, rid, r); @@ -1352,15 +1362,18 @@ bhndb_adjust_resource(device_t dev, devi sc = device_get_softc(dev); error = 0; + /* Delegate to our parent device's bus if the requested resource type + * isn't handled locally. */ + rm = bhndb_get_rman(sc, child, type); + if (rm == NULL) { + return (BUS_ADJUST_RESOURCE(device_get_parent(sc->parent_dev), + child, type, r, start, end)); + } + /* Verify basic constraints */ if (end <= start) return (EINVAL); - /* Fetch resource manager */ - rm = bhndb_get_rman(sc, child, type); - if (rm == NULL) - return (ENXIO); - if (!rman_is_region_manager(r, rm)) return (ENXIO); @@ -1567,7 +1580,7 @@ bhndb_try_activate_resource(struct bhndb BHNDB_LOCK_ASSERT(sc, MA_NOTOWNED); - // TODO - IRQs + /* Only MMIO resources can be mapped via register windows */ if (type != SYS_RES_MEMORY) return (ENXIO); @@ -1678,6 +1691,13 @@ bhndb_activate_resource(device_t dev, de { struct bhndb_softc *sc = device_get_softc(dev); + /* Delegate directly to our parent device's bus if the requested + * resource type isn't handled locally. */ + if (bhndb_get_rman(sc, child, type) == NULL) { + return (BUS_ACTIVATE_RESOURCE(device_get_parent(sc->parent_dev), + child, type, rid, r)); + } + return (bhndb_try_activate_resource(sc, child, type, rid, r, NULL)); } @@ -1695,8 +1715,13 @@ bhndb_deactivate_resource(device_t dev, sc = device_get_softc(dev); - if ((rm = bhndb_get_rman(sc, child, type)) == NULL) - return (EINVAL); + /* Delegate directly to our parent device's bus if the requested + * resource type isn't handled locally. */ + rm = bhndb_get_rman(sc, child, type); + if (rm == NULL) { + return (BUS_DEACTIVATE_RESOURCE( + device_get_parent(sc->parent_dev), child, type, rid, r)); + } /* Mark inactive */ if ((error = rman_deactivate_resource(r))) @@ -1752,6 +1777,15 @@ bhndb_activate_bhnd_resource(device_t de sc = device_get_softc(dev); + /* Delegate directly to BUS_ACTIVATE_RESOURCE() if the requested + * resource type isn't handled locally. */ + if (bhndb_get_rman(sc, child, type) == NULL) { + error = BUS_ACTIVATE_RESOURCE(dev, child, type, rid, r->res); + if (error == 0) + r->direct = true; + return (error); + } + r_start = rman_get_start(r->res); r_size = rman_get_size(r->res); @@ -1815,7 +1849,7 @@ bhndb_deactivate_bhnd_resource(device_t ("RF_ACTIVE not set on direct resource")); /* Perform deactivation */ - error = bus_deactivate_resource(child, type, rid, r->res); + error = BUS_DEACTIVATE_RESOURCE(dev, child, type, rid, r->res); if (!error) r->direct = false; @@ -2053,61 +2087,6 @@ bhndb_bus_barrier(device_t dev, device_t } /** - * Default bhndb(4) implementation of BUS_SETUP_INTR(). - */ -static int -bhndb_setup_intr(device_t dev, device_t child, struct resource *r, - int flags, driver_filter_t filter, driver_intr_t handler, void *arg, - void **cookiep) -{ - // TODO - return (EOPNOTSUPP); -} - -/** - * Default bhndb(4) implementation of BUS_TEARDOWN_INTR(). - */ -static int -bhndb_teardown_intr(device_t dev, device_t child, struct resource *r, - void *cookie) -{ - // TODO - return (EOPNOTSUPP); -} - -/** - * Default bhndb(4) implementation of BUS_CONFIG_INTR(). - */ -static int -bhndb_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol) -{ - // TODO - return (EOPNOTSUPP); -} - -/** - * Default bhndb(4) implementation of BUS_BIND_INTR(). - */ -static int -bhndb_bind_intr(device_t dev, device_t child, struct resource *r, int cpu) -{ - // TODO - return (EOPNOTSUPP); -} - -/** - * Default bhndb(4) implementation of BUS_DESCRIBE_INTR(). - */ -static int -bhndb_describe_intr(device_t dev, device_t child, struct resource *irq, void *cookie, - const char *descr) -{ - // TODO - return (EOPNOTSUPP); -} - -/** * Default bhndb(4) implementation of BUS_GET_DMA_TAG(). */ static bus_dma_tag_t @@ -2138,11 +2117,11 @@ static device_method_t bhndb_methods[] = DEVMETHOD(bus_activate_resource, bhndb_activate_resource), DEVMETHOD(bus_deactivate_resource, bhndb_deactivate_resource), - DEVMETHOD(bus_setup_intr, bhndb_setup_intr), - DEVMETHOD(bus_teardown_intr, bhndb_teardown_intr), - DEVMETHOD(bus_config_intr, bhndb_config_intr), - DEVMETHOD(bus_bind_intr, bhndb_bind_intr), - DEVMETHOD(bus_describe_intr, bhndb_describe_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_config_intr, bus_generic_config_intr), + DEVMETHOD(bus_bind_intr, bus_generic_bind_intr), + DEVMETHOD(bus_describe_intr, bus_generic_describe_intr), DEVMETHOD(bus_get_dma_tag, bhndb_get_dma_tag), Modified: head/sys/dev/bhnd/bhndb/bhndb_pci.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pci.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhndb/bhndb_pci.c Mon Sep 5 22:11:46 2016 (r305444) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "bhndb_pcivar.h" #include "bhndb_private.h" +static int bhndb_pci_init_msi(struct bhndb_pci_softc *sc); static int bhndb_pci_add_children(struct bhndb_pci_softc *sc); static int bhndb_enable_pci_clocks(struct bhndb_pci_softc *sc); @@ -78,6 +79,8 @@ static void bhndb_init_sromless_pci_con static bus_addr_t bhndb_pci_sprom_addr(struct bhndb_pci_softc *sc); static bus_size_t bhndb_pci_sprom_size(struct bhndb_pci_softc *sc); +#define BHNDB_PCI_MSI_COUNT 1 + /** * Default bhndb_pci implementation of device_probe(). * @@ -103,6 +106,33 @@ bhndb_pci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +/* Configure MSI interrupts */ +static int +bhndb_pci_init_msi(struct bhndb_pci_softc *sc) +{ + int error; + + /* Is MSI available? */ + if (pci_msi_count(sc->parent) < BHNDB_PCI_MSI_COUNT) + return (ENXIO); + + /* Allocate expected message count */ + sc->intr.msi_count = BHNDB_PCI_MSI_COUNT; + if ((error = pci_alloc_msi(sc->parent, &sc->intr.msi_count))) { + device_printf(sc->dev, "failed to allocate MSI interrupts: " + "%d\n", error); + return (error); + } + + if (sc->intr.msi_count < BHNDB_PCI_MSI_COUNT) + return (ENXIO); + + /* MSI uses resource IDs starting at 1 */ + sc->intr.intr_rid = 1; + + return (0); +} + static int bhndb_pci_attach(device_t dev) { @@ -114,6 +144,21 @@ bhndb_pci_attach(device_t dev) sc->parent = device_get_parent(dev); sc->set_regwin = bhndb_pci_compat_setregwin; + /* Enable PCI bus mastering */ + pci_enable_busmaster(sc->parent); + + /* Set up interrupt handling */ + if (bhndb_pci_init_msi(sc) == 0) { + device_printf(dev, "Using MSI interrupts on %s\n", + device_get_nameunit(sc->parent)); + } else { + device_printf(dev, "Using INTx interrupts on %s\n", + device_get_nameunit(sc->parent)); + sc->intr.intr_rid = 0; + } + + /* Determine our bridge device class */ + sc->pci_devclass = BHND_DEVCLASS_PCI; if (pci_find_cap(sc->parent, PCIY_EXPRESS, ®) == 0) sc->pci_devclass = BHND_DEVCLASS_PCIE; else @@ -153,6 +198,9 @@ bhndb_pci_attach(device_t dev) cleanup: device_delete_children(dev); bhndb_disable_pci_clocks(sc); + if (sc->intr.msi_count > 0) + pci_release_msi(dev); + pci_disable_busmaster(sc->parent); return (error); @@ -178,6 +226,10 @@ bhndb_pci_detach(device_t dev) if ((error = bhndb_disable_pci_clocks(sc))) return (error); + /* Release MSI interrupts */ + if (sc->intr.msi_count > 0) + pci_release_msi(dev); + /* Disable PCI bus mastering */ pci_disable_busmaster(sc->parent); @@ -679,6 +731,29 @@ bhndb_pci_pwrctl_ungate_clock(device_t d return (bhndb_enable_pci_clocks(sc)); } +static int +bhndb_pci_assign_intr(device_t dev, device_t child, int rid) +{ + struct bhndb_pci_softc *sc; + rman_res_t start, count; + int error; + + sc = device_get_softc(dev); + + /* Is the rid valid? */ + if (rid >= bhnd_get_intr_count(child)) + return (EINVAL); + + /* Fetch our common PCI interrupt's start/count. */ + error = bus_get_resource(sc->parent, SYS_RES_IRQ, sc->intr.intr_rid, + &start, &count); + if (error) + return (error); + + /* Add to child's resource list */ + return (bus_set_resource(child, SYS_RES_IRQ, rid, start, count)); +} + static device_method_t bhndb_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bhndb_pci_probe), @@ -688,6 +763,8 @@ static device_method_t bhndb_pci_methods DEVMETHOD(device_detach, bhndb_pci_detach), /* BHND interface */ + DEVMETHOD(bhnd_bus_assign_intr, bhndb_pci_assign_intr), + DEVMETHOD(bhnd_bus_pwrctl_get_clksrc, bhndb_pci_pwrctl_get_clksrc), DEVMETHOD(bhnd_bus_pwrctl_gate_clock, bhndb_pci_pwrctl_gate_clock), DEVMETHOD(bhnd_bus_pwrctl_ungate_clock, bhndb_pci_pwrctl_ungate_clock), Modified: head/sys/dev/bhnd/bhndb/bhndb_pcivar.h ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pcivar.h Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/bhndb/bhndb_pcivar.h Mon Sep 5 22:11:46 2016 (r305444) @@ -48,11 +48,19 @@ struct bhndb_pci_softc; typedef int (*bhndb_pci_set_regwin_t)(struct bhndb_pci_softc *sc, const struct bhndb_regwin *rw, bhnd_addr_t addr); +/* bhndb_pci interrupt state */ +struct bhndb_pci_intr { + int msi_count; /**< MSI count, or 0 */ + int intr_rid; /**< interrupt resource ID.*/ +}; + struct bhndb_pci_softc { struct bhndb_softc bhndb; /**< parent softc */ device_t dev; /**< bridge device */ device_t parent; /**< parent PCI device */ bhnd_devclass_t pci_devclass; /**< PCI core's devclass */ + struct bhndb_pci_intr intr; /**< PCI interrupt config */ + bhndb_pci_set_regwin_t set_regwin; /**< regwin handler */ }; Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c ============================================================================== --- head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Mon Sep 5 22:11:46 2016 (r305444) @@ -3395,14 +3395,14 @@ bhnd_pmu_radio_enable(struct bhnd_pmu_so if (enable) { oobsel |= BHND_PMU_SET_BITS(BCMA_DMP_OOBSEL_EN, - BCMA_DMP_OOBSEL_1); + BCMA_DMP_OOBSEL_5); oobsel |= BHND_PMU_SET_BITS(BCMA_DMP_OOBSEL_EN, - BCMA_DMP_OOBSEL_2); + BCMA_DMP_OOBSEL_6); } else { oobsel &= ~BHND_PMU_SET_BITS(BCMA_DMP_OOBSEL_EN, - BCMA_DMP_OOBSEL_1); + BCMA_DMP_OOBSEL_5); oobsel &= ~BHND_PMU_SET_BITS(BCMA_DMP_OOBSEL_EN, - BCMA_DMP_OOBSEL_2); + BCMA_DMP_OOBSEL_6); } bhnd_write_config(d11core, BCMA_DMP_OOBSELOUTB74, oobsel, 4); Modified: head/sys/dev/bhnd/siba/siba.c ============================================================================== --- head/sys/dev/bhnd/siba/siba.c Mon Sep 5 21:55:27 2016 (r305443) +++ head/sys/dev/bhnd/siba/siba.c Mon Sep 5 22:11:46 2016 (r305444) @@ -373,6 +373,60 @@ siba_get_region_addr(device_t dev, devic return (0); } +/** + * Default siba(4) bus driver implementation of BHND_BUS_GET_INTR_COUNT(). + * + * This implementation consults @p child's configuration block mapping, + * returning SIBA_CORE_NUM_INTR if a valid CFG0 block is mapped. + */ +int +siba_get_intr_count(device_t dev, device_t child) +{ + struct siba_devinfo *dinfo; + + /* delegate non-bus-attached devices to our parent */ + if (device_get_parent(child) != dev) + return (BHND_BUS_GET_INTR_COUNT(device_get_parent(dev), child)); + + dinfo = device_get_ivars(child); + + /* We can get/set interrupt sbflags on any core with a valid cfg0 + * block; whether the core actually makes use of it is another matter + * entirely */ + if (dinfo->cfg[0] == NULL) + return (0); + + return (SIBA_CORE_NUM_INTR); +} + +/** + * Default siba(4) bus driver implementation of BHND_BUS_GET_CORE_IVEC(). + * + * This implementation consults @p child's CFG0 register block, + * returning the interrupt flag assigned to @p child. + */ +int +siba_get_core_ivec(device_t dev, device_t child, u_int intr, uint32_t *ivec) +{ + struct siba_devinfo *dinfo; + uint32_t tpsflag; + + /* delegate non-bus-attached devices to our parent */ + if (device_get_parent(child) != dev) + return (BHND_BUS_GET_CORE_IVEC(device_get_parent(dev), child, + intr, ivec)); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Sep 5 23:12:26 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 00379B96061; Mon, 5 Sep 2016 23:12:25 +0000 (UTC) (envelope-from np@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 C0B03C72; Mon, 5 Sep 2016 23:12:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85NCPNw029432; Mon, 5 Sep 2016 23:12:25 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85NCPG2029431; Mon, 5 Sep 2016 23:12:25 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609052312.u85NCPG2029431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 5 Sep 2016 23:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305445 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 05 Sep 2016 23:12:26 -0000 Author: np Date: Mon Sep 5 23:12:24 2016 New Revision: 305445 URL: https://svnweb.freebsd.org/changeset/base/305445 Log: Fix send/recv limit mixup. Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Mon Sep 5 22:11:46 2016 (r305444) +++ head/sys/dev/iscsi/iscsi.c Mon Sep 5 23:12:24 2016 (r305445) @@ -1366,7 +1366,7 @@ iscsi_ioctl_daemon_wait(struct iscsi_sof request->idr_limits.isl_max_recv_data_segment_length = idl.idl_max_recv_data_segment_length; request->idr_limits.isl_max_send_data_segment_length = - idl.idl_max_recv_data_segment_length; + idl.idl_max_send_data_segment_length; request->idr_limits.isl_max_burst_length = idl.idl_max_burst_length; request->idr_limits.isl_first_burst_length = From owner-svn-src-head@freebsd.org Tue Sep 6 00:51:26 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 B0760A9D6B7; Tue, 6 Sep 2016 00:51:26 +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 805AD8A1; Tue, 6 Sep 2016 00:51:26 +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 u860pPhF063966; Tue, 6 Sep 2016 00:51:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u860pPcc063965; Tue, 6 Sep 2016 00:51:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201609060051.u860pPcc063965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 6 Sep 2016 00:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305449 - head/lib/libc/tests/db X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 00:51:26 -0000 Author: ngie Date: Tue Sep 6 00:51:25 2016 New Revision: 305449 URL: https://svnweb.freebsd.org/changeset/base/305449 Log: Install h_db to unbreak some of the lib/libc/db testcases after r305358 MFC after: 59 days X-MFC with: r305358 Reported by: Jenkins, rodrigc Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/tests/db/Makefile Modified: head/lib/libc/tests/db/Makefile ============================================================================== --- head/lib/libc/tests/db/Makefile Tue Sep 6 00:33:54 2016 (r305448) +++ head/lib/libc/tests/db/Makefile Tue Sep 6 00:51:25 2016 (r305449) @@ -5,7 +5,7 @@ PACKAGE= tests BINDIR= ${TESTSDIR} PROGS= h_db -PROGS= h_lfsr +PROGS+= h_lfsr ${PACKAGE}FILES+= README From owner-svn-src-head@freebsd.org Tue Sep 6 01:07: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 5CFBCA9D99E; Tue, 6 Sep 2016 01:07:13 +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 06747F3C; Tue, 6 Sep 2016 01:07: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 u8617Cjn070703; Tue, 6 Sep 2016 01:07:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8617Caj070702; Tue, 6 Sep 2016 01:07:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201609060107.u8617Caj070702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 6 Sep 2016 01:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305451 - head/contrib/netbsd-tests/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 01:07:13 -0000 Author: ngie Date: Tue Sep 6 01:07:12 2016 New Revision: 305451 URL: https://svnweb.freebsd.org/changeset/base/305451 Log: Fix lib/libc/rpc test assumptions added in r305358 - Require root in the tcp/udp subtests (it's needed on FreeBSD when registering services). - Skip the tests if service registration fails. MFC after: 59 days X-MFC with: r305358 Reported by: Jenkins, rodrigc Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Tue Sep 6 00:53:20 2016 (r305450) +++ head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Tue Sep 6 01:07:12 2016 (r305451) @@ -24,6 +24,13 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/ return; \ } while(/*CONSTCOND*/0) +#ifdef __FreeBSD__ +#define SKIPXI(ev, msg, ...) do { \ + atf_tc_skip(msg, __VA_ARGS__); \ + return ev; \ +} while(/*CONSTCOND*/0) +#endif + #else #define ERRX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) #define SKIPX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) @@ -188,7 +195,13 @@ regtest(const char *hostname, const char svc_fdset_init(p ? SVC_FDSET_POLL : 0); #endif if (!svc_create(server, PROGNUM, VERSNUM, transp)) +#ifdef __NetBSD__ ERRX(EXIT_FAILURE, "Cannot create server %d", num); +#else + { + SKIPXI(EXIT_FAILURE, "Cannot create server %d", num); + } +#endif switch ((pid = fork())) { case 0: @@ -335,6 +348,9 @@ ATF_TC(tcp); ATF_TC_HEAD(tcp, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc tcp (select)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(tcp, tc) @@ -347,6 +363,9 @@ ATF_TC(udp); ATF_TC_HEAD(udp, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc udp (select)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(udp, tc) @@ -359,6 +378,9 @@ ATF_TC(tcp_poll); ATF_TC_HEAD(tcp_poll, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc tcp (poll)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(tcp_poll, tc) @@ -371,6 +393,9 @@ ATF_TC(udp_poll); ATF_TC_HEAD(udp_poll, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc udp (poll)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(udp_poll, tc) From owner-svn-src-head@freebsd.org Tue Sep 6 02:58: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 E856CBA500D; Tue, 6 Sep 2016 02:58:23 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 96D37756; Tue, 6 Sep 2016 02:58:23 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id h6Y4bz5o0OQkFh6Y5bHmAZ; Mon, 05 Sep 2016 20:55:45 -0600 X-Authority-Analysis: v=2.2 cv=VYS1Bxh9 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=GW1xBdLrtEIA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=uooYTw9ockgChiKqBy8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id ECF9D7FA; Mon, 5 Sep 2016 19:55:43 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u862thYG042696; Mon, 5 Sep 2016 19:55:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201609060255.u862thYG042696@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.cschubert.com/ To: Andriy Gapon cc: Alexander Motin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs In-Reply-To: Message from Andriy Gapon of "Tue, 06 Sep 2016 00:17:19 +0300." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Sep 2016 19:55:43 -0700 X-CMAE-Envelope: MS4wfAcVBBoK7uWsp3BKGQU2ImuMrntjr4hnQkpZoFGg21sW37ZVYmUdXlkLOBkCv8mq3gYcF4zs4EQO1qpzNuos0YQdCVu/SkRi2VBsVvS5wBaTHY9r+7MX ookYFNx7fjG/WP06a0psEQ98r50NkK1GvERne7acI4a6DOxfhABk9qjwKKaWBwA+t5OlkbmSN14MzX714g1aIp/bIxfcPRJ12AWajMk0bvypgabX+N4v4BtO Kqx/4asmYS9zg7+L1OKzsSk7rI/xueOkbx9LbGTXerXGNKR3BID/eT11nNL/hY60JfteeaJTAOeIux7A//F+0A== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 02:58:24 -0000 In message , Andriy Gapon wri tes: > On 05/09/2016 23:47, Andriy Gapon wrote: > > Alexander, > > > > I belive that this commit accidentally breaks the following scenario: > > zpool create tank /dev/xxx > > zpool destroy tank > > zpool create tank /dev/xxx > > > > It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it wou > ld > > try to match a device GUID, if it can be read, in addition to a name. > > And a rather trivial (and maybe not quite correct) fix: > > diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > index 077983ca847c8..818052ba577ec 100644 > --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > @@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max > _psize, > > if (vd->vdev_spa->spa_splitting_newspa || > (vd->vdev_prevstate == VDEV_STATE_UNKNOWN && > - vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) { > + vd->vdev_spa->spa_load_state == SPA_LOAD_NONE || > + vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) { > /* > * We are dealing with a vdev that hasn't been previously > * opened (since boot), and we are not loading an > > This patch fixes mine as well: bob# zpool create foobar /dev/da1p1 cannot create 'foobar': no such pool or dataset bob# The at the time to-be-created pool's partiton was previously inhabited by NTFS. -- Cheers, Cy Schubert 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 Tue Sep 6 03:20: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 04843BA586B; Tue, 6 Sep 2016 03:20:08 +0000 (UTC) (envelope-from sephe@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 D5EAC282; Tue, 6 Sep 2016 03:20:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u863K7go020040; Tue, 6 Sep 2016 03:20:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u863K7C1020038; Tue, 6 Sep 2016 03:20:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609060320.u863K7C1020038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 6 Sep 2016 03:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305453 - in head/sys: dev/hyperv/netvsc 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.23 Precedence: list List-Id: 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, 06 Sep 2016 03:20:08 -0000 Author: sephe Date: Tue Sep 6 03:20:06 2016 New Revision: 305453 URL: https://svnweb.freebsd.org/changeset/base/305453 Log: hyperv/hn: Stringent RNDIS packet message length/offset check. While I'm here, use definition in net/rndis.h MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7782 Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/net/rndis.h Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Sep 6 01:10:51 2016 (r305452) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Sep 6 03:20:06 2016 (r305453) @@ -159,39 +159,22 @@ hv_rf_receive_indicate_status(struct hn_ } static int -hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info) +hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_recvinfo *info) { - const struct rndis_pktinfo *pi; - uint32_t mask = 0, len; + const struct rndis_pktinfo *pi = info_data; + uint32_t mask = 0; - info->vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info->csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info->hash_info = HN_NDIS_HASH_INFO_INVALID; - - if (rpkt->per_pkt_info_offset == 0) - return (0); - if (__predict_false(rpkt->per_pkt_info_offset & - (RNDIS_PKTINFO_ALIGN - 1))) - return (EINVAL); - if (__predict_false(rpkt->per_pkt_info_offset < - RNDIS_PACKET_MSG_OFFSET_MIN)) - return (EINVAL); - - pi = (const struct rndis_pktinfo *) - ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset); - len = rpkt->per_pkt_info_length; - - while (len != 0) { + while (info_dlen != 0) { const void *data; uint32_t dlen; - if (__predict_false(len < sizeof(*pi))) + if (__predict_false(info_dlen < sizeof(*pi))) return (EINVAL); - if (__predict_false(len < pi->rm_size)) + if (__predict_false(info_dlen < pi->rm_size)) return (EINVAL); - len -= pi->rm_size; + info_dlen -= pi->rm_size; - if (__predict_false(pi->rm_size & (RNDIS_PKTINFO_ALIGN - 1))) + if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) return (EINVAL); if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) return (EINVAL); @@ -249,43 +232,183 @@ next: return (0); } +static __inline bool +hn_rndis_check_overlap(int off, int len, int check_off, int check_len) +{ + + if (off < check_off) { + if (__predict_true(off + len <= check_off)) + return (false); + } else if (off > check_off) { + if (__predict_true(check_off + check_len <= off)) + return (false); + } + return (true); +} + /* * RNDIS filter receive data */ static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen) { - const rndis_msg *message = data; - const rndis_packet *rndis_pkt; - uint32_t data_offset; + const struct rndis_packet_msg *pkt; struct hn_recvinfo info; - - rndis_pkt = &message->msg.packet; + int data_off, pktinfo_off, data_len, pktinfo_len; /* - * Fixme: Handle multiple rndis pkt msgs that may be enclosed in this - * netvsc packet (ie tot_data_buf_len != message_length) + * Check length. */ + if (__predict_false(dlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); + return; + } + pkt = data; - /* Remove rndis header, then pass data packet up the stack */ - data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; + if (__predict_false(dlen < pkt->rm_len)) { + if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " + "dlen %d, msglen %u\n", dlen, pkt->rm_len); + return; + } + if (__predict_false(pkt->rm_len < + pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " + "msglen %u, data %u, oob %u, pktinfo %u\n", + pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, + pkt->rm_pktinfolen); + return; + } + if (__predict_false(pkt->rm_datalen == 0)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); + return; + } - dlen -= data_offset; - if (dlen < rndis_pkt->data_length) { - if_printf(rxr->hn_ifp, - "total length %u is less than data length %u\n", - dlen, rndis_pkt->data_length); + /* + * Check offests. + */ +#define IS_OFFSET_INVALID(ofs) \ + ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ + ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) + + /* XXX Hyper-V does not meet data offset alignment requirement */ + if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data offset %u\n", pkt->rm_dataoffset); return; } + if (__predict_false(pkt->rm_oobdataoffset > 0 && + IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob offset %u\n", pkt->rm_oobdataoffset); + return; + } + if (__predict_true(pkt->rm_pktinfooffset > 0) && + __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo offset %u\n", pkt->rm_pktinfooffset); + return; + } + +#undef IS_OFFSET_INVALID + + data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); + data_len = pkt->rm_datalen; + pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); + pktinfo_len = pkt->rm_pktinfolen; + + /* + * Check OOB coverage. + */ + if (__predict_false(pkt->rm_oobdatalen != 0)) { + int oob_off, oob_len; + + if_printf(rxr->hn_ifp, "got oobdata\n"); + oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); + oob_len = pkt->rm_oobdatalen; + + if (__predict_false(oob_off + oob_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overflow, msglen %u, oob abs %d len %d\n", + pkt->rm_len, oob_off, oob_len); + return; + } + + /* + * Check against data. + */ + if (hn_rndis_check_overlap(oob_off, oob_len, + data_off, data_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps data, oob abs %d len %d, " + "data abs %d len %d\n", + oob_off, oob_len, data_off, data_len); + return; + } + + /* + * Check against pktinfo. + */ + if (pktinfo_len != 0 && + hn_rndis_check_overlap(oob_off, oob_len, + pktinfo_off, pktinfo_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps pktinfo, oob abs %d len %d, " + "pktinfo abs %d len %d\n", + oob_off, oob_len, pktinfo_off, pktinfo_len); + return; + } + } - dlen = rndis_pkt->data_length; - data = (const uint8_t *)data + data_offset; + /* + * Check per-packet-info coverage and find useful per-packet-info. + */ + info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; + info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; + info.hash_info = HN_NDIS_HASH_INFO_INVALID; + if (__predict_true(pktinfo_len != 0)) { + bool overlap; + int error; + + if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overflow, msglen %u, " + "pktinfo abs %d len %d\n", + pkt->rm_len, pktinfo_off, pktinfo_len); + return; + } + + /* + * Check packet info coverage. + */ + overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, + data_off, data_len); + if (__predict_false(overlap)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overlap data, pktinfo abs %d len %d, " + "data abs %d len %d\n", + pktinfo_off, pktinfo_len, data_off, data_len); + return; + } + + /* + * Find useful per-packet-info. + */ + error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, + pktinfo_len, &info); + if (__predict_false(error)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " + "pktinfo\n"); + return; + } + } - if (hv_rf_find_recvinfo(rndis_pkt, &info)) { - if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); + if (__predict_false(data_off + data_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data overflow, msglen %u, data abs %d len %d\n", + pkt->rm_len, data_off, data_len); return; } - netvsc_recv(rxr, data, dlen, &info); + netvsc_recv(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); } /* @@ -565,7 +688,7 @@ hn_rndis_query(struct hn_softc *sc, uint * Check output data length and offset. */ /* ofs is the offset from the beginning of comp. */ - ofs = RNDIS_QUERY_COMP_INFOBUFABS(comp->rm_infobufoffset); + ofs = RNDIS_QUERY_COMP_INFOBUFOFFSET_ABS(comp->rm_infobufoffset); if (ofs < sizeof(*comp) || ofs + comp->rm_infobuflen > comp_len) { if_printf(sc->hn_ifp, "RNDIS query invalid comp ib off/len, " "%u/%u\n", comp->rm_infobufoffset, comp->rm_infobuflen); Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Tue Sep 6 01:10:51 2016 (r305452) +++ head/sys/net/rndis.h Tue Sep 6 03:20:06 2016 (r305453) @@ -127,6 +127,14 @@ struct rndis_packet_msg { (sizeof(struct rndis_packet_msg) - \ __offsetof(struct rndis_packet_msg, rm_dataoffset)) +/* Offset from the beginning of rndis_packet_msg. */ +#define RNDIS_PACKET_MSG_OFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_packet_msg, rm_dataoffset)) + +#define RNDIS_PACKET_MSG_OFFSET_ALIGN 4 +#define RNDIS_PACKET_MSG_OFFSET_ALIGNMASK \ + (RNDIS_PACKET_MSG_OFFSET_ALIGN - 1) + /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; @@ -137,7 +145,8 @@ struct rndis_pktinfo { #define RNDIS_PKTINFO_OFFSET \ __offsetof(struct rndis_pktinfo, rm_data[0]) -#define RNDIS_PKTINFO_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGNMASK (RNDIS_PKTINFO_SIZE_ALIGN - 1) #define NDIS_PKTINFO_TYPE_CSUM 0 #define NDIS_PKTINFO_TYPE_IPSEC 1 @@ -236,7 +245,8 @@ struct rndis_query_comp { uint32_t rm_infobufoffset; }; -#define RNDIS_QUERY_COMP_INFOBUFABS(ofs) \ +/* infobuf offset from the beginning of rndis_query_comp. */ +#define RNDIS_QUERY_COMP_INFOBUFOFFSET_ABS(ofs) \ ((ofs) + __offsetof(struct rndis_query_req, rm_rid)) /* Send a set object request. */ From owner-svn-src-head@freebsd.org Tue Sep 6 03:31: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 CB157BA5BDF; Tue, 6 Sep 2016 03:31:32 +0000 (UTC) (envelope-from sephe@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 7B18FAF1; Tue, 6 Sep 2016 03:31:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u863VVwG024524; Tue, 6 Sep 2016 03:31:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u863VVc7024522; Tue, 6 Sep 2016 03:31:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609060331.u863VVc7024522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 6 Sep 2016 03:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305454 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 03:31:32 -0000 Author: sephe Date: Tue Sep 6 03:31:31 2016 New Revision: 305454 URL: https://svnweb.freebsd.org/changeset/base/305454 Log: hyperv/hn: Fix VLAN tag setup for outgoing VLAN packets. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7785 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 6 03:20:06 2016 (r305453) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 6 03:31:31 2016 (r305454) @@ -903,8 +903,10 @@ hn_encap(struct hn_tx_ring *txr, struct rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi + rppi->per_packet_info_offset); - rppi_vlan_info->u1.s1.vlan_id = - m_head->m_pkthdr.ether_vtag & 0xfff; + rppi_vlan_info->u1.value = NDIS_VLAN_INFO_MAKE( + EVL_VLANOFTAG(m_head->m_pkthdr.ether_vtag), + EVL_PRIOFTAG(m_head->m_pkthdr.ether_vtag), + EVL_CFIOFTAG(m_head->m_pkthdr.ether_vtag)); } if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Tue Sep 6 03:20:06 2016 (r305453) +++ head/sys/dev/hyperv/netvsc/ndis.h Tue Sep 6 03:31:31 2016 (r305454) @@ -213,7 +213,7 @@ struct ndis_rssprm_toeplitz { #define NDIS_VLAN_INFO_CFI_MASK 0x0008 #define NDIS_VLAN_INFO_ID_MASK 0xfff0 #define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \ - (((pri) & NVIS_VLAN_INFO_PRI_MASK) | \ + (((pri) & NDIS_VLAN_INFO_PRI_MASK) | \ (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4)) #define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >> 4) #define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) >> 3) From owner-svn-src-head@freebsd.org Tue Sep 6 04:37: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 127FDA9D83F; Tue, 6 Sep 2016 04:37:55 +0000 (UTC) (envelope-from sephe@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 DAAF7844; Tue, 6 Sep 2016 04:37:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u864bsF2049803; Tue, 6 Sep 2016 04:37:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u864br60049801; Tue, 6 Sep 2016 04:37:53 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609060437.u864br60049801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 6 Sep 2016 04:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305455 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 04:37:55 -0000 Author: sephe Date: Tue Sep 6 04:37:53 2016 New Revision: 305455 URL: https://svnweb.freebsd.org/changeset/base/305455 Log: hyperv/hn: Avoid bit fields for LSOv2 setup. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7786 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 6 03:31:31 2016 (r305454) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 6 04:37:53 2016 (r305455) @@ -910,6 +910,7 @@ hn_encap(struct hn_tx_ring *txr, struct } if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { +#if defined(INET6) || defined(INET) rndis_tcp_tso_info *tso_info; struct ether_vlan_header *eh; int ether_len; @@ -929,8 +930,6 @@ hn_encap(struct hn_tx_ring *txr, struct tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi + rppi->per_packet_info_offset); - tso_info->lso_v2_xmit.type = - RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE; #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { @@ -940,13 +939,12 @@ hn_encap(struct hn_tx_ring *txr, struct struct tcphdr *th = (struct tcphdr *)((caddr_t)ip + iph_len); - tso_info->lso_v2_xmit.ip_version = - RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4; ip->ip_len = 0; ip->ip_sum = 0; - th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); + tso_info->value = NDIS_LSO2_INFO_MAKEIPV4(0, + m_head->m_pkthdr.tso_segsz); } #endif #if defined(INET6) && defined(INET) @@ -958,14 +956,13 @@ hn_encap(struct hn_tx_ring *txr, struct (m_head->m_data + ether_len); struct tcphdr *th = (struct tcphdr *)(ip6 + 1); - tso_info->lso_v2_xmit.ip_version = - RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV6; ip6->ip6_plen = 0; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); + tso_info->value = NDIS_LSO2_INFO_MAKEIPV6(0, + m_head->m_pkthdr.tso_segsz); } #endif - tso_info->lso_v2_xmit.tcp_header_offset = 0; - tso_info->lso_v2_xmit.mss = m_head->m_pkthdr.tso_segsz; +#endif /* INET6 || INET */ } else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) { rndis_tcp_ip_csum_info *csum_info; Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Tue Sep 6 03:31:31 2016 (r305454) +++ head/sys/dev/hyperv/netvsc/ndis.h Tue Sep 6 04:37:53 2016 (r305455) @@ -231,4 +231,21 @@ struct ndis_rssprm_toeplitz { #define NDIS_RXCSUM_INFO_TCPCS_INVAL 0x0080 #define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100 +/* LSOv2 */ +#define NDIS_LSO2_INFO_MSS_MASK 0x000fffff +#define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000 +#define NDIS_LSO2_INFO_ISLSO2 0x40000000 +#define NDIS_LSO2_INFO_ISIPV6 0x80000000 + +#define NDIS_LSO2_INFO_MAKE(thoff, mss) \ + ((((uint32_t)(mss)) & NDIS_LSO2_INFO_MSS_MASK) | \ + ((((uint32_t)(thoff)) & 0x3ff) << 20) | \ + NDIS_LSO2_INFO_ISLSO2) + +#define NDIS_LSO2_INFO_MAKEIPV4(thoff, mss) \ + NDIS_LSO2_INFO_MAKE((thoff), (mss)) + +#define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \ + (NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6) + #endif /* !_NET_NDIS_H_ */ From owner-svn-src-head@freebsd.org Tue Sep 6 06:09: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 6D1B0B96ECB; Tue, 6 Sep 2016 06:09:13 +0000 (UTC) (envelope-from avg@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 3D28598D; Tue, 6 Sep 2016 06:09:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8669COB083114; Tue, 6 Sep 2016 06:09:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8669CYl083113; Tue, 6 Sep 2016 06:09:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609060609.u8669CYl083113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 6 Sep 2016 06:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305456 - head/sys/cddl/contrib/opensolaris/uts/common/fs/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.23 Precedence: list List-Id: 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, 06 Sep 2016 06:09:13 -0000 Author: avg Date: Tue Sep 6 06:09:12 2016 New Revision: 305456 URL: https://svnweb.freebsd.org/changeset/base/305456 Log: fix zfs pool creation accidentally broken by r305331 The upstream change introduced a new load state, SPA_LOAD_CREATE, and vdev_geom code needs to be aware of it. Tested by: cy MFC after: 1 week X-MFC with: r305331 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Sep 6 04:37:53 2016 (r305455) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Sep 6 06:09:12 2016 (r305456) @@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if (vd->vdev_spa->spa_splitting_newspa || (vd->vdev_prevstate == VDEV_STATE_UNKNOWN && - vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) { + vd->vdev_spa->spa_load_state == SPA_LOAD_NONE || + vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) { /* * We are dealing with a vdev that hasn't been previously * opened (since boot), and we are not loading an From owner-svn-src-head@freebsd.org Tue Sep 6 06:41: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 E750FBA960F; Tue, 6 Sep 2016 06:41:00 +0000 (UTC) (envelope-from avos@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 A06DE86F; Tue, 6 Sep 2016 06:41:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u866exJK095619; Tue, 6 Sep 2016 06:40:59 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u866exUK095618; Tue, 6 Sep 2016 06:40:59 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609060640.u866exUK095618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 6 Sep 2016 06:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305465 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 06:41:01 -0000 Author: avos Date: Tue Sep 6 06:40:59 2016 New Revision: 305465 URL: https://svnweb.freebsd.org/changeset/base/305465 Log: rum: fix frame length checks in Rx path. Split usbd_xfer_status() check: - Check xfer length: must be longer, than Rx descriptor size. - Check frame size: must be shorter than xfer length. - Discard too short frames. Tested with WUSB54GC, STA/MONITOR modes. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Sep 6 06:26:24 2016 (r305464) +++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 6 06:40:59 2016 (r305465) @@ -1151,7 +1151,7 @@ rum_bulk_read_callback(struct usb_xfer * DPRINTFN(15, "rx done, actlen=%d\n", len); - if (len < (int)(RT2573_RX_DESC_SIZE + IEEE80211_MIN_LEN)) { + if (len < RT2573_RX_DESC_SIZE) { DPRINTF("%s: xfer too short %d\n", device_get_nameunit(sc->sc_dev), len); counter_u64_add(ic->ic_ierrors, 1); @@ -1165,6 +1165,20 @@ rum_bulk_read_callback(struct usb_xfer * rssi = rum_get_rssi(sc, sc->sc_rx_desc.rssi); flags = le32toh(sc->sc_rx_desc.flags); sc->last_rx_flags = flags; + if (len < ((flags >> 16) & 0xfff)) { + DPRINTFN(5, "%s: frame is truncated from %d to %d " + "bytes\n", device_get_nameunit(sc->sc_dev), + (flags >> 16) & 0xfff, len); + counter_u64_add(ic->ic_ierrors, 1); + goto tr_setup; + } + len = (flags >> 16) & 0xfff; + if (len < sizeof(struct ieee80211_frame_ack)) { + DPRINTFN(5, "%s: frame too short %d\n", + device_get_nameunit(sc->sc_dev), len); + counter_u64_add(ic->ic_ierrors, 1); + goto tr_setup; + } if (flags & RT2573_RX_CRC_ERROR) { /* * This should not happen since we did not @@ -1210,7 +1224,7 @@ rum_bulk_read_callback(struct usb_xfer * } /* finalize mbuf */ - m->m_pkthdr.len = m->m_len = (flags >> 16) & 0xfff; + m->m_pkthdr.len = m->m_len = len; if (ieee80211_radiotap_active(ic)) { struct rum_rx_radiotap_header *tap = &sc->sc_rxtap; From owner-svn-src-head@freebsd.org Tue Sep 6 08:45: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 DD71AA9DFAB; Tue, 6 Sep 2016 08:45:31 +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 A6F333B7; Tue, 6 Sep 2016 08:45:31 +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 u868jVPj043356; Tue, 6 Sep 2016 08:45:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u868jT5g043341; Tue, 6 Sep 2016 08:45:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201609060845.u868jT5g043341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 6 Sep 2016 08:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305467 - in head: . etc/mtree tests/sys/kqueue tests/sys/kqueue/libkqueue X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 08:45:32 -0000 Author: ngie Date: Tue Sep 6 08:45:29 2016 New Revision: 305467 URL: https://svnweb.freebsd.org/changeset/base/305467 Log: Move tests/sys/kqueue/... to tests/sys/kqueue/libkqueue/... This is being done to clearly distinguish the libkqueue tests from the (soon to be imported) NetBSD tests. MFC after: 58 days Sponsored by: EMC / Isilon Storage Division Added: head/tests/sys/kqueue/libkqueue/ head/tests/sys/kqueue/libkqueue/Makefile - copied, changed from r305466, head/tests/sys/kqueue/Makefile head/tests/sys/kqueue/libkqueue/Makefile.depend - copied unchanged from r305466, head/tests/sys/kqueue/Makefile.depend head/tests/sys/kqueue/libkqueue/common.h - copied unchanged from r305466, head/tests/sys/kqueue/common.h head/tests/sys/kqueue/libkqueue/config.h - copied unchanged from r305466, head/tests/sys/kqueue/config.h head/tests/sys/kqueue/libkqueue/kqueue_test.sh - copied unchanged from r305466, head/tests/sys/kqueue/kqueue_test.sh head/tests/sys/kqueue/libkqueue/main.c - copied unchanged from r305466, head/tests/sys/kqueue/main.c head/tests/sys/kqueue/libkqueue/proc.c - copied unchanged from r305466, head/tests/sys/kqueue/proc.c head/tests/sys/kqueue/libkqueue/read.c - copied unchanged from r305466, head/tests/sys/kqueue/read.c head/tests/sys/kqueue/libkqueue/signal.c - copied unchanged from r305466, head/tests/sys/kqueue/signal.c head/tests/sys/kqueue/libkqueue/timer.c - copied unchanged from r305466, head/tests/sys/kqueue/timer.c head/tests/sys/kqueue/libkqueue/user.c - copied unchanged from r305466, head/tests/sys/kqueue/user.c head/tests/sys/kqueue/libkqueue/vnode.c - copied unchanged from r305466, head/tests/sys/kqueue/vnode.c Replaced: head/tests/sys/kqueue/Makefile (contents, props changed) Deleted: head/tests/sys/kqueue/Makefile.depend head/tests/sys/kqueue/common.h head/tests/sys/kqueue/config.h head/tests/sys/kqueue/kqueue_test.sh head/tests/sys/kqueue/main.c head/tests/sys/kqueue/proc.c head/tests/sys/kqueue/read.c head/tests/sys/kqueue/signal.c head/tests/sys/kqueue/timer.c head/tests/sys/kqueue/user.c head/tests/sys/kqueue/vnode.c Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.tests.dist Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Sep 6 08:14:56 2016 (r305466) +++ head/ObsoleteFiles.inc Tue Sep 6 08:45:29 2016 (r305467) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue +OLD_FILES+=usr/tests/sys/kqueue/kqtest +OLD_FILES+=usr/tests/sys/kqueue/kqueue_test # 20160901: Remove digi(4) OLD_FILES+=usr/share/man/man4/digi.4.gz # 20160819: Remove ie(4) Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Tue Sep 6 08:14:56 2016 (r305466) +++ head/etc/mtree/BSD.tests.dist Tue Sep 6 08:45:29 2016 (r305467) @@ -419,6 +419,8 @@ .. .. kqueue + libkqueue + .. .. mac bsdextended Added: head/tests/sys/kqueue/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/Makefile Tue Sep 6 08:45:29 2016 (r305467) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/kqueue +BINDIR= ${TESTSDIR} + +TESTS_SUBDIRS+= libkqueue + +.include Copied and modified: head/tests/sys/kqueue/libkqueue/Makefile (from r305466, head/tests/sys/kqueue/Makefile) ============================================================================== --- head/tests/sys/kqueue/Makefile Tue Sep 6 08:14:56 2016 (r305466, copy source) +++ head/tests/sys/kqueue/libkqueue/Makefile Tue Sep 6 08:45:29 2016 (r305467) @@ -1,16 +1,11 @@ # $FreeBSD$ -# -# svn://mark.heily.com/libkqueue/trunk/test -# Last update: r114 -# -# libkqueue and test suite by Mark Heily -# - -TAP_TESTS_SH= kqueue_test -TESTSDIR= ${TESTSBASE}/sys/kqueue +TESTSDIR= ${TESTSBASE}/sys/kqueue/libkqueue BINDIR= ${TESTSDIR} +# libkqueue and test suite by Mark Heily +TAP_TESTS_SH= kqueue_test + PROGS= kqtest SRCS.kqtest= \ Copied: head/tests/sys/kqueue/libkqueue/Makefile.depend (from r305466, head/tests/sys/kqueue/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/Makefile.depend Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/Makefile.depend) @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied: head/tests/sys/kqueue/libkqueue/common.h (from r305466, head/tests/sys/kqueue/common.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/common.h Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/common.h) @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009 Mark Heily + * + * 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$ + */ + +#ifndef _COMMON_H +#define _COMMON_H + + +#if HAVE_ERR_H +# include +#else +# define err(rc,msg,...) do { perror(msg); exit(rc); } while (0) +# define errx(rc,msg,...) do { puts(msg); exit(rc); } while (0) +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "config.h" + +extern char *cur_test_id; +int vnode_fd; + +extern const char * kevent_to_str(struct kevent *); +struct kevent * kevent_get(int); +struct kevent * kevent_get_timeout(int, int); + + +void kevent_cmp(struct kevent *, struct kevent *); + +void +kevent_add(int kqfd, struct kevent *kev, + uintptr_t ident, + short filter, + u_short flags, + u_int fflags, + intptr_t data, + void *udata); + +/* DEPRECATED: */ +#define KEV_CMP(kev,_ident,_filter,_flags) do { \ + if (kev.ident != (_ident) || \ + kev.filter != (_filter) || \ + kev.flags != (_flags)) \ + err(1, "kevent mismatch: got [%d,%d,%d] but expecting [%d,%d,%d]", \ + (int)_ident, (int)_filter, (int)_flags,\ + (int)kev.ident, kev.filter, kev.flags);\ +} while (0); + +/* Checks if any events are pending, which is an error. */ +extern void test_no_kevents(void); + +extern void test_begin(const char *); +extern void success(void); + +#endif /* _COMMON_H */ Copied: head/tests/sys/kqueue/libkqueue/config.h (from r305466, head/tests/sys/kqueue/config.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/config.h Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/config.h) @@ -0,0 +1,13 @@ +/* $FreeBSD$ */ + +#define HAVE_ERR_H 1 +#define HAVE_SYS_EVENT_H 1 +#define HAVE_EV_DISPATCH 1 +#define HAVE_EV_RECEIPT 1 +#undef HAVE_NOTE_TRUNCATE +#define HAVE_EVFILT_TIMER 1 +#define HAVE_EVFILT_USER 1 +#define PROGRAM "libkqueue-test" +#define VERSION "0.1" +#define TARGET "freebsd" +#define CFLAGS "-g -O0 -Wall -Werror" Copied: head/tests/sys/kqueue/libkqueue/kqueue_test.sh (from r305466, head/tests/sys/kqueue/kqueue_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/kqueue_test.sh Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/kqueue_test.sh) @@ -0,0 +1,17 @@ +#!/bin/sh +# $FreeBSD$ + +i=1 +"$(dirname $0)/kqtest" | while read line; do + echo $line | grep -q passed + if [ $? -eq 0 ]; then + echo "ok - $i $line" + : $(( i += 1 )) + fi + + echo $line | grep -q 'tests completed' + if [ $? -eq 0 ]; then + echo -n "1.." + echo $line | cut -d' ' -f3 + fi +done Copied: head/tests/sys/kqueue/libkqueue/main.c (from r305466, head/tests/sys/kqueue/main.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/main.c Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/main.c) @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2009 Mark Heily + * + * 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$ + */ + +#include + +#include "config.h" +#include "common.h" + +int testnum = 1; +char *cur_test_id = NULL; +int kqfd; + +extern void test_evfilt_read(); +extern void test_evfilt_signal(); +extern void test_evfilt_vnode(); +extern void test_evfilt_timer(); +extern void test_evfilt_proc(); +#if HAVE_EVFILT_USER +extern void test_evfilt_user(); +#endif + +/* Checks if any events are pending, which is an error. */ +void +test_no_kevents(void) +{ + int nfds; + struct timespec timeo; + struct kevent kev; + + puts("confirming that there are no events pending"); + memset(&timeo, 0, sizeof(timeo)); + nfds = kevent(kqfd, NULL, 0, &kev, 1, &timeo); + if (nfds != 0) { + puts("\nUnexpected event:"); + puts(kevent_to_str(&kev)); + errx(1, "%d event(s) pending, but none expected:", nfds); + } +} + +/* Retrieve a single kevent */ +struct kevent * +kevent_get(int kqfd) +{ + int nfds; + struct kevent *kev; + + if ((kev = calloc(1, sizeof(*kev))) == NULL) + err(1, "out of memory"); + + nfds = kevent(kqfd, NULL, 0, kev, 1, NULL); + if (nfds < 1) + err(1, "kevent(2)"); + + return (kev); +} + +/* Retrieve a single kevent, specifying a maximum time to wait for it. */ +struct kevent * +kevent_get_timeout(int kqfd, int seconds) +{ + int nfds; + struct kevent *kev; + struct timespec timeout = {seconds, 0}; + + if ((kev = calloc(1, sizeof(*kev))) == NULL) + err(1, "out of memory"); + + nfds = kevent(kqfd, NULL, 0, kev, 1, &timeout); + if (nfds < 0) { + err(1, "kevent(2)"); + } else if (nfds == 0) { + free(kev); + kev = NULL; + } + + return (kev); +} + +char * +kevent_fflags_dump(struct kevent *kev) +{ + char *buf; + +#define KEVFFL_DUMP(attrib) \ + if (kev->fflags & attrib) \ + strncat(buf, #attrib" ", 64); + + if ((buf = calloc(1, 1024)) == NULL) + abort(); + + /* Not every filter has meaningful fflags */ + if (kev->filter == EVFILT_PROC) { + snprintf(buf, 1024, "fflags = %x (", kev->fflags); + KEVFFL_DUMP(NOTE_EXIT); + KEVFFL_DUMP(NOTE_FORK); + KEVFFL_DUMP(NOTE_EXEC); + KEVFFL_DUMP(NOTE_CHILD); + KEVFFL_DUMP(NOTE_TRACKERR); + KEVFFL_DUMP(NOTE_TRACK); + buf[strlen(buf) - 1] = ')'; + } else if (kev->filter == EVFILT_PROCDESC) { + snprintf(buf, 1024, "fflags = %x (", kev->fflags); + KEVFFL_DUMP(NOTE_EXIT); + KEVFFL_DUMP(NOTE_FORK); + KEVFFL_DUMP(NOTE_EXEC); + buf[strlen(buf) - 1] = ')'; + } else if (kev->filter == EVFILT_VNODE) { + snprintf(buf, 1024, "fflags = %x (", kev->fflags); + KEVFFL_DUMP(NOTE_DELETE); + KEVFFL_DUMP(NOTE_WRITE); + KEVFFL_DUMP(NOTE_EXTEND); +#if HAVE_NOTE_TRUNCATE + KEVFFL_DUMP(NOTE_TRUNCATE); +#endif + KEVFFL_DUMP(NOTE_ATTRIB); + KEVFFL_DUMP(NOTE_LINK); + KEVFFL_DUMP(NOTE_RENAME); +#if HAVE_NOTE_REVOKE + KEVFFL_DUMP(NOTE_REVOKE); +#endif + buf[strlen(buf) - 1] = ')'; + } else { + snprintf(buf, 1024, "fflags = %x", kev->fflags); + } + + return (buf); +} + +char * +kevent_flags_dump(struct kevent *kev) +{ + char *buf; + +#define KEVFL_DUMP(attrib) \ + if (kev->flags & attrib) \ + strncat(buf, #attrib" ", 64); + + if ((buf = calloc(1, 1024)) == NULL) + abort(); + + snprintf(buf, 1024, "flags = %d (", kev->flags); + KEVFL_DUMP(EV_ADD); + KEVFL_DUMP(EV_ENABLE); + KEVFL_DUMP(EV_DISABLE); + KEVFL_DUMP(EV_DELETE); + KEVFL_DUMP(EV_ONESHOT); + KEVFL_DUMP(EV_CLEAR); + KEVFL_DUMP(EV_EOF); + KEVFL_DUMP(EV_ERROR); +#if HAVE_EV_DISPATCH + KEVFL_DUMP(EV_DISPATCH); +#endif +#if HAVE_EV_RECEIPT + KEVFL_DUMP(EV_RECEIPT); +#endif + buf[strlen(buf) - 1] = ')'; + + return (buf); +} + +/* Copied from ../kevent.c kevent_dump() and improved */ +const char * +kevent_to_str(struct kevent *kev) +{ + char buf[512]; + + snprintf(&buf[0], sizeof(buf), + "[ident=%d, filter=%d, %s, %s, data=%d, udata=%p]", + (u_int) kev->ident, + kev->filter, + kevent_flags_dump(kev), + kevent_fflags_dump(kev), + (int) kev->data, + kev->udata); + + return (strdup(buf)); +} + +void +kevent_add(int kqfd, struct kevent *kev, + uintptr_t ident, + short filter, + u_short flags, + u_int fflags, + intptr_t data, + void *udata) +{ + EV_SET(kev, ident, filter, flags, fflags, data, NULL); + if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) { + printf("Unable to add the following kevent:\n%s\n", + kevent_to_str(kev)); + err(1, "kevent(): %s", strerror(errno)); + } +} + +void +kevent_cmp(struct kevent *k1, struct kevent *k2) +{ +/* XXX- + Workaround for inconsistent implementation of kevent(2) + */ +#ifdef __FreeBSD__ + if (k1->flags & EV_ADD) + k2->flags |= EV_ADD; +#endif + if (memcmp(k1, k2, sizeof(*k1)) != 0) { + printf("kevent_cmp: mismatch:\n %s !=\n %s\n", + kevent_to_str(k1), kevent_to_str(k2)); + abort(); + } +} + +void +test_begin(const char *func) +{ + if (cur_test_id) + free(cur_test_id); + cur_test_id = strdup(func); + if (!cur_test_id) + err(1, "strdup failed"); + + printf("\n\nTest %d: %s\n", testnum++, func); +} + +void +success(void) +{ + printf("%-70s %s\n", cur_test_id, "passed"); + free(cur_test_id); + cur_test_id = NULL; +} + +void +test_kqueue(void) +{ + test_begin("kqueue()"); + if ((kqfd = kqueue()) < 0) + err(1, "kqueue()"); + test_no_kevents(); + success(); +} + +void +test_kqueue_close(void) +{ + test_begin("close(kq)"); + if (close(kqfd) < 0) + err(1, "close()"); + success(); +} + +int +main(int argc, char **argv) +{ + int test_proc = 1; + int test_socket = 1; + int test_signal = 1; + int test_vnode = 1; + int test_timer = 1; +#ifdef __FreeBSD__ + int test_user = 1; +#else + /* XXX-FIXME temporary */ + int test_user = 0; +#endif + + while (argc) { + if (strcmp(argv[0], "--no-proc") == 0) + test_proc = 0; + if (strcmp(argv[0], "--no-socket") == 0) + test_socket = 0; + if (strcmp(argv[0], "--no-timer") == 0) + test_timer = 0; + if (strcmp(argv[0], "--no-signal") == 0) + test_signal = 0; + if (strcmp(argv[0], "--no-vnode") == 0) + test_vnode = 0; + if (strcmp(argv[0], "--no-user") == 0) + test_user = 0; + argv++; + argc--; + } + + /* + * Some tests fork. If output is fully buffered, + * the children inherit some buffered data and flush + * it when they exit, causing some data to be printed twice. + * Use line buffering to avoid this problem. + */ + setlinebuf(stdout); + setlinebuf(stderr); + + test_kqueue(); + test_kqueue_close(); + + if (test_socket) + test_evfilt_read(); + if (test_signal) + test_evfilt_signal(); + if (test_vnode) + test_evfilt_vnode(); +#if HAVE_EVFILT_USER + if (test_user) + test_evfilt_user(); +#endif + if (test_timer) + test_evfilt_timer(); + if (test_proc) + test_evfilt_proc(); + + printf("\n---\n" + "+OK All %d tests completed.\n", testnum - 1); + return (0); +} Copied: head/tests/sys/kqueue/libkqueue/proc.c (from r305466, head/tests/sys/kqueue/proc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/proc.c Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/proc.c) @@ -0,0 +1,423 @@ +/* + * Copyright (c) 2009 Mark Heily + * + * 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$ + */ + +#include + +#include + +#include "config.h" +#include "common.h" + +static int sigusr1_caught = 0; + +int kqfd; + +static void +sig_handler(int signum) +{ + sigusr1_caught = 1; +} + +static void +add_and_delete(void) +{ + struct kevent kev; + pid_t pid; + + /* Create a child that waits to be killed and then exits */ + pid = fork(); + if (pid == 0) { + struct stat s; + if (fstat(kqfd, &s) != -1) + errx(1, "kqueue inherited across fork! (%s() at %s:%d)", + __func__, __FILE__, __LINE__); + + pause(); + exit(2); + } + printf(" -- child created (pid %d)\n", (int) pid); + + test_begin("kevent(EVFILT_PROC, EV_ADD)"); + + test_no_kevents(); + kevent_add(kqfd, &kev, pid, EVFILT_PROC, EV_ADD, 0, 0, NULL); + test_no_kevents(); + + success(); + + test_begin("kevent(EVFILT_PROC, EV_DELETE)"); + + sleep(1); + test_no_kevents(); + kevent_add(kqfd, &kev, pid, EVFILT_PROC, EV_DELETE, 0, 0, NULL); + if (kill(pid, SIGKILL) < 0) + err(1, "kill"); + sleep(1); + test_no_kevents(); + + success(); + +} + +static void +proc_track(int sleep_time) +{ + char test_id[64]; + struct kevent kev; + pid_t pid; + int pipe_fd[2]; + ssize_t result; + + snprintf(test_id, sizeof(test_id), + "kevent(EVFILT_PROC, NOTE_TRACK); sleep %d", sleep_time); + test_begin(test_id); + test_no_kevents(); + + if (pipe(pipe_fd)) { + err(1, "pipe (parent) failed! (%s() at %s:%d)", + __func__, __FILE__, __LINE__); + } + + /* Create a child to track. */ + pid = fork(); + if (pid == 0) { /* Child */ + pid_t grandchild = -1; + + /* + * Give the parent a chance to start tracking us. + */ + result = read(pipe_fd[1], test_id, 1); + if (result != 1) { + err(1, "read from pipe in child failed! (ret %zd) (%s() at %s:%d)", + result, __func__, __FILE__, __LINE__); + } + + /* + * Spawn a grandchild that will immediately exit. If the kernel has bug + * 180385, the parent will see a kevent with both NOTE_CHILD and + * NOTE_EXIT. If that bug is fixed, it will see two separate kevents + * for those notes. Note that this triggers the conditions for + * detecting the bug quite reliably on a 1 CPU system (or if the test + * process is restricted to a single CPU), but may not trigger it on a + * multi-CPU system. + */ + grandchild = fork(); + if (grandchild == 0) { /* Grandchild */ + if (sleep_time) sleep(sleep_time); + exit(1); + } else if (grandchild == -1) { /* Error */ + err(1, "fork (grandchild) failed! (%s() at %s:%d)", + __func__, __FILE__, __LINE__); + } else { /* Child (Grandchild Parent) */ + printf(" -- grandchild created (pid %d)\n", (int) grandchild); + } + if (sleep_time) sleep(sleep_time); + exit(0); + } else if (pid == -1) { /* Error */ + err(1, "fork (child) failed! (%s() at %s:%d)", + __func__, __FILE__, __LINE__); + } + + printf(" -- child created (pid %d)\n", (int) pid); + + kevent_add(kqfd, &kev, pid, EVFILT_PROC, EV_ADD | EV_ENABLE, + NOTE_TRACK | NOTE_EXEC | NOTE_EXIT | NOTE_FORK, + 0, NULL); + + printf(" -- tracking child (pid %d)\n", (int) pid); + + /* Now that we're tracking the child, tell it to proceed. */ + result = write(pipe_fd[0], test_id, 1); + if (result != 1) { + err(1, "write to pipe in parent failed! (ret %zd) (%s() at %s:%d)", + result, __func__, __FILE__, __LINE__); + } + + /* + * Several events should be received: + * - NOTE_FORK (from child) + * - NOTE_CHILD (from grandchild) + * - NOTE_EXIT (from grandchild) + * - NOTE_EXIT (from child) + * + * The NOTE_FORK and NOTE_EXIT from the child could be combined into a + * single event, but the NOTE_CHILD and NOTE_EXIT from the grandchild must + * not be combined. + * + * The loop continues until no events are received within a 5 second + * period, at which point it is assumed that no more will be coming. The + * loop is deliberately designed to attempt to get events even after all + * the expected ones are received in case some spurious events are + * generated as well as the expected ones. + */ + { + int child_exit = 0; + int child_fork = 0; + int gchild_exit = 0; + int gchild_note = 0; + pid_t gchild_pid = -1; + int done = 0; + + while (!done) + { + int handled = 0; + struct kevent *kevp; + + kevp = kevent_get_timeout(kqfd, 5); + if (kevp == NULL) { + done = 1; + } else { + printf(" -- Received kevent: %s\n", kevent_to_str(kevp)); + + if ((kevp->fflags & NOTE_CHILD) && (kevp->fflags & NOTE_EXIT)) { + errx(1, "NOTE_CHILD and NOTE_EXIT in same kevent: %s", kevent_to_str(kevp)); + } + + if (kevp->fflags & NOTE_CHILD) { + if (kevp->data == pid) { + if (!gchild_note) { + ++gchild_note; + gchild_pid = kevp->ident; + ++handled; + } else { + errx(1, "Spurious NOTE_CHILD: %s", kevent_to_str(kevp)); + } + } + } + + if (kevp->fflags & NOTE_EXIT) { + if ((kevp->ident == pid) && (!child_exit)) { + ++child_exit; + ++handled; + } else if ((kevp->ident == gchild_pid) && (!gchild_exit)) { + ++gchild_exit; + ++handled; + } else { + errx(1, "Spurious NOTE_EXIT: %s", kevent_to_str(kevp)); + } + } + + if (kevp->fflags & NOTE_FORK) { + if ((kevp->ident == pid) && (!child_fork)) { + ++child_fork; + ++handled; + } else { + errx(1, "Spurious NOTE_FORK: %s", kevent_to_str(kevp)); + } + } + + if (!handled) { + errx(1, "Spurious kevent: %s", kevent_to_str(kevp)); + } + + free(kevp); + } + } + + /* Make sure all expected events were received. */ + if (child_exit && child_fork && gchild_exit && gchild_note) { + printf(" -- Received all expected events.\n"); + } else { + errx(1, "Did not receive all expected events."); + } + } + + success(); +} + +#ifdef TODO +static void +event_trigger(void) +{ + struct kevent kev; + pid_t pid; + + test_begin("kevent(EVFILT_PROC, wait)"); + + /* Create a child that waits to be killed and then exits */ + pid = fork(); + if (pid == 0) { + pause(); + printf(" -- child caught signal, exiting\n"); + exit(2); + } + printf(" -- child created (pid %d)\n", (int) pid); + + test_no_kevents(); + kevent_add(kqfd, &kev, pid, EVFILT_PROC, EV_ADD, 0, 0, NULL); + + /* Cause the child to exit, then retrieve the event */ + printf(" -- killing process %d\n", (int) pid); + if (kill(pid, SIGUSR1) < 0) + err(1, "kill"); + kevent_cmp(&kev, kevent_get(kqfd)); + test_no_kevents(); + + success(); +} + +void +test_kevent_signal_disable(void) +{ + const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)"; + struct kevent kev; + + test_begin(test_id); + + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_DISABLE, 0, 0, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Block SIGUSR1, then send it to ourselves */ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) + err(1, "sigprocmask"); + if (kill(getpid(), SIGKILL) < 0) + err(1, "kill"); + + test_no_kevents(); + + success(); +} + +void +test_kevent_signal_enable(void) +{ + const char *test_id = "kevent(EVFILT_SIGNAL, EV_ENABLE)"; + struct kevent kev; + + test_begin(test_id); + + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_ENABLE, 0, 0, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Block SIGUSR1, then send it to ourselves */ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) + err(1, "sigprocmask"); + if (kill(getpid(), SIGUSR1) < 0) + err(1, "kill"); + + kev.flags = EV_ADD | EV_CLEAR; +#if LIBKQUEUE + kev.data = 1; /* WORKAROUND */ +#else + kev.data = 2; // one extra time from test_kevent_signal_disable() +#endif + kevent_cmp(&kev, kevent_get(kqfd)); + + /* Delete the watch */ + kev.flags = EV_DELETE; + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + success(); +} + +void +test_kevent_signal_del(void) +{ + const char *test_id = "kevent(EVFILT_SIGNAL, EV_DELETE)"; + struct kevent kev; + + test_begin(test_id); + + /* Delete the kevent */ + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_DELETE, 0, 0, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Block SIGUSR1, then send it to ourselves */ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) + err(1, "sigprocmask"); + if (kill(getpid(), SIGUSR1) < 0) + err(1, "kill"); + + test_no_kevents(); + success(); +} + +void +test_kevent_signal_oneshot(void) +{ + const char *test_id = "kevent(EVFILT_SIGNAL, EV_ONESHOT)"; + struct kevent kev; + + test_begin(test_id); + + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_ADD | EV_ONESHOT, 0, 0, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Block SIGUSR1, then send it to ourselves */ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) + err(1, "sigprocmask"); + if (kill(getpid(), SIGUSR1) < 0) + err(1, "kill"); + + kev.flags |= EV_CLEAR; + kev.data = 1; + kevent_cmp(&kev, kevent_get(kqfd)); + + /* Send another one and make sure we get no events */ + if (kill(getpid(), SIGUSR1) < 0) + err(1, "kill"); + test_no_kevents(); + + success(); +} +#endif + +void +test_evfilt_proc() +{ + kqfd = kqueue(); + + signal(SIGUSR1, sig_handler); + + add_and_delete(); + proc_track(0); /* Run without sleeping before children exit. */ + proc_track(1); /* Sleep a bit in the children before exiting. */ + +#if TODO + event_trigger(); +#endif + + signal(SIGUSR1, SIG_DFL); + +#if TODO + test_kevent_signal_add(); + test_kevent_signal_del(); + test_kevent_signal_get(); + test_kevent_signal_disable(); + test_kevent_signal_enable(); + test_kevent_signal_oneshot(); +#endif + close(kqfd); +} Copied: head/tests/sys/kqueue/libkqueue/read.c (from r305466, head/tests/sys/kqueue/read.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kqueue/libkqueue/read.c Tue Sep 6 08:45:29 2016 (r305467, copy of r305466, head/tests/sys/kqueue/read.c) @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2009 Mark Heily + * + * 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$ + */ + +#include "common.h" + +int kqfd; +int sockfd[2]; + +static void +kevent_socket_drain(void) +{ + char buf[1]; + + /* Drain the read buffer, then make sure there are no more events. */ + puts("draining the read buffer"); + if (read(sockfd[0], &buf[0], 1) < 1) + err(1, "read(2)"); +} + +static void +kevent_socket_fill(void) +{ + puts("filling the read buffer"); + if (write(sockfd[1], ".", 1) < 1) + err(1, "write(2)"); +} + + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Sep 6 08:50: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 97D74B96301; Tue, 6 Sep 2016 08:50:22 +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 734C89E9; Tue, 6 Sep 2016 08:50:22 +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 u868oLOg043647; Tue, 6 Sep 2016 08:50:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u868oLD8043642; Tue, 6 Sep 2016 08:50:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201609060850.u868oLD8043642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 6 Sep 2016 08:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305468 - in head: contrib/netbsd-tests/kernel/kqueue tests/sys/kqueue X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 08:50:22 -0000 Author: ngie Date: Tue Sep 6 08:50:21 2016 New Revision: 305468 URL: https://svnweb.freebsd.org/changeset/base/305468 Log: Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/... proc2_test must be skipped because the invariant tested (`ke.fflags & NOTE_TRACKERR`) doesn't pass. MFC after: 58 days Submitted by: kib (earlier form) Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6172 Modified: head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c head/contrib/netbsd-tests/kernel/kqueue/t_sig.c head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c head/tests/sys/kqueue/Makefile Modified: head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c Tue Sep 6 08:45:29 2016 (r305467) +++ head/contrib/netbsd-tests/kernel/kqueue/t_proc2.c Tue Sep 6 08:50:21 2016 (r305468) @@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); __RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c Tue Sep 6 08:45:29 2016 (r305467) +++ head/contrib/netbsd-tests/kernel/kqueue/t_proc3.c Tue Sep 6 08:50:21 2016 (r305468) @@ -32,6 +32,9 @@ #include __RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: head/contrib/netbsd-tests/kernel/kqueue/t_sig.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_sig.c Tue Sep 6 08:45:29 2016 (r305467) +++ head/contrib/netbsd-tests/kernel/kqueue/t_sig.c Tue Sep 6 08:50:21 2016 (r305468) @@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); __RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -60,9 +63,13 @@ ATF_TC_HEAD(sig, tc) ATF_TC_BODY(sig, tc) { struct timespec timeout; +#ifdef __NetBSD__ struct kfilter_mapping km; +#endif struct kevent event[1]; +#ifdef __NetBSD__ char namebuf[32]; +#endif pid_t pid, child; int kq, n, num, status; @@ -84,16 +91,22 @@ ATF_TC_BODY(sig, tc) RL(kq = kqueue()); +#ifdef __NetBSD__ (void)strlcpy(namebuf, "EVFILT_SIGNAL", sizeof(namebuf)); km.name = namebuf; RL(ioctl(kq, KFILTER_BYNAME, &km)); (void)printf("got %d as filter number for `%s'.\n", km.filter, km.name); +#endif /* ignore the signal to avoid taking it for real */ REQUIRE_LIBC(signal(SIGUSR1, SIG_IGN), SIG_ERR); event[0].ident = SIGUSR1; +#ifdef __NetBSD__ event[0].filter = km.filter; +#else + event[0].filter = EVFILT_SIGNAL; +#endif event[0].flags = EV_ADD | EV_ENABLE; RL(kevent(kq, event, 1, NULL, 0, NULL)); Modified: head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c Tue Sep 6 08:45:29 2016 (r305467) +++ head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c Tue Sep 6 08:50:21 2016 (r305468) @@ -1,3 +1,6 @@ +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: head/tests/sys/kqueue/Makefile ============================================================================== --- head/tests/sys/kqueue/Makefile Tue Sep 6 08:45:29 2016 (r305467) +++ head/tests/sys/kqueue/Makefile Tue Sep 6 08:50:21 2016 (r305468) @@ -1,8 +1,20 @@ # $FreeBSD$ +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel/kqueue + TESTSDIR= ${TESTSBASE}/sys/kqueue BINDIR= ${TESTSDIR} +NETBSD_ATF_TESTS_C= proc1_test +# XXX: fails `ke.fflags & NOTE_TRACKERR` invariant +#NETBSD_ATF_TESTS_C+= proc2_test +NETBSD_ATF_TESTS_C+= proc3_test +NETBSD_ATF_TESTS_C+= sig_test +NETBSD_ATF_TESTS_C+= vnode_test + +WARNS?= 3 + TESTS_SUBDIRS+= libkqueue +.include .include From owner-svn-src-head@freebsd.org Tue Sep 6 08:52:01 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 BB56BB964B6; Tue, 6 Sep 2016 08:52:01 +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 73E34D61; Tue, 6 Sep 2016 08:52:01 +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 u868q0Vc045041; Tue, 6 Sep 2016 08:52:00 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u868q08H045040; Tue, 6 Sep 2016 08:52:00 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201609060852.u868q08H045040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 6 Sep 2016 08:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305469 - head/usr.sbin/portsnap/portsnap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 08:52:01 -0000 Author: delphij Date: Tue Sep 6 08:52:00 2016 New Revision: 305469 URL: https://svnweb.freebsd.org/changeset/base/305469 Log: Ensure that we always open only files that is named by explicitly using shell redirections instead of having gzip(1) to decide what file to open. Issue reported in the "non-cryptanalytic attacks against freebsd update components" anonymous gist. Reviewed by: allanjude, emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7653 Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Sep 6 08:50:21 2016 (r305468) +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Sep 6 08:52:00 2016 (r305469) @@ -651,7 +651,7 @@ fetch_index_sanity() { # Verify a list of files fetch_snapshot_verify() { while read F; do - if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then + if [ "`gunzip -c < snap/${F}.gz | ${SHA256} -q`" != ${F} ]; then echo "snapshot corrupt." return 1 fi @@ -686,7 +686,7 @@ fetch_snapshot() { cut -f 2 -d '|' tINDEX.new | fetch_snapshot_verify || return 1 # Extract the index rm -f INDEX.new - gunzip -c snap/`look INDEX tINDEX.new | + gunzip -c < snap/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 # Verify the snapshot contents @@ -782,7 +782,7 @@ fetch_update() { # Extract the index echo -n "Extracting index... " 1>${QUIETREDIR} - gunzip -c files/`look INDEX tINDEX.new | + gunzip -c < files/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 @@ -902,7 +902,7 @@ extract_make_index() { echo -n "$1 not provided by portsnap server; " echo "$2 not being generated." else - gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | + gunzip -c < "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | cut -f 2 -d '|'`.gz" | cat - ${LOCALDESC} | ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2 From owner-svn-src-head@freebsd.org Tue Sep 6 10:08: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 DED5EBC6D1A; Tue, 6 Sep 2016 10:08:33 +0000 (UTC) (envelope-from avos@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 B803C776; Tue, 6 Sep 2016 10:08:33 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86A8WlT073906; Tue, 6 Sep 2016 10:08:32 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86A8WtE073904; Tue, 6 Sep 2016 10:08:32 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609061008.u86A8WtE073904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 6 Sep 2016 10:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305470 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 10:08:34 -0000 Author: avos Date: Tue Sep 6 10:08:32 2016 New Revision: 305470 URL: https://svnweb.freebsd.org/changeset/base/305470 Log: iwm: fix scanning for hidden SSIDs. Setup SSIDs in scan command so firmware will send direct probe request(s) while scanning. Tested by: dbkirk@gmail.com PR: 211519 MFC after: 1 week Modified: head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- head/sys/dev/iwm/if_iwm_scan.c Tue Sep 6 08:52:00 2016 (r305469) +++ head/sys/dev/iwm/if_iwm_scan.c Tue Sep 6 10:08:32 2016 (r305470) @@ -265,6 +265,7 @@ iwm_mvm_lmac_scan_fill_channels(struct i struct iwm_scan_channel_cfg_lmac *chan, int n_ssids) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_scan_state *ss = ic->ic_scan; struct ieee80211_channel *c; uint8_t nchan; int j; @@ -292,10 +293,11 @@ iwm_mvm_lmac_scan_fill_channels(struct i chan->iter_count = htole16(1); chan->iter_interval = htole32(0); chan->flags = htole32(IWM_UNIFIED_SCAN_CHANNEL_PARTIAL); -#if 0 /* makes scanning while associated less useful */ - if (n_ssids != 0) - chan->flags |= htole32(1 << 1); /* select SSID 0 */ -#endif + chan->flags |= htole32(IWM_SCAN_CHANNEL_NSSIDS(n_ssids)); + /* XXX IEEE80211_SCAN_NOBCAST flag is never set. */ + if (!IEEE80211_IS_CHAN_PASSIVE(c) && + (!(ss->ss_flags & IEEE80211_SCAN_NOBCAST) || n_ssids != 0)) + chan->flags |= htole32(IWM_SCAN_CHANNEL_TYPE_ACTIVE); chan++; nchan++; } @@ -334,11 +336,7 @@ iwm_mvm_umac_scan_fill_channels(struct i chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0); chan->iter_count = 1; chan->iter_interval = htole16(0); - chan->flags = htole32(0); -#if 0 /* makes scanning while associated less useful */ - if (n_ssids != 0) - chan->flags = htole32(1 << 0); /* select SSID 0 */ -#endif + chan->flags = htole32(IWM_SCAN_CHANNEL_UMAC_NSSIDS(n_ssids)); chan++; nchan++; } @@ -355,13 +353,11 @@ iwm_mvm_fill_probe_req(struct iwm_softc struct ieee80211_rateset *rs; size_t remain = sizeof(preq->buf); uint8_t *frm, *pos; - int ssid_len = 0; - const uint8_t *ssid = NULL; memset(preq, 0, sizeof(*preq)); /* Ensure enough space for header and SSID IE. */ - if (remain < sizeof(*wh) + 2 + ssid_len) + if (remain < sizeof(*wh) + 2) return ENOBUFS; /* @@ -378,7 +374,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc *(uint16_t *)&wh->i_seq[0] = 0; /* filled by HW */ frm = (uint8_t *)(wh + 1); - frm = ieee80211_add_ssid(frm, ssid, ssid_len); + frm = ieee80211_add_ssid(frm, NULL, 0); /* Tell the firmware where the MAC header is. */ preq->mac_header.offset = 0; @@ -544,11 +540,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) .data = { NULL, }, .flags = IWM_CMD_SYNC, }; + struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; struct iwm_scan_req_umac *req; struct iwm_scan_req_umac_tail *tail; size_t req_len; - int ssid_len = 0; - const uint8_t *ssid = NULL; + uint8_t i, nssid; int ret; req_len = sizeof(struct iwm_scan_req_umac) + @@ -577,8 +573,9 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_umac *)req->data, ssid_len != 0); + (struct iwm_scan_channel_cfg_umac *)req->data, nssid); req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | @@ -589,15 +586,19 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) sc->sc_capa_n_scan_channels); /* Check if we're doing an active directed scan. */ - if (ssid_len != 0) { - tail->direct_scan[0].id = IEEE80211_ELEMID_SSID; - tail->direct_scan[0].len = ssid_len; - memcpy(tail->direct_scan[0].ssid, ssid, ssid_len); + for (i = 0; i < nssid; i++) { + tail->direct_scan[i].id = IEEE80211_ELEMID_SSID; + tail->direct_scan[i].len = MIN(ss->ss_ssid[i].len, + IEEE80211_NWID_LEN); + memcpy(tail->direct_scan[i].ssid, ss->ss_ssid[i].ssid, + tail->direct_scan[i].len); + /* XXX debug */ + } + if (nssid != 0) { req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); - } else { + } else req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); - } if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) @@ -631,11 +632,11 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) .data = { NULL, }, .flags = IWM_CMD_SYNC, }; + struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; struct iwm_scan_req_lmac *req; size_t req_len; + uint8_t i, nssid; int ret; - int ssid_len = 0; - const uint8_t *ssid = NULL; IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); @@ -668,11 +669,6 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL | IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE | IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL); - if (ssid_len == 0) - req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); - else - req->scan_flags |= - htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); @@ -698,15 +694,23 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->tx_cmd[1].sta_id = sc->sc_aux_sta.sta_id; /* Check if we're doing an active directed scan. */ - if (ssid_len != 0) { - req->direct_scan[0].id = IEEE80211_ELEMID_SSID; - req->direct_scan[0].len = ssid_len; - memcpy(req->direct_scan[0].ssid, ssid, ssid_len); + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); + for (i = 0; i < nssid; i++) { + req->direct_scan[i].id = IEEE80211_ELEMID_SSID; + req->direct_scan[i].len = MIN(ss->ss_ssid[i].len, + IEEE80211_NWID_LEN); + memcpy(req->direct_scan[i].ssid, ss->ss_ssid[i].ssid, + req->direct_scan[i].len); + /* XXX debug */ } + if (nssid != 0) { + req->scan_flags |= + htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); + } else + req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); req->n_channels = iwm_mvm_lmac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_lmac *)req->data, - ssid_len != 0); + (struct iwm_scan_channel_cfg_lmac *)req->data, nssid); ret = iwm_mvm_fill_probe_req(sc, (struct iwm_scan_probe_req *)(req->data + Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Tue Sep 6 08:52:00 2016 (r305469) +++ head/sys/dev/iwm/if_iwmreg.h Tue Sep 6 10:08:32 2016 (r305470) @@ -4766,6 +4766,7 @@ struct iwm_scd_txq_cfg_rsp { /* Masks for iwm_scan_channel.type flags */ #define IWM_SCAN_CHANNEL_TYPE_ACTIVE (1 << 0) +#define IWM_SCAN_CHANNEL_NSSIDS(x) (((1 << (x)) - 1) << 1) #define IWM_SCAN_CHANNEL_NARROW_BAND (1 << 22) /* Max number of IEs for direct SSID scans in a command */ @@ -5580,6 +5581,8 @@ enum iwm_umac_scan_general_flags { */ struct iwm_scan_channel_cfg_umac { uint32_t flags; +#define IWM_SCAN_CHANNEL_UMAC_NSSIDS(x) ((1 << (x)) - 1) + uint8_t channel_num; uint8_t iter_count; uint16_t iter_interval; From owner-svn-src-head@freebsd.org Tue Sep 6 10:13: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 8F647BC70D1; Tue, 6 Sep 2016 10:13:50 +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 539C9D92; Tue, 6 Sep 2016 10:13:50 +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 u86ADnsk077557; Tue, 6 Sep 2016 10:13:49 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86ADnvj077556; Tue, 6 Sep 2016 10:13:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609061013.u86ADnvj077556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 6 Sep 2016 10:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305471 - head/usr.sbin/acpi/acpidump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 10:13:50 -0000 Author: andrew Date: Tue Sep 6 10:13:49 2016 New Revision: 305471 URL: https://svnweb.freebsd.org/changeset/base/305471 Log: Teach acpidump how to parse ACPI 5.1 tables found on the development ThunderX units in the netperf cluster. Approved by: jkim Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7252 Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Sep 6 10:08:32 2016 (r305470) +++ head/usr.sbin/acpi/acpidump/acpi.c Tue Sep 6 10:13:49 2016 (r305471) @@ -356,6 +356,23 @@ acpi_print_mps_flags(uint16_t flags) } static void +acpi_print_gicc_flags(uint32_t flags) +{ + + printf("\tFlags={Performance intr="); + if (flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf(", VGIC intr="); + if (flags & ACPI_MADT_VGIC_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf("}\n"); +} + +static void acpi_print_intr(uint32_t intr, uint16_t mps_flags) { @@ -375,7 +392,12 @@ static const char *apic_types[] = { "Loc "NMI", "Local APIC NMI", "Local APIC Override", "IO SAPIC", "Local SAPIC", "Platform Interrupt", - "Local X2APIC", "Local X2APIC NMI" }; + "Local X2APIC", "Local X2APIC NMI", + "GIC CPU Interface Structure", + "GIC Distributor Structure", + "GICv2m MSI Frame", + "GIC Redistributor Structure", + "GIC ITS Structure" }; static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT", "Corrected Platform Error" }; @@ -393,6 +415,10 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp ACPI_MADT_INTERRUPT_SOURCE *isrc; ACPI_MADT_LOCAL_X2APIC *x2apic; ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi; + ACPI_MADT_GENERIC_INTERRUPT *gicc; + ACPI_MADT_GENERIC_DISTRIBUTOR *gicd; + ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr; + ACPI_MADT_GENERIC_TRANSLATOR *gict; if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0])) printf("\tType=%s\n", apic_types[mp->Type]); @@ -464,6 +490,41 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp acpi_print_cpu_uid(x2apic_nmi->Uid, NULL); acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags); break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + gicc = (ACPI_MADT_GENERIC_INTERRUPT *)mp; + acpi_print_cpu_uid(gicc->Uid, NULL); + printf("\tCPU INTERFACE=%x\n", gicc->CpuInterfaceNumber); + acpi_print_gicc_flags(gicc->Flags); + printf("\tParking Protocol Version=%x\n", gicc->ParkingVersion); + printf("\tPERF INTR=%d\n", gicc->PerformanceInterrupt); + printf("\tParked ADDR=%016jx\n", + (uintmax_t)gicc->ParkedAddress); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicc->BaseAddress); + printf("\tGICV=%016jx\n", (uintmax_t)gicc->GicvBaseAddress); + printf("\tGICH=%016jx\n", (uintmax_t)gicc->GichBaseAddress); + printf("\tVGIC INTR=%d\n", gicc->VgicInterrupt); + printf("\tGICR ADDR=%016jx\n", + (uintmax_t)gicc->GicrBaseAddress); + printf("\tMPIDR=%jx\n", (uintmax_t)gicc->ArmMpidr); + printf("\tEfficency Class=%d\n", (u_int)gicc->EfficiencyClass); + break; + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + gicd = (ACPI_MADT_GENERIC_DISTRIBUTOR *)mp; + printf("\tGIC ID=%d\n", (u_int)gicd->GicId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicd->BaseAddress); + printf("\tVector Base=%d\n", gicd->GlobalIrqBase); + printf("\tGIC VERSION=%d\n", (u_int)gicd->Version); + break; + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + gicr = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)mp; + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicr->BaseAddress); + printf("\tLength=%08x\n", gicr->Length); + break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + gict = (ACPI_MADT_GENERIC_TRANSLATOR *)mp; + printf("\tGIC ITS ID=%d\n", gict->TranslationId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gict->BaseAddress); + break; } } @@ -1012,13 +1073,14 @@ acpi_print_srat_memory(ACPI_SRAT_MEM_AFF printf("\tProximity Domain=%d\n", mp->ProximityDomain); } -static const char *srat_types[] = { "CPU", "Memory", "X2APIC" }; +static const char *srat_types[] = { "CPU", "Memory", "X2APIC", "GICC" }; static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat) { ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; + ACPI_SRAT_GICC_AFFINITY *gic; if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0])) printf("\tType=%s\n", srat_types[srat->Type]); @@ -1041,6 +1103,11 @@ acpi_print_srat(ACPI_SUBTABLE_HEADER *sr acpi_print_srat_cpu(x2apic->ApicId, x2apic->ProximityDomain, x2apic->Flags); break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + gic = (ACPI_SRAT_GICC_AFFINITY *)srat; + acpi_print_srat_cpu(gic->AcpiProcessorUid, gic->ProximityDomain, + gic->Flags); + break; } } From owner-svn-src-head@freebsd.org Tue Sep 6 10:42: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 8248EBC7BA0; Tue, 6 Sep 2016 10:42:15 +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 476D6EA3; Tue, 6 Sep 2016 10:42:14 +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 7184525D386D; Tue, 6 Sep 2016 10:42:12 +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 7EE2AD1F826; Tue, 6 Sep 2016 10:42:11 +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 lE7qweoDmsrk; Tue, 6 Sep 2016 10:42:10 +0000 (UTC) Received: from [10.111.64.116] (unknown [IPv6:fde9:577b:c1a9:4410:ddcf:57b0:8032:3ff1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 9E73CD1F824; Tue, 6 Sep 2016 10:42:09 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Ngie Cooper" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305468 - in head: contrib/netbsd-tests/kernel/kqueue tests/sys/kqueue Date: Tue, 06 Sep 2016 10:42:07 +0000 Message-ID: <886CFA3B-8860-4C37-8B25-500F2B55A10C@lists.zabbadoz.net> In-Reply-To: <201609060850.u868oLD8043642@repo.freebsd.org> References: <201609060850.u868oLD8043642@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Mailer: MailMate (2.0BETAr6054) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 10:42:15 -0000 On 6 Sep 2016, at 8:50, Ngie Cooper wrote: > Author: ngie > Date: Tue Sep 6 08:50:21 2016 > New Revision: 305468 > URL: https://svnweb.freebsd.org/changeset/base/305468 > > Log: > Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/... > > proc2_test must be skipped because the invariant tested > (`ke.fflags & NOTE_TRACKERR`) doesn't pass. > > MFC after: 58 days > Submitted by: kib (earlier form) > Sponsored by: EMC / Isilon Storage Division > Differential Revision: https://reviews.freebsd.org/D6172 Breaks build on 32bit platforms due to incorrect format strings in various places. From owner-svn-src-head@freebsd.org Tue Sep 6 11:08: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 A441BBC6423; Tue, 6 Sep 2016 11:08:33 +0000 (UTC) (envelope-from avos@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 772491AEB; Tue, 6 Sep 2016 11:08:33 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86B8Wr8096247; Tue, 6 Sep 2016 11:08:32 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86B8WoR096246; Tue, 6 Sep 2016 11:08:32 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609061108.u86B8WoR096246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 6 Sep 2016 11:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305472 - 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.23 Precedence: list List-Id: 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, 06 Sep 2016 11:08:33 -0000 Author: avos Date: Tue Sep 6 11:08:32 2016 New Revision: 305472 URL: https://svnweb.freebsd.org/changeset/base/305472 Log: rtwn: fix firmware readiness check in rtwn_load_firmware(). Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Tue Sep 6 10:13:49 2016 (r305471) +++ head/sys/dev/rtwn/if_rtwn.c Tue Sep 6 11:08:32 2016 (r305472) @@ -2204,7 +2204,7 @@ rtwn_load_firmware(struct rtwn_softc *sc break; DELAY(50); } - if (ntries == 1000) { + if (ntries == 2000) { device_printf(sc->sc_dev, "timeout waiting for firmware readiness\n"); error = ETIMEDOUT; From owner-svn-src-head@freebsd.org Tue Sep 6 12:00:17 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 D4813BC75A2; Tue, 6 Sep 2016 12:00:17 +0000 (UTC) (envelope-from avos@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 9F35F762; Tue, 6 Sep 2016 12:00:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86C0Gnp015114; Tue, 6 Sep 2016 12:00:16 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86C0GXw015113; Tue, 6 Sep 2016 12:00:16 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609061200.u86C0GXw015113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 6 Sep 2016 12:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305473 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 12:00:17 -0000 Author: avos Date: Tue Sep 6 12:00:16 2016 New Revision: 305473 URL: https://svnweb.freebsd.org/changeset/base/305473 Log: rum: use m_get2() in Rx path. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Sep 6 11:08:32 2016 (r305472) +++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 6 12:00:16 2016 (r305473) @@ -1205,7 +1205,7 @@ rum_bulk_read_callback(struct usb_xfer * goto tr_setup; } - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { DPRINTF("could not allocate mbuf\n"); counter_u64_add(ic->ic_ierrors, 1); From owner-svn-src-head@freebsd.org Tue Sep 6 13:34: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 AC15BBC4A2A; Tue, 6 Sep 2016 13:34:11 +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 60D9B69F; Tue, 6 Sep 2016 13:34:11 +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 u86DYAII052390; Tue, 6 Sep 2016 13:34:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86DYAeM052388; Tue, 6 Sep 2016 13:34:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609061334.u86DYAeM052388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 6 Sep 2016 13:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305474 - in head/sys/dev/bhnd: . bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 13:34:11 -0000 Author: emaste Date: Tue Sep 6 13:34:10 2016 New Revision: 305474 URL: https://svnweb.freebsd.org/changeset/base/305474 Log: bhnd: remove redundant ;s at the end of functions or switch statements Modified: head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhndb.c Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Tue Sep 6 12:00:16 2016 (r305473) +++ head/sys/dev/bhnd/bhnd_subr.c Tue Sep 6 13:34:10 2016 (r305474) @@ -833,7 +833,7 @@ bhnd_alloc_resources(device_t dev, struc } return (0); -}; +} /** * Release bhnd(4) resources defined in @p rs from a parent bus. @@ -1657,7 +1657,7 @@ bhnd_bus_generic_activate_resource(devic } return (error); -}; +} /** * Helper function for implementing BHND_BUS_DEACTIVATE_RESOURCE(). @@ -1674,5 +1674,5 @@ bhnd_bus_generic_deactivate_resource(dev child, type, rid, r)); return (EINVAL); -}; +} Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Tue Sep 6 12:00:16 2016 (r305473) +++ head/sys/dev/bhnd/bhndb/bhndb.c Tue Sep 6 13:34:10 2016 (r305474) @@ -1101,7 +1101,7 @@ bhndb_get_rman(struct bhndb_softc *sc, d return (NULL); default: return (NULL); - }; + } case BHNDB_ADDRSPACE_BRIDGED: switch (type) { @@ -1111,7 +1111,7 @@ bhndb_get_rman(struct bhndb_softc *sc, d return (NULL); default: return (NULL); - }; + } } /* Quieten gcc */ @@ -1830,7 +1830,7 @@ bhndb_activate_bhnd_resource(device_t de } return (error); -}; +} /** * Default bhndb(4) implementation of BHND_BUS_DEACTIVATE_RESOURCE(). @@ -1854,7 +1854,7 @@ bhndb_deactivate_bhnd_resource(device_t r->direct = false; return (error); -}; +} /** * Slow path for bhndb_io_resource(). From owner-svn-src-head@freebsd.org Tue Sep 6 14:59: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 186EDB960CF; Tue, 6 Sep 2016 14:59:16 +0000 (UTC) (envelope-from wma@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 B286BD89; Tue, 6 Sep 2016 14:59:15 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86ExEug083705; Tue, 6 Sep 2016 14:59:14 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86ExElr083698; Tue, 6 Sep 2016 14:59:14 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609061459.u86ExElr083698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 6 Sep 2016 14:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305477 - in head/sys/contrib/alpine-hal: . eth eth/eth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 14:59:16 -0000 Author: wma Date: Tue Sep 6 14:59:13 2016 New Revision: 305477 URL: https://svnweb.freebsd.org/changeset/base/305477 Log: Update Annapurna Alpine HAL to a newer version. HAL version: 2.7a Import from vendor-sys, r305475 Added: head/sys/contrib/alpine-hal/al_hal_serdes_25g.c (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_25g.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_25g_internal_regs.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_25g_regs.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_hssp.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_hssp_internal_regs.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_hssp_regs.h (contents, props changed) head/sys/contrib/alpine-hal/al_hal_serdes_interface.h (contents, props changed) head/sys/contrib/alpine-hal/al_serdes.c (contents, props changed) head/sys/contrib/alpine-hal/al_serdes.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_common.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_iofic.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_iofic.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_iofic_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_nb_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pbs_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie_axi_reg.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie_interrupts.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_pcie_w_reg.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_plat_services.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_plat_types.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_reg_utils.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_25g.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_25g.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_25g_internal_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_25g_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_hssp.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_hssp_internal_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_hssp_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_interface.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_internal_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_serdes_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_types.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_config.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_config.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_debug.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_debug.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_iofic.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_iofic.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_iofic_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_main.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_regs_gen.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_regs_m2s.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_udma_regs_s2m.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_hal_unit_adapter_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/al_serdes.c (contents, props changed) head/sys/contrib/alpine-hal/eth/al_serdes.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/ head/sys/contrib/alpine-hal/eth/eth/al_hal_an_lt_wrapper_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_alu.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_ec_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_kr.c (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_kr.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_mac_regs.h (contents, props changed) head/sys/contrib/alpine-hal/eth/eth/al_hal_eth_main.c (contents, props changed) Modified: head/sys/contrib/alpine-hal/al_hal_iofic.c head/sys/contrib/alpine-hal/al_hal_iofic.h head/sys/contrib/alpine-hal/al_hal_iofic_regs.h head/sys/contrib/alpine-hal/al_hal_nb_regs.h head/sys/contrib/alpine-hal/al_hal_pbs_regs.h head/sys/contrib/alpine-hal/al_hal_pcie.c head/sys/contrib/alpine-hal/al_hal_pcie.h head/sys/contrib/alpine-hal/al_hal_pcie_axi_reg.h head/sys/contrib/alpine-hal/al_hal_pcie_interrupts.h head/sys/contrib/alpine-hal/al_hal_pcie_regs.h head/sys/contrib/alpine-hal/al_hal_pcie_w_reg.h head/sys/contrib/alpine-hal/al_hal_plat_services.h head/sys/contrib/alpine-hal/al_hal_plat_types.h head/sys/contrib/alpine-hal/al_hal_reg_utils.h head/sys/contrib/alpine-hal/al_hal_serdes.c head/sys/contrib/alpine-hal/al_hal_serdes.h head/sys/contrib/alpine-hal/al_hal_udma.h head/sys/contrib/alpine-hal/al_hal_udma_config.c head/sys/contrib/alpine-hal/al_hal_udma_config.h head/sys/contrib/alpine-hal/al_hal_udma_debug.c head/sys/contrib/alpine-hal/al_hal_udma_iofic.h head/sys/contrib/alpine-hal/al_hal_udma_main.c head/sys/contrib/alpine-hal/al_hal_udma_regs_gen.h head/sys/contrib/alpine-hal/al_hal_unit_adapter_regs.h head/sys/contrib/alpine-hal/eth/al_hal_eth.h head/sys/contrib/alpine-hal/eth/al_hal_eth_mac_regs.h head/sys/contrib/alpine-hal/eth/al_hal_eth_main.c Modified: head/sys/contrib/alpine-hal/al_hal_iofic.c ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_iofic.c Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_iofic.c Tue Sep 6 14:59:13 2016 (r305477) @@ -129,10 +129,10 @@ int al_iofic_msix_moder_interval_config( } /* - * configure the vmid attributes for a given msix vector. + * configure the target-id attributes for a given msix vector. */ -int al_iofic_msix_vmid_attributes_config(void __iomem *regs_base, int group, - uint8_t vector, uint32_t vmid, uint8_t vmid_en) +int al_iofic_msix_tgtid_attributes_config(void __iomem *regs_base, int group, + uint8_t vector, uint32_t tgtid, uint8_t tgtid_en) { struct al_iofic_regs __iomem *regs = (struct al_iofic_regs __iomem *)(regs_base); uint32_t reg = 0; @@ -141,14 +141,14 @@ int al_iofic_msix_vmid_attributes_config al_assert(group < AL_IOFIC_MAX_GROUPS); AL_REG_FIELD_SET(reg, - INT_MSIX_VMID_MASK, - INT_MSIX_VMID_SHIFT, - vmid); + INT_MSIX_TGTID_MASK, + INT_MSIX_TGTID_SHIFT, + tgtid); AL_REG_BIT_VAL_SET(reg, - INT_MSIX_VMID_EN_SHIFT, - vmid_en); + INT_MSIX_TGTID_EN_SHIFT, + tgtid_en); - al_reg_write32(®s->grp_int_mod[group][vector].grp_int_vmid_reg, reg); + al_reg_write32(®s->grp_int_mod[group][vector].grp_int_tgtid_reg, reg); return 0; } Modified: head/sys/contrib/alpine-hal/al_hal_iofic.h ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_iofic.h Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_iofic.h Tue Sep 6 14:59:13 2016 (r305477) @@ -117,17 +117,17 @@ int al_iofic_msix_moder_interval_config( uint8_t vector, uint8_t interval); /** -* configure the vmid attributes for a given msix vector. +* configure the tgtid attributes for a given msix vector. * * @param group the interrupt group * @param vector index -* @param vmid the vmid value -* @param vmid_en take vmid from the intc +* @param tgtid the target-id value +* @param tgtid_en take target-id from the intc * * @return 0 on success. -EINVAL otherwise. */ -int al_iofic_msix_vmid_attributes_config(void __iomem *regs_base, int group, - uint8_t vector, uint32_t vmid, uint8_t vmid_en); +int al_iofic_msix_tgtid_attributes_config(void __iomem *regs_base, int group, + uint8_t vector, uint32_t tgtid, uint8_t tgtid_en); /** * return the offset of the unmask register for a given group. Modified: head/sys/contrib/alpine-hal/al_hal_iofic_regs.h ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_iofic_regs.h Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_iofic_regs.h Tue Sep 6 14:59:13 2016 (r305477) @@ -66,7 +66,7 @@ struct al_iofic_grp_ctrl { struct al_iofic_grp_mod { uint32_t grp_int_mod_reg; /* Interrupt moderation registerDedicated moderation in ... */ - uint32_t grp_int_vmid_reg; + uint32_t grp_int_tgtid_reg; }; struct al_iofic_regs { @@ -109,12 +109,12 @@ struct al_iofic_regs { #define INT_MOD_INTV_MASK 0x000000FF #define INT_MOD_INTV_SHIFT 0 -/**** grp_int_vmid_reg register ****/ -/* Interrupt vmid value registerDedicated reg ... */ -#define INT_MSIX_VMID_MASK 0x0000FFFF -#define INT_MSIX_VMID_SHIFT 0 -/* Interrupt vmid_en value registerDedicated reg ... */ -#define INT_MSIX_VMID_EN_SHIFT 31 +/**** grp_int_tgtid_reg register ****/ +/* Interrupt tgtid value registerDedicated reg ... */ +#define INT_MSIX_TGTID_MASK 0x0000FFFF +#define INT_MSIX_TGTID_SHIFT 0 +/* Interrupt tgtid_en value registerDedicated reg ... */ +#define INT_MSIX_TGTID_EN_SHIFT 31 #ifdef __cplusplus } Modified: head/sys/contrib/alpine-hal/al_hal_nb_regs.h ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_nb_regs.h Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_nb_regs.h Tue Sep 6 14:59:13 2016 (r305477) @@ -355,7 +355,7 @@ struct al_nb_nb_version { }; struct al_nb_sriov { /* [0x0] */ - uint32_t cpu_vmid[4]; + uint32_t cpu_tgtid[4]; uint32_t rsrvd[4]; }; struct al_nb_dram_channels { @@ -403,7 +403,7 @@ struct al_nb_push_packet { uint32_t pp_config; uint32_t rsrvd_0[3]; /* [0x10] */ - uint32_t pp_ext_awuser; + uint32_t pp_ext_attr; uint32_t rsrvd_1[3]; /* [0x20] */ uint32_t pp_base_low; @@ -411,7 +411,7 @@ struct al_nb_push_packet { uint32_t pp_base_high; uint32_t rsrvd_2[2]; /* [0x30] */ - uint32_t pp_sel_awuser; + uint32_t pp_sel_attr; uint32_t rsrvd[51]; }; @@ -853,8 +853,8 @@ Enables 4k hazard of post-barrier vs pre This value is sampled into the CP15 Configuration Base Address Register (CBAR) at reset. */ #define NB_GLOBAL_LGIC_BASE_HIGH_BASE_39_32_MASK 0x000000FF #define NB_GLOBAL_LGIC_BASE_HIGH_BASE_39_32_SHIFT 0 -#define NB_GLOBAL_LGIC_BASE_HIGH_BASE_43_32_MASK_PKR 0x00000FFF -#define NB_GLOBAL_LGIC_BASE_HIGH_BASE_43_32_SHIFT_PKR 0 +#define NB_GLOBAL_LGIC_BASE_HIGH_BASE_43_32_MASK_ALPINE_V2 0x00000FFF +#define NB_GLOBAL_LGIC_BASE_HIGH_BASE_43_32_SHIFT_ALPINE_V2 0 /* GIC registers base [31:15]. This value is sampled into the CP15 Configuration Base Address Register (CBAR) at reset */ #define NB_GLOBAL_LGIC_BASE_LOW_BASED_31_15_MASK 0xFFFF8000 @@ -1055,9 +1055,9 @@ Other access types are hazard check aga /* Disable counter (wait 1000 NB cycles) before applying PoS enable/disable configuration */ #define NB_GLOBAL_ACF_MISC_POS_CONFIG_CNT_DIS (1 << 14) /* Disable wr spliter A0 bug fixes */ -#define NB_GLOBAL_ACF_MISC_WRSPLT_ALPINE_M0_MODE (1 << 16) -/* Disable wr spliter PKR bug fixes */ -#define NB_GLOBAL_ACF_MISC_WRSPLT_ALPINE_A0_MODE (1 << 17) +#define NB_GLOBAL_ACF_MISC_WRSPLT_ALPINE_V1_M0_MODE (1 << 16) +/* Disable wr spliter ALPINE_V2 bug fixes */ +#define NB_GLOBAL_ACF_MISC_WRSPLT_ALPINE_V1_A0_MODE (1 << 17) /* Override the address parity calucation for write transactions going to IO-fabric */ #define NB_GLOBAL_ACF_MISC_NB_NIC_AWADDR_PAR_OVRD (1 << 18) /* Override the data parity calucation for write transactions going to IO-fabric */ @@ -1074,7 +1074,7 @@ Other access types are hazard check aga #define NB_GLOBAL_ACF_MISC_CPU_DSB_FLUSH_DIS (1 << 26) /* Enable DMB flush request to NB to SB PoS when barrier is terminted inside the processor cluster */ #define NB_GLOBAL_ACF_MISC_CPU_DMB_FLUSH_DIS (1 << 27) -/* Peakrock only: remap CPU address above 40 bits to Slave Error +/* Alpine V2 only: remap CPU address above 40 bits to Slave Error INTERNAL */ #define NB_GLOBAL_ACF_MISC_ADDR43_40_REMAP_DIS (1 << 28) /* Enable CPU WriteUnique to WriteNoSnoop trasform */ @@ -1586,7 +1586,7 @@ enable - 0x1: Enable interrupt on overfl /* Number of monitored events supported by the PMU. */ #define NB_MC_PMU_PMU_CONTROL_NUM_OF_EVENTS_MASK 0x00FC0000 #define NB_MC_PMU_PMU_CONTROL_NUM_OF_EVENTS_SHIFT 18 -#define NB_MC_PMU_PMU_CONTROL_NUM_OF_EVENTS_SHIFT_ALPINE 19 +#define NB_MC_PMU_PMU_CONTROL_NUM_OF_EVENTS_SHIFT_ALPINE_V1 19 /* Number of counters implemented by PMU. */ #define NB_MC_PMU_PMU_CONTROL_NUM_OF_CNTS_MASK 0x0F000000 #define NB_MC_PMU_PMU_CONTROL_NUM_OF_CNTS_SHIFT 24 @@ -1659,6 +1659,9 @@ Note: This field must be changed for lar /* Revision number (Major) */ #define NB_NB_VERSION_VERSION_RELEASE_NUM_MAJOR_MASK 0x0000FF00 #define NB_NB_VERSION_VERSION_RELEASE_NUM_MAJOR_SHIFT 8 +#define NB_NB_VERSION_VERSION_RELEASE_NUM_MAJOR_VAL_ALPINE_V1 2 +#define NB_NB_VERSION_VERSION_RELEASE_NUM_MAJOR_VAL_ALPINE_V2 3 +#define NB_NB_VERSION_VERSION_RELEASE_NUM_MAJOR_VAL_ALPINE_V3 4 /* Date of release */ #define NB_NB_VERSION_VERSION_DATE_DAY_MASK 0x001F0000 #define NB_NB_VERSION_VERSION_DATE_DAY_SHIFT 16 @@ -1672,10 +1675,10 @@ Note: This field must be changed for lar #define NB_NB_VERSION_VERSION_RESERVED_MASK 0xC0000000 #define NB_NB_VERSION_VERSION_RESERVED_SHIFT 30 -/**** cpu_vmid register ****/ -/* Target VMID */ -#define NB_SRIOV_CPU_VMID_VAL_MASK 0x000000FF -#define NB_SRIOV_CPU_VMID_VAL_SHIFT 0 +/**** cpu_tgtid register ****/ +/* Target-ID */ +#define NB_SRIOV_CPU_TGTID_VAL_MASK 0x000000FF +#define NB_SRIOV_CPU_TGTID_VAL_SHIFT 0 /**** DRAM_0_Control register ****/ /* Controller Idle @@ -1807,7 +1810,7 @@ Parity bits are still generated per tran #define NB_PUSH_PACKET_PP_EXT_AWUSER_AWUSER_SHIFT 0 /**** pp_sel_awuser register ****/ -/* Select whether to use addr[63:48] or PP awmisc as vmid. +/* Select whether to use addr[63:48] or PP awmisc as tgtid. Each bit if set to 1 selects the corresponding address bit. Otherwise, selects the corersponding awmis bit. */ #define NB_PUSH_PACKET_PP_SEL_AWUSER_SEL_MASK 0x0000FFFF #define NB_PUSH_PACKET_PP_SEL_AWUSER_SEL_SHIFT 0 Modified: head/sys/contrib/alpine-hal/al_hal_pbs_regs.h ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_pbs_regs.h Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_pbs_regs.h Tue Sep 6 14:59:13 2016 (r305477) @@ -447,11 +447,12 @@ struct al_pbs_target_id_enforcement { }; struct al_pbs_regs { - struct al_pbs_unit unit; /* [0x0] */ -struct al_pbs_low_latency_sram_remap low_latency_sram_remap; -/* [0x250] */ - uint32_t rsrvd_0[88]; - struct al_pbs_target_id_enforcement target_id_enforcement; /* [0x400] */ + struct al_pbs_unit unit; /* [0x0] */ + struct al_pbs_low_latency_sram_remap low_latency_sram_remap; /* [0x250] */ + uint32_t rsrvd_0[24]; + uint32_t iofic_base; /* [0x300] */ + uint32_t rsrvd_1[63]; + struct al_pbs_target_id_enforcement target_id_enforcement; /* [0x400] */ }; @@ -849,50 +850,50 @@ struct al_pbs_low_latency_sram_remap low * 2'b01 - select pcie_b[0] * 2'b10 - select pcie_a[2] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_2_MASK 0x00000003 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_2_SHIFT 0 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_2_MASK 0x00000003 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_2_SHIFT 0 /* * 2'b01 - select pcie_b[1] * 2'b10 - select pcie_a[3] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_3_MASK 0x00000030 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_3_SHIFT 4 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_3_MASK 0x00000030 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_3_SHIFT 4 /* * 2'b01 - select pcie_b[0] * 2'b10 - select pcie_a[4] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_4_MASK 0x00000300 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_4_SHIFT 8 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_4_MASK 0x00000300 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_4_SHIFT 8 /* * 2'b01 - select pcie_b[1] * 2'b10 - select pcie_a[5] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_5_MASK 0x00003000 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_5_SHIFT 12 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_5_MASK 0x00003000 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_5_SHIFT 12 /* * 2'b01 - select pcie_b[2] * 2'b10 - select pcie_a[6] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_6_MASK 0x00030000 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_6_SHIFT 16 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_6_MASK 0x00030000 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_6_SHIFT 16 /* * 2'b01 - select pcie_b[3] * 2'b10 - select pcie_a[7] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_7_MASK 0x00300000 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_7_SHIFT 20 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_7_MASK 0x00300000 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_7_SHIFT 20 /* * 2'b01 - select pcie_d[0] * 2'b10 - select pcie_c[2] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_10_MASK 0x03000000 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_10_SHIFT 24 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_10_MASK 0x03000000 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_10_SHIFT 24 /* * 2'b01 - select pcie_d[1] * 2'b10 - select pcie_c[3] */ -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_11_MASK 0x30000000 -#define PBS_UNIT_SERDES_MUX_PIPE_PKR_SELECT_OH_SERDES_11_SHIFT 28 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_11_MASK 0x30000000 +#define PBS_UNIT_SERDES_MUX_PIPE_ALPINE_V2_SELECT_OH_SERDES_11_SHIFT 28 /**** dma_io_master_map register ****/ /* @@ -978,6 +979,14 @@ struct al_pbs_low_latency_sram_remap low #define PBS_UNIT_CFG_AXI_CONF_2_DBG_AWQOS_MASK 0x3C000000 #define PBS_UNIT_CFG_AXI_CONF_2_DBG_AWQOS_SHIFT 26 +/**** cfg_axi_conf_3 register ****/ +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_LOW_MASK 0xFFFF +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_LOW_SHIFT 0 +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_HI_MASK 0xFF0000 +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_HI_SHIFT 16 +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_SPI_HI_MASK 0xFF000000 +#define PBS_UNIT_CFG_AXI_CONF_3_TIMEOUT_SPI_HI_SHIFT 24 + /**** spi_mst_conf_0 register ****/ /* * Sets the SPI master Configuration. For details see the SPI section in the @@ -1137,9 +1146,9 @@ struct al_pbs_low_latency_sram_remap low #define PBS_UNIT_CHIP_ID_DEV_ID_MASK 0xFFFF0000 #define PBS_UNIT_CHIP_ID_DEV_ID_SHIFT 16 -#define PBS_UNIT_CHIP_ID_DEV_ID_ALPINE 0 -#define PBS_UNIT_CHIP_ID_DEV_ID_PEAKROCK 1 -#define PBS_UNIT_CHIP_ID_DEV_ID_COYOTE 2 +#define PBS_UNIT_CHIP_ID_DEV_ID_ALPINE_V1 0 +#define PBS_UNIT_CHIP_ID_DEV_ID_ALPINE_V2 1 +#define PBS_UNIT_CHIP_ID_DEV_ID_ALPINE_V3 2 /**** uart0_conf_status register ****/ /* @@ -1420,56 +1429,56 @@ struct al_pbs_low_latency_sram_remap low * 2'b01 - select sata_b[0] * 2'b10 - select eth_a[0] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_8_MASK 0x00000003 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_8_SHIFT 0 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_8_MASK 0x00000003 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_8_SHIFT 0 /* * 3'b001 - select sata_b[1] * 3'b010 - select eth_b[0] * 3'b100 - select eth_a[1] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_9_MASK 0x00000070 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_9_SHIFT 4 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_9_MASK 0x00000070 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_9_SHIFT 4 /* * 3'b001 - select sata_b[2] * 3'b010 - select eth_c[0] * 3'b100 - select eth_a[2] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_10_MASK 0x00000700 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_10_SHIFT 8 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_10_MASK 0x00000700 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_10_SHIFT 8 /* * 3'b001 - select sata_b[3] * 3'b010 - select eth_d[0] * 3'b100 - select eth_a[3] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_11_MASK 0x00007000 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_11_SHIFT 12 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_11_MASK 0x00007000 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_11_SHIFT 12 /* * 2'b01 - select eth_a[0] * 2'b10 - select sata_a[0] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_12_MASK 0x00030000 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_12_SHIFT 16 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_12_MASK 0x00030000 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_12_SHIFT 16 /* * 3'b001 - select eth_b[0] * 3'b010 - select eth_c[1] * 3'b100 - select sata_a[1] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_13_MASK 0x00700000 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_13_SHIFT 20 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_13_MASK 0x00700000 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_13_SHIFT 20 /* * 3'b001 - select eth_a[0] * 3'b010 - select eth_c[2] * 3'b100 - select sata_a[2] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_14_MASK 0x07000000 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_14_SHIFT 24 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_14_MASK 0x07000000 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_14_SHIFT 24 /* * 3'b001 - select eth_d[0] * 3'b010 - select eth_c[3] * 3'b100 - select sata_a[3] */ -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_15_MASK 0x70000000 -#define PBS_UNIT_SERDES_MUX_MULTI_0_PKR_SELECT_OH_SERDES_15_SHIFT 28 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_15_MASK 0x70000000 +#define PBS_UNIT_SERDES_MUX_MULTI_0_ALPINE_V2_SELECT_OH_SERDES_15_SHIFT 28 /**** serdes_mux_multi_1 register ****/ /* SerDes one hot mux control. For details see datasheet. */ @@ -1632,62 +1641,62 @@ struct al_pbs_low_latency_sram_remap low * 2'b01 - eth_a[0] from serdes_8 * 2'b10 - eth_a[0] from serdes_14 */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_A_0_MASK 0x00000003 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_A_0_SHIFT 0 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_A_0_MASK 0x00000003 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_A_0_SHIFT 0 /* * 2'b01 - eth_b[0] from serdes_9 * 2'b10 - eth_b[0] from serdes_13 */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_B_0_MASK 0x00000030 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_B_0_SHIFT 4 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_B_0_MASK 0x00000030 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_B_0_SHIFT 4 /* * 2'b01 - eth_c[0] from serdes_10 * 2'b10 - eth_c[0] from serdes_12 */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_C_0_MASK 0x00000300 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_C_0_SHIFT 8 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_C_0_MASK 0x00000300 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_C_0_SHIFT 8 /* * 2'b01 - eth_d[0] from serdes_11 * 2'b10 - eth_d[0] from serdes_15 */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_D_0_MASK 0x00003000 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_D_0_SHIFT 12 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_D_0_MASK 0x00003000 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_D_0_SHIFT 12 /* which lane's is master clk */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_A_ICK_MASTER_MASK 0x00030000 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_A_ICK_MASTER_SHIFT 16 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_A_ICK_MASTER_MASK 0x00030000 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_A_ICK_MASTER_SHIFT 16 /* which lane's is master clk */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_C_ICK_MASTER_MASK 0x00300000 -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_C_ICK_MASTER_SHIFT 20 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_C_ICK_MASTER_MASK 0x00300000 +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_C_ICK_MASTER_SHIFT 20 /* enable xlaui on eth a */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_A_XLAUI_ENABLE (1 << 24) +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_A_XLAUI_ENABLE (1 << 24) /* enable xlaui on eth c */ -#define PBS_UNIT_SERDES_MUX_ETH_PKR_SELECT_OH_ETH_C_XLAUI_ENABLE (1 << 28) +#define PBS_UNIT_SERDES_MUX_ETH_ALPINE_V2_SELECT_OH_ETH_C_XLAUI_ENABLE (1 << 28) /**** serdes_mux_pcie register ****/ /* * 2'b01 - select pcie_b[0] from serdes 2 * 2'b10 - select pcie_b[0] from serdes 4 */ -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_B_0_MASK 0x00000003 -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_B_0_SHIFT 0 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_B_0_MASK 0x00000003 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_B_0_SHIFT 0 /* * 2'b01 - select pcie_b[1] from serdes 3 * 2'b10 - select pcie_b[1] from serdes 5 */ -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_B_1_MASK 0x00000030 -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_B_1_SHIFT 4 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_B_1_MASK 0x00000030 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_B_1_SHIFT 4 /* * 2'b01 - select pcie_d[0] from serdes 10 * 2'b10 - select pcie_d[0] from serdes 12 */ -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_D_0_MASK 0x00000300 -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_D_0_SHIFT 8 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_D_0_MASK 0x00000300 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_D_0_SHIFT 8 /* * 2'b01 - select pcie_d[1] from serdes 11 * 2'b10 - select pcie_d[1] from serdes 13 */ -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_D_1_MASK 0x00003000 -#define PBS_UNIT_SERDES_MUX_PCIE_PKR_SELECT_OH_PCIE_D_1_SHIFT 12 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_D_1_MASK 0x00003000 +#define PBS_UNIT_SERDES_MUX_PCIE_ALPINE_V2_SELECT_OH_PCIE_D_1_SHIFT 12 /**** serdes_mux_sata register ****/ /* Modified: head/sys/contrib/alpine-hal/al_hal_pcie.c ============================================================================== --- head/sys/contrib/alpine-hal/al_hal_pcie.c Tue Sep 6 14:52:14 2016 (r305476) +++ head/sys/contrib/alpine-hal/al_hal_pcie.c Tue Sep 6 14:59:13 2016 (r305477) @@ -96,6 +96,8 @@ __FBSDID("$FreeBSD$"); #define AL_PCIE_PARSE_LANES(v) (((1 << v) - 1) << \ PCIE_REVX_AXI_MISC_PCIE_GLOBAL_CONF_NOF_ACT_LANES_SHIFT) +#define AL_PCIE_FLR_DONE_INTERVAL 10 + /** * Static functions */ @@ -183,10 +185,6 @@ al_pcie_port_link_config( return -EINVAL; } - al_dbg("PCIe %d: link config: max speed gen %d, max lanes %d, reversal %s\n", - pcie_port->port_id, link_params->max_speed, - pcie_port->max_lanes, link_params->enable_reversal? "enable" : "disable"); - al_pcie_port_link_speed_ctrl_set(pcie_port, link_params->max_speed); /* Change Max Payload Size, if needed. @@ -220,12 +218,6 @@ al_pcie_port_link_config( (max_lanes + (max_lanes-1)) << PCIE_PORT_LINK_CTRL_LINK_CAPABLE_SHIFT); - /* TODO: add support for reversal mode */ - if (link_params->enable_reversal) { - al_err("PCIe %d: enabling reversal mode not implemented\n", - pcie_port->port_id); - return -ENOSYS; - } return 0; } @@ -364,12 +356,9 @@ al_pcie_rev_id_get( PBS_UNIT_CHIP_ID_DEV_ID_MASK, PBS_UNIT_CHIP_ID_DEV_ID_SHIFT); - if (chip_id_dev == PBS_UNIT_CHIP_ID_DEV_ID_ALPINE) { - rev_id = AL_REG_FIELD_GET( - chip_id, - PBS_UNIT_CHIP_ID_DEV_REV_ID_MASK, - PBS_UNIT_CHIP_ID_DEV_REV_ID_SHIFT); - } else if (chip_id_dev == PBS_UNIT_CHIP_ID_DEV_ID_PEAKROCK) { + if (chip_id_dev == PBS_UNIT_CHIP_ID_DEV_ID_ALPINE_V1) { + rev_id = AL_PCIE_REV_ID_1; + } else if (chip_id_dev == PBS_UNIT_CHIP_ID_DEV_ID_ALPINE_V2) { struct al_pcie_revx_regs __iomem *regs = (struct al_pcie_revx_regs __iomem *)pcie_reg_base; uint32_t dev_id; @@ -469,20 +458,6 @@ al_pcie_ib_hcrd_os_ob_reads_config_defau al_pcie_port_ib_hcrd_os_ob_reads_config(pcie_port, &ib_hcrd_os_ob_reads_config); }; -/** return AL_TRUE is link started (LTSSM enabled) and AL_FALSE otherwise */ -static al_bool -al_pcie_is_link_started(struct al_pcie_port *pcie_port) -{ - struct al_pcie_regs *regs = (struct al_pcie_regs *)pcie_port->regs; - - uint32_t port_init = al_reg_read32(regs->app.global_ctrl.port_init); - uint8_t ltssm_en = AL_REG_FIELD_GET(port_init, - PCIE_W_GLOBAL_CTRL_PORT_INIT_APP_LTSSM_EN_MASK, - PCIE_W_GLOBAL_CTRL_PORT_INIT_APP_LTSSM_EN_SHIFT); - - return ltssm_en; -} - /** return AL_TRUE if link is up, AL_FALSE otherwise */ static al_bool al_pcie_check_link( @@ -651,18 +626,6 @@ al_pcie_port_gen3_params_config(struct a } static int -al_pcie_port_tl_credits_config( - struct al_pcie_port *pcie_port, - const struct al_pcie_tl_credits_params *tl_credits __attribute__((__unused__))) -{ - al_err("PCIe %d: transport layer credits config not implemented\n", - pcie_port->port_id); - - return -ENOSYS; - -} - -static int al_pcie_port_pf_params_config(struct al_pcie_pf *pcie_pf, const struct al_pcie_pf_config_params *pf_params) { @@ -680,22 +643,21 @@ al_pcie_port_pf_params_config(struct al_ regs->core_space[pf_num].pcie_pm_cap_base, AL_FIELD_MASK(26, 25) | AL_FIELD_MASK(31, 28), 0); - /* Disable FLR capability */ + /* Set/Clear FLR bit */ if (pf_params->cap_flr_dis) al_reg_write32_masked( regs->core_space[pf_num].pcie_dev_cap_base, - AL_BIT(28), 0); + AL_PCI_EXP_DEVCAP_FLR, 0); + else + al_reg_write32_masked( + regs->core_space[pcie_pf->pf_num].pcie_dev_cap_base, + AL_PCI_EXP_DEVCAP_FLR, AL_PCI_EXP_DEVCAP_FLR); /* Disable ASPM capability */ if (pf_params->cap_aspm_dis) { al_reg_write32_masked( regs->core_space[pf_num].pcie_cap_base + (AL_PCI_EXP_LNKCAP >> 2), AL_PCI_EXP_LNKCAP_ASPMS, 0); - } else if (pcie_port->rev_id == AL_PCIE_REV_ID_0) { - al_warn("%s: ASPM support is enabled, please disable it\n", - __func__); - ret = -EINVAL; - goto done; } if (!pf_params->bar_params_valid) { @@ -743,8 +705,9 @@ al_pcie_port_pf_params_config(struct al_ if (params->memory_space) { if (size < AL_PCIE_MIN_MEMORY_BAR_SIZE) { - al_err("PCIe %d: memory BAR %d: size (0x%llx) less that minimal allowed value\n", - pcie_port->port_id, bar_idx, size); + al_err("PCIe %d: memory BAR %d: size (0x%jx) less that minimal allowed value\n", + pcie_port->port_id, bar_idx, + (uintmax_t)size); ret = -EINVAL; goto done; } @@ -756,8 +719,9 @@ al_pcie_port_pf_params_config(struct al_ } if (size < AL_PCIE_MIN_IO_BAR_SIZE) { - al_err("PCIe %d: IO BAR %d: size (0x%llx) less that minimal allowed value\n", - pcie_port->port_id, bar_idx, size); + al_err("PCIe %d: IO BAR %d: size (0x%jx) less that minimal allowed value\n", + pcie_port->port_id, bar_idx, + (uintmax_t)size); ret = -EINVAL; goto done; } @@ -765,9 +729,9 @@ al_pcie_port_pf_params_config(struct al_ /* size must be power of 2 */ if (size & (size - 1)) { - al_err("PCIe %d: BAR %d:size (0x%llx) must be " + al_err("PCIe %d: BAR %d:size (0x%jx) must be " "power of 2\n", - pcie_port->port_id, bar_idx, size); + pcie_port->port_id, bar_idx, (uintmax_t)size); ret = -EINVAL; goto done; } @@ -826,8 +790,7 @@ al_pcie_port_pf_params_config(struct al_ } /* Open CPU generated msi and legacy interrupts in pcie wrapper logic */ - if ((pcie_port->rev_id == AL_PCIE_REV_ID_0) || - (pcie_port->rev_id == AL_PCIE_REV_ID_1)) { + if (pcie_port->rev_id == AL_PCIE_REV_ID_1) { al_reg_write32(regs->app.soc_int[pf_num].mask_inta_leg_0, (1 << 21)); } else if ((pcie_port->rev_id == AL_PCIE_REV_ID_2) || (pcie_port->rev_id == AL_PCIE_REV_ID_3)) { @@ -853,13 +816,7 @@ al_pcie_port_pf_params_config(struct al_ * Restore the original value after the write to app.soc.mask_msi_leg_0 * register. */ - if (pcie_port->rev_id == AL_PCIE_REV_ID_0) { - uint32_t backup; - - backup = al_reg_read32(®s->app.int_grp_a->mask); - al_reg_write32(regs->app.soc_int[pf_num].mask_msi_leg_0, (1 << 22)); - al_reg_write32(®s->app.int_grp_a->mask, backup); - } else if (pcie_port->rev_id == AL_PCIE_REV_ID_1) { + if (pcie_port->rev_id == AL_PCIE_REV_ID_1) { al_reg_write32(regs->app.soc_int[pf_num].mask_msi_leg_0, (1 << 22)); } else if ((pcie_port->rev_id == AL_PCIE_REV_ID_2) || (pcie_port->rev_id == AL_PCIE_REV_ID_3)) { @@ -878,22 +835,6 @@ done: return ret; } -static void -al_pcie_port_features_config( - struct al_pcie_port *pcie_port, - const struct al_pcie_features *features) -{ - struct al_pcie_regs *regs = pcie_port->regs; - - al_assert(pcie_port->rev_id > AL_PCIE_REV_ID_0); - - al_reg_write32_masked( - ®s->app.ctrl_gen->features, - PCIE_W_CTRL_GEN_FEATURES_SATA_EP_MSI_FIX, - features->sata_ep_msi_fix ? - PCIE_W_CTRL_GEN_FEATURES_SATA_EP_MSI_FIX : 0); -} - static int al_pcie_port_sris_config( struct al_pcie_port *pcie_port, @@ -916,6 +857,9 @@ al_pcie_port_sris_config( switch (pcie_port->rev_id) { case AL_PCIE_REV_ID_3: + al_reg_write32_masked(®s->app.cfg_func_ext->cfg, + PCIE_W_CFG_FUNC_EXT_CFG_APP_SRIS_MODE, + PCIE_W_CFG_FUNC_EXT_CFG_APP_SRIS_MODE); case AL_PCIE_REV_ID_2: al_reg_write32_masked(regs->app.global_ctrl.sris_kp_counter, PCIE_W_GLOBAL_CTRL_SRIS_KP_COUNTER_VALUE_GEN3_SRIS_MASK | @@ -989,6 +933,34 @@ al_pcie_port_max_num_of_pfs_get(struct a return 1; } +/** Enable ecrc generation in outbound atu (Addressing RMN: 5119) */ +static void al_pcie_ecrc_gen_ob_atu_enable(struct al_pcie_port *pcie_port, unsigned int pf_num) +{ + struct al_pcie_regs *regs = pcie_port->regs; + int max_ob_atu = (pcie_port->rev_id == AL_PCIE_REV_ID_3) ? + AL_PCIE_REV_3_ATU_NUM_OUTBOUND_REGIONS : AL_PCIE_REV_1_2_ATU_NUM_OUTBOUND_REGIONS; + int i; + for (i = 0; i < max_ob_atu; i++) { + al_bool enable = 0; + uint32_t reg = 0; + unsigned int func_num; + AL_REG_FIELD_SET(reg, 0xF, 0, i); + AL_REG_BIT_VAL_SET(reg, 31, AL_PCIE_ATU_DIR_OUTBOUND); + al_reg_write32(®s->port_regs->iatu.index, reg); + reg = al_reg_read32(®s->port_regs->iatu.cr2); + enable = AL_REG_BIT_GET(reg, 31) ? AL_TRUE : AL_FALSE; + reg = al_reg_read32(®s->port_regs->iatu.cr1); + func_num = AL_REG_FIELD_GET(reg, + PCIE_IATU_CR1_FUNC_NUM_MASK, + PCIE_IATU_CR1_FUNC_NUM_SHIFT); + if ((enable == AL_TRUE) && (pf_num == func_num)) { + /* Set TD bit */ + AL_REG_BIT_SET(reg, 8); + al_reg_write32(®s->port_regs->iatu.cr1, reg); + } + } +} + /******************************************************************************/ /***************************** API Implementation *****************************/ /******************************************************************************/ @@ -1025,12 +997,13 @@ al_pcie_port_handle_init( /* Zero all regs */ al_memset(pcie_port->regs, 0, sizeof(struct al_pcie_regs)); - if ((pcie_port->rev_id == AL_PCIE_REV_ID_0) || - (pcie_port->rev_id == AL_PCIE_REV_ID_1)) { + if (pcie_port->rev_id == AL_PCIE_REV_ID_1) { struct al_pcie_rev1_regs __iomem *regs = (struct al_pcie_rev1_regs __iomem *)pcie_reg_base; pcie_port->regs->axi.ctrl.global = ®s->axi.ctrl.global; + pcie_port->regs->axi.ctrl.master_rctl = ®s->axi.ctrl.master_rctl; + pcie_port->regs->axi.ctrl.master_ctl = ®s->axi.ctrl.master_ctl; pcie_port->regs->axi.ctrl.master_arctl = ®s->axi.ctrl.master_arctl; pcie_port->regs->axi.ctrl.master_awctl = ®s->axi.ctrl.master_awctl; pcie_port->regs->axi.ctrl.slv_ctl = ®s->axi.ctrl.slv_ctl; @@ -1059,20 +1032,21 @@ al_pcie_port_handle_init( pcie_port->regs->app.global_ctrl.pm_control = ®s->app.global_ctrl.pm_control; pcie_port->regs->app.global_ctrl.events_gen[0] = ®s->app.global_ctrl.events_gen; pcie_port->regs->app.debug = ®s->app.debug; + pcie_port->regs->app.soc_int[0].status_0 = ®s->app.soc_int.status_0; + pcie_port->regs->app.soc_int[0].status_1 = ®s->app.soc_int.status_1; + pcie_port->regs->app.soc_int[0].status_2 = ®s->app.soc_int.status_2; pcie_port->regs->app.soc_int[0].mask_inta_leg_0 = ®s->app.soc_int.mask_inta_leg_0; + pcie_port->regs->app.soc_int[0].mask_inta_leg_1 = ®s->app.soc_int.mask_inta_leg_1; + pcie_port->regs->app.soc_int[0].mask_inta_leg_2 = ®s->app.soc_int.mask_inta_leg_2; pcie_port->regs->app.soc_int[0].mask_msi_leg_0 = ®s->app.soc_int.mask_msi_leg_0; + pcie_port->regs->app.soc_int[0].mask_msi_leg_1 = ®s->app.soc_int.mask_msi_leg_1; + pcie_port->regs->app.soc_int[0].mask_msi_leg_2 = ®s->app.soc_int.mask_msi_leg_2; pcie_port->regs->app.ctrl_gen = ®s->app.ctrl_gen; pcie_port->regs->app.parity = ®s->app.parity; pcie_port->regs->app.atu.in_mask_pair = regs->app.atu.in_mask_pair; pcie_port->regs->app.atu.out_mask_pair = regs->app.atu.out_mask_pair; - - if (pcie_port->rev_id == AL_PCIE_REV_ID_0) { - pcie_port->regs->app.int_grp_a = ®s->app.int_grp_a_m0; - pcie_port->regs->app.int_grp_b = ®s->app.int_grp_b_m0; - } else { - pcie_port->regs->app.int_grp_a = ®s->app.int_grp_a; - pcie_port->regs->app.int_grp_b = ®s->app.int_grp_b; - } + pcie_port->regs->app.int_grp_a = ®s->app.int_grp_a; + pcie_port->regs->app.int_grp_b = ®s->app.int_grp_b; pcie_port->regs->core_space[0].config_header = regs->core_space.config_header; pcie_port->regs->core_space[0].pcie_pm_cap_base = ®s->core_space.pcie_pm_cap_base; @@ -1091,6 +1065,8 @@ al_pcie_port_handle_init( (struct al_pcie_rev2_regs __iomem *)pcie_reg_base; pcie_port->regs->axi.ctrl.global = ®s->axi.ctrl.global; + pcie_port->regs->axi.ctrl.master_rctl = ®s->axi.ctrl.master_rctl; + pcie_port->regs->axi.ctrl.master_ctl = ®s->axi.ctrl.master_ctl; pcie_port->regs->axi.ctrl.master_arctl = ®s->axi.ctrl.master_arctl; pcie_port->regs->axi.ctrl.master_awctl = ®s->axi.ctrl.master_awctl; pcie_port->regs->axi.ctrl.slv_ctl = ®s->axi.ctrl.slv_ctl; @@ -1100,6 +1076,10 @@ al_pcie_port_handle_init( pcie_port->regs->axi.ob_ctrl.io_start_h = ®s->axi.ob_ctrl.io_start_h; pcie_port->regs->axi.ob_ctrl.io_limit_l = ®s->axi.ob_ctrl.io_limit_l; pcie_port->regs->axi.ob_ctrl.io_limit_h = ®s->axi.ob_ctrl.io_limit_h; + pcie_port->regs->axi.ob_ctrl.tgtid_reg_ovrd = ®s->axi.ob_ctrl.tgtid_reg_ovrd; + pcie_port->regs->axi.ob_ctrl.addr_high_reg_ovrd_sel = ®s->axi.ob_ctrl.addr_high_reg_ovrd_sel; + pcie_port->regs->axi.ob_ctrl.addr_high_reg_ovrd_value = ®s->axi.ob_ctrl.addr_high_reg_ovrd_value; + pcie_port->regs->axi.ob_ctrl.addr_size_replace = ®s->axi.ob_ctrl.addr_size_replace; pcie_port->regs->axi.pcie_global.conf = ®s->axi.pcie_global.conf; pcie_port->regs->axi.conf.zero_lane0 = ®s->axi.conf.zero_lane0; pcie_port->regs->axi.conf.zero_lane1 = ®s->axi.conf.zero_lane1; @@ -1120,11 +1100,20 @@ al_pcie_port_handle_init( pcie_port->regs->app.global_ctrl.events_gen[0] = ®s->app.global_ctrl.events_gen; pcie_port->regs->app.global_ctrl.corr_err_sts_int = ®s->app.global_ctrl.pended_corr_err_sts_int; pcie_port->regs->app.global_ctrl.uncorr_err_sts_int = ®s->app.global_ctrl.pended_uncorr_err_sts_int; + pcie_port->regs->app.global_ctrl.sris_kp_counter = ®s->app.global_ctrl.sris_kp_counter_value; pcie_port->regs->app.debug = ®s->app.debug; pcie_port->regs->app.ap_user_send_msg = ®s->app.ap_user_send_msg; + pcie_port->regs->app.soc_int[0].status_0 = ®s->app.soc_int.status_0; + pcie_port->regs->app.soc_int[0].status_1 = ®s->app.soc_int.status_1; + pcie_port->regs->app.soc_int[0].status_2 = ®s->app.soc_int.status_2; + pcie_port->regs->app.soc_int[0].status_3 = ®s->app.soc_int.status_3; pcie_port->regs->app.soc_int[0].mask_inta_leg_0 = ®s->app.soc_int.mask_inta_leg_0; + pcie_port->regs->app.soc_int[0].mask_inta_leg_1 = ®s->app.soc_int.mask_inta_leg_1; + pcie_port->regs->app.soc_int[0].mask_inta_leg_2 = ®s->app.soc_int.mask_inta_leg_2; pcie_port->regs->app.soc_int[0].mask_inta_leg_3 = ®s->app.soc_int.mask_inta_leg_3; pcie_port->regs->app.soc_int[0].mask_msi_leg_0 = ®s->app.soc_int.mask_msi_leg_0; + pcie_port->regs->app.soc_int[0].mask_msi_leg_1 = ®s->app.soc_int.mask_msi_leg_1; + pcie_port->regs->app.soc_int[0].mask_msi_leg_2 = ®s->app.soc_int.mask_msi_leg_2; pcie_port->regs->app.soc_int[0].mask_msi_leg_3 = ®s->app.soc_int.mask_msi_leg_3; pcie_port->regs->app.ctrl_gen = ®s->app.ctrl_gen; pcie_port->regs->app.parity = ®s->app.parity; @@ -1150,6 +1139,8 @@ al_pcie_port_handle_init( struct al_pcie_rev3_regs __iomem *regs = (struct al_pcie_rev3_regs __iomem *)pcie_reg_base; pcie_port->regs->axi.ctrl.global = ®s->axi.ctrl.global; + pcie_port->regs->axi.ctrl.master_rctl = ®s->axi.ctrl.master_rctl; + pcie_port->regs->axi.ctrl.master_ctl = ®s->axi.ctrl.master_ctl; pcie_port->regs->axi.ctrl.master_arctl = ®s->axi.ctrl.master_arctl; pcie_port->regs->axi.ctrl.master_awctl = ®s->axi.ctrl.master_awctl; pcie_port->regs->axi.ctrl.slv_ctl = ®s->axi.ctrl.slv_ctl; @@ -1159,6 +1150,13 @@ al_pcie_port_handle_init( pcie_port->regs->axi.ob_ctrl.io_start_h = ®s->axi.ob_ctrl.io_start_h; pcie_port->regs->axi.ob_ctrl.io_limit_l = ®s->axi.ob_ctrl.io_limit_l; pcie_port->regs->axi.ob_ctrl.io_limit_h = ®s->axi.ob_ctrl.io_limit_h; + pcie_port->regs->axi.ob_ctrl.io_addr_mask_h = ®s->axi.ob_ctrl.io_addr_mask_h; + pcie_port->regs->axi.ob_ctrl.ar_msg_addr_mask_h = ®s->axi.ob_ctrl.ar_msg_addr_mask_h; + pcie_port->regs->axi.ob_ctrl.aw_msg_addr_mask_h = ®s->axi.ob_ctrl.aw_msg_addr_mask_h; + pcie_port->regs->axi.ob_ctrl.tgtid_reg_ovrd = ®s->axi.ob_ctrl.tgtid_reg_ovrd; + pcie_port->regs->axi.ob_ctrl.addr_high_reg_ovrd_sel = ®s->axi.ob_ctrl.addr_high_reg_ovrd_sel; + pcie_port->regs->axi.ob_ctrl.addr_high_reg_ovrd_value = ®s->axi.ob_ctrl.addr_high_reg_ovrd_value; + pcie_port->regs->axi.ob_ctrl.addr_size_replace = ®s->axi.ob_ctrl.addr_size_replace; pcie_port->regs->axi.pcie_global.conf = ®s->axi.pcie_global.conf; pcie_port->regs->axi.conf.zero_lane0 = ®s->axi.conf.zero_lane0; pcie_port->regs->axi.conf.zero_lane1 = ®s->axi.conf.zero_lane1; @@ -1213,9 +1211,17 @@ al_pcie_port_handle_init( pcie_port->regs->app.debug = ®s->app.debug; for (i = 0; i < AL_MAX_NUM_OF_PFS; i++) { + pcie_port->regs->app.soc_int[i].status_0 = ®s->app.soc_int_per_func[i].status_0; + pcie_port->regs->app.soc_int[i].status_1 = ®s->app.soc_int_per_func[i].status_1; + pcie_port->regs->app.soc_int[i].status_2 = ®s->app.soc_int_per_func[i].status_2; + pcie_port->regs->app.soc_int[i].status_3 = ®s->app.soc_int_per_func[i].status_3; pcie_port->regs->app.soc_int[i].mask_inta_leg_0 = ®s->app.soc_int_per_func[i].mask_inta_leg_0; + pcie_port->regs->app.soc_int[i].mask_inta_leg_1 = ®s->app.soc_int_per_func[i].mask_inta_leg_1; + pcie_port->regs->app.soc_int[i].mask_inta_leg_2 = ®s->app.soc_int_per_func[i].mask_inta_leg_2; pcie_port->regs->app.soc_int[i].mask_inta_leg_3 = ®s->app.soc_int_per_func[i].mask_inta_leg_3; pcie_port->regs->app.soc_int[i].mask_msi_leg_0 = ®s->app.soc_int_per_func[i].mask_msi_leg_0; + pcie_port->regs->app.soc_int[i].mask_msi_leg_1 = ®s->app.soc_int_per_func[i].mask_msi_leg_1; + pcie_port->regs->app.soc_int[i].mask_msi_leg_2 = ®s->app.soc_int_per_func[i].mask_msi_leg_2; pcie_port->regs->app.soc_int[i].mask_msi_leg_3 = ®s->app.soc_int_per_func[i].mask_msi_leg_3; } @@ -1224,6 +1230,7 @@ al_pcie_port_handle_init( pcie_port->regs->app.parity = ®s->app.parity; pcie_port->regs->app.atu.in_mask_pair = regs->app.atu.in_mask_pair; pcie_port->regs->app.atu.out_mask_pair = regs->app.atu.out_mask_pair; + pcie_port->regs->app.cfg_func_ext = ®s->app.cfg_func_ext; for (i = 0; i < AL_MAX_NUM_OF_PFS; i++) pcie_port->regs->app.status_per_func[i] = ®s->app.status_per_func[i]; @@ -1260,6 +1267,10 @@ al_pcie_port_handle_init( /* set maximum number of physical functions */ pcie_port->max_num_of_pfs = al_pcie_port_max_num_of_pfs_get(pcie_port); + /* Clear 'nof_p_hdr' & 'nof_np_hdr' to later know if they where changed by the user */ + pcie_port->ib_hcrd_config.nof_np_hdr = 0; + pcie_port->ib_hcrd_config.nof_p_hdr = 0; + al_dbg("pcie port handle initialized. port id: %d, rev_id %d, regs base %p\n", port_id, pcie_port->rev_id, pcie_reg_base); return 0; @@ -1294,6 +1305,12 @@ al_pcie_pf_handle_init( return 0; } +/** Get port revision ID */ +int al_pcie_port_rev_id_get(struct al_pcie_port *pcie_port) +{ + return pcie_port->rev_id; +} + /************************** Pre PCIe Port Enable API **************************/ /** configure pcie operating mode (root complex or endpoint) */ @@ -1346,7 +1363,7 @@ al_pcie_port_operating_mode_config( "EndPoint" : "Root Complex"); return 0; } - al_info("PCIe %d: set operating mode to %s\n", + al_dbg("PCIe %d: set operating mode to %s\n", pcie_port->port_id, (mode == AL_PCIE_OPERATING_MODE_EP) ? "EndPoint" : "Root Complex"); AL_REG_FIELD_SET(reg, PCIE_AXI_MISC_PCIE_GLOBAL_CONF_DEV_TYPE_MASK, @@ -1362,6 +1379,7 @@ int al_pcie_port_max_lanes_set(struct al_pcie_port *pcie_port, uint8_t lanes) { struct al_pcie_regs *regs = pcie_port->regs; + uint32_t active_lanes_val; if (al_pcie_port_is_enabled(pcie_port)) { al_err("PCIe %d: already enabled, cannot set max lanes\n", @@ -1370,7 +1388,7 @@ al_pcie_port_max_lanes_set(struct al_pci } /* convert to bitmask format (4 ->'b1111, 2 ->'b11, 1 -> 'b1) */ - uint32_t active_lanes_val = AL_PCIE_PARSE_LANES(lanes); + active_lanes_val = AL_PCIE_PARSE_LANES(lanes); al_reg_write32_masked(regs->axi.pcie_global.conf, (pcie_port->rev_id == AL_PCIE_REV_ID_3) ? @@ -1387,11 +1405,7 @@ al_pcie_port_max_num_of_pfs_set( struct al_pcie_port *pcie_port, uint8_t max_num_of_pfs) { - if (al_pcie_port_is_enabled(pcie_port)) { - al_err("PCIe %d: already enabled, cannot set max num of PFs\n", - pcie_port->port_id); - return -EINVAL; - } + struct al_pcie_regs *regs = pcie_port->regs; if (pcie_port->rev_id == AL_PCIE_REV_ID_3) al_assert(max_num_of_pfs <= REV3_MAX_NUM_OF_PFS); @@ -1400,6 +1414,33 @@ al_pcie_port_max_num_of_pfs_set( pcie_port->max_num_of_pfs = max_num_of_pfs; + if (al_pcie_port_is_enabled(pcie_port) && (pcie_port->rev_id == AL_PCIE_REV_ID_3)) { + enum al_pcie_operating_mode op_mode = al_pcie_operating_mode_get(pcie_port); + + al_bool is_multi_pf = + ((op_mode == AL_PCIE_OPERATING_MODE_EP) && (pcie_port->max_num_of_pfs > 1)); + + /* Set maximum physical function numbers */ + al_reg_write32_masked( + ®s->port_regs->timer_ctrl_max_func_num, + PCIE_PORT_GEN3_MAX_FUNC_NUM, + pcie_port->max_num_of_pfs - 1); + + al_pcie_port_wr_to_ro_set(pcie_port, AL_TRUE); + + /** + * in EP mode, when we have more than 1 PF we need to assert + * multi-pf support so the host scan all PFs + */ + al_reg_write32_masked((uint32_t __iomem *) + (®s->core_space[0].config_header[0] + + (PCIE_BIST_HEADER_TYPE_BASE >> 2)), + PCIE_BIST_HEADER_TYPE_MULTI_FUNC_MASK, + is_multi_pf ? PCIE_BIST_HEADER_TYPE_MULTI_FUNC_MASK : 0); + + al_pcie_port_wr_to_ro_set(pcie_port, AL_FALSE); + } + return 0; } @@ -1503,6 +1544,28 @@ al_pcie_operating_mode_get( return AL_PCIE_OPERATING_MODE_UNKNOWN; } +/* PCIe AXI quality of service configuration */ +void al_pcie_axi_qos_config( + struct al_pcie_port *pcie_port, + unsigned int arqos, + unsigned int awqos) +{ + struct al_pcie_regs *regs = pcie_port->regs; + + al_assert(pcie_port); + al_assert(arqos <= PCIE_AXI_CTRL_MASTER_ARCTL_ARQOS_VAL_MAX); + al_assert(awqos <= PCIE_AXI_CTRL_MASTER_AWCTL_AWQOS_VAL_MAX); + + al_reg_write32_masked( + regs->axi.ctrl.master_arctl, + PCIE_AXI_CTRL_MASTER_ARCTL_ARQOS_MASK, + arqos << PCIE_AXI_CTRL_MASTER_ARCTL_ARQOS_SHIFT); + al_reg_write32_masked( + regs->axi.ctrl.master_awctl, + PCIE_AXI_CTRL_MASTER_AWCTL_AWQOS_MASK, + awqos << PCIE_AXI_CTRL_MASTER_AWCTL_AWQOS_SHIFT); +} + /**************************** PCIe Port Enable API ****************************/ /** Enable PCIe port (deassert reset) */ @@ -1518,17 +1581,19 @@ al_pcie_port_enable(struct al_pcie_port /** * Set inbound header credit and outstanding outbound reads defaults + * if the port initiator doesn't set it. * Must be called before port enable (PCIE_EXIST) */ - al_pcie_ib_hcrd_os_ob_reads_config_default(pcie_port); + if ((pcie_port->ib_hcrd_config.nof_np_hdr == 0) || + (pcie_port->ib_hcrd_config.nof_p_hdr == 0)) + al_pcie_ib_hcrd_os_ob_reads_config_default(pcie_port); /* * Disable ATS capability * - must be done before core reset deasserted * - rev_id 0 - no effect, but no harm */ - if ((pcie_port->rev_id == AL_PCIE_REV_ID_0) || - (pcie_port->rev_id == AL_PCIE_REV_ID_1) || *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Sep 6 15:06:09 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 800E8B9672B; Tue, 6 Sep 2016 15:06:09 +0000 (UTC) (envelope-from wma@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 500667F9; Tue, 6 Sep 2016 15:06:09 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86F68I6087295; Tue, 6 Sep 2016 15:06:08 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86F68W0087294; Tue, 6 Sep 2016 15:06:08 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609061506.u86F68W0087294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 6 Sep 2016 15:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305478 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 15:06:09 -0000 Author: wma Date: Tue Sep 6 15:06:08 2016 New Revision: 305478 URL: https://svnweb.freebsd.org/changeset/base/305478 Log: Remove check for 64-bit FDT ranges in pci-host-generic This allows 32-bit platforms to use pci-host-generic. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: wma Differential Revision: https://reviews.freebsd.org/D7560 Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Tue Sep 6 14:59:13 2016 (r305477) +++ head/sys/dev/pci/pci_host_generic.c Tue Sep 6 15:06:08 2016 (r305478) @@ -281,7 +281,7 @@ parse_pci_mem_ranges(struct generic_pcie OF_getencprop(OF_parent(node), "#address-cells", &parent_addr_cells, sizeof(parent_addr_cells)); - if (parent_addr_cells != 2 || pci_addr_cells != 3 || size_cells != 2) { + if (parent_addr_cells > 2 || pci_addr_cells != 3 || size_cells > 2) { device_printf(sc->dev, "Unexpected number of address or size cells in FDT\n"); return (ENXIO); From owner-svn-src-head@freebsd.org Tue Sep 6 15:11: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 5E6FEB9691F; Tue, 6 Sep 2016 15:11:38 +0000 (UTC) (envelope-from wma@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 2F575B04; Tue, 6 Sep 2016 15:11:38 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86FBbY5091032; Tue, 6 Sep 2016 15:11:37 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86FBbgs091031; Tue, 6 Sep 2016 15:11:37 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609061511.u86FBbgs091031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 6 Sep 2016 15:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305479 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 15:11:38 -0000 Author: wma Date: Tue Sep 6 15:11:37 2016 New Revision: 305479 URL: https://svnweb.freebsd.org/changeset/base/305479 Log: Import missing enum declaration in pci_host_generic header file Other files including pci_host_generic.h failed to compile due to missing declaration of enum pci_id_type. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: wma Differential Revision: https://reviews.freebsd.org/D7561 Modified: head/sys/dev/pci/pci_host_generic.h Modified: head/sys/dev/pci/pci_host_generic.h ============================================================================== --- head/sys/dev/pci/pci_host_generic.h Tue Sep 6 15:06:08 2016 (r305478) +++ head/sys/dev/pci/pci_host_generic.h Tue Sep 6 15:11:37 2016 (r305479) @@ -34,6 +34,8 @@ #ifndef __PCI_HOST_GENERIC_H_ #define __PCI_HOST_GENERIC_H_ +#include "pci_if.h" + #define MAX_RANGES_TUPLES 16 #define MIN_RANGES_TUPLES 2 From owner-svn-src-head@freebsd.org Tue Sep 6 15:17: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 C4DA6B96A97; Tue, 6 Sep 2016 15:17:36 +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 7E471F1D; Tue, 6 Sep 2016 15:17:36 +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 u86FHZBd091256; Tue, 6 Sep 2016 15:17:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86FHZZg091253; Tue, 6 Sep 2016 15:17:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201609061517.u86FHZZg091253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 6 Sep 2016 15:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305480 - in head: lib/libstand sys/ufs/ffs sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 15:17:36 -0000 Author: imp Date: Tue Sep 6 15:17:35 2016 New Revision: 305480 URL: https://svnweb.freebsd.org/changeset/base/305480 Log: Renumber the advertising clause. Modified: head/lib/libstand/ufs.c head/sys/ufs/ffs/fs.h head/sys/ufs/ufs/dir.h Modified: head/lib/libstand/ufs.c ============================================================================== --- head/lib/libstand/ufs.c Tue Sep 6 15:11:37 2016 (r305479) +++ head/lib/libstand/ufs.c Tue Sep 6 15:17:35 2016 (r305480) @@ -24,7 +24,7 @@ * 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. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Tue Sep 6 15:11:37 2016 (r305479) +++ head/sys/ufs/ffs/fs.h Tue Sep 6 15:17:35 2016 (r305480) @@ -10,7 +10,7 @@ * 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. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: head/sys/ufs/ufs/dir.h ============================================================================== --- head/sys/ufs/ufs/dir.h Tue Sep 6 15:11:37 2016 (r305479) +++ head/sys/ufs/ufs/dir.h Tue Sep 6 15:17:35 2016 (r305480) @@ -15,7 +15,7 @@ * 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. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * From owner-svn-src-head@freebsd.org Tue Sep 6 17:17: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 D2586BC6B3C; Tue, 6 Sep 2016 17:17:00 +0000 (UTC) (envelope-from mjg@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 A18A1B56; Tue, 6 Sep 2016 17:17:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86HGxLo037386; Tue, 6 Sep 2016 17:16:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86HGxvm037385; Tue, 6 Sep 2016 17:16:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609061716.u86HGxvm037385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 6 Sep 2016 17:16:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305482 - 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.23 Precedence: list List-Id: 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, 06 Sep 2016 17:17:00 -0000 Author: mjg Date: Tue Sep 6 17:16:59 2016 New Revision: 305482 URL: https://svnweb.freebsd.org/changeset/base/305482 Log: cv: do a lockless check for no waiters in cv_signal and cv_broadcastpri In case of some consumers like zfs there are no waiters vast majority of the time Reviewed by: jhb MFC after: 1 week Modified: head/sys/kern/kern_condvar.c Modified: head/sys/kern/kern_condvar.c ============================================================================== --- head/sys/kern/kern_condvar.c Tue Sep 6 17:08:31 2016 (r305481) +++ head/sys/kern/kern_condvar.c Tue Sep 6 17:16:59 2016 (r305482) @@ -397,6 +397,8 @@ cv_signal(struct cv *cvp) { int wakeup_swapper; + if (cvp->cv_waiters == 0) + return; wakeup_swapper = 0; sleepq_lock(cvp); if (cvp->cv_waiters > 0) { @@ -424,6 +426,8 @@ cv_broadcastpri(struct cv *cvp, int pri) { int wakeup_swapper; + if (cvp->cv_waiters == 0) + return; /* * XXX sleepq_broadcast pri argument changed from -1 meaning * no pri to 0 meaning no pri. From owner-svn-src-head@freebsd.org Tue Sep 6 17:22:26 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 F259CBC711C; Tue, 6 Sep 2016 17:22:26 +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 AB1BE362; Tue, 6 Sep 2016 17:22:26 +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 u86HMPvL041053; Tue, 6 Sep 2016 17:22:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86HMPNc041047; Tue, 6 Sep 2016 17:22:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201609061722.u86HMPNc041047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 6 Sep 2016 17:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305483 - in head/contrib/netbsd-tests/kernel/kqueue: . read X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 17:22:27 -0000 Author: ngie Date: Tue Sep 6 17:22:25 2016 New Revision: 305483 URL: https://svnweb.freebsd.org/changeset/base/305483 Log: Fix tests/sys/kqueue NetBSD tests on 32-bit platforms by using proper format specifier for pointers when printing them out with printf(3) MFC after: 57 days Pointyhat to: ngie Reported by: bz, cy, Jenkins (i386 job) Submitted by: cy Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c head/contrib/netbsd-tests/kernel/kqueue/read/t_file.c head/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c head/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c head/contrib/netbsd-tests/kernel/kqueue/t_sig.c Modified: head/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c Tue Sep 6 17:22:25 2016 (r305483) @@ -78,7 +78,11 @@ ATF_TC_BODY(fifo, tc) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, " +#ifdef __FreeBSD__ + "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags, +#else "data: %" PRId64 "\n", n, event[0].filter, event[0].flags, +#endif event[0].fflags, event[0].data); ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ); Modified: head/contrib/netbsd-tests/kernel/kqueue/read/t_file.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/read/t_file.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/read/t_file.c Tue Sep 6 17:22:25 2016 (r305483) @@ -111,7 +111,11 @@ ATF_TC_BODY(file, tc) num += n; (void)printf("kevent num %d flags: %#x, fflags: %#x, data: " +#ifdef __FreeBSD__ + "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags, +#else "%" PRId64 "\n", n, event[0].flags, event[0].fflags, +#endif event[0].data); if (event[0].data < 0) Modified: head/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c Tue Sep 6 17:22:25 2016 (r305483) @@ -67,7 +67,11 @@ ATF_TC_BODY(pipe, tc) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d flags: %#x, fflags: %#x, data: " +#ifdef __FreeBSD__ + "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags, event[0].data); +#else "%" PRId64 "\n", n, event[0].flags, event[0].fflags, event[0].data); +#endif RL(n = read(fds[0], buffer, event[0].data)); buffer[n] = '\0'; Modified: head/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c Tue Sep 6 17:22:25 2016 (r305483) @@ -103,7 +103,11 @@ h_check(bool check_master) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, " +#ifdef __FreeBSD__ + "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags, +#else "data: %" PRId64 "\n", n, event[0].filter, event[0].flags, +#endif event[0].fflags, event[0].data); ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ); Modified: head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/t_proc1.c Tue Sep 6 17:22:25 2016 (r305483) @@ -139,7 +139,11 @@ ATF_TC_BODY(proc1, tc) printf(" NOTE_FORK"); } if (event[0].fflags & NOTE_CHILD) +#ifdef __FreeBSD__ + printf(" NOTE_CHILD, parent = %" PRIdPTR, event[0].data); +#else printf(" NOTE_CHILD, parent = %" PRId64, event[0].data); +#endif printf("\n"); } Modified: head/contrib/netbsd-tests/kernel/kqueue/t_sig.c ============================================================================== --- head/contrib/netbsd-tests/kernel/kqueue/t_sig.c Tue Sep 6 17:16:59 2016 (r305482) +++ head/contrib/netbsd-tests/kernel/kqueue/t_sig.c Tue Sep 6 17:22:25 2016 (r305483) @@ -130,7 +130,11 @@ ATF_TC_BODY(sig, tc) if (n == 0) continue; +#ifdef __FreeBSD__ + (void)printf("sig: kevent flags: 0x%x, data: %" PRIdPTR " (# " +#else (void)printf("sig: kevent flags: 0x%x, data: %" PRId64 " (# " +#endif "times signal posted)\n", event[0].flags, event[0].data); } From owner-svn-src-head@freebsd.org Tue Sep 6 17:58:59 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 CEEE4BC6096; Tue, 6 Sep 2016 17:58:59 +0000 (UTC) (envelope-from will@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 9B34FD22; Tue, 6 Sep 2016 17:58:59 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86HwwHI053264; Tue, 6 Sep 2016 17:58:58 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86HwwR0053263; Tue, 6 Sep 2016 17:58:58 GMT (envelope-from will@FreeBSD.org) Message-Id: <201609061758.u86HwwR0053263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Tue, 6 Sep 2016 17:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305484 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 17:58:59 -0000 Author: will Date: Tue Sep 6 17:58:58 2016 New Revision: 305484 URL: https://svnweb.freebsd.org/changeset/base/305484 Log: loader.efi: Bump the staging size to 64M. This is required on my system, which loads nvidia, vmm, and zfs, and 48M is no longer enough for that. nvidia-driver's recent update increased its size by several megabytes. Reviewed by: jhb MFC after: 1 week Modified: head/sys/boot/efi/loader/copy.c Modified: head/sys/boot/efi/loader/copy.c ============================================================================== --- head/sys/boot/efi/loader/copy.c Tue Sep 6 17:22:25 2016 (r305483) +++ head/sys/boot/efi/loader/copy.c Tue Sep 6 17:58:58 2016 (r305484) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" #ifndef EFI_STAGING_SIZE -#define EFI_STAGING_SIZE 48 +#define EFI_STAGING_SIZE 64 #endif #define STAGE_PAGES EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024) From owner-svn-src-head@freebsd.org Tue Sep 6 18:53: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 8A03CBC7815; Tue, 6 Sep 2016 18:53:18 +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 3EFAAAFF; Tue, 6 Sep 2016 18:53:18 +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 u86IrHNe076296; Tue, 6 Sep 2016 18:53:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86IrHdU076294; Tue, 6 Sep 2016 18:53:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609061853.u86IrHdU076294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Sep 2016 18:53:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305485 - head/sys/amd64/vmm/io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 18:53:18 -0000 Author: jhb Date: Tue Sep 6 18:53:17 2016 New Revision: 305485 URL: https://svnweb.freebsd.org/changeset/base/305485 Log: Leave ppt devices in the host domain when they are not attached to a VM. This allows a pass through device to be reset to a normal device driver on the host and reused on the host. ppt devices are now always active in some I/O MMU domain when the I/O MMU is active, either the host domain or the domain of a VM they are attached to. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7666 Modified: head/sys/amd64/vmm/io/iommu.c head/sys/amd64/vmm/io/ppt.c Modified: head/sys/amd64/vmm/io/iommu.c ============================================================================== --- head/sys/amd64/vmm/io/iommu.c Tue Sep 6 17:58:58 2016 (r305484) +++ head/sys/amd64/vmm/io/iommu.c Tue Sep 6 18:53:17 2016 (r305485) @@ -158,7 +158,6 @@ iommu_init(void) { int error, bus, slot, func; vm_paddr_t maxaddr; - const char *name; device_t dev; if (!iommu_enable) @@ -203,12 +202,7 @@ iommu_init(void) if (dev == NULL) continue; - /* skip passthrough devices */ - name = device_get_name(dev); - if (name != NULL && strcmp(name, "ppt") == 0) - continue; - - /* everything else belongs to the host domain */ + /* Everything belongs to the host domain. */ iommu_add_device(host_domain, pci_get_rid(dev)); } Modified: head/sys/amd64/vmm/io/ppt.c ============================================================================== --- head/sys/amd64/vmm/io/ppt.c Tue Sep 6 17:58:58 2016 (r305484) +++ head/sys/amd64/vmm/io/ppt.c Tue Sep 6 18:53:17 2016 (r305485) @@ -363,6 +363,7 @@ ppt_assign_device(struct vm *vm, int bus return (EBUSY); ppt->vm = vm; + iommu_remove_device(iommu_host_domain(), pci_get_rid(ppt->dev)); iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); return (0); } @@ -385,6 +386,7 @@ ppt_unassign_device(struct vm *vm, int b ppt_teardown_msi(ppt); ppt_teardown_msix(ppt); iommu_remove_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); + iommu_add_device(iommu_host_domain(), pci_get_rid(ppt->dev)); ppt->vm = NULL; return (0); } From owner-svn-src-head@freebsd.org Tue Sep 6 19:00:39 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 1BD4FBC79B8; Tue, 6 Sep 2016 19:00:39 +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 C6607DD3; Tue, 6 Sep 2016 19:00:38 +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 u86J0bgj076629; Tue, 6 Sep 2016 19:00:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86J0bd4076628; Tue, 6 Sep 2016 19:00:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609061900.u86J0bd4076628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 6 Sep 2016 19:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305486 - head/usr.bin/bsdiff/bspatch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 19:00:39 -0000 Author: emaste Date: Tue Sep 6 19:00:37 2016 New Revision: 305486 URL: https://svnweb.freebsd.org/changeset/base/305486 Log: bspatch: add sanity checks on sizes to avoid integer overflow Note that this introduces an explicit 2GB limit, but this was already implicit in variable and function argument types. This is based on the "non-cryptanalytic attacks against freebsd update components" anonymous gist. Further refinement is planned. Reviewed by: allanjude, cem, kib Obtained from: anonymous gist MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7619 Modified: head/usr.bin/bsdiff/bspatch/bspatch.c Modified: head/usr.bin/bsdiff/bspatch/bspatch.c ============================================================================== --- head/usr.bin/bsdiff/bspatch/bspatch.c Tue Sep 6 18:53:17 2016 (r305485) +++ head/usr.bin/bsdiff/bspatch/bspatch.c Tue Sep 6 19:00:37 2016 (r305486) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -98,8 +99,8 @@ int main(int argc, char *argv[]) char *directory, *namebuf; int cbz2err, dbz2err, ebz2err; int newfd, oldfd; - ssize_t oldsize, newsize; - ssize_t bzctrllen, bzdatalen; + off_t oldsize, newsize; + off_t bzctrllen, bzdatalen; u_char header[32], buf[8]; u_char *old, *new; off_t oldpos, newpos; @@ -194,7 +195,9 @@ int main(int argc, char *argv[]) bzctrllen = offtin(header + 8); bzdatalen = offtin(header + 16); newsize = offtin(header + 24); - if ((bzctrllen < 0) || (bzdatalen < 0) || (newsize < 0)) + if (bzctrllen < 0 || bzctrllen > OFF_MAX - 32 || + bzdatalen < 0 || bzctrllen + 32 > OFF_MAX - bzdatalen || + newsize < 0 || newsize > SSIZE_MAX) errx(1, "Corrupt patch\n"); /* Close patch file and re-open it via libbzip2 at the right places */ @@ -217,12 +220,13 @@ int main(int argc, char *argv[]) errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err); if ((oldsize = lseek(oldfd, 0, SEEK_END)) == -1 || - (old = malloc(oldsize+1)) == NULL || + oldsize > SSIZE_MAX || + (old = malloc(oldsize)) == NULL || lseek(oldfd, 0, SEEK_SET) != 0 || read(oldfd, old, oldsize) != oldsize || close(oldfd) == -1) err(1, "%s", argv[1]); - if ((new = malloc(newsize + 1)) == NULL) + if ((new = malloc(newsize)) == NULL) err(1, NULL); oldpos = 0; @@ -238,7 +242,8 @@ int main(int argc, char *argv[]) } /* Sanity-check */ - if ((ctrl[0] < 0) || (ctrl[1] < 0)) + if (ctrl[0] < 0 || ctrl[0] > INT_MAX || + ctrl[1] < 0 || ctrl[1] > INT_MAX) errx(1, "Corrupt patch\n"); /* Sanity-check */ From owner-svn-src-head@freebsd.org Tue Sep 6 19:25: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 3F0B4BC616D; Tue, 6 Sep 2016 19:25:34 +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 F3ED3BA; Tue, 6 Sep 2016 19:25:33 +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 u86JPXkc088201; Tue, 6 Sep 2016 19:25:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86JPWFH088196; Tue, 6 Sep 2016 19:25:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609061925.u86JPWFH088196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Sep 2016 19:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305489 - in head/sys: amd64/amd64 amd64/conf conf x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 19:25:34 -0000 Author: jhb Date: Tue Sep 6 19:25:32 2016 New Revision: 305489 URL: https://svnweb.freebsd.org/changeset/base/305489 Log: Remove remnants of PERFMON and I586_PMC_GUPROF from amd64. These options were never fully ported over from i386. Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/prof_machdep.c head/sys/amd64/conf/NOTES head/sys/conf/options.amd64 head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Sep 6 19:18:50 2016 (r305488) +++ head/sys/amd64/amd64/machdep.c Tue Sep 6 19:25:32 2016 (r305489) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include "opt_kstack_pages.h" #include "opt_maxmem.h" #include "opt_mp_watchdog.h" -#include "opt_perfmon.h" #include "opt_platform.h" #include "opt_sched.h" @@ -125,9 +124,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef PERFMON -#include -#endif #include #ifdef SMP #include @@ -274,9 +270,6 @@ cpu_startup(dummy) startrtclock(); printcpuinfo(); panicifcpuunsupported(); -#ifdef PERFMON - perfmon_init(); -#endif /* * Display physical memory if SMBIOS reports reasonable amount. Modified: head/sys/amd64/amd64/prof_machdep.c ============================================================================== --- head/sys/amd64/amd64/prof_machdep.c Tue Sep 6 19:18:50 2016 (r305488) +++ head/sys/amd64/amd64/prof_machdep.c Tue Sep 6 19:25:32 2016 (r305489) @@ -28,10 +28,6 @@ __FBSDID("$FreeBSD$"); #ifdef GUPROF -#if 0 -#include "opt_i586_guprof.h" -#include "opt_perfmon.h" -#endif #include #include @@ -44,25 +40,16 @@ __FBSDID("$FreeBSD$"); #include #include -#if 0 -#include -#endif #include #define CPUTIME_CLOCK_UNINITIALIZED 0 #define CPUTIME_CLOCK_I8254 1 #define CPUTIME_CLOCK_TSC 2 -#define CPUTIME_CLOCK_I586_PMC 3 #define CPUTIME_CLOCK_I8254_SHIFT 7 int cputime_bias = 1; /* initialize for locality of reference */ static int cputime_clock = CPUTIME_CLOCK_UNINITIALIZED; -#if defined(PERFMON) && defined(I586_PMC_GUPROF) -static u_int cputime_clock_pmc_conf = I586_PMC_GUPROF; -static int cputime_clock_pmc_init; -static struct gmonparam saved_gmp; -#endif static int cputime_prof_active; #endif /* GUPROF */ @@ -198,9 +185,6 @@ cputime() { u_int count; int delta; -#if defined(PERFMON) && defined(I586_PMC_GUPROF) && !defined(SMP) - u_quad_t event_count; -#endif u_char high, low; static u_int prev_count; @@ -217,21 +201,6 @@ cputime() prev_count = count; return (delta); } -#if defined(PERFMON) && defined(I586_PMC_GUPROF) && !defined(SMP) - if (cputime_clock == CPUTIME_CLOCK_I586_PMC) { - /* - * XXX permon_read() should be inlined so that the - * perfmon module doesn't need to be compiled with - * profiling disabled and so that it is fast. - */ - perfmon_read(0, &event_count); - - count = (u_int)event_count; - delta = (int)(count - prev_count); - prev_count = count; - return (delta); - } -#endif /* PERFMON && I586_PMC_GUPROF && !SMP */ /* * Read the current value of the 8254 timer counter 0. @@ -262,39 +231,13 @@ sysctl_machdep_cputime_clock(SYSCTL_HAND { int clock; int error; -#if defined(PERFMON) && defined(I586_PMC_GUPROF) - int event; - struct pmc pmc; -#endif clock = cputime_clock; -#if defined(PERFMON) && defined(I586_PMC_GUPROF) - if (clock == CPUTIME_CLOCK_I586_PMC) { - pmc.pmc_val = cputime_clock_pmc_conf; - clock += pmc.pmc_event; - } -#endif error = sysctl_handle_opaque(oidp, &clock, sizeof clock, req); if (error == 0 && req->newptr != NULL) { -#if defined(PERFMON) && defined(I586_PMC_GUPROF) - if (clock >= CPUTIME_CLOCK_I586_PMC) { - event = clock - CPUTIME_CLOCK_I586_PMC; - if (event >= 256) - return (EINVAL); - pmc.pmc_num = 0; - pmc.pmc_event = event; - pmc.pmc_unit = 0; - pmc.pmc_flags = PMCF_E | PMCF_OS | PMCF_USR; - pmc.pmc_mask = 0; - cputime_clock_pmc_conf = pmc.pmc_val; - cputime_clock = CPUTIME_CLOCK_I586_PMC; - } else -#endif - { - if (clock < 0 || clock >= CPUTIME_CLOCK_I586_PMC) - return (EINVAL); - cputime_clock = clock; - } + if (clock < 0 || clock > CPUTIME_CLOCK_TSC) + return (EINVAL); + cputime_clock = clock; } return (error); } @@ -325,32 +268,6 @@ startguprof(gp) cputime_prof_active = 1; } else gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT; -#if defined(PERFMON) && defined(I586_PMC_GUPROF) - if (cputime_clock == CPUTIME_CLOCK_I586_PMC) { - if (perfmon_avail() && - perfmon_setup(0, cputime_clock_pmc_conf) == 0) { - if (perfmon_start(0) != 0) - perfmon_fini(0); - else { - /* XXX 1 event == 1 us. */ - gp->profrate = 1000000; - - saved_gmp = *gp; - - /* Zap overheads. They are invalid. */ - gp->cputime_overhead = 0; - gp->mcount_overhead = 0; - gp->mcount_post_overhead = 0; - gp->mcount_pre_overhead = 0; - gp->mexitcount_overhead = 0; - gp->mexitcount_post_overhead = 0; - gp->mexitcount_pre_overhead = 0; - - cputime_clock_pmc_init = TRUE; - } - } - } -#endif /* PERFMON && I586_PMC_GUPROF */ cputime_bias = 0; cputime(); } @@ -359,13 +276,6 @@ void stopguprof(gp) struct gmonparam *gp; { -#if defined(PERFMON) && defined(I586_PMC_GUPROF) - if (cputime_clock_pmc_init) { - *gp = saved_gmp; - perfmon_fini(0); - cputime_clock_pmc_init = FALSE; - } -#endif if (cputime_clock == CPUTIME_CLOCK_TSC) cputime_prof_active = 0; } Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Tue Sep 6 19:18:50 2016 (r305488) +++ head/sys/amd64/conf/NOTES Tue Sep 6 19:25:32 2016 (r305489) @@ -73,12 +73,6 @@ cpu HAMMER # aka K8, aka Opteron & At # Options for CPU features. # -# -# PERFMON causes the driver for Pentium/Pentium Pro performance counters -# to be compiled. See perfmon(4) for more information. -# -#XXX#options PERFMON - ##################################################################### # NETWORKING OPTIONS Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Tue Sep 6 19:18:50 2016 (r305488) +++ head/sys/conf/options.amd64 Tue Sep 6 19:25:32 2016 (r305489) @@ -6,7 +6,6 @@ AUTO_EOI_2 opt_auto_eoi.h COUNT_XINVLTLB_HITS opt_smp.h COUNT_IPIS opt_smp.h MAXMEM -PERFMON MPTABLE_FORCE_HTT MP_WATCHDOG NKPT opt_pmap.h Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Tue Sep 6 19:18:50 2016 (r305488) +++ head/sys/x86/x86/cpu_machdep.c Tue Sep 6 19:25:32 2016 (r305489) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include "opt_kstack_pages.h" #include "opt_maxmem.h" #include "opt_mp_watchdog.h" -#include "opt_perfmon.h" #include "opt_platform.h" #ifdef __i386__ #include "opt_npx.h" @@ -83,9 +82,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef PERFMON -#include -#endif #include #ifdef SMP #include From owner-svn-src-head@freebsd.org Tue Sep 6 19:36: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 111C4BC6615; Tue, 6 Sep 2016 19:36:30 +0000 (UTC) (envelope-from gonzo@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 CD43BCC0; Tue, 6 Sep 2016 19:36:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86JaSSk092151; Tue, 6 Sep 2016 19:36:28 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86JaSBU092150; Tue, 6 Sep 2016 19:36:28 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201609061936.u86JaSBU092150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 6 Sep 2016 19:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305492 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 19:36:30 -0000 Author: gonzo Date: Tue Sep 6 19:36:28 2016 New Revision: 305492 URL: https://svnweb.freebsd.org/changeset/base/305492 Log: Let knlist_add do the locking part Remove explicit mtx_lock/mtx_unlock around knlist_add and pass 0 as locked parameter so knlist_add does the locking itself Suggested by: kib@ Modified: head/sys/arm/ti/ti_pruss.c Modified: head/sys/arm/ti/ti_pruss.c ============================================================================== --- head/sys/arm/ti/ti_pruss.c Tue Sep 6 19:29:14 2016 (r305491) +++ head/sys/arm/ti/ti_pruss.c Tue Sep 6 19:36:28 2016 (r305492) @@ -310,9 +310,7 @@ ti_pruss_kqfilter(struct cdev *cdev, str case EVFILT_READ: kn->kn_hook = sc; kn->kn_fop = &ti_pruss_kq_read; - mtx_lock(&sc->sc_mtx); - knlist_add(&sc->sc_selinfo.si_note, kn, 1); - mtx_unlock(&sc->sc_mtx); + knlist_add(&sc->sc_selinfo.si_note, kn, 0); break; default: return (EINVAL); From owner-svn-src-head@freebsd.org Tue Sep 6 20:17: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 C93C1BC79E1; Tue, 6 Sep 2016 20:17:55 +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 A03C999; Tue, 6 Sep 2016 20:17:55 +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 u86KHsjr007921; Tue, 6 Sep 2016 20:17:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86KHsZX007917; Tue, 6 Sep 2016 20:17:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609062017.u86KHsZX007917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Sep 2016 20:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305497 - in head: share/man/man9 sys/amd64/vmm/io sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 20:17:55 -0000 Author: jhb Date: Tue Sep 6 20:17:54 2016 New Revision: 305497 URL: https://svnweb.freebsd.org/changeset/base/305497 Log: Update the I/O MMU in bhyve when PCI devices are added and removed. When the I/O MMU is active in bhyve, all PCI devices need valid entries in the DMAR context tables. The I/O MMU code does a single enumeration of the available PCI devices during initialization to add all existing devices to a domain representing the host. The ppt(4) driver then moves pass through devices in and out of domains for virtual machines as needed. However, when new PCI devices were added at runtime either via SR-IOV or HotPlug, the I/O MMU tables were not updated. This change adds a new set of EVENTHANDLERS that are invoked when PCI devices are added and deleted. The I/O MMU driver in bhyve installs handlers for these events which it uses to add and remove devices to the "host" domain. Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7667 Modified: head/share/man/man9/pci.9 head/sys/amd64/vmm/io/iommu.c head/sys/dev/pci/pci.c head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Tue Sep 6 20:01:15 2016 (r305496) +++ head/share/man/man9/pci.9 Tue Sep 6 20:17:54 2016 (r305497) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 1, 2016 +.Dd September 6, 2016 .Dt PCI 9 .Os .Sh NAME @@ -149,6 +149,10 @@ .Fn pcie_read_config "device_t dev" "int reg" "int width" .Ft void .Fn pcie_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.Ft void +.Fn pci_event_fn "void *arg" "device_t dev" +.Fn EVENTHANDLER_REGISTER "pci_add_device" "pci_event_fn" +.Fn EVENTHANDLER_DEREGISTER "pci_delete_resource" "pci_event_fn" .In dev/pci/pci_iov.h .Ft int .Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema" @@ -910,6 +914,24 @@ with one in the new distribution. The .Fn pci_remap_msix function will fail if this condition is not met. +.Ss Device Events +The +.Va pci_add_device +event handler is invoked every time a new PCI device is added to the system. +This includes the creation of Virtual Functions via SR-IOV. +.Pp +The +.Va pci_delete_device +event handler is invoked every time a PCI device is removed from the system. +.Pp +Both event handlers pass the +.Vt device_t +object of the relevant PCI device as +.Fa dev +to each callback function. +Both event handlers are invoked while +.Fa dev +is unattached but with valid instance variables. .Sh SEE ALSO .Xr pci 4 , .Xr pciconf 8 , @@ -921,6 +943,7 @@ function will fail if this condition is .Xr devclass 9 , .Xr device 9 , .Xr driver 9 , +.Xr eventhandler 9 , .Xr rman 9 .Rs .%B FreeBSD Developers' Handbook Modified: head/sys/amd64/vmm/io/iommu.c ============================================================================== --- head/sys/amd64/vmm/io/iommu.c Tue Sep 6 20:01:15 2016 (r305496) +++ head/sys/amd64/vmm/io/iommu.c Tue Sep 6 20:17:54 2016 (r305497) @@ -58,6 +58,7 @@ SYSCTL_INT(_hw_vmm_iommu, OID_AUTO, enab static struct iommu_ops *ops; static void *host_domain; +static eventhandler_tag add_tag, delete_tag; static __inline int IOMMU_INIT(void) @@ -154,6 +155,21 @@ IOMMU_DISABLE(void) } static void +iommu_pci_add(void *arg, device_t dev) +{ + + /* Add new devices to the host domain. */ + iommu_add_device(host_domain, pci_get_rid(dev)); +} + +static void +iommu_pci_delete(void *arg, device_t dev) +{ + + iommu_remove_device(host_domain, pci_get_rid(dev)); +} + +static void iommu_init(void) { int error, bus, slot, func; @@ -195,6 +211,9 @@ iommu_init(void) */ iommu_create_mapping(host_domain, 0, 0, maxaddr); + add_tag = EVENTHANDLER_REGISTER(pci_add_device, iommu_pci_add, NULL, 0); + delete_tag = EVENTHANDLER_REGISTER(pci_delete_device, iommu_pci_delete, + NULL, 0); for (bus = 0; bus <= PCI_BUSMAX; bus++) { for (slot = 0; slot <= PCI_SLOTMAX; slot++) { for (func = 0; func <= PCI_FUNCMAX; func++) { @@ -215,6 +234,15 @@ iommu_init(void) void iommu_cleanup(void) { + + if (add_tag != NULL) { + EVENTHANDLER_DEREGISTER(pci_add_device, add_tag); + add_tag = NULL; + } + if (delete_tag != NULL) { + EVENTHANDLER_DEREGISTER(pci_delete_device, delete_tag); + delete_tag = NULL; + } IOMMU_DISABLE(); IOMMU_DESTROY_DOMAIN(host_domain); IOMMU_CLEANUP(); Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Sep 6 20:01:15 2016 (r305496) +++ head/sys/dev/pci/pci.c Tue Sep 6 20:17:54 2016 (r305497) @@ -4071,6 +4071,7 @@ pci_add_child(device_t bus, struct pci_d pci_print_verbose(dinfo); pci_add_resources(bus, dinfo->cfg.dev, 0, 0); pci_child_added(dinfo->cfg.dev); + EVENTHANDLER_INVOKE(pci_add_device, dinfo->cfg.dev); } void @@ -5312,6 +5313,8 @@ pci_child_deleted(device_t dev, device_t dinfo = device_get_ivars(child); rl = &dinfo->resources; + EVENTHANDLER_INVOKE(pci_delete_device, child); + /* Turn off access to resources we're about to free */ if (bus_child_present(child) != 0) { pci_write_config(child, PCIR_COMMAND, pci_read_config(child, Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Tue Sep 6 20:01:15 2016 (r305496) +++ head/sys/dev/pci/pcivar.h Tue Sep 6 20:17:54 2016 (r305497) @@ -31,6 +31,7 @@ #define _PCIVAR_H_ #include +#include /* some PCI bus constants */ #define PCI_MAXMAPS_0 6 /* max. no. of memory/port maps */ @@ -631,4 +632,12 @@ void * vga_pci_map_bios(device_t dev, si void vga_pci_unmap_bios(device_t dev, void *bios); int vga_pci_repost(device_t dev); +/** + * Global eventhandlers invoked when PCI devices are added or removed + * from the system. + */ +typedef void (*pci_event_fn)(void *arg, device_t dev); +EVENTHANDLER_DECLARE(pci_add_device, pci_event_fn); +EVENTHANDLER_DECLARE(pci_delete_device, pci_event_fn); + #endif /* _PCIVAR_H_ */ From owner-svn-src-head@freebsd.org Tue Sep 6 20:43: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 50E08BCC538; Tue, 6 Sep 2016 20:43:27 +0000 (UTC) (envelope-from jmcneill@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 27D2D946; Tue, 6 Sep 2016 20:43:27 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86KhQLW019322; Tue, 6 Sep 2016 20:43:26 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86KhQdp019321; Tue, 6 Sep 2016 20:43:26 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609062043.u86KhQdp019321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 6 Sep 2016 20:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305498 - head/sys/dev/cpufreq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 20:43:27 -0000 Author: jmcneill Date: Tue Sep 6 20:43:26 2016 New Revision: 305498 URL: https://svnweb.freebsd.org/changeset/base/305498 Log: Add generic device-tree cpufreq driver. This driver supports two bindings: - cpufreq-dt: systems which share clock and voltage across all CPUs - arm_big_little_dt: systems which share clock and voltage across all CPUs in a single cluster Reviewed by: andrew, imp Relnotes: yes Differential Revision: https://reviews.freebsd.org/D7741 Added: head/sys/dev/cpufreq/cpufreq_dt.c (contents, props changed) Added: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Sep 6 20:43:26 2016 (r305498) @@ -0,0 +1,360 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Generic DT based cpufreq driver + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "cpufreq_if.h" + +struct cpufreq_dt_opp { + uint32_t freq_khz; + uint32_t voltage_uv; +}; + +struct cpufreq_dt_softc { + clk_t clk; + regulator_t reg; + + struct cpufreq_dt_opp *opp; + ssize_t nopp; + int clk_latency; + + cpuset_t cpus; +}; + +static void +cpufreq_dt_notify(device_t dev, uint64_t freq) +{ +#ifdef __aarch64__ + struct cpufreq_dt_softc *sc; + struct pcpu *pc; + int cpu; + + sc = device_get_softc(dev); + + CPU_FOREACH(cpu) { + if (CPU_ISSET(cpu, &sc->cpus)) { + pc = pcpu_find(cpu); + pc->pc_clock = freq; + } + } +#endif +} + +static const struct cpufreq_dt_opp * +cpufreq_dt_find_opp(device_t dev, uint32_t freq_mhz) +{ + struct cpufreq_dt_softc *sc; + ssize_t n; + + sc = device_get_softc(dev); + + for (n = 0; n < sc->nopp; n++) + if (CPUFREQ_CMP(sc->opp[n].freq_khz / 1000, freq_mhz)) + return (&sc->opp[n]); + + return (NULL); +} + +static void +cpufreq_dt_opp_to_setting(device_t dev, const struct cpufreq_dt_opp *opp, + struct cf_setting *set) +{ + struct cpufreq_dt_softc *sc; + + sc = device_get_softc(dev); + + memset(set, 0, sizeof(*set)); + set->freq = opp->freq_khz / 1000; + set->volts = opp->voltage_uv / 1000; + set->power = CPUFREQ_VAL_UNKNOWN; + set->lat = sc->clk_latency; + set->dev = dev; +} + +static int +cpufreq_dt_get(device_t dev, struct cf_setting *set) +{ + struct cpufreq_dt_softc *sc; + const struct cpufreq_dt_opp *opp; + uint64_t freq; + + sc = device_get_softc(dev); + + if (clk_get_freq(sc->clk, &freq) != 0) + return (ENXIO); + + opp = cpufreq_dt_find_opp(dev, freq / 1000000); + if (opp == NULL) + return (ENOENT); + + cpufreq_dt_opp_to_setting(dev, opp, set); + + return (0); +} + +static int +cpufreq_dt_set(device_t dev, const struct cf_setting *set) +{ + struct cpufreq_dt_softc *sc; + const struct cpufreq_dt_opp *opp, *copp; + uint64_t freq; + int error; + + sc = device_get_softc(dev); + + if (clk_get_freq(sc->clk, &freq) != 0) + return (ENXIO); + + copp = cpufreq_dt_find_opp(dev, freq / 1000000); + if (copp == NULL) + return (ENOENT); + opp = cpufreq_dt_find_opp(dev, set->freq); + if (opp == NULL) + return (EINVAL); + + if (copp->voltage_uv < opp->voltage_uv) { + error = regulator_set_voltage(sc->reg, opp->voltage_uv, + opp->voltage_uv); + if (error != 0) + return (ENXIO); + } + + error = clk_set_freq(sc->clk, (uint64_t)opp->freq_khz * 1000, 0); + if (error != 0) { + /* Restore previous voltage (best effort) */ + (void)regulator_set_voltage(sc->reg, copp->voltage_uv, + copp->voltage_uv); + return (ENXIO); + } + + if (copp->voltage_uv > opp->voltage_uv) { + error = regulator_set_voltage(sc->reg, opp->voltage_uv, + opp->voltage_uv); + if (error != 0) { + /* Restore previous CPU frequency (best effort) */ + (void)clk_set_freq(sc->clk, + (uint64_t)copp->freq_khz * 1000, 0); + return (ENXIO); + } + } + + if (clk_get_freq(sc->clk, &freq) == 0) + cpufreq_dt_notify(dev, freq); + + return (0); +} + + +static int +cpufreq_dt_type(device_t dev, int *type) +{ + if (type == NULL) + return (EINVAL); + + *type = CPUFREQ_TYPE_ABSOLUTE; + return (0); +} + +static int +cpufreq_dt_settings(device_t dev, struct cf_setting *sets, int *count) +{ + struct cpufreq_dt_softc *sc; + ssize_t n; + + if (sets == NULL || count == NULL) + return (EINVAL); + + sc = device_get_softc(dev); + + if (*count < sc->nopp) { + *count = (int)sc->nopp; + return (E2BIG); + } + + for (n = 0; n < sc->nopp; n++) + cpufreq_dt_opp_to_setting(dev, &sc->opp[n], &sets[n]); + + *count = (int)sc->nopp; + + return (0); +} + +static void +cpufreq_dt_identify(driver_t *driver, device_t parent) +{ + phandle_t node; + + /* Properties must be listed under node /cpus/cpu@0 */ + node = ofw_bus_get_node(parent); + + /* The cpu@0 node must have the following properties */ + if (!OF_hasprop(node, "operating-points") || + !OF_hasprop(node, "clocks") || + !OF_hasprop(node, "cpu-supply")) + return; + + if (device_find_child(parent, "cpufreq_dt", -1) != NULL) + return; + + if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", -1) == NULL) + device_printf(parent, "add cpufreq_dt child failed\n"); +} + +static int +cpufreq_dt_probe(device_t dev) +{ + phandle_t node; + + node = ofw_bus_get_node(device_get_parent(dev)); + + if (!OF_hasprop(node, "operating-points") || + !OF_hasprop(node, "clocks") || + !OF_hasprop(node, "cpu-supply")) + return (ENXIO); + + device_set_desc(dev, "Generic cpufreq driver"); + return (BUS_PROBE_GENERIC); +} + +static int +cpufreq_dt_attach(device_t dev) +{ + struct cpufreq_dt_softc *sc; + uint32_t *opp, lat; + phandle_t node, cnode; + uint64_t freq; + ssize_t n; + int cpu; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(device_get_parent(dev)); + + if (regulator_get_by_ofw_property(dev, node, + "cpu-supply", &sc->reg) != 0) { + device_printf(dev, "no regulator for %s\n", + ofw_bus_get_name(device_get_parent(dev))); + return (ENXIO); + } + + if (clk_get_by_ofw_index(dev, node, 0, &sc->clk) != 0) { + device_printf(dev, "no clock for %s\n", + ofw_bus_get_name(device_get_parent(dev))); + regulator_release(sc->reg); + return (ENXIO); + } + + sc->nopp = OF_getencprop_alloc(node, "operating-points", + sizeof(*sc->opp), (void **)&opp); + if (sc->nopp == -1) + return (ENXIO); + sc->opp = malloc(sizeof(*sc->opp) * sc->nopp, M_DEVBUF, M_WAITOK); + for (n = 0; n < sc->nopp; n++) { + sc->opp[n].freq_khz = opp[n * 2 + 0]; + sc->opp[n].voltage_uv = opp[n * 2 + 1]; + + if (bootverbose) + device_printf(dev, "%u.%03u MHz, %u uV\n", + sc->opp[n].freq_khz / 1000, + sc->opp[n].freq_khz % 1000, + sc->opp[n].voltage_uv); + } + free(opp, M_OFWPROP); + + if (OF_getencprop(node, "clock-latency", &lat, sizeof(lat)) == -1) + sc->clk_latency = CPUFREQ_VAL_UNKNOWN; + else + sc->clk_latency = (int)lat; + + /* + * Find all CPUs that share the same voltage and CPU frequency + * controls. Start with the current node and move forward until + * the end is reached or a peer has an "operating-points" property. + */ + CPU_ZERO(&sc->cpus); + cpu = device_get_unit(device_get_parent(dev)); + for (cnode = node; cnode > 0; cnode = OF_peer(cnode), cpu++) { + if (cnode != node && OF_hasprop(cnode, "operating-points")) + break; + CPU_SET(cpu, &sc->cpus); + } + + if (clk_get_freq(sc->clk, &freq) == 0) + cpufreq_dt_notify(dev, freq); + + cpufreq_register(dev); + + return (0); +} + + +static device_method_t cpufreq_dt_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, cpufreq_dt_identify), + DEVMETHOD(device_probe, cpufreq_dt_probe), + DEVMETHOD(device_attach, cpufreq_dt_attach), + + /* cpufreq interface */ + DEVMETHOD(cpufreq_drv_get, cpufreq_dt_get), + DEVMETHOD(cpufreq_drv_set, cpufreq_dt_set), + DEVMETHOD(cpufreq_drv_type, cpufreq_dt_type), + DEVMETHOD(cpufreq_drv_settings, cpufreq_dt_settings), + + DEVMETHOD_END +}; + +static driver_t cpufreq_dt_driver = { + "cpufreq_dt", + cpufreq_dt_methods, + sizeof(struct cpufreq_dt_softc), +}; + +static devclass_t cpufreq_dt_devclass; + +DRIVER_MODULE(cpufreq_dt, cpu, cpufreq_dt_driver, cpufreq_dt_devclass, 0, 0); +MODULE_VERSION(cpufreq_dt, 1); From owner-svn-src-head@freebsd.org Tue Sep 6 21:01:39 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 AFB1BBCCD49; Tue, 6 Sep 2016 21:01:39 +0000 (UTC) (envelope-from jmcneill@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 7E4346E0; Tue, 6 Sep 2016 21:01:39 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86L1cRk024692; Tue, 6 Sep 2016 21:01:38 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86L1cQs024691; Tue, 6 Sep 2016 21:01:38 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609062101.u86L1cQs024691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 6 Sep 2016 21:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305501 - 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.23 Precedence: list List-Id: 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, 06 Sep 2016 21:01:39 -0000 Author: jmcneill Date: Tue Sep 6 21:01:38 2016 New Revision: 305501 URL: https://svnweb.freebsd.org/changeset/base/305501 Log: Add "pci" as a dependency to ichss. Reviewed by: jhibbits Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Sep 6 20:55:59 2016 (r305500) +++ head/sys/conf/files Tue Sep 6 21:01:38 2016 (r305501) @@ -1236,7 +1236,7 @@ dev/ciss/ciss.c optional ciss dev/cm/smc90cx6.c optional cm dev/cmx/cmx.c optional cmx dev/cmx/cmx_pccard.c optional cmx pccard -dev/cpufreq/ichss.c optional cpufreq +dev/cpufreq/ichss.c optional cpufreq pci dev/cs/if_cs.c optional cs dev/cs/if_cs_isa.c optional cs isa dev/cs/if_cs_pccard.c optional cs pccard From owner-svn-src-head@freebsd.org Tue Sep 6 21:15: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 66BBABCD107; Tue, 6 Sep 2016 21:15:37 +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 346A0F9C; Tue, 6 Sep 2016 21:15:37 +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 u86LFaQG030922; Tue, 6 Sep 2016 21:15:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86LFZaU030916; Tue, 6 Sep 2016 21:15:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609062115.u86LFZaU030916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Sep 2016 21:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305502 - in head: share/man/man9 sys/amd64/vmm/io sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 21:15:37 -0000 Author: jhb Date: Tue Sep 6 21:15:35 2016 New Revision: 305502 URL: https://svnweb.freebsd.org/changeset/base/305502 Log: Reset PCI pass through devices via PCI-e FLR during VM start and end. Add routines to trigger a function level reset (FLR) of a PCI-express device via the PCI-express device control register. This also includes support routines to wait for pending transactions to complete as well as calculating the maximum completion timeout permitted by a device. Change the ppt(4) driver to reset pass through devices before attaching to a VM during startup and before detaching from a VM during shutdown. Reviewed by: imp, wblock (earlier version) MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7751 Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 head/sys/amd64/vmm/io/ppt.c head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Sep 6 21:01:38 2016 (r305501) +++ head/share/man/man9/Makefile Tue Sep 6 21:15:35 2016 (r305502) @@ -1354,7 +1354,10 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_set_max_read_req.9 \ pci.9 pci_write_config.9 \ pci.9 pcie_adjust_config.9 \ + pci.9 pcie_flr.9 \ + pci.9 pcie_max_completion_timeout.9 \ pci.9 pcie_read_config.9 \ + pci.9 pcie_wait_for_pending_transactions.9 \ pci.9 pcie_write_config.9 MLINKS+=pci_iov_schema.9 pci_iov_schema_alloc_node.9 \ pci_iov_schema.9 pci_iov_schema_add_bool.9 \ Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Tue Sep 6 21:01:38 2016 (r305501) +++ head/share/man/man9/pci.9 Tue Sep 6 21:15:35 2016 (r305502) @@ -66,7 +66,10 @@ .Nm pci_set_powerstate , .Nm pci_write_config , .Nm pcie_adjust_config , +.Nm pcie_flr , +.Nm pcie_get_max_completion_timeout , .Nm pcie_read_config , +.Nm pcie_wait_for_pending_transactions , .Nm pcie_write_config .Nd PCI bus interface .Sh SYNOPSIS @@ -145,8 +148,14 @@ .Fa "uint32_t val" .Fa "int width" .Fc +.Ft bool +.Fn pcie_flr "device_t dev" "u_int max_delay" "bool force" +.Ft int +.Fn pcie_get_max_completion_timeout "device_t dev" .Ft uint32_t .Fn pcie_read_config "device_t dev" "int reg" "int width" +.Ft bool +.Fn pcie_wait_for_pending_transactions "device_t dev" "u_int max_delay" .Ft void .Fn pcie_write_config "device_t dev" "int reg" "uint32_t val" "int width" .Ft void @@ -431,6 +440,51 @@ keyword, then .Fn pci_get_vpd_readonly returns an error. +.Pp +The +.Fn pcie_get_max_completion_timeout +function returns the maximum completion timeout configured for the device +.Fa dev +in microseconds. +If the +.Fa dev +device is not a PCI-express device, +.Fn pcie_get_max_completion_timeout +returns zero. +When completion timeouts are disabled for +.Fa dev , +this function returns the maxmimum timeout that would be used if timeouts +were enabled. +.Pp +The +.Fn pcie_wait_for_pending_transactions +function waits for any pending transactions initiated by the +.Fa dev +device to complete. +The function checks for pending transactions by polling the transactions +pending flag in the PCI-express device status register. +It returns +.Dv true +once the transaction pending flag is clear. +If transactions are still pending after +.Fa max_delay +milliseconds, +.Fn pcie_wait_for_pending_transactions +returns +.Dv false . +If +.Fa max_delay +is set to zero, +.Fn pcie_wait_for_pending_transactions +performs a single check; +otherwise, +this function may sleep while polling the transactions pending flag. +.Nm pcie_wait_for_pending_transactions +returns +.Dv true +if +.Fa dev +is not a PCI-express device. .Ss Device Configuration The .Fn pci_enable_busmaster @@ -662,6 +716,51 @@ is invoked, then the device will be transitioned to .Dv PCI_POWERSTATE_D0 before any config registers are restored. +.Pp +The +.Fn pcie_flr +function requests a Function Level Reset +.Pq FLR +of +.Fa dev . +If +.Fa dev +is not a PCI-express device or does not support Function Level Resets via +the PCI-express device control register, +.Dv false +is returned. +Pending transactions are drained by disabling busmastering and calling +.Fn pcie_wait_for_pending_transactions +before resetting the device. +The +.Fa max_delay +argument specifies the maximum timeout to wait for pending transactions as +described for +.Fn pcie_wait_for_pending_transactions . +If +.Fn pcie_wait_for_pending_transactions +fails with a timeout and +.Fa force +is +.Dv false , +busmastering is re-enabled and +.Dv false +is returned. +If +.Fn pcie_wait_for_pending_transactions +fails with a timeout and +.Fa force +is +.Dv true , +the device is reset despite the timeout. +After the reset has been requested, +.Nm pcie_flr +sleeps for at least 100 milliseconds before returning +.Dv true . +Note that +.Nm pcie_flr +does not save and restore any state around the reset. +The caller should save and restore state as needed. .Ss Message Signaled Interrupts Message Signaled Interrupts .Pq MSI Modified: head/sys/amd64/vmm/io/ppt.c ============================================================================== --- head/sys/amd64/vmm/io/ppt.c Tue Sep 6 21:01:38 2016 (r305501) +++ head/sys/amd64/vmm/io/ppt.c Tue Sep 6 21:15:35 2016 (r305502) @@ -362,6 +362,11 @@ ppt_assign_device(struct vm *vm, int bus if (ppt->vm != NULL && ppt->vm != vm) return (EBUSY); + pci_save_state(ppt->dev); + pcie_flr(ppt->dev, + max(pcie_get_max_completion_timeout(ppt->dev) / 1000, 10), + true); + pci_restore_state(ppt->dev); ppt->vm = vm; iommu_remove_device(iommu_host_domain(), pci_get_rid(ppt->dev)); iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); @@ -382,6 +387,12 @@ ppt_unassign_device(struct vm *vm, int b */ if (ppt->vm != vm) return (EBUSY); + + pci_save_state(ppt->dev); + pcie_flr(ppt->dev, + max(pcie_get_max_completion_timeout(ppt->dev) / 1000, 10), + true); + pci_restore_state(ppt->dev); ppt_unmap_mmio(vm, ppt); ppt_teardown_msi(ppt); ppt_teardown_msix(ppt); Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Sep 6 21:01:38 2016 (r305501) +++ head/sys/dev/pci/pci.c Tue Sep 6 21:15:35 2016 (r305502) @@ -5892,3 +5892,165 @@ pci_find_pcie_root_port(device_t dev) dev = pcib; } } + +/* + * Wait for pending transactions to complete on a PCI-express function. + * + * The maximum delay is specified in milliseconds in max_delay. Note + * that this function may sleep. + * + * Returns true if the function is idle and false if the timeout is + * exceeded. If dev is not a PCI-express function, this returns true. + */ +bool +pcie_wait_for_pending_transactions(device_t dev, u_int max_delay) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + uint16_t sta; + int cap; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (true); + + sta = pci_read_config(dev, cap + PCIER_DEVICE_STA, 2); + while (sta & PCIEM_STA_TRANSACTION_PND) { + if (max_delay == 0) + return (false); + + /* Poll once every 100 milliseconds up to the timeout. */ + if (max_delay > 100) { + pause_sbt("pcietp", 100 * SBT_1MS, 0, C_HARDCLOCK); + max_delay -= 100; + } else { + pause_sbt("pcietp", max_delay * SBT_1MS, 0, + C_HARDCLOCK); + max_delay = 0; + } + sta = pci_read_config(dev, cap + PCIER_DEVICE_STA, 2); + } + + return (true); +} + +/* + * Determine the maximum Completion Timeout in microseconds. + * + * For non-PCI-express functions this returns 0. + */ +int +pcie_get_max_completion_timeout(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + int cap; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (0); + + /* + * Functions using the 1.x spec use the default timeout range of + * 50 microseconds to 50 milliseconds. Functions that do not + * support programmable timeouts also use this range. + */ + if ((dinfo->cfg.pcie.pcie_flags & PCIEM_FLAGS_VERSION) < 2 || + (pci_read_config(dev, cap + PCIER_DEVICE_CAP2, 4) & + PCIEM_CAP2_COMP_TIMO_RANGES) == 0) + return (50 * 1000); + + switch (pci_read_config(dev, cap + PCIER_DEVICE_CTL2, 2) & + PCIEM_CTL2_COMP_TIMO_VAL) { + case PCIEM_CTL2_COMP_TIMO_100US: + return (100); + case PCIEM_CTL2_COMP_TIMO_10MS: + return (10 * 1000); + case PCIEM_CTL2_COMP_TIMO_55MS: + return (55 * 1000); + case PCIEM_CTL2_COMP_TIMO_210MS: + return (210 * 1000); + case PCIEM_CTL2_COMP_TIMO_900MS: + return (900 * 1000); + case PCIEM_CTL2_COMP_TIMO_3500MS: + return (3500 * 1000); + case PCIEM_CTL2_COMP_TIMO_13S: + return (13 * 1000 * 1000); + case PCIEM_CTL2_COMP_TIMO_64S: + return (64 * 1000 * 1000); + default: + return (50 * 1000); + } +} + +/* + * Perform a Function Level Reset (FLR) on a device. + * + * This function first waits for any pending transactions to complete + * within the timeout specified by max_delay. If transactions are + * still pending, the function will return false without attempting a + * reset. + * + * If dev is not a PCI-express function or does not support FLR, this + * function returns false. + * + * Note that no registers are saved or restored. The caller is + * responsible for saving and restoring any registers including + * PCI-standard registers via pci_save_state() and + * pci_restore_state(). + */ +bool +pcie_flr(device_t dev, u_int max_delay, bool force) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + uint16_t cmd, ctl; + int compl_delay; + int cap; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (false); + + if (!(pci_read_config(dev, cap + PCIER_DEVICE_CAP, 4) & PCIEM_CAP_FLR)) + return (false); + + /* + * Disable busmastering to prevent generation of new + * transactions while waiting for the device to go idle. If + * the idle timeout fails, the command register is restored + * which will re-enable busmastering. + */ + cmd = pci_read_config(dev, PCIR_COMMAND, 2); + pci_write_config(dev, PCIR_COMMAND, cmd & ~(PCIM_CMD_BUSMASTEREN), 2); + if (!pcie_wait_for_pending_transactions(dev, max_delay)) { + if (!force) { + pci_write_config(dev, PCIR_COMMAND, cmd, 2); + return (false); + } + pci_printf(&dinfo->cfg, + "Resetting with transactions pending after %d ms\n", + max_delay); + + /* + * Extend the post-FLR delay to cover the maximum + * Completion Timeout delay of anything in flight + * during the FLR delay. Enforce a minimum delay of + * at least 10ms. + */ + compl_delay = pcie_get_max_completion_timeout(dev) / 1000; + if (compl_delay < 10) + compl_delay = 10; + } else + compl_delay = 0; + + /* Initiate the reset. */ + ctl = pci_read_config(dev, cap + PCIER_DEVICE_CTL, 2); + pci_write_config(dev, cap + PCIER_DEVICE_CTL, ctl | + PCIEM_CTL_INITIATE_FLR, 2); + + /* Wait for 100ms. */ + pause_sbt("pcieflr", (100 + compl_delay) * SBT_1MS, 0, C_HARDCLOCK); + + if (pci_read_config(dev, cap + PCIER_DEVICE_STA, 2) & + PCIEM_STA_TRANSACTION_PND) + pci_printf(&dinfo->cfg, "Transactions pending after FLR!\n"); + return (true); +} Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Tue Sep 6 21:01:38 2016 (r305501) +++ head/sys/dev/pci/pcireg.h Tue Sep 6 21:15:35 2016 (r305502) @@ -885,10 +885,25 @@ #define PCIEM_ROOT_STA_PME_STATUS 0x00010000 #define PCIEM_ROOT_STA_PME_PEND 0x00020000 #define PCIER_DEVICE_CAP2 0x24 -#define PCIEM_CAP2_ARI 0x20 +#define PCIEM_CAP2_COMP_TIMO_RANGES 0x0000000f +#define PCIEM_CAP2_COMP_TIMO_RANGE_A 0x00000001 +#define PCIEM_CAP2_COMP_TIMO_RANGE_B 0x00000002 +#define PCIEM_CAP2_COMP_TIMO_RANGE_C 0x00000004 +#define PCIEM_CAP2_COMP_TIMO_RANGE_D 0x00000008 +#define PCIEM_CAP2_COMP_TIMO_DISABLE 0x00000010 +#define PCIEM_CAP2_ARI 0x00000020 #define PCIER_DEVICE_CTL2 0x28 -#define PCIEM_CTL2_COMP_TIMEOUT_VAL 0x000f -#define PCIEM_CTL2_COMP_TIMEOUT_DIS 0x0010 +#define PCIEM_CTL2_COMP_TIMO_VAL 0x000f +#define PCIEM_CTL2_COMP_TIMO_50MS 0x0000 +#define PCIEM_CTL2_COMP_TIMO_100US 0x0001 +#define PCIEM_CTL2_COMP_TIMO_10MS 0x0002 +#define PCIEM_CTL2_COMP_TIMO_55MS 0x0005 +#define PCIEM_CTL2_COMP_TIMO_210MS 0x0006 +#define PCIEM_CTL2_COMP_TIMO_900MS 0x0009 +#define PCIEM_CTL2_COMP_TIMO_3500MS 0x000a +#define PCIEM_CTL2_COMP_TIMO_13S 0x000d +#define PCIEM_CTL2_COMP_TIMO_64S 0x000e +#define PCIEM_CTL2_COMP_TIMO_DISABLE 0x0010 #define PCIEM_CTL2_ARI 0x0020 #define PCIEM_CTL2_ATOMIC_REQ_ENABLE 0x0040 #define PCIEM_CTL2_ATOMIC_EGR_BLOCK 0x0080 Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Tue Sep 6 21:01:38 2016 (r305501) +++ head/sys/dev/pci/pcivar.h Tue Sep 6 21:15:35 2016 (r305502) @@ -595,7 +595,9 @@ uint32_t pcie_read_config(device_t dev, void pcie_write_config(device_t dev, int reg, uint32_t value, int width); uint32_t pcie_adjust_config(device_t dev, int reg, uint32_t mask, uint32_t value, int width); - +bool pcie_flr(device_t dev, u_int max_delay, bool force); +int pcie_get_max_completion_timeout(device_t dev); +bool pcie_wait_for_pending_transactions(device_t dev, u_int max_delay); #ifdef BUS_SPACE_MAXADDR #if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) From owner-svn-src-head@freebsd.org Tue Sep 6 21:18: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 25200BCD1D7; Tue, 6 Sep 2016 21:18:16 +0000 (UTC) (envelope-from jmcneill@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 E3D5A23C; Tue, 6 Sep 2016 21:18:15 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86LIFLM031055; Tue, 6 Sep 2016 21:18:15 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86LIEYb031053; Tue, 6 Sep 2016 21:18:14 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609062118.u86LIEYb031053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 6 Sep 2016 21:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305503 - in head/sys: arm64/conf 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.23 Precedence: list List-Id: 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, 06 Sep 2016 21:18:16 -0000 Author: jmcneill Date: Tue Sep 6 21:18:14 2016 New Revision: 305503 URL: https://svnweb.freebsd.org/changeset/base/305503 Log: Add generic device-tree cpufreq driver. Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Tue Sep 6 21:15:35 2016 (r305502) +++ head/sys/arm64/conf/GENERIC Tue Sep 6 21:18:14 2016 (r305503) @@ -96,6 +96,9 @@ device virtio_mmio device virtio_blk device vtnet +# CPU frequency control +device cpufreq + # Bus drivers device pci options PCI_HP # PCI-Express native HotPlug Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Sep 6 21:15:35 2016 (r305502) +++ head/sys/conf/files.arm64 Tue Sep 6 21:18:14 2016 (r305503) @@ -97,6 +97,7 @@ crypto/blowfish/bf_enc.c optional crypto crypto/des/des_enc.c optional crypto | ipsec | netsmb dev/acpica/acpi_if.m optional acpi dev/ahci/ahci_generic.c optional ahci fdt +dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/hwpmc/hwpmc_arm64.c optional hwpmc dev/hwpmc/hwpmc_arm64_md.c optional hwpmc dev/mmc/host/dwmmc.c optional dwmmc fdt From owner-svn-src-head@freebsd.org Tue Sep 6 21:22:05 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 08130BCD2EE; Tue, 6 Sep 2016 21:22:05 +0000 (UTC) (envelope-from mjg@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 CAFCA8C1; Tue, 6 Sep 2016 21:22:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86LM3bU032523; Tue, 6 Sep 2016 21:22:03 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86LM3hf032522; Tue, 6 Sep 2016 21:22:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609062122.u86LM3hf032522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 6 Sep 2016 21:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305504 - 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.23 Precedence: list List-Id: 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, 06 Sep 2016 21:22:05 -0000 Author: mjg Date: Tue Sep 6 21:22:03 2016 New Revision: 305504 URL: https://svnweb.freebsd.org/changeset/base/305504 Log: nullfs: stop special-casing directories in null_vptocnp The previous code was forcing an expensive walk in vop_stdvptocnp, which was causing performance issues on highly contended zfs. No objections: kib MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Sep 6 21:18:14 2016 (r305503) +++ head/sys/fs/nullfs/null_vnops.c Tue Sep 6 21:22:03 2016 (r305504) @@ -870,9 +870,6 @@ null_vptocnp(struct vop_vptocnp_args *ap struct ucred *cred = ap->a_cred; int error, locked; - if (vp->v_type == VDIR) - return (vop_stdvptocnp(ap)); - locked = VOP_ISLOCKED(vp); lvp = NULLVPTOLOWERVP(vp); vhold(lvp); From owner-svn-src-head@freebsd.org Tue Sep 6 21:29: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 06588BCD4F8; Tue, 6 Sep 2016 21:29:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (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 D7AD2BB9; Tue, 6 Sep 2016 21:29: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 mail.baldwin.cx (Postfix) with ESMTPSA id 4BF3710AF39; Tue, 6 Sep 2016 17:29:45 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305502 - in head: share/man/man9 sys/amd64/vmm/io sys/dev/pci Date: Tue, 06 Sep 2016 14:29:40 -0700 Message-ID: <1571206.j1ezrSnmG7@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201609062115.u86LFZaU030916@repo.freebsd.org> References: <201609062115.u86LFZaU030916@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.4.3 (mail.baldwin.cx); Tue, 06 Sep 2016 17:29:45 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 21:29:53 -0000 On Tuesday, September 06, 2016 09:15:35 PM John Baldwin wrote: > Author: jhb > Date: Tue Sep 6 21:15:35 2016 > New Revision: 305502 > URL: https://svnweb.freebsd.org/changeset/base/305502 > > Log: > Reset PCI pass through devices via PCI-e FLR during VM start and end. > > Add routines to trigger a function level reset (FLR) of a PCI-express > device via the PCI-express device control register. This also includes > support routines to wait for pending transactions to complete as well > as calculating the maximum completion timeout permitted by a device. > > Change the ppt(4) driver to reset pass through devices before attaching > to a VM during startup and before detaching from a VM during shutdown. With the recent fixes, it should (in theory) be safe to do something like: kldload vmm iovctl -C -f /path/to/iovctl.conf devctl set driver ppt vmrun.sh -p And have it work correctly, including if you hotplug or create new VFs after an initial VM is running/has run, or you delete a VF, etc. FLR should (in theory) make VMs with pass through devices a bit more robust if they do not cleanly shutdown the device hardware. I also have some thoughts (still kicking around in my head) about adding a 'devctl reset' command. In particular the trickier case is what to do for attached devices (I think we suspend / resume devices around reset perhaps). Also, there are different ways you can trigger a PCI reset that we should eventually support. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Sep 6 21:36: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 F1D75BCD751; Tue, 6 Sep 2016 21:36:21 +0000 (UTC) (envelope-from jmcneill@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 C045B139; Tue, 6 Sep 2016 21:36:21 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86LaKX6038509; Tue, 6 Sep 2016 21:36:20 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86LaKsE038507; Tue, 6 Sep 2016 21:36:20 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609062136.u86LaKsE038507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 6 Sep 2016 21:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305505 - in head/sys: arm/conf 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.23 Precedence: list List-Id: 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, 06 Sep 2016 21:36:22 -0000 Author: jmcneill Date: Tue Sep 6 21:36:20 2016 New Revision: 305505 URL: https://svnweb.freebsd.org/changeset/base/305505 Log: Add generic device-tree cpufreq driver. Modified: head/sys/arm/conf/ALLWINNER head/sys/conf/files.arm Modified: head/sys/arm/conf/ALLWINNER ============================================================================== --- head/sys/arm/conf/ALLWINNER Tue Sep 6 21:22:03 2016 (r305504) +++ head/sys/arm/conf/ALLWINNER Tue Sep 6 21:36:20 2016 (r305505) @@ -52,6 +52,9 @@ device phy device hwreset device regulator +# CPU frequency control +device cpufreq + # Interrupt controller device gic Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Tue Sep 6 21:22:03 2016 (r305504) +++ head/sys/conf/files.arm Tue Sep 6 21:36:20 2016 (r305505) @@ -94,6 +94,7 @@ cddl/dev/dtrace/arm/dtrace_subr.c opti cddl/dev/fbt/arm/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec | netsmb +dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional dwc dev/dwc/if_dwc_if.m optional dwc dev/fb/fb.c optional sc From owner-svn-src-head@freebsd.org Tue Sep 6 21:47: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 9A05FBCD9DE; Tue, 6 Sep 2016 21:47:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B652B903; Tue, 6 Sep 2016 21:47:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA27097; Wed, 07 Sep 2016 00:47:40 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bhODU-000LpB-PE; Wed, 07 Sep 2016 00:47:40 +0300 Subject: Re: svn commit: r305504 - head/sys/fs/nullfs To: Mateusz Guzik , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201609062122.u86LM3hf032522@repo.freebsd.org> Cc: Konstantin Belousov From: Andriy Gapon Message-ID: Date: Wed, 7 Sep 2016 00:46:44 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609062122.u86LM3hf032522@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 21:47:50 -0000 On 07/09/2016 00:22, Mateusz Guzik wrote: > nullfs: stop special-casing directories in null_vptocnp > > The previous code was forcing an expensive walk in vop_stdvptocnp, > which was causing performance issues on highly contended zfs. In other words, the name cache was always bypassed for directories? -- Andriy Gapon From owner-svn-src-head@freebsd.org Tue Sep 6 21:51: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 268A8BCDB49; Tue, 6 Sep 2016 21:51:55 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::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 B7B20CB1; Tue, 6 Sep 2016 21:51:54 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id b187so86325540wme.1; Tue, 06 Sep 2016 14:51:54 -0700 (PDT) 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-disposition:in-reply-to:user-agent; bh=EoBVjaDT+P/9Fnw8zb3Rv4wmG++3V23dGEacy74vy0g=; b=NOUhRZKeVb0EaJadxWTO9Q4KTmBFcOFpEnOsVO2mvqqtm+G5oAnDTQuHsO+JF4Fisr USmRt5ZEbsFb4qAJAe2XIPb7m4YD78dEXvDn0IaaMfttae7Gmpx20QUJprCJJYXiqTtu YmfBSWCfamuc4rFixAqJHUDODAdFfcQ/cojTo5N0NxNuRq6cDNGhrhjCuRxh25m9uryf w4mqk7U3WPakqQo5kVDKIThJwp/ZZMr63zN0df+5QgUqpottNnzPLY5dvVjT8m7pBCCU xkCXah+uVAFjNVmUel40BtHJjetXvfER6yHn8XDWnbK5nSF7JVbzDR7Tblyt2f9NodsZ VLCg== 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-disposition:in-reply-to:user-agent; bh=EoBVjaDT+P/9Fnw8zb3Rv4wmG++3V23dGEacy74vy0g=; b=kQHyZlxC2n0hEbri/GHnKqivzXzFqNKMaToho5lUK+Knvg9XNn/AtJzXFNAedxES6A 1cnyzRR0Q3YyvXbHtcPpYjULF0S3I918VDb6qdeQz66BRjs36SLr3+5d1Ug645Q+xmZZ 6AZ8SwkzjcymVtgLcGXqyRM/cMxX1YyNWpTnvhGa5pyFWjbuiQX+mRL9TZ+m3FEVcnL3 mFKL3+bd992x+BSWE7NIF+1ZEJvl9bYfZqH4njGJ2E00UAFXTllNYSYGjygktznWrfER p5px8Q82P5gQwQZAf6wutUQBrTgp/8PYCUsnGS55/RLaQDlLxC2IQyEMQJ1A8SpYpZfs LB+A== X-Gm-Message-State: AE9vXwPY+WyR+veTY+5oej53mzZg9pBZ6Yr9v9t14xG+GCJWo/OiA8HSiy06LuiIivyHMw== X-Received: by 10.28.74.217 with SMTP id n86mr730331wmi.84.1473198712941; Tue, 06 Sep 2016 14:51:52 -0700 (PDT) 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 188sm854553wmo.4.2016.09.06.14.51.51 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 06 Sep 2016 14:51:52 -0700 (PDT) Date: Tue, 6 Sep 2016 23:51:49 +0200 From: Mateusz Guzik To: Andriy Gapon Cc: Mateusz Guzik , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r305504 - head/sys/fs/nullfs Message-ID: <20160906215149.GC23680@dft-labs.eu> References: <201609062122.u86LM3hf032522@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 21:51:55 -0000 On Wed, Sep 07, 2016 at 12:46:44AM +0300, Andriy Gapon wrote: > On 07/09/2016 00:22, Mateusz Guzik wrote: > > nullfs: stop special-casing directories in null_vptocnp > > > > The previous code was forcing an expensive walk in vop_stdvptocnp, > > which was causing performance issues on highly contended zfs. > > In other words, the name cache was always bypassed for directories? > Or whatever the target fs had in store for resolving names. This particular thing was causing a lot of idle time on my poudriere tests due to lockmgr contention. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Sep 6 21:58: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 3B6C4BCDC31; Tue, 6 Sep 2016 21:58:23 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::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 C3350F27; Tue, 6 Sep 2016 21:58:22 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x231.google.com with SMTP id b187so86510354wme.1; Tue, 06 Sep 2016 14:58:22 -0700 (PDT) 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-disposition:in-reply-to:user-agent; bh=45zJqK3MAZnEE/+UQxrFMqmt6LQM/D+uh0aMJWLWUi8=; b=qnuf+l7qkHvXLTc9H6mk27hh4h6EecKhrRpm8sPC6diYLI8jIXnD+b3OYzwigaPcI1 hxV2+0eH0RMaIKEEbV4MlUv0QMv/UZrdI6H4EVsf6RGIimuLdINpwdZ2FutFBjLw3iF5 McVK2JFkIBOgz7/bmNDLnWdwJQPL5uFVoOGYSoziNJzjXHdDfR2XHcrjV6m1FbmtIuuS +RMkUsKxZqONmTRfOHYFyuH9n506NJRptfa7khwCcEC6bRx5b8W/RTQe0gTvXGgg8gvL pNiHfnDC7/q2D6XslyRjVrRZMVmesWLdAqfm7GKTTzOnQWm888Y7Nieuxg/M94/8RK+3 Rn/w== 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-disposition:in-reply-to:user-agent; bh=45zJqK3MAZnEE/+UQxrFMqmt6LQM/D+uh0aMJWLWUi8=; b=lLEhIRxXqps6x2EuFnUIO1b1XMx9IF8BBJlnGBQQttDov/kIHIz+l3h8YeDPsvWlVU 9iUR7qTgU7ZRnDC2xir1xs16eYbCxHJYmGrCbVn258f6h7UpaFc7p7rizgxBcEhtvp+k GLMQldEOI+4fhKinwqbS481Gjr5dr2MnVhLjGKQ8iwx16l3xgFhjw5qSoI0CH8NeLXr6 ow0CaPml6JMVjC3p49Rtpmdhfqf9ZOpSZ90lGq/W0OvmA07yi0DKuBI6WsVSGUTK2IPd fIdJQjroy9QWTsPTQkGXSaXrW7f+e30JCRpSpmnJ8uPD8K9lhHSdKx7WzNP+P68kDAIg tgtw== X-Gm-Message-State: AE9vXwMT+gc6rkLdQ7NPt0pGbYg5DH36krKPgSMqsi96HpvlKik/KXV7VJ+QfS/VRC9E5A== X-Received: by 10.194.65.100 with SMTP id w4mr18190567wjs.149.1473199101170; Tue, 06 Sep 2016 14:58:21 -0700 (PDT) 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 g7sm35421979wjx.10.2016.09.06.14.58.20 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 06 Sep 2016 14:58:20 -0700 (PDT) Date: Tue, 6 Sep 2016 23:58:18 +0200 From: Mateusz Guzik To: Andriy Gapon Cc: Mateusz Guzik , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r305504 - head/sys/fs/nullfs Message-ID: <20160906215818.GD23680@dft-labs.eu> References: <201609062122.u86LM3hf032522@repo.freebsd.org> <20160906215149.GC23680@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160906215149.GC23680@dft-labs.eu> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 21:58:23 -0000 On Tue, Sep 06, 2016 at 11:51:49PM +0200, Mateusz Guzik wrote: > On Wed, Sep 07, 2016 at 12:46:44AM +0300, Andriy Gapon wrote: > > On 07/09/2016 00:22, Mateusz Guzik wrote: > > > nullfs: stop special-casing directories in null_vptocnp > > > > > > The previous code was forcing an expensive walk in vop_stdvptocnp, > > > which was causing performance issues on highly contended zfs. > > > > In other words, the name cache was always bypassed for directories? > > > > Or whatever the target fs had in store for resolving names. > > This particular thing was causing a lot of idle time on my poudriere > tests due to lockmgr contention. > To be clear, this is not name -> vp translation, but the other way around (e.g. for getcwd). -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Sep 6 22:03: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 6B02DBCE1E1; Tue, 6 Sep 2016 22:03:54 +0000 (UTC) (envelope-from brooks@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 4500C152D; Tue, 6 Sep 2016 22:03:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86M3rHq049789; Tue, 6 Sep 2016 22:03:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86M3rfu049788; Tue, 6 Sep 2016 22:03:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201609062203.u86M3rfu049788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 6 Sep 2016 22:03:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305506 - 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.23 Precedence: list List-Id: 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, 06 Sep 2016 22:03:54 -0000 Author: brooks Date: Tue Sep 6 22:03:53 2016 New Revision: 305506 URL: https://svnweb.freebsd.org/changeset/base/305506 Log: Modernize the initalization of sigproptbl. Use C99 designators to set the value of each slot and the nitems macro to check for valid entries. In the process, switch to indexing by signal number rather than signal-1 for improved clarity. Obtained from: CheriBSD (a6053c5abf03a5f53bbfcdd3a26429383f67e09f) Sponsored by: DARPA, AFRL Reviewed by: kib Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Sep 6 21:36:20 2016 (r305505) +++ head/sys/kern/kern_sig.c Tue Sep 6 22:03:53 2016 (r305506) @@ -198,37 +198,37 @@ SYSCTL_INT(_kern, OID_AUTO, coredump_dev #define SIGPROP_CANTMASK 0x40 /* non-maskable, catchable */ static int sigproptbl[NSIG] = { - SIGPROP_KILL, /* SIGHUP */ - SIGPROP_KILL, /* SIGINT */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGQUIT */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGILL */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGTRAP */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGABRT */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGEMT */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGFPE */ - SIGPROP_KILL, /* SIGKILL */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGBUS */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGSEGV */ - SIGPROP_KILL | SIGPROP_CORE, /* SIGSYS */ - SIGPROP_KILL, /* SIGPIPE */ - SIGPROP_KILL, /* SIGALRM */ - SIGPROP_KILL, /* SIGTERM */ - SIGPROP_IGNORE, /* SIGURG */ - SIGPROP_STOP, /* SIGSTOP */ - SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTSTP */ - SIGPROP_IGNORE | SIGPROP_CONT, /* SIGCONT */ - SIGPROP_IGNORE, /* SIGCHLD */ - SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTTIN */ - SIGPROP_STOP | SIGPROP_TTYSTOP, /* SIGTTOU */ - SIGPROP_IGNORE, /* SIGIO */ - SIGPROP_KILL, /* SIGXCPU */ - SIGPROP_KILL, /* SIGXFSZ */ - SIGPROP_KILL, /* SIGVTALRM */ - SIGPROP_KILL, /* SIGPROF */ - SIGPROP_IGNORE, /* SIGWINCH */ - SIGPROP_IGNORE, /* SIGINFO */ - SIGPROP_KILL, /* SIGUSR1 */ - SIGPROP_KILL, /* SIGUSR2 */ + [SIGHUP] = SIGPROP_KILL, + [SIGINT] = SIGPROP_KILL, + [SIGQUIT] = SIGPROP_KILL | SIGPROP_CORE, + [SIGILL] = SIGPROP_KILL | SIGPROP_CORE, + [SIGTRAP] = SIGPROP_KILL | SIGPROP_CORE, + [SIGABRT] = SIGPROP_KILL | SIGPROP_CORE, + [SIGEMT] = SIGPROP_KILL | SIGPROP_CORE, + [SIGFPE] = SIGPROP_KILL | SIGPROP_CORE, + [SIGKILL] = SIGPROP_KILL, + [SIGBUS] = SIGPROP_KILL | SIGPROP_CORE, + [SIGSEGV] = SIGPROP_KILL | SIGPROP_CORE, + [SIGSYS] = SIGPROP_KILL | SIGPROP_CORE, + [SIGPIPE] = SIGPROP_KILL, + [SIGALRM] = SIGPROP_KILL, + [SIGTERM] = SIGPROP_KILL, + [SIGURG] = SIGPROP_IGNORE, + [SIGSTOP] = SIGPROP_STOP, + [SIGTSTP] = SIGPROP_STOP | SIGPROP_TTYSTOP, + [SIGCONT] = SIGPROP_IGNORE | SIGPROP_CONT, + [SIGCHLD] = SIGPROP_IGNORE, + [SIGTTIN] = SIGPROP_STOP | SIGPROP_TTYSTOP, + [SIGTTOU] = SIGPROP_STOP | SIGPROP_TTYSTOP, + [SIGIO] = SIGPROP_IGNORE, + [SIGXCPU] = SIGPROP_KILL, + [SIGXFSZ] = SIGPROP_KILL, + [SIGVTALRM] = SIGPROP_KILL, + [SIGPROF] = SIGPROP_KILL, + [SIGWINCH] = SIGPROP_IGNORE, + [SIGINFO] = SIGPROP_IGNORE, + [SIGUSR1] = SIGPROP_KILL, + [SIGUSR2] = SIGPROP_KILL, }; static void reschedule_signals(struct proc *p, sigset_t block, int flags); @@ -611,8 +611,8 @@ static __inline int sigprop(int sig) { - if (sig > 0 && sig < NSIG) - return (sigproptbl[_SIG_IDX(sig)]); + if (sig > 0 && sig < nitems(sigproptbl)) + return (sigproptbl[sig]); return (0); } From owner-svn-src-head@freebsd.org Tue Sep 6 22:18: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 39707BCE471; Tue, 6 Sep 2016 22:18:10 +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 084301A2B; Tue, 6 Sep 2016 22:18: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 u86MI9cj053559; Tue, 6 Sep 2016 22:18:09 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86MI90a053558; Tue, 6 Sep 2016 22:18:09 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201609062218.u86MI90a053558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 6 Sep 2016 22:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305507 - head/sys/sparc64/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.23 Precedence: list List-Id: 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, 06 Sep 2016 22:18:10 -0000 Author: marius Date: Tue Sep 6 22:18:08 2016 New Revision: 305507 URL: https://svnweb.freebsd.org/changeset/base/305507 Log: Disable vt(4) by default on sparc64 as creator_vt(4) and vt_ofwfb(4) have the serious problem of not actually attaching the hardware they are driving at the bus level. This causes creator(4) and machfb(4) to attach and drive the very same hardware in parallel when both syscons(4) and vt(4) as well as their associated hardware drivers are built into a kernel, i. e. GENERIC, at the same time. Also, syscons(4) and its drivers still are way superior to vt(4) and its equivalents; unlike the syscons(4) counterparts the vt(4) drivers don't provide hardware acceleration resulting in considerably slower screen drawing, creator_vt(4) doesn't provide a /dev/fb node as required by the Xorg sunffb(4) etc. In theory, vt_ofwfb(4) should be able to handle more devices than machfb(4). However, testing shows that it hardly works with any hardware machfb(4) isn't also able to drive, making vt(4) and vt_ofwfb(4) not favorable for the time being from that perspective either. MFC after: 3 days Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Tue Sep 6 22:03:53 2016 (r305506) +++ head/sys/sparc64/conf/GENERIC Tue Sep 6 22:18:08 2016 (r305507) @@ -147,7 +147,7 @@ device splash # Splash screen and scre options KBD_INSTALL_CDEV # install a CDEV entry in /dev # vt is the new video console driver -device vt +#device vt # Builtin hardware device auxio # auxiliary I/O device From owner-svn-src-head@freebsd.org Tue Sep 6 23:35: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 683E5BCD490; Tue, 6 Sep 2016 23:35:49 +0000 (UTC) (envelope-from markj@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 1D780C87; Tue, 6 Sep 2016 23:35:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86NZmQm083030; Tue, 6 Sep 2016 23:35:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86NZmRE083029; Tue, 6 Sep 2016 23:35:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609062335.u86NZmRE083029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 6 Sep 2016 23:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305508 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 23:35:49 -0000 Author: markj Date: Tue Sep 6 23:35:48 2016 New Revision: 305508 URL: https://svnweb.freebsd.org/changeset/base/305508 Log: Add some fail points to gmirror. These are useful for testing changes to I/O error handling, and for reproducing existing bugs in a controlled manner. The fail points are g_mirror_regular_request_read g_mirror_regular_request_write g_mirror_sync_request_read g_mirror_sync_request_write g_mirror_metadata_write They all effectively allow one to inject an error value into the bio_error field of a corresponding BIO request as it is being completed. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Tue Sep 6 22:18:08 2016 (r305507) +++ head/sys/geom/mirror/g_mirror.c Tue Sep 6 23:35:48 2016 (r305508) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -646,6 +647,7 @@ g_mirror_write_metadata(struct g_mirror_ else mirror_metadata_encode(md, sector); } + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_metadata_write, error); if (error == 0) error = g_write_data(cp, offset, sector, length); free(sector, M_MIRROR); @@ -914,6 +916,13 @@ g_mirror_regular_request(struct bio *bp) g_topology_unlock(); } + if (bp->bio_cmd == BIO_READ) + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_read, + bp->bio_error); + else if (bp->bio_cmd == BIO_WRITE) + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_write, + bp->bio_error); + pbp->bio_inbed++; KASSERT(pbp->bio_inbed <= pbp->bio_children, ("bio_inbed (%u) is bigger than bio_children (%u).", pbp->bio_inbed, @@ -1308,6 +1317,9 @@ g_mirror_sync_request(struct bio *bp) { struct g_consumer *cp; + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, + bp->bio_error); + if (bp->bio_error != 0) { G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", @@ -1334,6 +1346,9 @@ g_mirror_sync_request(struct bio *bp) void *data; int i; + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_write, + bp->bio_error); + if (bp->bio_error != 0) { G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", From owner-svn-src-head@freebsd.org Tue Sep 6 23:43: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 B7EEABCD6C0; Tue, 6 Sep 2016 23:43:00 +0000 (UTC) (envelope-from markj@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 77142FC; Tue, 6 Sep 2016 23:43:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u86Ngxr2086765; Tue, 6 Sep 2016 23:42:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u86NgxKV086764; Tue, 6 Sep 2016 23:42:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609062342.u86NgxKV086764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 6 Sep 2016 23:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305509 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 06 Sep 2016 23:43:00 -0000 Author: markj Date: Tue Sep 6 23:42:59 2016 New Revision: 305509 URL: https://svnweb.freebsd.org/changeset/base/305509 Log: Don't treat an error from g_mirror_clear_metadata() as fatal. Such errors can occur as the result of a write error or because the disk backing the mirror element was removed. They result in a generation ID bump on all active elements of the mirror, so we can safely disconnect the mirror component rather than destroy it. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7750 Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Tue Sep 6 23:35:48 2016 (r305508) +++ head/sys/geom/mirror/g_mirror.c Tue Sep 6 23:42:59 2016 (r305509) @@ -2678,8 +2678,12 @@ again: int error; error = g_mirror_clear_metadata(disk); - if (error != 0) - return (error); + if (error != 0) { + G_MIRROR_DEBUG(0, + "Device %s: failed to clear metadata on %s: %d.", + sc->sc_name, g_mirror_get_diskname(disk), error); + break; + } DISK_STATE_CHANGED(); G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name, g_mirror_get_diskname(disk)); From owner-svn-src-head@freebsd.org Wed Sep 7 01:09: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 F3F98BCEFBB; Wed, 7 Sep 2016 01:09:26 +0000 (UTC) (envelope-from jmcneill@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 BFEFCA81; Wed, 7 Sep 2016 01:09:26 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8719PpF017292; Wed, 7 Sep 2016 01:09:25 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8719PHY017291; Wed, 7 Sep 2016 01:09:25 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609070109.u8719PHY017291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Wed, 7 Sep 2016 01:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305511 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 01:09:27 -0000 Author: jmcneill Date: Wed Sep 7 01:09:25 2016 New Revision: 305511 URL: https://svnweb.freebsd.org/changeset/base/305511 Log: Attach later so axp81x attaches after aw_nmi. Modified: head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/axp81x.c ============================================================================== --- head/sys/arm/allwinner/axp81x.c Wed Sep 7 00:34:45 2016 (r305510) +++ head/sys/arm/allwinner/axp81x.c Wed Sep 7 01:09:25 2016 (r305511) @@ -777,9 +777,9 @@ extern devclass_t ofwgpiobus_devclass, g extern driver_t ofw_gpiobus_driver, gpioc_driver; EARLY_DRIVER_MODULE(axp81x, iicbus, axp81x_driver, axp81x_devclass, 0, 0, - BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); EARLY_DRIVER_MODULE(ofw_gpiobus, axp81x_pmu, ofw_gpiobus_driver, - ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); + ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); DRIVER_MODULE(gpioc, axp81x_pmu, gpioc_driver, gpioc_devclass, 0, 0); MODULE_VERSION(axp81x, 1); MODULE_DEPEND(axp81x, iicbus, 1, 1, 1); From owner-svn-src-head@freebsd.org Wed Sep 7 01:10: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 88122B96054; Wed, 7 Sep 2016 01:10:18 +0000 (UTC) (envelope-from jmcneill@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 47F71C0C; Wed, 7 Sep 2016 01:10:18 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u871AHRt017388; Wed, 7 Sep 2016 01:10:17 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u871AHoH017384; Wed, 7 Sep 2016 01:10:17 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201609070110.u871AHoH017384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Wed, 7 Sep 2016 01:10:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305512 - in head/sys: arm/allwinner/clk boot/fdt/dts/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.23 Precedence: list List-Id: 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, 07 Sep 2016 01:10:18 -0000 Author: jmcneill Date: Wed Sep 7 01:10:16 2016 New Revision: 305512 URL: https://svnweb.freebsd.org/changeset/base/305512 Log: Add support for Allwinner A83T CPU frequency scaling. Modified: head/sys/arm/allwinner/clk/aw_cpuclk.c head/sys/arm/allwinner/clk/aw_pll.c head/sys/boot/fdt/dts/arm/a83t.dtsi head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Modified: head/sys/arm/allwinner/clk/aw_cpuclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_cpuclk.c Wed Sep 7 01:09:25 2016 (r305511) +++ head/sys/arm/allwinner/clk/aw_cpuclk.c Wed Sep 7 01:10:16 2016 (r305512) @@ -47,8 +47,42 @@ __FBSDID("$FreeBSD$"); #include -#define CPU_CLK_SRC_SEL_WIDTH 2 -#define CPU_CLK_SRC_SEL_SHIFT 16 +#define A10_CPU_CLK_SRC_SEL_WIDTH 2 +#define A10_CPU_CLK_SRC_SEL_SHIFT 16 + +#define A83T_Cx_CLK_SRC_SEL_WIDTH 1 +#define A83T_C0_CLK_SRC_SEL_SHIFT 12 +#define A83T_C1_CLK_SRC_SEL_SHIFT 28 + +struct aw_cpuclk_config { + u_int width; + u_int shift; +}; + +static struct aw_cpuclk_config a10_config = { + .width = A10_CPU_CLK_SRC_SEL_WIDTH, + .shift = A10_CPU_CLK_SRC_SEL_SHIFT, +}; + +static struct aw_cpuclk_config a83t_c0_config = { + .width = A83T_Cx_CLK_SRC_SEL_WIDTH, + .shift = A83T_C0_CLK_SRC_SEL_SHIFT, +}; + +static struct aw_cpuclk_config a83t_c1_config = { + .width = A83T_Cx_CLK_SRC_SEL_WIDTH, + .shift = A83T_C1_CLK_SRC_SEL_SHIFT, +}; + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun4i-a10-cpu-clk", (uintptr_t)&a10_config }, + { "allwinner,sun8i-a83t-c0cpu-clk", (uintptr_t)&a83t_c0_config }, + { "allwinner,sun8i-a83t-c1cpu-clk", (uintptr_t)&a83t_c1_config }, + { NULL, (uintptr_t)NULL } +}; + +#define CPUCLK_CONF(d) \ + (void *)ofw_bus_search_compatible((d), compat_data)->ocd_data static int aw_cpuclk_probe(device_t dev) @@ -56,7 +90,7 @@ aw_cpuclk_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-cpu-clk")) + if (CPUCLK_CONF(dev) == NULL) return (ENXIO); device_set_desc(dev, "Allwinner CPU Clock"); @@ -68,6 +102,7 @@ aw_cpuclk_attach(device_t dev) { struct clk_mux_def def; struct clkdom *clkdom; + struct aw_cpuclk_config *conf; bus_addr_t paddr; bus_size_t psize; phandle_t node; @@ -75,6 +110,7 @@ aw_cpuclk_attach(device_t dev) clk_t clk; node = ofw_bus_get_node(dev); + conf = CPUCLK_CONF(dev); if (ofw_reg_to_paddr(node, 0, &paddr, &psize, NULL) != 0) { device_printf(dev, "cannot parse 'reg' property\n"); @@ -105,8 +141,8 @@ aw_cpuclk_attach(device_t dev) } def.clkdef.parent_cnt = ncells; def.offset = paddr; - def.shift = CPU_CLK_SRC_SEL_SHIFT; - def.width = CPU_CLK_SRC_SEL_WIDTH; + def.shift = conf->shift; + def.width = conf->width; error = clk_parse_ofw_clk_name(dev, node, &def.clkdef.name); if (error != 0) { Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Wed Sep 7 01:09:25 2016 (r305511) +++ head/sys/arm/allwinner/clk/aw_pll.c Wed Sep 7 01:10:16 2016 (r305512) @@ -157,6 +157,17 @@ __FBSDID("$FreeBSD$"); #define A80_PLL4_FACTOR_N (0xff << 8) #define A80_PLL4_FACTOR_N_SHIFT 8 +#define A83T_PLLCPUX_LOCK_TIME (0x7 << 24) +#define A83T_PLLCPUX_LOCK_TIME_SHIFT 24 +#define A83T_PLLCPUX_CLOCK_OUTPUT_DIS (1 << 20) +#define A83T_PLLCPUX_OUT_EXT_DIVP (1 << 16) +#define A83T_PLLCPUX_FACTOR_N (0xff << 8) +#define A83T_PLLCPUX_FACTOR_N_SHIFT 8 +#define A83T_PLLCPUX_FACTOR_N_MIN 12 +#define A83T_PLLCPUX_FACTOR_N_MAX 125 +#define A83T_PLLCPUX_POSTDIV_M (0x3 << 0) +#define A83T_PLLCPUX_POSTDIV_M_SHIFT 0 + #define CLKID_A10_PLL3_1X 0 #define CLKID_A10_PLL3_2X 1 @@ -202,6 +213,7 @@ enum aw_pll_type { AWPLL_A31_PLL6, AWPLL_A64_PLLHSIC, AWPLL_A80_PLL4, + AWPLL_A83T_PLLCPUX, AWPLL_H3_PLL1, }; @@ -824,6 +836,46 @@ a64_pllhsic_init(device_t dev, bus_addr_ return (0); } +static int +a83t_pllcpux_recalc(struct aw_pll_sc *sc, uint64_t *freq) +{ + uint32_t val, n, p; + + DEVICE_LOCK(sc); + PLL_READ(sc, &val); + DEVICE_UNLOCK(sc); + + n = (val & A83T_PLLCPUX_FACTOR_N) >> A83T_PLLCPUX_FACTOR_N_SHIFT; + p = (val & A83T_PLLCPUX_OUT_EXT_DIVP) ? 4 : 1; + + *freq = (*freq * n) / p; + + return (0); +} + +static int +a83t_pllcpux_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout, + int flags) +{ + uint32_t val; + u_int n; + + n = *fout / fin; + + if (n < A83T_PLLCPUX_FACTOR_N_MIN || n > A83T_PLLCPUX_FACTOR_N_MAX) + return (EINVAL); + + DEVICE_LOCK(sc); + PLL_READ(sc, &val); + val &= ~A83T_PLLCPUX_FACTOR_N; + val |= (n << A83T_PLLCPUX_FACTOR_N_SHIFT); + val &= ~A83T_PLLCPUX_CLOCK_OUTPUT_DIS; + PLL_WRITE(sc, val); + DEVICE_UNLOCK(sc); + + return (0); +} + #define PLL(_type, _recalc, _set_freq, _init) \ [(_type)] = { \ .recalc = (_recalc), \ @@ -842,6 +894,7 @@ static struct aw_pll_funcs aw_pll_func[] PLL(AWPLL_A31_PLL1, a31_pll1_recalc, NULL, NULL), PLL(AWPLL_A31_PLL6, a31_pll6_recalc, NULL, a31_pll6_init), PLL(AWPLL_A80_PLL4, a80_pll4_recalc, NULL, NULL), + PLL(AWPLL_A83T_PLLCPUX, a83t_pllcpux_recalc, a83t_pllcpux_set_freq, NULL), PLL(AWPLL_A64_PLLHSIC, a64_pllhsic_recalc, NULL, a64_pllhsic_init), PLL(AWPLL_H3_PLL1, a23_pll1_recalc, h3_pll1_set_freq, NULL), }; @@ -856,6 +909,7 @@ static struct ofw_compat_data compat_dat { "allwinner,sun6i-a31-pll1-clk", AWPLL_A31_PLL1 }, { "allwinner,sun6i-a31-pll6-clk", AWPLL_A31_PLL6 }, { "allwinner,sun8i-a23-pll1-clk", AWPLL_A23_PLL1 }, + { "allwinner,sun8i-a83t-pllcpux-clk", AWPLL_A83T_PLLCPUX }, { "allwinner,sun8i-h3-pll1-clk", AWPLL_H3_PLL1 }, { "allwinner,sun9i-a80-pll4-clk", AWPLL_A80_PLL4 }, { "allwinner,sun50i-a64-pllhsic-clk", AWPLL_A64_PLLHSIC }, Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/a83t.dtsi Wed Sep 7 01:09:25 2016 (r305511) +++ head/sys/boot/fdt/dts/arm/a83t.dtsi Wed Sep 7 01:10:16 2016 (r305512) @@ -27,6 +27,18 @@ */ / { + cpus { + cpu@0 { + clocks = <&c0_cpux_clk>; + clock-latency = <2000000>; + }; + + cpu@100 { + clocks = <&c1_cpux_clk>; + clock-latency = <2000000>; + }; + }; + pmu { compatible = "arm,cortex-a7-pmu", "arm,cortex-a15-pmu"; @@ -38,6 +50,38 @@ }; clocks { + pll_c0cpux: clk@01c20000 { + #clock-cells = <0>; + compatible = "allwinner,sun8i-a83t-pllcpux-clk"; + reg = <0x01c20000 0x4>; + clocks = <&osc24M>; + clock-output-names = "pll_c0cpux"; + }; + + pll_c1cpux: clk@01c20004 { + #clock-cells = <0>; + compatible = "allwinner,sun8i-a83t-pllcpux-clk"; + reg = <0x01c20004 0x4>; + clocks = <&osc24M>; + clock-output-names = "pll_c1cpux"; + }; + + c0_cpux_clk: c0clk@01c20050 { + #clock-cells = <0>; + compatible = "allwinner,sun8i-a83t-c0cpu-clk"; + reg = <0x01c20050 0x4>; + clocks = <&osc24M>, <&pll_c0cpux>; + clock-output-names = "c0_cpux"; + }; + + c1_cpux_clk: c1clk@01c20050 { + #clock-cells = <0>; + compatible = "allwinner,sun8i-a83t-c1cpu-clk"; + reg = <0x01c20050 0x4>; + clocks = <&osc24M>, <&pll_c1cpux>; + clock-output-names = "c1_cpux"; + }; + /* cpus_clk compatible in gnu dt is incorrect */ cpus_clk: clk@01f01400 { compatible = "allwinner,sun8i-a83t-cpus-clk"; Modified: head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Wed Sep 7 01:09:25 2016 (r305511) +++ head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Wed Sep 7 01:10:16 2016 (r305512) @@ -29,6 +29,32 @@ #include "sun8i-a83t-sinovoip-bpi-m3.dts" #include "a83t.dtsi" +/ { + cpus { + cpu@0 { + cpu-supply = <®_dcdc2>; + operating-points = < + /* kHz uV */ + 1200000 840000 + 1008000 840000 + 648000 840000 + 408000 840000 + >; + }; + + cpu@100 { + cpu-supply = <®_dcdc3>; + operating-points = < + /* kHz uV */ + 1200000 840000 + 1008000 840000 + 648000 840000 + 408000 840000 + >; + }; + }; +}; + &ehci0 { status = "okay"; }; @@ -115,6 +141,16 @@ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; gpio-controller; #gpio-cells = <1>; + + regulators { + reg_dcdc2: dcdc2 { + regulator-name = "dcdc2"; + }; + + reg_dcdc3: dcdc3 { + regulator-name = "dcdc3"; + }; + }; }; }; From owner-svn-src-head@freebsd.org Wed Sep 7 02:45: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 8D7AFBCE70C; Wed, 7 Sep 2016 02:45:10 +0000 (UTC) (envelope-from kevlo@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 5D0FF615; Wed, 7 Sep 2016 02:45:10 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u872j9K1054136; Wed, 7 Sep 2016 02:45:09 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u872j9o5054135; Wed, 7 Sep 2016 02:45:09 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201609070245.u872j9o5054135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Wed, 7 Sep 2016 02:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305513 - 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.23 Precedence: list List-Id: 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, 07 Sep 2016 02:45:10 -0000 Author: kevlo Date: Wed Sep 7 02:45:09 2016 New Revision: 305513 URL: https://svnweb.freebsd.org/changeset/base/305513 Log: Remove extra period from kern.vt.kbd_reboot Modified: head/share/man/man4/vt.4 Modified: head/share/man/man4/vt.4 ============================================================================== --- head/share/man/man4/vt.4 Wed Sep 7 01:10:16 2016 (r305512) +++ head/share/man/man4/vt.4 Wed Sep 7 02:45:09 2016 (r305513) @@ -250,7 +250,7 @@ command. Enable halt keyboard combination. .It Va kern.vt.kbd_poweroff Enable power off key combination. -.It Va kern.vt.kbd_reboot. +.It Va kern.vt.kbd_reboot Enable reboot key combination, usually Ctrl+Alt+Del. .It Va kern.vt.kbd_debug Enable debug request key combination, usually Ctrl+Alt+Esc. From owner-svn-src-head@freebsd.org Wed Sep 7 03:26:56 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 70376B96185; Wed, 7 Sep 2016 03:26:56 +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 1F229FEC; Wed, 7 Sep 2016 03:26:56 +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 u873Qt1Y069628; Wed, 7 Sep 2016 03:26:55 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u873Qt91069627; Wed, 7 Sep 2016 03:26:55 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201609070326.u873Qt91069627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 7 Sep 2016 03:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305517 - 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.23 Precedence: list List-Id: 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, 07 Sep 2016 03:26:56 -0000 Author: jhibbits Date: Wed Sep 7 03:26:55 2016 New Revision: 305517 URL: https://svnweb.freebsd.org/changeset/base/305517 Log: Allow pmap_early_io_unmap() to reclaim memory pmap_early_io_map()/pmap_early_io_unmap(), if used in pairs, should be used in the form: pmap_early_io_map() ..do stuff.. pmap_early_io_unmap() Without other allocations in the middle. Without reclaiming memory this can leave large holes in the device space. While here, make a simple change to the unmap loop which now permits it to unmap multiple TLB entries in the range. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Sep 7 03:15:26 2016 (r305516) +++ head/sys/powerpc/booke/pmap.c Wed Sep 7 03:26:55 2016 (r305517) @@ -3391,27 +3391,37 @@ tlb1_init() set_mas4_defaults(); } +/* + * pmap_early_io_unmap() should be used in short conjunction with + * pmap_early_io_map(), as in the following snippet: + * + * x = pmap_early_io_map(...); + * + * pmap_early_io_unmap(x, size); + * + * And avoiding more allocations between. + */ void pmap_early_io_unmap(vm_offset_t va, vm_size_t size) { int i; tlb_entry_t e; + vm_size_t isize; - for (i = 0; i < TLB1_ENTRIES && size > 0; i ++) { + size = roundup(size, PAGE_SIZE); + isize = size; + for (i = 0; i < TLB1_ENTRIES && size > 0; i++) { tlb1_read_entry(&e, i); if (!(e.mas1 & MAS1_VALID)) continue; - /* - * FIXME: this code does not work if VA region - * spans multiple TLB entries. This does not cause - * problems right now but shall be fixed in the future - */ - if (va >= e.virt && (va + size) <= (e.virt + e.size)) { + if (va <= e.virt && (va + isize) >= (e.virt + e.size)) { size -= e.size; e.mas1 &= ~MAS1_VALID; tlb1_write_entry(&e, i); } } + if (tlb1_map_base == va + isize) + tlb1_map_base -= isize; } vm_offset_t From owner-svn-src-head@freebsd.org Wed Sep 7 04:13: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 6589FBC61AC; Wed, 7 Sep 2016 04:13:29 +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 34BE89F1; Wed, 7 Sep 2016 04:13:29 +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 u874DSm0088132; Wed, 7 Sep 2016 04:13:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u874DSfe088131; Wed, 7 Sep 2016 04:13:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201609070413.u874DSfe088131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 7 Sep 2016 04:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305520 - 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.23 Precedence: list List-Id: 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, 07 Sep 2016 04:13:29 -0000 Author: jhibbits Date: Wed Sep 7 04:13:28 2016 New Revision: 305520 URL: https://svnweb.freebsd.org/changeset/base/305520 Log: Disable the qoriq errata fix for now It hangs more often than it actually works it seems. Further debugging is needed to determine why, but for now the system needs to be able to boot. Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Sep 7 04:07:43 2016 (r305519) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Sep 7 04:13:28 2016 (r305520) @@ -195,7 +195,9 @@ mpc85xx_attach(platform_t plat) } ccsrbar_va = pmap_early_io_map(ccsrbar, ccsrsize); +#if 0 mpc85xx_fix_errata(ccsrbar_va); +#endif mpc85xx_enable_l3_cache(); return (0); From owner-svn-src-head@freebsd.org Wed Sep 7 05:27: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 8CE08BC72B9; Wed, 7 Sep 2016 05:27:44 +0000 (UTC) (envelope-from sephe@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 3F5407BA; Wed, 7 Sep 2016 05:27:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u875RhhH014502; Wed, 7 Sep 2016 05:27:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u875Rhdl014499; Wed, 7 Sep 2016 05:27:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609070527.u875Rhdl014499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 7 Sep 2016 05:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305521 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 05:27:44 -0000 Author: sephe Date: Wed Sep 7 05:27:43 2016 New Revision: 305521 URL: https://svnweb.freebsd.org/changeset/base/305521 Log: hyperv/hn: Avoid bit fields for TXCSUM setup. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7792 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 04:13:28 2016 (r305520) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 05:27:43 2016 (r305521) @@ -972,16 +972,14 @@ hn_encap(struct hn_tx_ring *txr, struct csum_info = (rndis_tcp_ip_csum_info *)((uint8_t *)rppi + rppi->per_packet_info_offset); - csum_info->xmit.is_ipv4 = 1; + csum_info->value = NDIS_TXCSUM_INFO_IPV4; if (m_head->m_pkthdr.csum_flags & CSUM_IP) - csum_info->xmit.ip_header_csum = 1; + csum_info->value |= NDIS_TXCSUM_INFO_IPCS; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { - csum_info->xmit.tcp_csum = 1; - csum_info->xmit.tcp_header_offset = 0; - } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { - csum_info->xmit.udp_csum = 1; - } + if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + csum_info->value |= NDIS_TXCSUM_INFO_TCPCS; + else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + csum_info->value |= NDIS_TXCSUM_INFO_UDPCS; } rndis_mesg->msg_len = tot_data_buf_len + rndis_msg_size; Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Wed Sep 7 04:13:28 2016 (r305520) +++ head/sys/dev/hyperv/netvsc/ndis.h Wed Sep 7 05:27:43 2016 (r305521) @@ -232,6 +232,7 @@ struct ndis_rssprm_toeplitz { #define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100 /* LSOv2 */ +#define NDIS_LSO2_INFO_SIZE sizeof(uint32_t) #define NDIS_LSO2_INFO_MSS_MASK 0x000fffff #define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000 #define NDIS_LSO2_INFO_ISLSO2 0x40000000 @@ -248,4 +249,13 @@ struct ndis_rssprm_toeplitz { #define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \ (NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6) +/* Transmission checksum */ +#define NDIS_TXCSUM_INFO_SIZE sizeof(uint32_t) +#define NDIS_TXCSUM_INFO_IPV4 0x00000001 +#define NDIS_TXCSUM_INFO_IPV6 0x00000002 +#define NDIS_TXCSUM_INFO_TCPCS 0x00000004 +#define NDIS_TXCSUM_INFO_UDPCS 0x00000008 +#define NDIS_TXCSUM_INFO_IPCS 0x00000010 +#define NDIS_TXCSUM_INFO_THOFF 0x03ff0000 + #endif /* !_NET_NDIS_H_ */ From owner-svn-src-head@freebsd.org Wed Sep 7 05:34: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 1CE20BC7525; Wed, 7 Sep 2016 05:34:43 +0000 (UTC) (envelope-from wma@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 BD950B7B; Wed, 7 Sep 2016 05:34:42 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u875YfQ6018075; Wed, 7 Sep 2016 05:34:41 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u875YfCM018069; Wed, 7 Sep 2016 05:34:41 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609070534.u875YfCM018069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 7 Sep 2016 05:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305522 - in head/sys: arm/annapurna/alpine arm64/conf boot/fdt/dts/arm 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.23 Precedence: list List-Id: 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, 07 Sep 2016 05:34:43 -0000 Author: wma Date: Wed Sep 7 05:34:41 2016 New Revision: 305522 URL: https://svnweb.freebsd.org/changeset/base/305522 Log: Introduce support for Annapurna Alpine CCU and NB devices This commit adds drivers for Alpine Cache Coherency Unit and North Bridge Service whose task is to configure the system fabric and enable cache coherency. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: wma Differential Revision: https://reviews.freebsd.org/D7565 Added: head/sys/arm/annapurna/alpine/alpine_ccu.c (contents, props changed) head/sys/arm/annapurna/alpine/alpine_nb_service.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/boot/fdt/dts/arm/annapurna-alpine.dts head/sys/conf/files.arm head/sys/conf/files.arm64 Added: head/sys/arm/annapurna/alpine/alpine_ccu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/annapurna/alpine/alpine_ccu.c Wed Sep 7 05:34:41 2016 (r305522) @@ -0,0 +1,131 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET 0x4000 +#define AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET 0x5000 +#define AL_CCU_SPECULATION_CONTROL_OFFSET 0x4 + +static struct resource_spec al_ccu_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct al_ccu_softc { + struct resource *res; +}; + +static int al_ccu_probe(device_t dev); +static int al_ccu_attach(device_t dev); +static int al_ccu_detach(device_t dev); + +static device_method_t al_ccu_methods[] = { + DEVMETHOD(device_probe, al_ccu_probe), + DEVMETHOD(device_attach, al_ccu_attach), + DEVMETHOD(device_detach, al_ccu_detach), + + { 0, 0 } +}; + +static driver_t al_ccu_driver = { + "ccu", + al_ccu_methods, + sizeof(struct al_ccu_softc) +}; + +static devclass_t al_ccu_devclass; + +EARLY_DRIVER_MODULE(al_ccu, simplebus, al_ccu_driver, + al_ccu_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(al_ccu, ofwbus, al_ccu_driver, + al_ccu_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE); + +static int +al_ccu_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "annapurna-labs,al-ccu")) + return (ENXIO); + + device_set_desc(dev, "Alpine CCU"); + + return (BUS_PROBE_DEFAULT); +} + +static int +al_ccu_attach(device_t dev) +{ + struct al_ccu_softc *sc; + int err; + + sc = device_get_softc(dev); + + err = bus_alloc_resources(dev, al_ccu_spec, &sc->res); + if (err != 0) { + device_printf(dev, "could not allocate resources\n"); + return (err); + } + + /* Enable cache snoop */ + bus_write_4(sc->res, AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET, 1); + bus_write_4(sc->res, AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET, 1); + + /* Disable speculative fetches from masters */ + bus_write_4(sc->res, AL_CCU_SPECULATION_CONTROL_OFFSET, 7); + + return (0); +} + +static int +al_ccu_detach(device_t dev) +{ + struct al_ccu_softc *sc; + + sc = device_get_softc(dev); + + bus_release_resources(dev, al_ccu_spec, &sc->res); + + return (0); +} Added: head/sys/arm/annapurna/alpine/alpine_nb_service.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/annapurna/alpine/alpine_nb_service.c Wed Sep 7 05:34:41 2016 (r305522) @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define AL_NB_ACF_MISC_OFFSET 0xD0 +#define AL_NB_ACF_MISC_READ_BYPASS (1 << 30) + +static struct resource_spec nb_service_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct nb_service_softc { + struct resource *res; +}; + +static int nb_service_probe(device_t dev); +static int nb_service_attach(device_t dev); +static int nb_service_detach(device_t dev); + +static device_method_t nb_service_methods[] = { + DEVMETHOD(device_probe, nb_service_probe), + DEVMETHOD(device_attach, nb_service_attach), + DEVMETHOD(device_detach, nb_service_detach), + + { 0, 0 } +}; + +static driver_t nb_service_driver = { + "nb_service", + nb_service_methods, + sizeof(struct nb_service_softc) +}; + +static devclass_t nb_service_devclass; + +EARLY_DRIVER_MODULE(nb_service, simplebus, nb_service_driver, + nb_service_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(nb_service, ofwbus, nb_service_driver, + nb_service_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE); + +static int +nb_service_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "annapurna-labs,al-nb-service")) + return (ENXIO); + + device_set_desc(dev, "Alpine North Bridge Service"); + + return (BUS_PROBE_DEFAULT); +} + +static int +nb_service_attach(device_t dev) +{ + struct nb_service_softc *sc; + uint32_t val; + int err; + + sc = device_get_softc(dev); + + err = bus_alloc_resources(dev, nb_service_spec, &sc->res); + if (err != 0) { + device_printf(dev, "could not allocate resources\n"); + return (err); + } + + /* Do not allow reads to bypass writes to different addresses */ + val = bus_read_4(sc->res, AL_NB_ACF_MISC_OFFSET); + val &= ~AL_NB_ACF_MISC_READ_BYPASS; + bus_write_4(sc->res, AL_NB_ACF_MISC_OFFSET, val); + + return (0); +} + +static int +nb_service_detach(device_t dev) +{ + struct nb_service_softc *sc; + + sc = device_get_softc(dev); + + bus_release_resources(dev, nb_service_spec, &sc->res); + + return (0); +} Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Sep 7 05:27:43 2016 (r305521) +++ head/sys/arm64/conf/GENERIC Wed Sep 7 05:34:41 2016 (r305522) @@ -90,6 +90,10 @@ options SOC_ALLWINNER_A64 options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 +# Annapurna Alpine drivers +device al_ccu # Alpine Cache Coherency Unit +device al_nb_service # Alpine North Bridge Service + # VirtIO support device virtio device virtio_mmio Modified: head/sys/boot/fdt/dts/arm/annapurna-alpine.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Wed Sep 7 05:27:43 2016 (r305521) +++ head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Wed Sep 7 05:34:41 2016 (r305522) @@ -137,6 +137,12 @@ reg = <0x00ff5ec0 0x30>; }; + ccu { + compatible = "annapurna-labs,al-ccu"; + reg = <0x00090000 0x10000>; + io_coherency = <1>; + }; + nb_service { compatible = "annapurna-labs,al-nb-service"; reg = <0x00070000 0x10000>; Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Wed Sep 7 05:27:43 2016 (r305521) +++ head/sys/conf/files.arm Wed Sep 7 05:34:41 2016 (r305522) @@ -1,4 +1,6 @@ # $FreeBSD$ +arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt +arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/arm/autoconf.c standard arm/arm/bcopy_page.S standard arm/arm/bcopyinout.S standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Sep 7 05:27:43 2016 (r305521) +++ head/sys/conf/files.arm64 Wed Sep 7 05:34:41 2016 (r305522) @@ -38,6 +38,8 @@ arm/allwinner/clk/aw_pll.c optional aw_c arm/allwinner/clk/aw_thsclk.c optional aw_ccu arm/allwinner/clk/aw_usbclk.c optional aw_ccu arm/allwinner/if_awg.c optional awg +arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt +arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/arm/generic_timer.c standard arm/arm/gic.c standard arm/arm/gic_fdt.c optional fdt From owner-svn-src-head@freebsd.org Wed Sep 7 05:36:56 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 D5EE5BC75E6; Wed, 7 Sep 2016 05:36:56 +0000 (UTC) (envelope-from wma@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 93CCCD49; Wed, 7 Sep 2016 05:36:56 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u875ataT018199; Wed, 7 Sep 2016 05:36:55 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u875atwT018196; Wed, 7 Sep 2016 05:36:55 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201609070536.u875atwT018196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 7 Sep 2016 05:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305523 - in head/sys/arm: annapurna/alpine 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.23 Precedence: list List-Id: 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, 07 Sep 2016 05:36:56 -0000 Author: wma Date: Wed Sep 7 05:36:55 2016 New Revision: 305523 URL: https://svnweb.freebsd.org/changeset/base/305523 Log: Remove messy machdep code for Alpine V1 and use proper drivers instead Let drivers for Alpine CCU, NB and Serdes take care of internal SoC configuration. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: imp,wma Differential Revision: https://reviews.freebsd.org/D7566 Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c head/sys/arm/annapurna/alpine/alpine_machdep_mp.c head/sys/arm/conf/ALPINE Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep.c Wed Sep 7 05:34:41 2016 (r305522) +++ head/sys/arm/annapurna/alpine/alpine_machdep.c Wed Sep 7 05:36:55 2016 (r305523) @@ -51,21 +51,10 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_platform.h" -struct mtx al_dbg_lock; - #define DEVMAP_MAX_VA_ADDRESS 0xF0000000 bus_addr_t al_devmap_pa; bus_addr_t al_devmap_size; -#define AL_NB_SERVICE_OFFSET 0x70000 -#define AL_NB_CCU_OFFSET 0x90000 -#define AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET 0x4000 -#define AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET 0x5000 -#define AL_CCU_SPECULATION_CONTROL_OFFSET 0x4 - -#define AL_NB_ACF_MISC_OFFSET 0xD0 -#define AL_NB_ACF_MISC_READ_BYPASS (1 << 30) - int alpine_get_devmap_base(bus_addr_t *pa, bus_addr_t *size); vm_offset_t @@ -90,35 +79,7 @@ platform_gpio_init(void) void platform_late_init(void) { - bus_addr_t reg_baddr; - uint32_t val; - - if (!mtx_initialized(&al_dbg_lock)) - mtx_init(&al_dbg_lock, "ALDBG", "ALDBG", MTX_SPIN); - - /* configure system fabric */ - if (bus_space_map(fdtbus_bs_tag, al_devmap_pa, al_devmap_size, 0, - ®_baddr)) - panic("Couldn't map Register Space area"); - - /* do not allow reads to bypass writes to different addresses */ - val = bus_space_read_4(fdtbus_bs_tag, reg_baddr, - AL_NB_SERVICE_OFFSET + AL_NB_ACF_MISC_OFFSET); - val &= ~AL_NB_ACF_MISC_READ_BYPASS; - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_SERVICE_OFFSET + AL_NB_ACF_MISC_OFFSET, val); - - /* enable cache snoop */ - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET, 1); - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET, 1); - - /* disable speculative fetches from masters */ - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SPECULATION_CONTROL_OFFSET, 7); - bus_space_unmap(fdtbus_bs_tag, reg_baddr, al_devmap_size); } /* Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Wed Sep 7 05:34:41 2016 (r305522) +++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Wed Sep 7 05:36:55 2016 (r305523) @@ -68,22 +68,14 @@ __FBSDID("$FreeBSD$"); #define AL_NB_INIT_CONTROL (0x8) #define AL_NB_CONFIG_STATUS_PWR_CTRL(cpu) (0x2020 + (cpu)*0x100) -#define SERDES_NUM_GROUPS 4 -#define SERDES_GROUP_SIZE 0x400 - extern bus_addr_t al_devmap_pa; extern bus_addr_t al_devmap_size; extern void mpentry(void); -int alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, - bus_addr_t *baddr); static int platform_mp_get_core_cnt(void); static int alpine_get_cpu_resume_base(u_long *pbase, u_long *psize); static int alpine_get_nb_base(u_long *pbase, u_long *psize); -static int alpine_get_serdes_base(u_long *pbase, u_long *psize); -int alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, - bus_addr_t *baddr); static boolean_t alpine_validate_cpu(u_int, phandle_t, u_int, pcell_t *); static boolean_t @@ -254,60 +246,3 @@ platform_mp_start_ap(void) bus_space_unmap(fdtbus_bs_tag, nb_baddr, nb_size); bus_space_unmap(fdtbus_bs_tag, cpu_resume_baddr, cpu_resume_size); } - -static int -alpine_get_serdes_base(u_long *pbase, u_long *psize) -{ - phandle_t node; - u_long base = 0; - u_long size = 0; - - if (pbase == NULL || psize == NULL) - return (EINVAL); - - if ((node = OF_finddevice("/")) == -1) - return (EFAULT); - - if ((node = - ofw_bus_find_compatible(node, "annapurna-labs,al-serdes")) == 0) - return (EFAULT); - - if (fdt_regsize(node, &base, &size)) - return (EFAULT); - - *pbase = base; - *psize = size; - - return (0); -} - -int -alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, bus_addr_t *baddr) -{ - u_long serdes_base, serdes_size; - int ret; - static bus_addr_t baddr_mapped[SERDES_NUM_GROUPS]; - - if (group >= SERDES_NUM_GROUPS) - return (EINVAL); - - if (baddr_mapped[group]) { - *tag = fdtbus_bs_tag; - *baddr = baddr_mapped[group]; - return (0); - } - - ret = alpine_get_serdes_base(&serdes_base, &serdes_size); - if (ret) - return (ret); - - ret = bus_space_map(fdtbus_bs_tag, - al_devmap_pa + serdes_base + group * SERDES_GROUP_SIZE, - (SERDES_NUM_GROUPS - group) * SERDES_GROUP_SIZE, 0, baddr); - if (ret) - return (ret); - - baddr_mapped[group] = *baddr; - - return (0); -} Modified: head/sys/arm/conf/ALPINE ============================================================================== --- head/sys/arm/conf/ALPINE Wed Sep 7 05:34:41 2016 (r305522) +++ head/sys/arm/conf/ALPINE Wed Sep 7 05:36:55 2016 (r305523) @@ -32,6 +32,10 @@ options SMP # Enable multiple cores device gic options INTRNG +# Annapurna Alpine drivers +device al_ccu # Alpine Cache Coherency Unit +device al_nb_service # Alpine North Bridge Service + # Pseudo devices device loop device random From owner-svn-src-head@freebsd.org Wed Sep 7 05:41:03 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 58192BC78E8; Wed, 7 Sep 2016 05:41:03 +0000 (UTC) (envelope-from sephe@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 32A15FCE; Wed, 7 Sep 2016 05:41:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u875f2LP020575; Wed, 7 Sep 2016 05:41:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u875f2dw020572; Wed, 7 Sep 2016 05:41:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609070541.u875f2dw020572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 7 Sep 2016 05:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305524 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 05:41:03 -0000 Author: sephe Date: Wed Sep 7 05:41:01 2016 New Revision: 305524 URL: https://svnweb.freebsd.org/changeset/base/305524 Log: hyperv/hn: Cleanup RNDIS packet message encapsulation. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7793 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 05:36:55 2016 (r305523) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 05:41:01 2016 (r305524) @@ -142,14 +142,14 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 -#define HN_RNDIS_MSG_LEN \ - (sizeof(rndis_msg) + \ +#define HN_RNDIS_PKT_LEN \ + (sizeof(struct rndis_packet_msg) + \ RNDIS_HASHVAL_PPI_SIZE + \ RNDIS_VLAN_PPI_SIZE + \ RNDIS_TSO_PPI_SIZE + \ RNDIS_CSUM_PPI_SIZE) -#define HN_RNDIS_MSG_BOUNDARY PAGE_SIZE -#define HN_RNDIS_MSG_ALIGN CACHE_LINE_SIZE +#define HN_RNDIS_PKT_BOUNDARY PAGE_SIZE +#define HN_RNDIS_PKT_ALIGN CACHE_LINE_SIZE #define HN_TX_DATA_BOUNDARY PAGE_SIZE #define HN_TX_DATA_MAXSIZE IP_MAXPACKET @@ -173,9 +173,9 @@ struct hn_txdesc { bus_dmamap_t data_dmap; - bus_addr_t rndis_msg_paddr; - rndis_msg *rndis_msg; - bus_dmamap_t rndis_msg_dmap; + bus_addr_t rndis_pkt_paddr; + struct rndis_packet_msg *rndis_pkt; + bus_dmamap_t rndis_pkt_dmap; }; #define HN_TXD_FLAG_ONLIST 0x1 @@ -845,6 +845,15 @@ netvsc_channel_rollup(struct hn_rx_ring hn_txeof(txr); } +static __inline uint32_t +hn_rndis_pktmsg_offset(uint32_t ofs) +{ + + KASSERT(ofs >= sizeof(struct rndis_packet_msg), + ("invalid RNDIS packet msg offset %u", ofs)); + return (ofs - __offsetof(struct rndis_packet_msg, rm_dataoffset)); +} + /* * NOTE: * If this function fails, then both txd and m_head0 will be freed. @@ -855,14 +864,11 @@ hn_encap(struct hn_tx_ring *txr, struct bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX]; int error, nsegs, i; struct mbuf *m_head = *m_head0; - rndis_msg *rndis_mesg; - rndis_packet *rndis_pkt; + struct rndis_packet_msg *pkt; rndis_per_packet_info *rppi; struct rndis_hash_value *hash_value; - uint32_t rndis_msg_size, tot_data_buf_len, send_buf_section_idx; - int send_buf_section_size; - - tot_data_buf_len = m_head->m_pkthdr.len; + uint32_t send_buf_section_idx; + int send_buf_section_size, pktlen; /* * extension points to the area reserved for the @@ -870,25 +876,20 @@ hn_encap(struct hn_tx_ring *txr, struct * the netvsc_packet (and rppi struct, if present; * length is updated later). */ - rndis_mesg = txd->rndis_msg; - /* XXX not necessary */ - memset(rndis_mesg, 0, HN_RNDIS_MSG_LEN); - rndis_mesg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG; - - rndis_pkt = &rndis_mesg->msg.packet; - rndis_pkt->data_offset = sizeof(rndis_packet); - rndis_pkt->data_length = tot_data_buf_len; - rndis_pkt->per_pkt_info_offset = sizeof(rndis_packet); - - rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet); + pkt = txd->rndis_pkt; + pkt->rm_type = REMOTE_NDIS_PACKET_MSG; + pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; + pkt->rm_dataoffset = sizeof(*pkt); + pkt->rm_datalen = m_head->m_pkthdr.len; + pkt->rm_pktinfooffset = sizeof(*pkt); + pkt->rm_pktinfolen = 0; /* * Set the hash value for this packet, so that the host could * dispatch the TX done event for this packet back to this TX * ring's channel. */ - rndis_msg_size += RNDIS_HASHVAL_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_HASHVAL_PPI_SIZE, + rppi = hv_set_rppi_data(pkt, RNDIS_HASHVAL_PPI_SIZE, nbl_hash_value); hash_value = (struct rndis_hash_value *)((uint8_t *)rppi + rppi->per_packet_info_offset); @@ -897,8 +898,7 @@ hn_encap(struct hn_tx_ring *txr, struct if (m_head->m_flags & M_VLANTAG) { ndis_8021q_info *rppi_vlan_info; - rndis_msg_size += RNDIS_VLAN_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_VLAN_PPI_SIZE, + rppi = hv_set_rppi_data(pkt, RNDIS_VLAN_PPI_SIZE, ieee_8021q_info); rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi + @@ -924,8 +924,7 @@ hn_encap(struct hn_tx_ring *txr, struct else ether_len = ETHER_HDR_LEN; - rndis_msg_size += RNDIS_TSO_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_TSO_PPI_SIZE, + rppi = hv_set_rppi_data(pkt, RNDIS_TSO_PPI_SIZE, tcp_large_send_info); tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi + @@ -966,8 +965,7 @@ hn_encap(struct hn_tx_ring *txr, struct } else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) { rndis_tcp_ip_csum_info *csum_info; - rndis_msg_size += RNDIS_CSUM_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_CSUM_PPI_SIZE, + rppi = hv_set_rppi_data(pkt, RNDIS_CSUM_PPI_SIZE, tcpip_chksum_info); csum_info = (rndis_tcp_ip_csum_info *)((uint8_t *)rppi + rppi->per_packet_info_offset); @@ -982,24 +980,26 @@ hn_encap(struct hn_tx_ring *txr, struct csum_info->value |= NDIS_TXCSUM_INFO_UDPCS; } - rndis_mesg->msg_len = tot_data_buf_len + rndis_msg_size; - tot_data_buf_len = rndis_mesg->msg_len; + pktlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; + /* Convert RNDIS packet message offsets */ + pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt->rm_dataoffset); + pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); /* * Chimney send, if the packet could fit into one chimney buffer. */ - if (tot_data_buf_len < txr->hn_chim_size) { + if (pkt->rm_len < txr->hn_chim_size) { txr->hn_tx_chimney_tried++; send_buf_section_idx = hn_chim_alloc(txr->hn_sc); if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { uint8_t *dest = txr->hn_sc->hn_chim + (send_buf_section_idx * txr->hn_sc->hn_chim_szmax); - memcpy(dest, rndis_mesg, rndis_msg_size); - dest += rndis_msg_size; + memcpy(dest, pkt, pktlen); + dest += pktlen; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - send_buf_section_size = tot_data_buf_len; + send_buf_section_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; goto done; @@ -1030,9 +1030,9 @@ hn_encap(struct hn_tx_ring *txr, struct txr->hn_gpa_cnt = nsegs + 1; /* send packet with page buffer */ - txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); - txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; - txr->hn_gpa[0].gpa_len = rndis_msg_size; + txr->hn_gpa[0].gpa_page = atop(txd->rndis_pkt_paddr); + txr->hn_gpa[0].gpa_ofs = txd->rndis_pkt_paddr & PAGE_MASK; + txr->hn_gpa[0].gpa_len = pktlen; /* * Fill the page buffers with mbuf info after the page @@ -2457,16 +2457,16 @@ hn_create_tx_ring(struct hn_softc *sc, i parent_dtag = bus_get_dma_tag(dev); - /* DMA tag for RNDIS messages. */ + /* DMA tag for RNDIS packet messages. */ error = bus_dma_tag_create(parent_dtag, /* parent */ - HN_RNDIS_MSG_ALIGN, /* alignment */ - HN_RNDIS_MSG_BOUNDARY, /* boundary */ + HN_RNDIS_PKT_ALIGN, /* alignment */ + HN_RNDIS_PKT_BOUNDARY, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - HN_RNDIS_MSG_LEN, /* maxsize */ + HN_RNDIS_PKT_LEN, /* maxsize */ 1, /* nsegments */ - HN_RNDIS_MSG_LEN, /* maxsegsize */ + HN_RNDIS_PKT_LEN, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ @@ -2501,28 +2501,28 @@ hn_create_tx_ring(struct hn_softc *sc, i txd->txr = txr; /* - * Allocate and load RNDIS messages. + * Allocate and load RNDIS packet message. */ error = bus_dmamem_alloc(txr->hn_tx_rndis_dtag, - (void **)&txd->rndis_msg, - BUS_DMA_WAITOK | BUS_DMA_COHERENT, - &txd->rndis_msg_dmap); + (void **)&txd->rndis_pkt, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &txd->rndis_pkt_dmap); if (error) { device_printf(dev, - "failed to allocate rndis_msg, %d\n", i); + "failed to allocate rndis_packet_msg, %d\n", i); return error; } error = bus_dmamap_load(txr->hn_tx_rndis_dtag, - txd->rndis_msg_dmap, - txd->rndis_msg, HN_RNDIS_MSG_LEN, - hyperv_dma_map_paddr, &txd->rndis_msg_paddr, + txd->rndis_pkt_dmap, + txd->rndis_pkt, HN_RNDIS_PKT_LEN, + hyperv_dma_map_paddr, &txd->rndis_pkt_paddr, BUS_DMA_NOWAIT); if (error) { device_printf(dev, - "failed to load rndis_msg, %d\n", i); + "failed to load rndis_packet_msg, %d\n", i); bus_dmamem_free(txr->hn_tx_rndis_dtag, - txd->rndis_msg, txd->rndis_msg_dmap); + txd->rndis_pkt, txd->rndis_pkt_dmap); return error; } @@ -2533,9 +2533,9 @@ hn_create_tx_ring(struct hn_softc *sc, i device_printf(dev, "failed to allocate tx data dmamap\n"); bus_dmamap_unload(txr->hn_tx_rndis_dtag, - txd->rndis_msg_dmap); + txd->rndis_pkt_dmap); bus_dmamem_free(txr->hn_tx_rndis_dtag, - txd->rndis_msg, txd->rndis_msg_dmap); + txd->rndis_pkt, txd->rndis_pkt_dmap); return error; } @@ -2593,9 +2593,9 @@ hn_txdesc_dmamap_destroy(struct hn_txdes KASSERT(txd->m == NULL, ("still has mbuf installed")); KASSERT((txd->flags & HN_TXD_FLAG_DMAMAP) == 0, ("still dma mapped")); - bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap); - bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_msg, - txd->rndis_msg_dmap); + bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_pkt_dmap); + bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_pkt, + txd->rndis_pkt_dmap); bus_dmamap_destroy(txr->hn_tx_data_dtag, txd->data_dmap); } Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Sep 7 05:36:55 2016 (r305523) +++ head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Sep 7 05:41:01 2016 (r305524) @@ -900,8 +900,7 @@ int netvsc_recv(struct hn_rx_ring *rxr, const struct hn_recvinfo *info); void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -void* hv_set_rppi_data(rndis_msg *rndis_mesg, - uint32_t rppi_size, +void* hv_set_rppi_data(struct rndis_packet_msg *pkt, uint32_t rppi_size, int pkt_type); #endif /* __HV_RNDIS_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 05:36:55 2016 (r305523) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 05:41:01 2016 (r305524) @@ -106,24 +106,31 @@ again: * Set the Per-Packet-Info with the specified type */ void * -hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, - int pkt_type) +hv_set_rppi_data(struct rndis_packet_msg *pkt, uint32_t rppi_size, int pkt_type) { - rndis_packet *rndis_pkt; rndis_per_packet_info *rppi; - rndis_pkt = &rndis_mesg->msg.packet; - rndis_pkt->data_offset += rppi_size; + /* Data immediately follow per-packet-info. */ + pkt->rm_dataoffset += rppi_size; - rppi = (rndis_per_packet_info *)((char *)rndis_pkt + - rndis_pkt->per_pkt_info_offset + rndis_pkt->per_pkt_info_length); + /* Update RNDIS packet msg length */ + pkt->rm_len += rppi_size; + + /* + * Per-packet-info does not move; it only grows. + * + * NOTE: + * rm_pktinfooffset in this phase counts from the beginning + * of rndis_packet_msg. + */ + rppi = (rndis_per_packet_info *)((uint8_t *)pkt + + pkt->rm_pktinfooffset + pkt->rm_pktinfolen); + pkt->rm_pktinfolen += rppi_size; rppi->size = rppi_size; rppi->type = pkt_type; rppi->per_packet_info_offset = sizeof(rndis_per_packet_info); - rndis_pkt->per_pkt_info_length += rppi_size; - return (rppi); } From owner-svn-src-head@freebsd.org Wed Sep 7 06:02:31 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 1C186BC7E5A; Wed, 7 Sep 2016 06:02:31 +0000 (UTC) (envelope-from sephe@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 EAD13C3F; Wed, 7 Sep 2016 06:02:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8762UMS029585; Wed, 7 Sep 2016 06:02:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8762TOr029580; Wed, 7 Sep 2016 06:02:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609070602.u8762TOr029580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 7 Sep 2016 06:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305525 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 06:02:31 -0000 Author: sephe Date: Wed Sep 7 06:02:29 2016 New Revision: 305525 URL: https://svnweb.freebsd.org/changeset/base/305525 Log: hyperv/hn: Simplify per-packet-info construction. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7794 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 05:41:01 2016 (r305524) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 06:02:29 2016 (r305525) @@ -142,12 +142,12 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 -#define HN_RNDIS_PKT_LEN \ - (sizeof(struct rndis_packet_msg) + \ - RNDIS_HASHVAL_PPI_SIZE + \ - RNDIS_VLAN_PPI_SIZE + \ - RNDIS_TSO_PPI_SIZE + \ - RNDIS_CSUM_PPI_SIZE) +#define HN_RNDIS_PKT_LEN \ + (sizeof(struct rndis_packet_msg) + \ + HN_RNDIS_PKTINFO_SIZE(HN_NDIS_HASH_VALUE_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_VLAN_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_LSO2_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_TXCSUM_INFO_SIZE)) #define HN_RNDIS_PKT_BOUNDARY PAGE_SIZE #define HN_RNDIS_PKT_ALIGN CACHE_LINE_SIZE @@ -865,10 +865,9 @@ hn_encap(struct hn_tx_ring *txr, struct int error, nsegs, i; struct mbuf *m_head = *m_head0; struct rndis_packet_msg *pkt; - rndis_per_packet_info *rppi; - struct rndis_hash_value *hash_value; uint32_t send_buf_section_idx; int send_buf_section_size, pktlen; + uint32_t *pi_data; /* * extension points to the area reserved for the @@ -889,21 +888,14 @@ hn_encap(struct hn_tx_ring *txr, struct * dispatch the TX done event for this packet back to this TX * ring's channel. */ - rppi = hv_set_rppi_data(pkt, RNDIS_HASHVAL_PPI_SIZE, - nbl_hash_value); - hash_value = (struct rndis_hash_value *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - hash_value->hash_value = txr->hn_tx_idx; + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); + *pi_data = txr->hn_tx_idx; if (m_head->m_flags & M_VLANTAG) { - ndis_8021q_info *rppi_vlan_info; - - rppi = hv_set_rppi_data(pkt, RNDIS_VLAN_PPI_SIZE, - ieee_8021q_info); - - rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - rppi_vlan_info->u1.value = NDIS_VLAN_INFO_MAKE( + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_VLAN_INFO_SIZE, NDIS_PKTINFO_TYPE_VLAN); + *pi_data = NDIS_VLAN_INFO_MAKE( EVL_VLANOFTAG(m_head->m_pkthdr.ether_vtag), EVL_PRIOFTAG(m_head->m_pkthdr.ether_vtag), EVL_CFIOFTAG(m_head->m_pkthdr.ether_vtag)); @@ -911,7 +903,6 @@ hn_encap(struct hn_tx_ring *txr, struct if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { #if defined(INET6) || defined(INET) - rndis_tcp_tso_info *tso_info; struct ether_vlan_header *eh; int ether_len; @@ -924,12 +915,8 @@ hn_encap(struct hn_tx_ring *txr, struct else ether_len = ETHER_HDR_LEN; - rppi = hv_set_rppi_data(pkt, RNDIS_TSO_PPI_SIZE, - tcp_large_send_info); - - tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO); #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { struct ip *ip = @@ -942,7 +929,7 @@ hn_encap(struct hn_tx_ring *txr, struct ip->ip_sum = 0; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); - tso_info->value = NDIS_LSO2_INFO_MAKEIPV4(0, + *pi_data = NDIS_LSO2_INFO_MAKEIPV4(0, m_head->m_pkthdr.tso_segsz); } #endif @@ -957,27 +944,23 @@ hn_encap(struct hn_tx_ring *txr, struct ip6->ip6_plen = 0; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); - tso_info->value = NDIS_LSO2_INFO_MAKEIPV6(0, + *pi_data = NDIS_LSO2_INFO_MAKEIPV6(0, m_head->m_pkthdr.tso_segsz); } #endif #endif /* INET6 || INET */ } else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) { - rndis_tcp_ip_csum_info *csum_info; - - rppi = hv_set_rppi_data(pkt, RNDIS_CSUM_PPI_SIZE, - tcpip_chksum_info); - csum_info = (rndis_tcp_ip_csum_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_TXCSUM_INFO_SIZE, NDIS_PKTINFO_TYPE_CSUM); + *pi_data = NDIS_TXCSUM_INFO_IPV4; - csum_info->value = NDIS_TXCSUM_INFO_IPV4; if (m_head->m_pkthdr.csum_flags & CSUM_IP) - csum_info->value |= NDIS_TXCSUM_INFO_IPCS; + *pi_data |= NDIS_TXCSUM_INFO_IPCS; if (m_head->m_pkthdr.csum_flags & CSUM_TCP) - csum_info->value |= NDIS_TXCSUM_INFO_TCPCS; + *pi_data |= NDIS_TXCSUM_INFO_TCPCS; else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) - csum_info->value |= NDIS_TXCSUM_INFO_UDPCS; + *pi_data |= NDIS_TXCSUM_INFO_UDPCS; } pktlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Sep 7 05:41:01 2016 (r305524) +++ head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Sep 7 06:02:29 2016 (r305525) @@ -569,18 +569,6 @@ typedef struct rndis_tcp_tso_info_ { }; } rndis_tcp_tso_info; -#define RNDIS_HASHVAL_PPI_SIZE (sizeof(rndis_per_packet_info) + \ - sizeof(struct rndis_hash_value)) - -#define RNDIS_VLAN_PPI_SIZE (sizeof(rndis_per_packet_info) + \ - sizeof(ndis_8021q_info)) - -#define RNDIS_CSUM_PPI_SIZE (sizeof(rndis_per_packet_info) + \ - sizeof(rndis_tcp_ip_csum_info)) - -#define RNDIS_TSO_PPI_SIZE (sizeof(rndis_per_packet_info) + \ - sizeof(rndis_tcp_tso_info)) - /* * Format of Information buffer passed in a SetRequest for the OID * OID_GEN_RNDIS_CONFIG_PARAMETER. @@ -900,8 +888,5 @@ int netvsc_recv(struct hn_rx_ring *rxr, const struct hn_recvinfo *info); void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -void* hv_set_rppi_data(struct rndis_packet_msg *pkt, uint32_t rppi_size, - int pkt_type); - #endif /* __HV_RNDIS_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 05:41:01 2016 (r305524) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 06:02:29 2016 (r305525) @@ -102,19 +102,15 @@ again: return ((rid & 0xffff) << 16); } -/* - * Set the Per-Packet-Info with the specified type - */ void * -hv_set_rppi_data(struct rndis_packet_msg *pkt, uint32_t rppi_size, int pkt_type) +hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, + size_t pi_dlen, uint32_t pi_type) { - rndis_per_packet_info *rppi; + const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); + struct rndis_pktinfo *pi; - /* Data immediately follow per-packet-info. */ - pkt->rm_dataoffset += rppi_size; - - /* Update RNDIS packet msg length */ - pkt->rm_len += rppi_size; + KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, + ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); /* * Per-packet-info does not move; it only grows. @@ -123,15 +119,23 @@ hv_set_rppi_data(struct rndis_packet_msg * rm_pktinfooffset in this phase counts from the beginning * of rndis_packet_msg. */ - rppi = (rndis_per_packet_info *)((uint8_t *)pkt + - pkt->rm_pktinfooffset + pkt->rm_pktinfolen); - pkt->rm_pktinfolen += rppi_size; - - rppi->size = rppi_size; - rppi->type = pkt_type; - rppi->per_packet_info_offset = sizeof(rndis_per_packet_info); + KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, + ("%u pktinfo overflows RNDIS packet msg", pi_type)); + pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + + pkt->rm_pktinfolen); + pkt->rm_pktinfolen += pi_size; + + pi->rm_size = pi_size; + pi->rm_type = pi_type; + pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; + + /* Data immediately follow per-packet-info. */ + pkt->rm_dataoffset += pi_size; + + /* Update RNDIS packet msg length */ + pkt->rm_len += pi_size; - return (rppi); + return (pi->rm_data); } /* Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Wed Sep 7 05:41:01 2016 (r305524) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Wed Sep 7 06:02:29 2016 (r305525) @@ -221,4 +221,8 @@ CTASSERT(sizeof(struct hn_nvs_rndis_ack) #define HN_NDIS_HASH_VALUE_SIZE sizeof(uint32_t) #define HN_NDIS_PKTINFO_TYPE_HASHVAL NDIS_PKTINFO_TYPE_PKT_CANCELID +/* Per-packet-info size */ +#define HN_RNDIS_PKTINFO_SIZE(dlen) \ + __offsetof(struct rndis_pktinfo, rm_data[dlen]) + #endif /* !_IF_HNREG_H_ */ Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Wed Sep 7 05:41:01 2016 (r305524) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Wed Sep 7 06:02:29 2016 (r305525) @@ -121,6 +121,9 @@ void hn_nvs_sent_xact(struct hn_send_ct uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); +void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, + size_t pktsize, size_t pi_dlen, uint32_t pi_type); + extern struct hn_send_ctx hn_send_ctx_none; #endif /* !_IF_HNVAR_H_ */ From owner-svn-src-head@freebsd.org Wed Sep 7 09:20:59 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 9FEF0B96679; Wed, 7 Sep 2016 09:20:59 +0000 (UTC) (envelope-from sephe@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 6EE778D5; Wed, 7 Sep 2016 09:20:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u879Kw8T002575; Wed, 7 Sep 2016 09:20:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u879KwWC002569; Wed, 7 Sep 2016 09:20:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609070920.u879KwWC002569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 7 Sep 2016 09:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305526 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 09:20:59 -0000 Author: sephe Date: Wed Sep 7 09:20:58 2016 New Revision: 305526 URL: https://svnweb.freebsd.org/changeset/base/305526 Log: hyperv/hn: Nuke unused bits MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7795 Deleted: head/sys/dev/hyperv/netvsc/hv_rndis.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Sep 7 09:20:58 2016 (r305526) @@ -48,9 +48,9 @@ #include #include #include -#include #include #include +#include MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); @@ -513,15 +513,15 @@ hv_nv_connect_to_vsp(struct hn_softc *sc for (i = protocol_number - 1; i >= 0; i--) { if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { sc->hn_nvs_ver = protocol_list[i]; - sc->hn_ndis_ver = NDIS_VERSION_6_30; + sc->hn_ndis_ver = HN_NDIS_VERSION_6_30; if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) - sc->hn_ndis_ver = NDIS_VERSION_6_1; + sc->hn_ndis_ver = HN_NDIS_VERSION_6_1; if (bootverbose) { if_printf(sc->hn_ifp, "NVS version 0x%x, " "NDIS version %u.%u\n", sc->hn_nvs_ver, - NDIS_VERSION_MAJOR(sc->hn_ndis_ver), - NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } break; } @@ -547,8 +547,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc memset(&ndis, 0, sizeof(ndis)); ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; - ndis.nvs_ndis_major = NDIS_VERSION_MAJOR(sc->hn_ndis_ver); - ndis.nvs_ndis_minor = NDIS_VERSION_MINOR(sc->hn_ndis_ver); + ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); /* NOTE: No response. */ ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); @@ -764,7 +764,7 @@ hv_nv_on_receive(struct hn_softc *sc, st } pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (__predict_false(pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID)) { + if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", pkt->cp_rxbuf_id); return; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Sep 7 09:20:58 2016 (r305526) @@ -74,110 +74,6 @@ MALLOC_DECLARE(M_NETVSC); #define NVSP_PROTOCOL_VERSION_2 0x30002 #define NVSP_PROTOCOL_VERSION_4 0x40000 #define NVSP_PROTOCOL_VERSION_5 0x50000 -#define NVSP_MIN_PROTOCOL_VERSION (NVSP_PROTOCOL_VERSION_1) -#define NVSP_MAX_PROTOCOL_VERSION (NVSP_PROTOCOL_VERSION_2) - -#define NVSP_PROTOCOL_VERSION_CURRENT NVSP_PROTOCOL_VERSION_2 - -#define VERSION_4_OFFLOAD_SIZE 22 - -#define NVSP_OPERATIONAL_STATUS_OK (0x00000000) -#define NVSP_OPERATIONAL_STATUS_DEGRADED (0x00000001) -#define NVSP_OPERATIONAL_STATUS_NONRECOVERABLE (0x00000002) -#define NVSP_OPERATIONAL_STATUS_NO_CONTACT (0x00000003) -#define NVSP_OPERATIONAL_STATUS_LOST_COMMUNICATION (0x00000004) - -/* - * Maximun number of transfer pages (packets) the VSP will use on a receive - */ -#define NVSP_MAX_PACKETS_PER_RECEIVE 375 - -/* vRSS stuff */ -#define RNDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 -#define RNDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 - -#define RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 -#define RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 - -struct rndis_obj_header { - uint8_t type; - uint8_t rev; - uint16_t size; -} __packed; - -/* rndis_recv_scale_cap/cap_flag */ -#define RNDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x01000000 -#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x02000000 -#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x04000000 -#define RNDIS_RSS_CAPS_USING_MSI_X 0x08000000 -#define RNDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x10000000 -#define RNDIS_RSS_CAPS_SUPPORTS_MSI_X 0x20000000 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x00000100 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x00000200 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x00000400 - -/* RNDIS_RECEIVE_SCALE_CAPABILITIES */ -struct rndis_recv_scale_cap { - struct rndis_obj_header hdr; - uint32_t cap_flag; - uint32_t num_int_msg; - uint32_t num_recv_que; - uint16_t num_indirect_tabent; -} __packed; - -/* rndis_recv_scale_param flags */ -#define RNDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 -#define RNDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED 0x0002 -#define RNDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 -#define RNDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 -#define RNDIS_RSS_PARAM_FLAG_DISABLE_RSS 0x0010 - -/* Hash info bits */ -#define RNDIS_HASH_FUNC_TOEPLITZ 0x00000001 -#define RNDIS_HASH_IPV4 0x00000100 -#define RNDIS_HASH_TCP_IPV4 0x00000200 -#define RNDIS_HASH_IPV6 0x00000400 -#define RNDIS_HASH_IPV6_EX 0x00000800 -#define RNDIS_HASH_TCP_IPV6 0x00001000 -#define RNDIS_HASH_TCP_IPV6_EX 0x00002000 - -#define RNDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) -#define RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 - -#define ITAB_NUM 128 -#define HASH_KEYLEN RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 - -/* RNDIS_RECEIVE_SCALE_PARAMETERS */ -typedef struct rndis_recv_scale_param_ { - struct rndis_obj_header hdr; - - /* Qualifies the rest of the information */ - uint16_t flag; - - /* The base CPU number to do receive processing. not used */ - uint16_t base_cpu_number; - - /* This describes the hash function and type being enabled */ - uint32_t hashinfo; - - /* The size of indirection table array */ - uint16_t indirect_tabsize; - - /* The offset of the indirection table from the beginning of this - * structure - */ - uint32_t indirect_taboffset; - - /* The size of the hash secret key */ - uint16_t hashkey_size; - - /* The offset of the secret key from the beginning of this structure */ - uint32_t hashkey_offset; - - uint32_t processor_masks_offset; - uint32_t num_processor_masks; - uint32_t processor_masks_entry_size; -} rndis_recv_scale_param; /* * The following arguably belongs in a separate header file @@ -188,18 +84,10 @@ typedef struct rndis_recv_scale_param_ { */ #define NETVSC_SEND_BUFFER_SIZE (1024*1024*15) /* 15M */ -#define NETVSC_SEND_BUFFER_ID 0xface #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ -#define NETVSC_RECEIVE_BUFFER_ID 0xcafe - -#define NETVSC_RECEIVE_SG_COUNT 1 - -/* Preallocated receive packets */ -#define NETVSC_RECEIVE_PACKETLIST_COUNT 256 - /* * Maximum MTU we permit to be configured for a netvsc interface. * When the code was developed, a max MTU of 12232 was tested and @@ -208,7 +96,6 @@ typedef struct rndis_recv_scale_param_ { #define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024) #define NETVSC_PACKET_SIZE PAGE_SIZE -#define VRSS_SEND_TABLE_SIZE 16 /* * Data types @@ -216,26 +103,9 @@ typedef struct rndis_recv_scale_param_ { struct vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); - #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) #define NETVSC_PACKET_MAXPAGE 32 -#define NETVSC_VLAN_PRIO_MASK 0xe000 -#define NETVSC_VLAN_PRIO_SHIFT 13 -#define NETVSC_VLAN_VID_MASK 0x0fff - -#define TYPE_IPV4 2 -#define TYPE_IPV6 4 -#define TYPE_TCP 2 -#define TYPE_UDP 4 - -#define TRANSPORT_TYPE_NOT_IP 0 -#define TRANSPORT_TYPE_IPV4_TCP ((TYPE_IPV4 << 16) | TYPE_TCP) -#define TRANSPORT_TYPE_IPV4_UDP ((TYPE_IPV4 << 16) | TYPE_UDP) -#define TRANSPORT_TYPE_IPV6_TCP ((TYPE_IPV6 << 16) | TYPE_TCP) -#define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) - typedef struct { uint8_t mac_addr[ETHER_ADDR_LEN]; uint32_t link_state; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Sep 7 09:20:58 2016 (r305526) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #include #include @@ -118,7 +118,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -827,7 +826,7 @@ hn_tx_done(struct hn_send_ctx *sndc, str } void -netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) +hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { #if defined(INET) || defined(INET6) tcp_lro_flush_all(&rxr->hn_lro); @@ -1263,7 +1262,7 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb * Note: This is no longer used as a callback */ int -netvsc_recv(struct hn_rx_ring *rxr, const void *data, int dlen, +hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info) { struct ifnet *ifp = rxr->hn_ifp; @@ -2089,8 +2088,8 @@ hn_ndis_version_sysctl(SYSCTL_HANDLER_AR char verstr[16]; snprintf(verstr, sizeof(verstr), "%u.%u", - NDIS_VERSION_MAJOR(sc->hn_ndis_ver), - NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); } Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Sep 7 09:20:58 2016 (r305526) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -48,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -419,7 +419,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx pkt->rm_len, data_off, data_len); return; } - netvsc_recv(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); } /* @@ -731,7 +731,7 @@ hn_rndis_get_rsscaps(struct hn_softc *sc /* * Only NDIS 6.30+ is supported. */ - KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); *rxr_cnt = 0; @@ -827,7 +827,7 @@ hn_rndis_conf_offload(struct hn_softc *s memset(¶ms, 0, sizeof(params)); params.ndis_hdr.ndis_type = NDIS_OBJTYPE_DEFAULT; - if (sc->hn_ndis_ver < NDIS_VERSION_6_30) { + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_2; paramsz = NDIS_OFFLOAD_PARAMS_SIZE_6_1; } else { @@ -839,7 +839,7 @@ hn_rndis_conf_offload(struct hn_softc *s params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; - if (sc->hn_ndis_ver >= NDIS_VERSION_6_30) { + if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; } @@ -866,7 +866,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, i /* * Only NDIS 6.30+ is supported. */ - KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); memset(rss, 0, sizeof(*rss)); @@ -1059,7 +1059,7 @@ hv_rf_on_device_add(struct hn_softc *sc, hv_rf_query_device_link_status(sc, &dev_info->link_state); - if (sc->hn_ndis_ver < NDIS_VERSION_6_30 || nchan == 1) { + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { /* * Either RSS is not supported, or multiple RX/TX rings * are not requested. @@ -1189,5 +1189,5 @@ void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { - netvsc_channel_rollup(rxr, txr); + hn_chan_rollup(rxr, txr); } Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Wed Sep 7 09:20:58 2016 (r305526) @@ -32,6 +32,14 @@ #include #include +/* + * NDIS protocol version numbers + */ +#define HN_NDIS_VERSION_6_1 0x00060001 +#define HN_NDIS_VERSION_6_30 0x0006001e +#define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) +#define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) + #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Wed Sep 7 06:02:29 2016 (r305525) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Wed Sep 7 09:20:58 2016 (r305526) @@ -112,6 +112,7 @@ hn_nvs_send_sglist(struct vmbus_channel } struct vmbus_xact; +struct rndis_packet_msg; const void *hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, @@ -124,6 +125,10 @@ void hn_chim_free(struct hn_softc *sc, void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); +int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, + const struct hn_recvinfo *info); +void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); + extern struct hn_send_ctx hn_send_ctx_none; #endif /* !_IF_HNVAR_H_ */ From owner-svn-src-head@freebsd.org Wed Sep 7 09:31: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 EE6C5B96838; Wed, 7 Sep 2016 09:31:11 +0000 (UTC) (envelope-from sgalabov@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 C9525E22; Wed, 7 Sep 2016 09:31:11 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u879VBbK005596; Wed, 7 Sep 2016 09:31:11 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u879VA80005593; Wed, 7 Sep 2016 09:31:10 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201609070931.u879VA80005593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Wed, 7 Sep 2016 09:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305527 - in head/sys/mips: include mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 09:31:12 -0000 Author: sgalabov Date: Wed Sep 7 09:31:10 2016 New Revision: 305527 URL: https://svnweb.freebsd.org/changeset/base/305527 Log: Fix MIPS INTRNG (both FDT and non-FDT) behaviour broken by r304459 More changes to MIPS may be required, as commented in D7692, but this revision aims to restore MIPS INTRNG functionality so we can move on with working interrupts. Reported by: yamori813@yahoo.co.jp Tested by: mizhka (on BCM), sgalabov (on Mediatek) Reviewed by: adrian, nwhitehorn (older version) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D7692 Modified: head/sys/mips/include/intr.h head/sys/mips/mips/mips_pic.c head/sys/mips/mips/nexus.c Modified: head/sys/mips/include/intr.h ============================================================================== --- head/sys/mips/include/intr.h Wed Sep 7 09:20:58 2016 (r305526) +++ head/sys/mips/include/intr.h Wed Sep 7 09:31:10 2016 (r305527) @@ -63,6 +63,8 @@ void cpu_establish_hardintr(const char * void *, int, int, void **); void cpu_establish_softintr(const char *, driver_filter_t *, void (*)(void*), void *, int, int, void **); +int cpu_create_intr_map(int); +struct resource *cpu_get_irq_resource(int); /* MIPS interrupt C entry point */ void cpu_intr(struct trapframe *); Modified: head/sys/mips/mips/mips_pic.c ============================================================================== --- head/sys/mips/mips/mips_pic.c Wed Sep 7 09:20:58 2016 (r305526) +++ head/sys/mips/mips/mips_pic.c Wed Sep 7 09:31:10 2016 (r305527) @@ -71,6 +71,11 @@ __FBSDID("$FreeBSD$"); static int mips_pic_intr(void *); +struct intr_map_data_mips_pic { + struct intr_map_data hdr; + u_int irq; +}; + struct mips_pic_irqsrc { struct intr_irqsrc isrc; struct resource *res; @@ -304,24 +309,37 @@ static int mips_pic_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { -#ifdef FDT - struct intr_map_data_fdt *daf; struct mips_pic_softc *sc; - - if (data->type != INTR_MAP_DATA_FDT) - return (ENOTSUP); + int res; sc = device_get_softc(dev); - daf = (struct intr_map_data_fdt *)data; + res = 0; +#ifdef FDT + if (data->type == INTR_MAP_DATA_FDT) { + struct intr_map_data_fdt *daf; - if (daf->ncells != 1 || daf->cells[0] >= sc->nirqs) - return (EINVAL); + daf = (struct intr_map_data_fdt *)data; - *isrcp = PIC_INTR_ISRC(sc, daf->cells[0]); - return (0); -#else - return (ENOTSUP); + if (daf->ncells != 1 || daf->cells[0] >= sc->nirqs) + return (EINVAL); + + *isrcp = PIC_INTR_ISRC(sc, daf->cells[0]); + } else #endif + if (data->type == INTR_MAP_DATA_PLAT_1) { + struct intr_map_data_mips_pic *mpd; + + mpd = (struct intr_map_data_mips_pic *)data; + + if (mpd->irq < 0 || mpd->irq >= sc->nirqs) + return (EINVAL); + + *isrcp = PIC_INTR_ISRC(sc, mpd->irq); + } else { + res = ENOTSUP; + } + + return (res); } static void @@ -383,6 +401,46 @@ cpu_init_interrupts(void) { } +int +cpu_create_intr_map(int irq) +{ + struct intr_map_data_mips_pic *mips_pic_data; + intptr_t iparent; + size_t len; + u_int new_irq; + + len = sizeof(*mips_pic_data); + iparent = pic_xref(pic_sc->pic_dev); + + /* Allocate mips_pic data and fill it in */ + mips_pic_data = (struct intr_map_data_mips_pic *)intr_alloc_map_data( + INTR_MAP_DATA_PLAT_1, len, M_WAITOK | M_ZERO); + mips_pic_data->irq = irq; + + /* Get the new irq number */ + new_irq = intr_map_irq(pic_sc->pic_dev, iparent, + (struct intr_map_data *)mips_pic_data); + + /* Adjust the resource accordingly */ + rman_set_start(pic_sc->pic_irqs[irq].res, new_irq); + rman_set_end(pic_sc->pic_irqs[irq].res, new_irq); + + /* Activate the new irq */ + return (intr_activate_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res)); +} + +struct resource * +cpu_get_irq_resource(int irq) +{ + + KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); + + if (irq < 0 || irq >= pic_sc->nirqs) + panic("%s called for unknown irq %d", __func__, irq); + + return pic_sc->pic_irqs[irq].res; +} + void cpu_establish_hardintr(const char *name, driver_filter_t *filt, void (*handler)(void*), void *arg, int irq, int flags, void **cookiep) @@ -398,6 +456,10 @@ cpu_establish_hardintr(const char *name, KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); irq += NSOFT_IRQS; + + res = cpu_create_intr_map(irq); + if (res != 0) panic("Unable to create map for hard IRQ %d", irq); + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, handler, arg, flags, cookiep); if (res != 0) panic("Unable to add hard IRQ %d handler", irq); @@ -415,6 +477,9 @@ cpu_establish_softintr(const char *name, KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); + res = cpu_create_intr_map(irq); + if (res != 0) panic("Unable to create map for soft IRQ %d", irq); + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, handler, arg, flags, cookiep); if (res != 0) panic("Unable to add soft IRQ %d handler", irq); Modified: head/sys/mips/mips/nexus.c ============================================================================== --- head/sys/mips/mips/nexus.c Wed Sep 7 09:20:58 2016 (r305526) +++ head/sys/mips/mips/nexus.c Wed Sep 7 09:31:10 2016 (r305527) @@ -432,7 +432,16 @@ nexus_activate_resource(device_t bus, de rman_set_bushandle(r, (bus_space_handle_t)(uintptr_t)vaddr); } else if (type == SYS_RES_IRQ) { #ifdef INTRNG +#ifdef FDT intr_activate_irq(child, r); +#else + /* + * INTRNG without FDT needs to have the interrupt properly + * mapped first. cpu_create_intr_map() will do that and + * call intr_activate_irq() at the end. + */ + cpu_create_intr_map(rman_get_start(r)); +#endif #endif } @@ -466,9 +475,13 @@ static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - #ifdef INTRNG - return (intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); + struct resource *r = res; + +#ifndef FDT + r = cpu_get_irq_resource(rman_get_start(r)); +#endif + return (intr_setup_irq(child, r, filt, intr, arg, flags, cookiep)); #else int irq; register_t s; From owner-svn-src-head@freebsd.org Wed Sep 7 12:07:03 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 95BF7BD0CB8; Wed, 7 Sep 2016 12:07:03 +0000 (UTC) (envelope-from avos@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 61D9D202; Wed, 7 Sep 2016 12:07:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87C72Yc065436; Wed, 7 Sep 2016 12:07:02 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87C72Sp065435; Wed, 7 Sep 2016 12:07:02 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609071207.u87C72Sp065435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 7 Sep 2016 12:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305528 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 12:07:03 -0000 Author: avos Date: Wed Sep 7 12:07:02 2016 New Revision: 305528 URL: https://svnweb.freebsd.org/changeset/base/305528 Log: rum: use mgmt frame rate for EAPOL frames. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Wed Sep 7 09:31:10 2016 (r305527) +++ head/sys/dev/usb/wlan/if_rum.c Wed Sep 7 12:07:02 2016 (r305528) @@ -1631,6 +1631,8 @@ rum_tx_data(struct rum_softc *sc, struct rate = tp->mcastrate; else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) rate = tp->ucastrate; + else if (m0->m_flags & M_EAPOL) + rate = tp->mgmtrate; else rate = ni->ni_txrate; From owner-svn-src-head@freebsd.org Wed Sep 7 13:45: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 3496DBC7613; Wed, 7 Sep 2016 13:45:37 +0000 (UTC) (envelope-from avg@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 E932083D; Wed, 7 Sep 2016 13:45:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87DjaCF005820; Wed, 7 Sep 2016 13:45:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87Dja3s005819; Wed, 7 Sep 2016 13:45:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609071345.u87Dja3s005819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 7 Sep 2016 13:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305535 - head/sys/dev/amdsbwd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 13:45:37 -0000 Author: avg Date: Wed Sep 7 13:45:35 2016 New Revision: 305535 URL: https://svnweb.freebsd.org/changeset/base/305535 Log: amdsbwd: add support for FCH in family 16h models 30h-3Fh processors Requested by: Mike Tancsa Tested by: Mike Tancsa MFC after: 1 week Modified: head/sys/dev/amdsbwd/amdsbwd.c Modified: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- head/sys/dev/amdsbwd/amdsbwd.c Wed Sep 7 13:16:21 2016 (r305534) +++ head/sys/dev/amdsbwd/amdsbwd.c Wed Sep 7 13:45:35 2016 (r305535) @@ -108,6 +108,21 @@ __FBSDID("$FreeBSD$"); #define AMDSB8_SMBUS_REVID 0x40 #define AMDHUDSON_SMBUS_DEVID 0x780b1022 #define AMDKERNCZ_SMBUS_DEVID 0x790b1022 +/* BKDG Family 16h Models 30h - 3Fh */ +#define AMDFCH16H3XH_PM_WDT_EN 0x00 +#define AMDFCH_WDT_DEC_EN 0x80 +#define AMDFCH16H3XH_PM_WDT_CTRL 0x03 +#define AMDFCH_WDT_RES_MASK 0x03 +#define AMDFCH_WDT_RES_32US 0x00 +#define AMDFCH_WDT_RES_10MS 0x01 +#define AMDFCH_WDT_RES_100MS 0x02 +#define AMDFCH_WDT_RES_1S 0x03 +#define AMDFCH_WDT_ENABLE_MASK 0x0c +#define AMDFCH_WDT_ENABLE 0x00 +#define AMDFCH16H3XH_PM_MMIO_CTRL 0x04 +#define AMDFCH_WDT_MMIO_EN 0x02 +#define AMDFCH16H3XH_WDT_ADDR1 0xfed80b00u +#define AMDFCH16H3XH_WDT_ADDR2 0xfeb00000u #define amdsbwd_verbose_printf(dev, ...) \ do { \ @@ -295,8 +310,8 @@ amdsbwd_identify(driver_t *driver, devic static void amdsbwd_probe_sb7xx(device_t dev, struct resource *pmres, uint32_t *addr) { - uint32_t val; - int i; + uint8_t val; + int i; /* Report cause of previous reset for user's convenience. */ val = pmio_read(pmres, AMDSB_PM_RESET_STATUS0); @@ -336,8 +351,8 @@ amdsbwd_probe_sb7xx(device_t dev, struct static void amdsbwd_probe_sb8xx(device_t dev, struct resource *pmres, uint32_t *addr) { - uint32_t val; - int i; + uint8_t val; + int i; /* Report cause of previous reset for user's convenience. */ val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS0); @@ -363,7 +378,7 @@ amdsbwd_probe_sb8xx(device_t dev, struct pmio_write(pmres, AMDSB8_PM_WDT_CTRL, val); #ifdef AMDSBWD_DEBUG val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL); - amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#02x\n", val); + amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#04x\n", val); #endif /* @@ -376,11 +391,56 @@ amdsbwd_probe_sb8xx(device_t dev, struct pmio_write(pmres, AMDSB8_PM_WDT_EN, val); #ifdef AMDSBWD_DEBUG val = pmio_read(pmres, AMDSB8_PM_WDT_EN); - device_printf(dev, "AMDSB8_PM_WDT_EN value = %#02x\n", val); + device_printf(dev, "AMDSB8_PM_WDT_EN value = %#04x\n", val); #endif device_set_desc(dev, "AMD SB8xx/SB9xx/Axx Watchdog Timer"); } +static void +amdsbwd_probe_fch_16h_3xh(device_t dev, struct resource *pmres, uint32_t *addr) +{ + uint8_t val; + + val = pmio_read(pmres, AMDFCH16H3XH_PM_MMIO_CTRL); + if ((val & AMDFCH_WDT_MMIO_EN) != 0) { + /* Fixed offset for the watchdog within ACPI MMIO range. */ + amdsbwd_verbose_printf(dev, "ACPI MMIO range is enabled\n"); + *addr = AMDFCH16H3XH_WDT_ADDR1; + } else { + /* + * Enable decoding of watchdog MMIO address. + */ + val = pmio_read(pmres, AMDFCH16H3XH_PM_WDT_EN); + val |= AMDFCH_WDT_DEC_EN; + pmio_write(pmres, AMDFCH16H3XH_PM_WDT_EN, val); +#ifdef AMDSBWD_DEBUG + val = pmio_read(pmres, AMDFCH16H3XH_PM_WDT_EN); + device_printf(dev, "AMDFCH16H3XH_PM_WDT_EN value = %#04x\n", + val); +#endif + + /* Special fixed MMIO range for the watchdog. */ + *addr = AMDFCH16H3XH_WDT_ADDR2; + } + + /* + * Set watchdog timer tick to 1s and + * enable the watchdog device (in stopped state). + */ + val = pmio_read(pmres, AMDFCH16H3XH_PM_WDT_CTRL); + val &= ~AMDFCH_WDT_RES_MASK; + val |= AMDFCH_WDT_RES_1S; + val &= ~AMDFCH_WDT_ENABLE_MASK; + val |= AMDFCH_WDT_ENABLE; + pmio_write(pmres, AMDFCH16H3XH_PM_WDT_CTRL, val); +#ifdef AMDSBWD_DEBUG + val = pmio_read(pmres, AMDFCH16H3XH_PM_WDT_CTRL); + amdsbwd_verbose_printf(dev, "AMDFCH16H3XH_PM_WDT_CTRL value = %#04x\n", + val); +#endif + device_set_desc(dev, "AMD FCH Rev 42h+ Watchdog Timer"); +} + static int amdsbwd_probe(device_t dev) { @@ -389,6 +449,8 @@ amdsbwd_probe(device_t dev) uint32_t addr; int rid; int rc; + uint32_t devid; + uint8_t revid; /* Do not claim some ISA PnP device by accident. */ if (isa_get_logicalid(dev) != 0) @@ -410,11 +472,15 @@ amdsbwd_probe(device_t dev) smb_dev = pci_find_bsf(0, 20, 0); KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n")); - if (pci_get_devid(smb_dev) == AMDSB_SMBUS_DEVID && - pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID) + devid = pci_get_devid(smb_dev); + revid = pci_get_revid(smb_dev); + if (devid == AMDSB_SMBUS_DEVID && revid < AMDSB8_SMBUS_REVID) amdsbwd_probe_sb7xx(dev, res, &addr); - else + else if (devid == AMDSB_SMBUS_DEVID || devid == AMDKERNCZ_SMBUS_DEVID || + (devid == AMDHUDSON_SMBUS_DEVID && revid < 0x42)) amdsbwd_probe_sb8xx(dev, res, &addr); + else + amdsbwd_probe_fch_16h_3xh(dev, res, &addr); bus_release_resource(dev, SYS_RES_IOPORT, rid, res); bus_delete_resource(dev, SYS_RES_IOPORT, rid); @@ -439,14 +505,11 @@ amdsbwd_probe(device_t dev) static int amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc) { - device_t smb_dev; sc->max_ticks = UINT16_MAX; sc->rid_ctrl = 0; sc->rid_count = 1; - smb_dev = pci_find_bsf(0, 20, 0); - KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n")); sc->ms_per_tick = 1000; sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY, From owner-svn-src-head@freebsd.org Wed Sep 7 13:51:35 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 9D008BC78D8; Wed, 7 Sep 2016 13:51:35 +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 4C494C8B; Wed, 7 Sep 2016 13:51:35 +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 u87DpYmG008214; Wed, 7 Sep 2016 13:51:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87DpYoF008212; Wed, 7 Sep 2016 13:51:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609071351.u87DpYoF008212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 7 Sep 2016 13:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305536 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 13:51:35 -0000 Author: mav Date: Wed Sep 7 13:51:34 2016 New Revision: 305536 URL: https://svnweb.freebsd.org/changeset/base/305536 Log: Fix channel initialization in FBS mode. Due to reading initialized variable, FIS receive area was always allocated as 256 bytes, suitable for command-based switching, instead of 4096 bytes, required for FIS-based switching. This caused memory corruption in case of port multipliers used on FBS-capable HBAs (Marvell). MFC after: 1 week Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Sep 7 13:45:35 2016 (r305535) +++ head/sys/dev/ahci/ahci.c Wed Sep 7 13:51:34 2016 (r305536) @@ -715,6 +715,21 @@ ahci_ch_attach(device_t dev) if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE))) return (ENXIO); + ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); + version = ATA_INL(ctlr->r_mem, AHCI_VS); + if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) + ch->chcaps |= AHCI_P_CMD_FBSCP; + if (ch->caps2 & AHCI_CAP2_SDS) + ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); + if (bootverbose) { + device_printf(dev, "Caps:%s%s%s%s%s%s\n", + (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", + (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", + (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", + (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", + (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", + (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); + } ahci_dmainit(dev); ahci_slotsalloc(dev); mtx_lock(&ch->mtx); @@ -733,21 +748,6 @@ ahci_ch_attach(device_t dev) error = ENXIO; goto err1; } - ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); - version = ATA_INL(ctlr->r_mem, AHCI_VS); - if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) - ch->chcaps |= AHCI_P_CMD_FBSCP; - if (ch->caps2 & AHCI_CAP2_SDS) - ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); - if (bootverbose) { - device_printf(dev, "Caps:%s%s%s%s%s%s\n", - (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", - (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", - (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", - (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", - (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", - (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); - } /* Create the device queue for our SIM. */ devq = cam_simq_alloc(ch->numslots); if (devq == NULL) { From owner-svn-src-head@freebsd.org Wed Sep 7 14:24:31 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 F3E12BCF161; Wed, 7 Sep 2016 14:24:30 +0000 (UTC) (envelope-from avg@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 B910FE6F; Wed, 7 Sep 2016 14:24:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87EOTkX020865; Wed, 7 Sep 2016 14:24:29 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87EOToA020864; Wed, 7 Sep 2016 14:24:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609071424.u87EOToA020864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 7 Sep 2016 14:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305539 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 14:24:31 -0000 Author: avg Date: Wed Sep 7 14:24:29 2016 New Revision: 305539 URL: https://svnweb.freebsd.org/changeset/base/305539 Log: work around AMD erratum 793 for family 16h, models 00h-0Fh Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Wed Sep 7 14:01:58 2016 (r305538) +++ head/sys/amd64/amd64/initcpu.c Wed Sep 7 14:24:29 2016 (r305539) @@ -108,6 +108,20 @@ init_amd(void) wrmsr(0xc001102a, msr); } } + + /* + * Work around Erratum 793: Specific Combination of Writes to Write + * Combined Memory Types and Locked Instructions May Cause Core Hang. + * See Revision Guide for AMD Family 16h Models 00h-0Fh Processors, + * revision 3.04 or later, publication 51810. + */ + if (CPUID_TO_FAMILY(cpu_id) == 0x16 && CPUID_TO_MODEL(cpu_id) <= 0xf) { + if ((cpu_feature2 & CPUID2_HV) == 0) { + msr = rdmsr(0xc0011020); + msr |= (uint64_t)1 << 15; + wrmsr(0xc0011020, msr); + } + } } /* From owner-svn-src-head@freebsd.org Wed Sep 7 15:48:45 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 B2CA3BCF667; Wed, 7 Sep 2016 15:48:45 +0000 (UTC) (envelope-from br@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 830FF7E3; Wed, 7 Sep 2016 15:48:45 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87FmiH9051290; Wed, 7 Sep 2016 15:48:44 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87FmiHa051289; Wed, 7 Sep 2016 15:48:44 GMT (envelope-from br@FreeBSD.org) Message-Id: <201609071548.u87FmiHa051289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 7 Sep 2016 15:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305541 - head/sys/boot/fdt/dts/riscv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 15:48:45 -0000 Author: br Date: Wed Sep 7 15:48:44 2016 New Revision: 305541 URL: https://svnweb.freebsd.org/changeset/base/305541 Log: o Update QEMU device tree. QEMU was updated to privileged architecture v1.9 and we now fully support it. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/sys/boot/fdt/dts/riscv/qemu.dts Modified: head/sys/boot/fdt/dts/riscv/qemu.dts ============================================================================== --- head/sys/boot/fdt/dts/riscv/qemu.dts Wed Sep 7 15:37:39 2016 (r305540) +++ head/sys/boot/fdt/dts/riscv/qemu.dts Wed Sep 7 15:48:44 2016 (r305541) @@ -37,24 +37,39 @@ /dts-v1/; / { - model = "QEMU RV64I"; - compatible = "riscv,rv64i"; + model = "QEMU RV64"; + compatible = "riscv,rv64"; #address-cells = <1>; #size-cells = <1>; #interrupt-cells = <1>; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "riscv,rv64"; + reg = <0x0>; + }; + }; + aliases { console0 = &console0; }; memory { + /* + * This is not used currently. + * We take information from sbi_query_memory. + */ device_type = "memory"; - reg = <0x0 0x40000000>; /* 1GB at 0x0 */ + reg = <0x80000000 0x40000000>; /* 1GB at 0x80000000 */ }; soc { - #address-cells = <2>; - #size-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; #interrupt-cells = <1>; compatible = "simple-bus"; @@ -67,7 +82,9 @@ timer0: timer@0 { compatible = "riscv,timer"; - interrupts = < 1 >; + reg = < 0x40000000 0x0008 >, /* rtc */ + < 0x40000008 0x1000 >; /* timecmp */ + interrupts = < 5 >; interrupt-parent = < &pic0 >; clock-frequency = < 400000000 >; }; From owner-svn-src-head@freebsd.org Wed Sep 7 16:19: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 60301BCB261; Wed, 7 Sep 2016 16:19:21 +0000 (UTC) (envelope-from avos@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 1433ACBD; Wed, 7 Sep 2016 16:19:21 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87GJK5S062803; Wed, 7 Sep 2016 16:19:20 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87GJKo6062802; Wed, 7 Sep 2016 16:19:20 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609071619.u87GJKo6062802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 7 Sep 2016 16:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305544 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 16:19:21 -0000 Author: avos Date: Wed Sep 7 16:19:20 2016 New Revision: 305544 URL: https://svnweb.freebsd.org/changeset/base/305544 Log: rum: fix possible panic on device detach (similar to r302034). Tested with WUSB54GC, STA/AP modes. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Wed Sep 7 16:08:36 2016 (r305543) +++ head/sys/dev/usb/wlan/if_rum.c Wed Sep 7 16:19:20 2016 (r305544) @@ -165,6 +165,8 @@ static int rum_cmd_sleepable(struct rum size_t, uint8_t, CMD_FUNC_PROTO); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); +static void rum_reset_tx_list(struct rum_softc *, + struct ieee80211vap *); static void rum_unsetup_tx_list(struct rum_softc *); static void rum_beacon_miss(struct ieee80211vap *); static void rum_sta_recv_mgmt(struct ieee80211_node *, @@ -723,12 +725,22 @@ rum_vap_delete(struct ieee80211vap *vap) { struct rum_vap *rvp = RUM_VAP(vap); struct ieee80211com *ic = vap->iv_ic; + struct rum_softc *sc = ic->ic_softc; + + /* Put vap into INIT state. */ + ieee80211_new_state(vap, IEEE80211_S_INIT, -1); + ieee80211_draintask(ic, &vap->iv_nstate_task); + + RUM_LOCK(sc); + /* Cancel any unfinished Tx. */ + rum_reset_tx_list(sc, vap); + RUM_UNLOCK(sc); - m_freem(rvp->bcn_mbuf); usb_callout_drain(&rvp->ratectl_ch); ieee80211_draintask(ic, &rvp->ratectl_task); ieee80211_ratectl_deinit(vap); ieee80211_vap_detach(vap); + m_freem(rvp->bcn_mbuf); free(rvp, M_80211_VAP); } @@ -816,6 +828,30 @@ rum_setup_tx_list(struct rum_softc *sc) } static void +rum_reset_tx_list(struct rum_softc *sc, struct ieee80211vap *vap) +{ + struct rum_tx_data *data, *tmp; + + KASSERT(vap != NULL, ("%s: vap is NULL\n", __func__)); + + STAILQ_FOREACH_SAFE(data, &sc->tx_q, next, tmp) { + if (data->ni != NULL && data->ni->ni_vap == vap) { + ieee80211_free_node(data->ni); + data->ni = NULL; + + KASSERT(data->m != NULL, ("%s: m is NULL\n", + __func__)); + m_freem(data->m); + data->m = NULL; + + STAILQ_REMOVE(&sc->tx_q, data, rum_tx_data, next); + STAILQ_INSERT_TAIL(&sc->tx_free, data, next); + sc->tx_nfree++; + } + } +} + +static void rum_unsetup_tx_list(struct rum_softc *sc) { struct rum_tx_data *data; From owner-svn-src-head@freebsd.org Wed Sep 7 16:22:06 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 62B13BCB463; Wed, 7 Sep 2016 16:22:06 +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 16AC8C4; Wed, 7 Sep 2016 16:22:06 +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 u87GM5XX064245; Wed, 7 Sep 2016 16:22:05 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87GM5UZ064244; Wed, 7 Sep 2016 16:22:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609071622.u87GM5UZ064244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 7 Sep 2016 16:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305545 - 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.23 Precedence: list List-Id: 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, 07 Sep 2016 16:22:06 -0000 Author: andrew Date: Wed Sep 7 16:22:05 2016 New Revision: 305545 URL: https://svnweb.freebsd.org/changeset/base/305545 Log: Only call cpu_icache_sync_range when inserting an executable page. If the page is non-executable the contents of the i-cache are unimportant so this call is just adding unneeded overhead when inserting pages. While doing research using gem5 with an O3 pipeline and 1k/32k/1M iTLB/L1 iCache/L2 Bjoern Zeeb (bz@) observed a fairly high rate of calls into arm64_icache_sync_range() from pmap_enter() along with a high number of instruction fetches and iTLB/iCache hits. Limiting the calls to arm64_icache_sync_range() to only executable pages, we observe the iTLB and iCache Hit going down by about 43%. These numbers are quite misleading when looked at alone as at the same time instructions retired were reduced by 19.2% and instruction fetches were reduced by 38.8%. Overall this reduced the runtime of the test program by 22.4%. On Juno hardware, in steady-state, running the same test, using the cycle count to determine runtime, we do see a reduction of up to 28.9% in runtime. While these numbers certainly depend on the program executed, we expect an overall performance improvement. Reported by: bz Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Sep 7 16:19:20 2016 (r305544) +++ head/sys/arm64/arm64/pmap.c Wed Sep 7 16:22:05 2016 (r305545) @@ -2939,8 +2939,9 @@ validate: pmap_invalidate_page(pmap, va); if (pmap != pmap_kernel()) { - if (pmap == &curproc->p_vmspace->vm_pmap) - cpu_icache_sync_range(va, PAGE_SIZE); + if (pmap == &curproc->p_vmspace->vm_pmap && + (prot & VM_PROT_EXECUTE) != 0) + cpu_icache_sync_range(va, PAGE_SIZE); if ((mpte == NULL || mpte->wire_count == NL3PG) && pmap_superpages_enabled() && From owner-svn-src-head@freebsd.org Wed Sep 7 16:46:56 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 014BFBCBF2B; Wed, 7 Sep 2016 16:46:56 +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 C687C769; Wed, 7 Sep 2016 16:46:55 +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 u87GktfV075761; Wed, 7 Sep 2016 16:46:55 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87GktoZ075760; Wed, 7 Sep 2016 16:46:55 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609071646.u87GktoZ075760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 7 Sep 2016 16:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305546 - 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.23 Precedence: list List-Id: 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, 07 Sep 2016 16:46:56 -0000 Author: andrew Date: Wed Sep 7 16:46:54 2016 New Revision: 305546 URL: https://svnweb.freebsd.org/changeset/base/305546 Log: When synchronising the instruction and data caches we only need to clean the data cache to the point of unification. This is the point where the two caches are unified to a single unified cache so cleaning past here is just extra unneeded work. This was noticed when investigating r305545. Reported by: bz Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/cpufunc_asm.S Modified: head/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- head/sys/arm64/arm64/cpufunc_asm.S Wed Sep 7 16:22:05 2016 (r305545) +++ head/sys/arm64/arm64/cpufunc_asm.S Wed Sep 7 16:46:54 2016 (r305546) @@ -151,5 +151,5 @@ END(arm64_idcache_wbinv_range) * void arm64_icache_sync_range(vm_offset_t, vm_size_t) */ ENTRY(arm64_icache_sync_range) - cache_handle_range dcop = cvac, ic = 1, icop = ivau + cache_handle_range dcop = cvau, ic = 1, icop = ivau END(arm64_icache_sync_range) From owner-svn-src-head@freebsd.org Wed Sep 7 17:49: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 3BB9CBD0E3C; Wed, 7 Sep 2016 17:49:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.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 19FCC6B7; Wed, 7 Sep 2016 17:49:43 +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 mail.baldwin.cx (Postfix) with ESMTPSA id D397010AF44; Wed, 7 Sep 2016 13:49:41 -0400 (EDT) From: John Baldwin To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305539 - head/sys/amd64/amd64 Date: Wed, 07 Sep 2016 09:39:38 -0700 Message-ID: <15727056.pEvyZgkc37@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201609071424.u87EOToA020864@repo.freebsd.org> References: <201609071424.u87EOToA020864@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.4.3 (mail.baldwin.cx); Wed, 07 Sep 2016 13:49:41 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 17:49:43 -0000 On Wednesday, September 07, 2016 02:24:29 PM Andriy Gapon wrote: > Author: avg > Date: Wed Sep 7 14:24:29 2016 > New Revision: 305539 > URL: https://svnweb.freebsd.org/changeset/base/305539 > > Log: > work around AMD erratum 793 for family 16h, models 00h-0Fh Would this apply to FreeBSD/i386 as well? Perhaps we need some shared code in sys/x86 for initcpu.c on modern CPUs. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Sep 7 18:08: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 96157BD02AA; Wed, 7 Sep 2016 18:08:44 +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 656D734A; Wed, 7 Sep 2016 18:08:44 +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 u87I8hc5006032; Wed, 7 Sep 2016 18:08:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87I8hFb006031; Wed, 7 Sep 2016 18:08:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609071808.u87I8hFb006031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 7 Sep 2016 18:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305548 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 18:08:44 -0000 Author: jhb Date: Wed Sep 7 18:08:43 2016 New Revision: 305548 URL: https://svnweb.freebsd.org/changeset/base/305548 Log: Don't break out of the m_advance() loop if len drops to zero. If a packet contains the Ethernet header (14 bytes) in the first mbuf and the payload (IP + UDP + data) in the second mbuf, then the attempt to fetch the l3hdr will return a NULL pointer. The first loop iteration will drop len to zero and exit the loop without setting 'p'. However, the desired data is at the start of the second mbuf, so the correct behavior is to loop around and let the conditional set 'p' to m_data of the next mbuf (and leave offset as 0). Reviewed by: np Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Wed Sep 7 18:06:34 2016 (r305547) +++ head/sys/dev/cxgbe/t4_sge.c Wed Sep 7 18:08:43 2016 (r305548) @@ -2082,7 +2082,7 @@ m_advance(struct mbuf **pm, int *poffset MPASS(len > 0); - while (len) { + for (;;) { if (offset + len < m->m_len) { offset += len; p = mtod(m, uintptr_t) + offset; From owner-svn-src-head@freebsd.org Wed Sep 7 18:13:59 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 E81C5BD0507; Wed, 7 Sep 2016 18:13: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 AD9DFA0B; Wed, 7 Sep 2016 18:13:59 +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 u87IDxKY009558; Wed, 7 Sep 2016 18:13:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87IDvpN009545; Wed, 7 Sep 2016 18:13:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609071813.u87IDvpN009545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 7 Sep 2016 18:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305549 - in head: share/man/man4 sys/arm/conf sys/conf sys/dev/cxgbe sys/dev/cxgbe/common sys/modules/cxgbe sys/modules/cxgbe/if_cxgbev sys/modules/cxgbe/if_cxlv sys/powerpc/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.23 Precedence: list List-Id: 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, 07 Sep 2016 18:14:00 -0000 Author: jhb Date: Wed Sep 7 18:13:57 2016 New Revision: 305549 URL: https://svnweb.freebsd.org/changeset/base/305549 Log: Chelsio T4/T5 VF driver. The cxgbev/cxlv driver supports Virtual Function devices for Chelsio T4 and T4 adapters. The VF devices share most of their code with the existing PF4 driver (cxgbe/cxl) and as such the VF device driver currently depends on the PF4 driver. Similar to the cxgbe/cxl drivers, the VF driver includes a t4vf/t5vf PCI device driver that attaches to the VF device. It then creates child cxgbev/cxlv devices representing ports assigned to the VF. By default, the PF driver assigns a single port to each VF. t4vf_hw.c contains VF-specific routines from the shared code used to fetch VF-specific parameters from the firmware. t4_vf.c contains the VF-specific PCI device driver and includes its own attach routine. VF devices are required to use a different firmware request when transmitting packets (which in turn requires a different CPL message to encapsulate messages). This alternate firmware request does not permit chaining multiple packets in a single message, so each packet results in a firmware request. In addition, the different CPL message requires more detailed information when enabling hardware checksums, so parse_pkt() on VF devices must examine L2 and L3 headers for all packets (not just TSO packets) for VF devices. Finally, L2 checksums on non-UDP/non-TCP packets do not work reliably (the firmware trashes the IPv4 fragment field), so IPv4 checksums for such packets are calculated in software. Most of the other changes in the non-VF-specific code are to expose various variables and functions private to the PF driver so that they can be used by the VF driver. Note that a limited subset of cxgbetool functions are supported on VF devices including register dumps, scheduler classes, and clearing of statistics. In addition, TOE is not supported on VF devices, only for the PF interfaces. Reviewed by: np MFC after: 2 months Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7599 Added: head/share/man/man4/cxgbev.4 - copied, changed from r305546, head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/common/t4vf_hw.c (contents, props changed) head/sys/dev/cxgbe/if_cxlv.c (contents, props changed) head/sys/dev/cxgbe/t4_vf.c (contents, props changed) head/sys/modules/cxgbe/if_cxgbev/ head/sys/modules/cxgbe/if_cxgbev/Makefile (contents, props changed) head/sys/modules/cxgbe/if_cxlv/ head/sys/modules/cxgbe/if_cxlv/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/cxgbe.4 head/sys/arm/conf/NOTES head/sys/conf/NOTES head/sys/conf/files head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/modules/cxgbe/Makefile head/sys/powerpc/conf/NOTES Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Sep 7 18:08:43 2016 (r305548) +++ head/share/man/man4/Makefile Wed Sep 7 18:13:57 2016 (r305549) @@ -113,6 +113,7 @@ MAN= aac.4 \ cue.4 \ cxgb.4 \ cxgbe.4 \ + cxgbev.4 \ cy.4 \ cyapa.4 \ da.4 \ @@ -602,6 +603,9 @@ MLINKS+=cxgb.4 if_cxgb.4 MLINKS+=cxgbe.4 if_cxgbe.4 \ cxgbe.4 cxl.4 \ cxgbe.4 if_cxl.4 +MLINKS+=cxgbev.4 if_cxgbev.4 \ + cxgbev.4 cxlv.4 \ + cxgbev.4 if_cxlv.4 MLINKS+=dc.4 if_dc.4 MLINKS+=de.4 if_de.4 MLINKS+=disc.4 if_disc.4 Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Wed Sep 7 18:08:43 2016 (r305548) +++ head/share/man/man4/cxgbe.4 Wed Sep 7 18:13:57 2016 (r305549) @@ -77,8 +77,7 @@ For more information on configuring this .Sh HARDWARE The .Nm -driver supports 40Gb, 10Gb and 1Gb Ethernet adapters based on the T5 ASIC -(ports will be named cxl): +driver supports 40Gb, 10Gb and 1Gb Ethernet adapters based on the T5 ASIC: .Pp .Bl -bullet -compact .It @@ -320,6 +319,7 @@ email all the specific information relat .Xr altq 4 , .Xr arp 4 , .Xr cxgb 4 , +.Xr cxgbev 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr ifconfig 8 Copied and modified: head/share/man/man4/cxgbev.4 (from r305546, head/share/man/man4/cxgbe.4) ============================================================================== --- head/share/man/man4/cxgbe.4 Wed Sep 7 16:46:54 2016 (r305546, copy source) +++ head/share/man/man4/cxgbev.4 Wed Sep 7 18:13:57 2016 (r305549) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2011-2014, Chelsio Inc +.\" Copyright (c) 2011-2016, Chelsio Inc .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -31,33 +31,32 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2015 -.Dt CXGBE 4 +.Dd August 22, 2016 +.Dt CXGBEV 4 .Os .Sh NAME -.Nm cxgbe -.Nd "Chelsio T4 and T5 based 40Gb, 10Gb, and 1Gb Ethernet adapter driver" +.Nm cxgbev +.Nd "Chelsio T4 and T5 based 40Gb, 10Gb, and 1Gb Ethernet VF driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device cxgbe" +.Cd "device cxgbev" .Ed .Pp To load the driver as a -module at boot time, place the following lines in +module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -t4fw_cfg_load="YES" -t5fw_cfg_load="YES" -if_cxgbe_load="YES" +if_cxgbev_load="YES" .Ed .Sh DESCRIPTION The .Nm -driver provides support for PCI Express Ethernet adapters based on -the Chelsio Terminator 4 and Terminator 5 ASICs (T4 and T5). +driver provides support for Virtual Functions on PCI Express Ethernet adapters +based on the Chelsio Terminator 4 and Terminator 5 ASICs (T4 and T5). The driver supports Jumbo Frames, Transmit/Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), VLAN tag insertion/extraction, VLAN checksum offload, VLAN TSO, and @@ -66,19 +65,20 @@ For further hardware information and que requirements, see .Pa http://www.chelsio.com/ . .Pp -Note that ports of T5 cards are named cxl and attach to a t5nex parent device -(in contrast to ports named cxgbe that attach to a t4nex parent for a T4 card). -Loader tunables with the hw.cxgbe prefix apply to both T4 and T5 cards. -The sysctl MIBs are at dev.t5nex and dev.cxl for T5 cards and at dev.t4nex and -dev.cxgbe for T4 cards. +Note that ports of T5 VFs are named cxlv and attach to a t5vf parent device +(in contrast to ports named cxgbev that attach to a t4vf parent for a T4 VF). +Loader tunables with the hw.cxgbe prefix apply to both T4 and T5 VFs. +The Physical Function driver for T4 and T5 adapters shares these tunables. +The sysctl MIBs are at dev.t5vf and dev.cxlv for T5 cards and at dev.t4vf and +dev.cxgbev for T4 cards. .Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE The .Nm -driver supports 40Gb, 10Gb and 1Gb Ethernet adapters based on the T5 ASIC -(ports will be named cxl): +driver supports Virtual Functions on 40Gb, 10Gb and 1Gb Ethernet adapters +based on the T5 ASIC: .Pp .Bl -bullet -compact .It @@ -109,7 +109,8 @@ Chelsio T504-BT .Pp The .Nm -driver supports 10Gb and 1Gb Ethernet adapters based on the T4 ASIC: +driver supports Virtual Functions on 10Gb and 1Gb Ethernet adapters based +on the T4 ASIC: .Pp .Bl -bullet -compact .It @@ -155,31 +156,6 @@ of CPU cores in the system, whichever is The number of rx queues to use for a 1Gb port. The default is 2 or the number of CPU cores in the system, whichever is less. -.It Va hw.cxgbe.nofldtxq10g -The number of TOE tx queues to use for a 10Gb or 40Gb port. -The default is 8 or the -number of CPU cores in the system, whichever is less. -.It Va hw.cxgbe.nofldrxq10g -The number of TOE rx queues to use for a 10Gb or 40Gb port. -The default is 2 or the -number of CPU cores in the system, whichever is less. -.It Va hw.cxgbe.nofldtxq1g -The number of TOE tx queues to use for a 1Gb port. -The default is 2 or the -number of CPU cores in the system, whichever is less. -.It Va hw.cxgbe.nofldrxq1g -The number of TOE rx queues to use for a 1Gb port. -The default is 1. -.It Va hw.cxgbe.num_vis -The number of virtual interfaces (VIs) created for each port. -Each virtual interface creates a separate network interface. -The first virtual interface on each port is required and represents -the primary network interface on the port. -Additional virtual interfaces on a port are named vcxgbe (T4) or -vcxl (T5) and only use a single rx and tx queue. -Additional virtual interfaces use a single pair of queues -for rx and tx as well an additional pair of queues for TOE rx and tx. -The default is 1. .It Va hw.cxgbe.holdoff_timer_idx_10G .It Va hw.cxgbe.holdoff_timer_idx_1G The timer index value to use to delay interrupts. @@ -188,7 +164,7 @@ by default (all values are in microsecon value from this list. The default value is 1 which means the timer value is 5us. Different interfaces can be assigned different values at any time via the -dev.cxgbe.X.holdoff_tmr_idx or dev.cxl.X.holdoff_tmr_idx sysctl. +dev.cxgbev.X.holdoff_tmr_idx or dev.cxlv.X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G .It Va hw.cxgbe.holdoff_pktc_idx_1G The packet-count index value to use to delay interrupts. @@ -197,7 +173,7 @@ and the index selects a value from this The default value is -1 which means packet counting is disabled and interrupts are generated based solely on the holdoff timer value. Different interfaces can be assigned different values via the -dev.cxgbe.X.holdoff_pktc_idx or dev.cxl.X.holdoff_pktc_idx sysctl. +dev.cxgbev.X.holdoff_pktc_idx or dev.cxlv.X.holdoff_pktc_idx sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_txq @@ -209,7 +185,7 @@ See .Xr ifnet 9 . The default value is 1024. Different interfaces can be assigned different values via the -dev.cxgbe.X.qsize_txq sysctl or dev.cxl.X.qsize_txq sysctl. +dev.cxgbev.X.qsize_txq sysctl or dev.cxlv.X.qsize_txq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_rxq @@ -217,7 +193,7 @@ The size, in number of entries, of the d rx queue. The default value is 1024. Different interfaces can be assigned different values via the -dev.cxgbe.X.qsize_rxq or dev.cxl.X.qsize_rxq sysctl. +dev.cxgbev.X.qsize_rxq or dev.cxlv.X.qsize_rxq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.interrupt_types @@ -226,15 +202,6 @@ Bit 0 represents INTx (line interrupts), The default is 7 (all allowed). The driver will select the best possible type out of the allowed types by itself. -.It Va hw.cxgbe.fw_install -0 prohibits the driver from installing a firmware on the card. -1 allows the driver to install a new firmware if internal driver -heuristics indicate that the new firmware is preferable to the one -already on the card. -2 instructs the driver to always install the new firmware on the card as -long as it is compatible with the driver and is a different version than -the one already on the card. -The default is 1. .It Va hw.cxgbe.fl_pktshift The number of bytes of padding inserted before the beginning of an Ethernet frame in the receive buffer. @@ -246,23 +213,6 @@ A non-zero value ensures that writes fro padded up to the specified boundary. The default is -1 which lets the driver pick a pad boundary. 0 disables trailer padding completely. -.It Va hw.cxgbe.cong_drop -Controls the hardware response to congestion. --1 disables congestion feedback and is not recommended. -0 instructs the hardware to backpressure its pipeline on congestion. -This usually results in the port emitting PAUSE frames. -1 instructs the hardware to drop frames destined for congested queues. -.It Va hw.cxgbe.pause_settings -PAUSE frame settings. -Bit 0 is rx_pause, bit 1 is tx_pause. -rx_pause = 1 instructs the hardware to heed incoming PAUSE frames, 0 instructs -it to ignore them. -tx_pause = 1 allows the hardware to emit PAUSE frames when its receive FIFO -reaches a high threshold, 0 prohibits the hardware from emitting PAUSE frames. -The default is 3 (both rx_pause and tx_pause = 1). -This tunable establishes the default PAUSE settings for all ports. -Settings can be displayed and controlled on a per-port basis via the -dev.cxgbe.X.pause_settings (dev.cxl.X.pause_settings for T5 cards) sysctl. .It Va hw.cxgbe.buffer_packing Allow the hardware to deliver multiple frames in the same receive buffer opportunistically. @@ -285,29 +235,31 @@ largest_rx_cluster and will fall back to safest_rx_cluster size if an allocation larger than safest_rx_cluster fails. Note that largest_rx_cluster merely establishes a ceiling -- the driver is allowed to allocate buffers of smaller sizes. -.It Va hw.cxgbe.config_file -Select a pre-packaged device configuration file. -A configuration file contains a recipe for partitioning and configuring the -hardware resources on the card. -This tunable is for specialized applications only and should not be used in -normal operation. -The configuration profile currently in use is available in the dev.t4nex.X.cf -and dev.t4nex.X.cfcsum (dev.t5nex for T5 cards) sysctls. -.It Va hw.cxgbe.linkcaps_allowed -.It Va hw.cxgbe.niccaps_allowed -.It Va hw.cxgbe.toecaps_allowed -.It Va hw.cxgbe.rdmacaps_allowed -.It Va hw.cxgbe.iscsicaps_allowed -.It Va hw.cxgbe.fcoecaps_allowed -Disallowing capabilities provides a hint to the driver and firmware to not -reserve hardware resources for that feature. -Each of these is a bit field with a bit for each sub-capability within the -capability. -This tunable is for specialized applications only and should not be used in -normal operation. -The capabilities for which hardware resources have been reserved are listed in -dev.t4nex.X.*caps or dev.t5nex.X.*caps sysctls. .El +.Pp +Certain settings and resources for Virtual Functions are dictated +by the parent Physical Function driver. +For example, the Physical Function driver limits the number of queues a +Virtual Function is permitted to use. +Some of these limits can be adjusted in the firmware configuration file +used with the Physical Function driver. +.Pp +The PAUSE settings on the port of a Virtual Function are inherited from +the settings of the same port on the Physical Function. +Virtual Functions cannot modify the setting and track changes made to +the associated port's setting by the Physical Function driver. +.Pp +Receive queues on a Virtual Function always drop packets in response to +congestion +.Po +equivalent to setting +.Va hw.cxgbe.cong_drop +to 1 +.Pc . +.Pp +The VF driver currently depends on the PF driver. +As a result, loading the VF driver will also load the PF driver as a +dependency. .Sh SUPPORT For general information and support, go to the Chelsio support website at: @@ -319,7 +271,7 @@ email all the specific information relat .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , -.Xr cxgb 4 , +.Xr cxgbe 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr ifconfig 8 @@ -327,14 +279,12 @@ email all the specific information relat The .Nm device driver first appeared in -.Fx 9.0 . -Support for T5 cards first appeared in -.Fx 9.2 -and -.Fx 10.0 . +.Fx 12.0 . .Sh AUTHORS .An -nosplit The .Nm driver was written by -.An Navdeep Parhar Aq Mt np@FreeBSD.org . +.An Navdeep Parhar Aq Mt np@FreeBSD.org +and +.An John Baldwin Aq Mt jhb@FreeBSD.org . Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/arm/conf/NOTES Wed Sep 7 18:13:57 2016 (r305549) @@ -80,6 +80,7 @@ nodevice star_saver nodevice warp_saver nodevice cxgbe +nodevice cxgbev nodevice snd_cmi # Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/conf/NOTES Wed Sep 7 18:13:57 2016 (r305549) @@ -1949,6 +1949,7 @@ device xmphy # XaQti XMAC II # (and SMC COM90c66 in '56 compatibility mode) adapters. # cxgb: Chelsio T3 based 1GbE/10GbE PCIe Ethernet adapters. # cxgbe:Chelsio T4 and T5 based 1GbE/10GbE/40GbE PCIe Ethernet adapters. +# cxgbev: Chelsio T4 and T5 based PCIe Virtual Functions. # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics @@ -2132,6 +2133,7 @@ device xl # 3Com 3c90x (``Boomerang'', device cxgb # Chelsio T3 10 Gigabit Ethernet device cxgb_t3fw # Chelsio T3 10 Gigabit Ethernet firmware device cxgbe # Chelsio T4 and T5 1GbE/10GbE/40GbE +device cxgbev # Chelsio T4 and T5 1GbE/10GbE/40GbE VF device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/conf/files Wed Sep 7 18:13:57 2016 (r305549) @@ -1281,8 +1281,12 @@ dev/cxgbe/t4_l2t.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_tracer.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/t4_vf.c optional cxgbev pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/common/t4vf_hw.c optional cxgbev pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" t4fw_cfg.c optional cxgbe \ compile-with "${AWK} -f $S/tools/fw_stub.awk t4fw_cfg.fw:t4fw_cfg t4fw_cfg_uwire.fw:t4fw_cfg_uwire t4fw.fw:t4fw -mt4fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/dev/cxgbe/adapter.h Wed Sep 7 18:13:57 2016 (r305549) @@ -945,6 +945,9 @@ struct adapter { /* One for errors, one for firmware events */ #define T4_EXTRA_INTR 2 +/* One for firmware events */ +#define T4VF_EXTRA_INTR 1 + static inline uint32_t t4_read_reg(struct adapter *sc, uint32_t reg) { @@ -1079,13 +1082,34 @@ t4_use_ldst(struct adapter *sc) } /* t4_main.c */ +extern int t4_ntxq10g; +extern int t4_nrxq10g; +extern int t4_ntxq1g; +extern int t4_nrxq1g; +extern int t4_intr_types; +extern int t4_tmr_idx_10g; +extern int t4_pktc_idx_10g; +extern int t4_tmr_idx_1g; +extern int t4_pktc_idx_1g; +extern unsigned int t4_qsize_rxq; +extern unsigned int t4_qsize_txq; +extern device_method_t cxgbe_methods[]; + int t4_os_find_pci_capability(struct adapter *, int); int t4_os_pci_save_state(struct adapter *); int t4_os_pci_restore_state(struct adapter *); void t4_os_portmod_changed(const struct adapter *, int); void t4_os_link_changed(struct adapter *, int, int, int); void t4_iterate(void (*)(struct adapter *, void *), void *); +void t4_add_adapter(struct adapter *); +int t4_detach_common(device_t); int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); +int t4_map_bars_0_and_4(struct adapter *); +int t4_map_bar_2(struct adapter *); +int t4_set_sched_class(struct adapter *, struct t4_sched_params *); +int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *); +int t4_setup_intr_handlers(struct adapter *); +void t4_sysctls(struct adapter *); int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *); void doom_vi(struct adapter *, struct vi_info *); void end_synchronized_op(struct adapter *, int); @@ -1126,7 +1150,7 @@ void t4_intr_err(void *); void t4_intr_evt(void *); void t4_wrq_tx_locked(struct adapter *, struct sge_wrq *, struct wrqe *); void t4_update_fl_bufsize(struct ifnet *); -int parse_pkt(struct mbuf **); +int parse_pkt(struct adapter *, struct mbuf **); void *start_wrq_wr(struct sge_wrq *, int, struct wrq_cookie *); void commit_wrq_wr(struct sge_wrq *, void *, struct wrq_cookie *); int tnl_cong(struct port_info *, int); Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/dev/cxgbe/common/common.h Wed Sep 7 18:13:57 2016 (r305549) @@ -558,6 +558,7 @@ int t4_get_scfg_version(struct adapter * int t4_get_vpd_version(struct adapter *adapter, u32 *vers); int t4_get_version_info(struct adapter *adapter); int t4_init_hw(struct adapter *adapter, u32 fw_params); +const struct chip_params *t4_get_chip_params(int chipid); int t4_prep_adapter(struct adapter *adapter, u8 *buf); int t4_shutdown_adapter(struct adapter *adapter); int t4_init_devlog_params(struct adapter *adapter, int fw_attach); @@ -765,4 +766,32 @@ int t4_config_watchdog(struct adapter *a int t4_get_devlog_level(struct adapter *adapter, unsigned int *level); int t4_set_devlog_level(struct adapter *adapter, unsigned int level); void t4_sge_decode_idma_state(struct adapter *adapter, int state); + +static inline int t4vf_query_params(struct adapter *adapter, + unsigned int nparams, const u32 *params, + u32 *vals) +{ + return t4_query_params(adapter, 0, 0, 0, nparams, params, vals); +} + +static inline int t4vf_set_params(struct adapter *adapter, + unsigned int nparams, const u32 *params, + const u32 *vals) +{ + return t4_set_params(adapter, 0, 0, 0, nparams, params, vals); +} + +static inline int t4vf_wr_mbox(struct adapter *adap, const void *cmd, + int size, void *rpl) +{ + return t4_wr_mbox(adap, adap->mbox, cmd, size, rpl); +} + +int t4vf_wait_dev_ready(struct adapter *adapter); +int t4vf_fw_reset(struct adapter *adapter); +int t4vf_get_sge_params(struct adapter *adapter); +int t4vf_get_rss_glb_config(struct adapter *adapter); +int t4vf_get_vfres(struct adapter *adapter); +int t4vf_prep_adapter(struct adapter *adapter); + #endif /* __CHELSIO_COMMON_H */ Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Sep 7 18:13:57 2016 (r305549) @@ -7616,7 +7616,7 @@ static void set_pcie_completion_timeout( } } -static const struct chip_params *get_chip_params(int chipid) +const struct chip_params *t4_get_chip_params(int chipid) { static const struct chip_params chip_params[] = { { @@ -7695,7 +7695,7 @@ int t4_prep_adapter(struct adapter *adap } } - adapter->chip_params = get_chip_params(chip_id(adapter)); + adapter->chip_params = t4_get_chip_params(chip_id(adapter)); if (adapter->chip_params == NULL) return -EINVAL; Added: head/sys/dev/cxgbe/common/t4vf_hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/common/t4vf_hw.c Wed Sep 7 18:13:57 2016 (r305549) @@ -0,0 +1,376 @@ +/*- + * Copyright (c) 2016 Chelsio Communications, Inc. + * 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 "common.h" +#include "t4_regs.h" + +#undef msleep +#define msleep(x) do { \ + if (cold) \ + DELAY((x) * 1000); \ + else \ + pause("t4hw", (x) * hz / 1000); \ +} while (0) + +/* + * Wait for the device to become ready (signified by our "who am I" register + * returning a value other than all 1's). Return an error if it doesn't + * become ready ... + */ +int t4vf_wait_dev_ready(struct adapter *adapter) +{ + const u32 whoami = VF_PL_REG(A_PL_VF_WHOAMI); + const u32 notready1 = 0xffffffff; + const u32 notready2 = 0xeeeeeeee; + u32 val; + + val = t4_read_reg(adapter, whoami); + if (val != notready1 && val != notready2) + return 0; + msleep(500); + val = t4_read_reg(adapter, whoami); + if (val != notready1 && val != notready2) + return 0; + else + return -EIO; +} + + +/** + * t4vf_fw_reset - issue a reset to FW + * @adapter: the adapter + * + * Issues a reset command to FW. For a Physical Function this would + * result in the Firmware reseting all of its state. For a Virtual + * Function this just resets the state associated with the VF. + */ +int t4vf_fw_reset(struct adapter *adapter) +{ + struct fw_reset_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_RESET_CMD) | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(V_FW_CMD_LEN16(FW_LEN16(cmd))); + return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); +} + +/** + * t4vf_get_sge_params - retrieve adapter Scatter gather Engine parameters + * @adapter: the adapter + * + * Retrieves various core SGE parameters in the form of hardware SGE + * register values. The caller is responsible for decoding these as + * needed. The SGE parameters are stored in @adapter->params.sge. + */ +int t4vf_get_sge_params(struct adapter *adapter) +{ + struct sge_params *sp = &adapter->params.sge; + u32 params[7], vals[7]; + u32 whoami; + unsigned int pf, s_hps; + int i, v; + + params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_CONTROL)); + params[1] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_HOST_PAGE_SIZE)); + params[2] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_TIMER_VALUE_0_AND_1)); + params[3] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_TIMER_VALUE_2_AND_3)); + params[4] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_TIMER_VALUE_4_AND_5)); + params[5] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_CONM_CTRL)); + params[6] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_INGRESS_RX_THRESHOLD)); + v = t4vf_query_params(adapter, 7, params, vals); + if (v != FW_SUCCESS) + return v; + + sp->sge_control = vals[0]; + sp->counter_val[0] = G_THRESHOLD_0(vals[6]); + sp->counter_val[1] = G_THRESHOLD_1(vals[6]); + sp->counter_val[2] = G_THRESHOLD_2(vals[6]); + sp->counter_val[3] = G_THRESHOLD_3(vals[6]); + sp->timer_val[0] = core_ticks_to_us(adapter, G_TIMERVALUE0(vals[2])); + sp->timer_val[1] = core_ticks_to_us(adapter, G_TIMERVALUE1(vals[2])); + sp->timer_val[2] = core_ticks_to_us(adapter, G_TIMERVALUE2(vals[3])); + sp->timer_val[3] = core_ticks_to_us(adapter, G_TIMERVALUE3(vals[3])); + sp->timer_val[4] = core_ticks_to_us(adapter, G_TIMERVALUE4(vals[4])); + sp->timer_val[5] = core_ticks_to_us(adapter, G_TIMERVALUE5(vals[4])); + + sp->fl_starve_threshold = G_EGRTHRESHOLD(vals[5]) * 2 + 1; + if (is_t4(adapter)) + sp->fl_starve_threshold2 = sp->fl_starve_threshold; + else + sp->fl_starve_threshold2 = G_EGRTHRESHOLDPACKING(vals[5]) * 2 + + 1; + + /* + * We need the Queues/Page and Host Page Size for our VF. + * This is based on the PF from which we're instantiated. + */ + whoami = t4_read_reg(adapter, VF_PL_REG(A_PL_VF_WHOAMI)); + pf = G_SOURCEPF(whoami); + + s_hps = (S_HOSTPAGESIZEPF0 + + (S_HOSTPAGESIZEPF1 - S_HOSTPAGESIZEPF0) * pf); + sp->page_shift = ((vals[1] >> s_hps) & M_HOSTPAGESIZEPF0) + 10; + + for (i = 0; i < SGE_FLBUF_SIZES; i++) { + params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_FL_BUFFER_SIZE0 + (4 * i))); + v = t4vf_query_params(adapter, 1, params, vals); + if (v != FW_SUCCESS) + return v; + + sp->sge_fl_buffer_size[i] = vals[0]; + } + + /* + * T4 uses a single control field to specify both the PCIe Padding and + * Packing Boundary. T5 introduced the ability to specify these + * separately with the Padding Boundary in SGE_CONTROL and and Packing + * Boundary in SGE_CONTROL2. So for T5 and later we need to grab + * SGE_CONTROL in order to determine how ingress packet data will be + * laid out in Packed Buffer Mode. Unfortunately, older versions of + * the firmware won't let us retrieve SGE_CONTROL2 so if we get a + * failure grabbing it we throw an error since we can't figure out the + * right value. + */ + sp->spg_len = sp->sge_control & F_EGRSTATUSPAGESIZE ? 128 : 64; + sp->fl_pktshift = G_PKTSHIFT(sp->sge_control); + sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + 5); + if (is_t4(adapter)) + sp->pack_boundary = sp->pad_boundary; + else { + params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_CONTROL2)); + v = t4vf_query_params(adapter, 1, params, vals); + if (v != FW_SUCCESS) { + CH_ERR(adapter, "Unable to get SGE Control2; " + "probably old firmware.\n"); + return v; + } + if (G_INGPACKBOUNDARY(vals[0]) == 0) + sp->pack_boundary = 16; + else + sp->pack_boundary = 1 << (G_INGPACKBOUNDARY(vals[0]) + + 5); + } + + /* + * For T5 and later we want to use the new BAR2 Doorbells. + * Unfortunately, older firmware didn't allow the this register to be + * read. + */ + if (!is_t4(adapter)) { + unsigned int s_qpp; + + params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_EGRESS_QUEUES_PER_PAGE_VF)); + params[1] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | + V_FW_PARAMS_PARAM_XYZ(A_SGE_INGRESS_QUEUES_PER_PAGE_VF)); + v = t4vf_query_params(adapter, 2, params, vals); + if (v != FW_SUCCESS) { + CH_WARN(adapter, "Unable to get VF SGE Queues/Page; " + "probably old firmware.\n"); + return v; + } + + s_qpp = (S_QUEUESPERPAGEPF0 + + (S_QUEUESPERPAGEPF1 - S_QUEUESPERPAGEPF0) * pf); + sp->eq_s_qpp = ((vals[0] >> s_qpp) & M_QUEUESPERPAGEPF0); + sp->iq_s_qpp = ((vals[1] >> s_qpp) & M_QUEUESPERPAGEPF0); + } + + return 0; +} + +/** + * t4vf_get_rss_glb_config - retrieve adapter RSS Global Configuration + * @adapter: the adapter + * + * Retrieves global RSS mode and parameters with which we have to live + * and stores them in the @adapter's RSS parameters. + */ +int t4vf_get_rss_glb_config(struct adapter *adapter) +{ + struct rss_params *rss = &adapter->params.rss; + struct fw_rss_glb_config_cmd cmd, rpl; + int v; + + /* + * Execute an RSS Global Configuration read command to retrieve + * our RSS configuration. + */ + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_RSS_GLB_CONFIG_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_READ); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); + if (v != FW_SUCCESS) + return v; + + /* + * Transate the big-endian RSS Global Configuration into our + * cpu-endian format based on the RSS mode. We also do first level + * filtering at this point to weed out modes which don't support + * VF Drivers ... + */ + rss->mode = G_FW_RSS_GLB_CONFIG_CMD_MODE( + be32_to_cpu(rpl.u.manual.mode_pkd)); + switch (rss->mode) { + case FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL: { + u32 word = be32_to_cpu( + rpl.u.basicvirtual.synmapen_to_hashtoeplitz); + + rss->u.basicvirtual.synmapen = + ((word & F_FW_RSS_GLB_CONFIG_CMD_SYNMAPEN) != 0); + rss->u.basicvirtual.syn4tupenipv6 = + ((word & F_FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6) != 0); + rss->u.basicvirtual.syn2tupenipv6 = + ((word & F_FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6) != 0); + rss->u.basicvirtual.syn4tupenipv4 = + ((word & F_FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4) != 0); + rss->u.basicvirtual.syn2tupenipv4 = + ((word & F_FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4) != 0); + + rss->u.basicvirtual.ofdmapen = + ((word & F_FW_RSS_GLB_CONFIG_CMD_OFDMAPEN) != 0); + + rss->u.basicvirtual.tnlmapen = + ((word & F_FW_RSS_GLB_CONFIG_CMD_TNLMAPEN) != 0); + rss->u.basicvirtual.tnlalllookup = + ((word & F_FW_RSS_GLB_CONFIG_CMD_TNLALLLKP) != 0); + + rss->u.basicvirtual.hashtoeplitz = + ((word & F_FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ) != 0); + + /* we need at least Tunnel Map Enable to be set */ + if (!rss->u.basicvirtual.tnlmapen) + return -EINVAL; + break; + } + + default: + /* all unknown/unsupported RSS modes result in an error */ + return -EINVAL; + } + + return 0; +} + +/** + * t4vf_get_vfres - retrieve VF resource limits + * @adapter: the adapter + * + * Retrieves configured resource limits and capabilities for a virtual + * function. The results are stored in @adapter->vfres. + */ +int t4vf_get_vfres(struct adapter *adapter) +{ + struct vf_resources *vfres = &adapter->params.vfres; + struct fw_pfvf_cmd cmd, rpl; + int v; + u32 word; + + /* + * Execute PFVF Read command to get VF resource limits; bail out early + * with error on command failure. + */ + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_PFVF_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_READ); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); + if (v != FW_SUCCESS) + return v; + + /* + * Extract VF resource limits and return success. + */ + word = be32_to_cpu(rpl.niqflint_niq); + vfres->niqflint = G_FW_PFVF_CMD_NIQFLINT(word); + vfres->niq = G_FW_PFVF_CMD_NIQ(word); + + word = be32_to_cpu(rpl.type_to_neq); + vfres->neq = G_FW_PFVF_CMD_NEQ(word); + vfres->pmask = G_FW_PFVF_CMD_PMASK(word); + + word = be32_to_cpu(rpl.tc_to_nexactf); + vfres->tc = G_FW_PFVF_CMD_TC(word); + vfres->nvi = G_FW_PFVF_CMD_NVI(word); + vfres->nexactf = G_FW_PFVF_CMD_NEXACTF(word); + + word = be32_to_cpu(rpl.r_caps_to_nethctrl); + vfres->r_caps = G_FW_PFVF_CMD_R_CAPS(word); + vfres->wx_caps = G_FW_PFVF_CMD_WX_CAPS(word); + vfres->nethctrl = G_FW_PFVF_CMD_NETHCTRL(word); + + return 0; +} + +/** + */ +int t4vf_prep_adapter(struct adapter *adapter) +{ + int err; + + /* + * Wait for the device to become ready before proceeding ... + */ + err = t4vf_wait_dev_ready(adapter); + if (err) + return err; + + adapter->params.chipid = pci_get_device(adapter->dev) >> 12; + if (adapter->params.chipid >= 0xa) { + adapter->params.chipid -= (0xa - 0x4); + adapter->params.fpga = 1; + } + + /* + * Default port and clock for debugging in case we can't reach + * firmware. + */ + adapter->params.nports = 1; + adapter->params.vfres.pmask = 1; + adapter->params.vpd.cclk = 50000; + + adapter->chip_params = t4_get_chip_params(chip_id(adapter)); + if (adapter->chip_params == NULL) + return -EINVAL; + + return 0; +} Added: head/sys/dev/cxgbe/if_cxlv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/if_cxlv.c Wed Sep 7 18:13:57 2016 (r305549) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2015 Chelsio Communications, Inc. + * All rights reserved. + * Written by: Navdeep Parhar + * + * 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 + +static int +mod_event(module_t mod, int cmd, void *arg) +{ + + return (0); +} +static moduledata_t if_cxlv_mod = {"if_cxlv", mod_event}; +DECLARE_MODULE(if_cxlv, if_cxlv_mod, SI_SUB_EXEC, SI_ORDER_ANY); +MODULE_VERSION(if_cxlv, 1); +MODULE_DEPEND(if_cxlv, cxlv, 1, 1, 1); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Sep 7 18:08:43 2016 (r305548) +++ head/sys/dev/cxgbe/t4_main.c Wed Sep 7 18:13:57 2016 (r305549) @@ -105,7 +105,7 @@ static driver_t t4_driver = { static int cxgbe_probe(device_t); static int cxgbe_attach(device_t); static int cxgbe_detach(device_t); -static device_method_t cxgbe_methods[] = { +device_method_t cxgbe_methods[] = { DEVMETHOD(device_probe, cxgbe_probe), DEVMETHOD(device_attach, cxgbe_attach), DEVMETHOD(device_detach, cxgbe_detach), @@ -210,19 +210,19 @@ SLIST_HEAD(, uld_info) t4_uld_list; * Number of queues for tx and rx, 10G and 1G, NIC and offload. */ #define NTXQ_10G 16 -static int t4_ntxq10g = -1; +int t4_ntxq10g = -1; TUNABLE_INT("hw.cxgbe.ntxq10g", &t4_ntxq10g); #define NRXQ_10G 8 -static int t4_nrxq10g = -1; +int t4_nrxq10g = -1; TUNABLE_INT("hw.cxgbe.nrxq10g", &t4_nrxq10g); #define NTXQ_1G 4 -static int t4_ntxq1g = -1; +int t4_ntxq1g = -1; TUNABLE_INT("hw.cxgbe.ntxq1g", &t4_ntxq1g); #define NRXQ_1G 2 -static int t4_nrxq1g = -1; +int t4_nrxq1g = -1; TUNABLE_INT("hw.cxgbe.nrxq1g", &t4_nrxq1g); #define NTXQ_VI 1 @@ -276,34 +276,34 @@ TUNABLE_INT("hw.cxgbe.nnmrxq_vi", &t4_nn * Holdoff parameters for 10G and 1G ports. */ #define TMR_IDX_10G 1 -static int t4_tmr_idx_10g = TMR_IDX_10G; +int t4_tmr_idx_10g = TMR_IDX_10G; TUNABLE_INT("hw.cxgbe.holdoff_timer_idx_10G", &t4_tmr_idx_10g); #define PKTC_IDX_10G (-1) -static int t4_pktc_idx_10g = PKTC_IDX_10G; +int t4_pktc_idx_10g = PKTC_IDX_10G; TUNABLE_INT("hw.cxgbe.holdoff_pktc_idx_10G", &t4_pktc_idx_10g); #define TMR_IDX_1G 1 -static int t4_tmr_idx_1g = TMR_IDX_1G; +int t4_tmr_idx_1g = TMR_IDX_1G; TUNABLE_INT("hw.cxgbe.holdoff_timer_idx_1G", &t4_tmr_idx_1g); #define PKTC_IDX_1G (-1) -static int t4_pktc_idx_1g = PKTC_IDX_1G; +int t4_pktc_idx_1g = PKTC_IDX_1G; TUNABLE_INT("hw.cxgbe.holdoff_pktc_idx_1G", &t4_pktc_idx_1g); /* * Size (# of entries) of each tx and rx queue. */ -static unsigned int t4_qsize_txq = TX_EQ_QSIZE; +unsigned int t4_qsize_txq = TX_EQ_QSIZE; TUNABLE_INT("hw.cxgbe.qsize_txq", &t4_qsize_txq); -static unsigned int t4_qsize_rxq = RX_IQ_QSIZE; +unsigned int t4_qsize_rxq = RX_IQ_QSIZE; TUNABLE_INT("hw.cxgbe.qsize_rxq", &t4_qsize_rxq); /* * Interrupt types allowed (bits 0, 1, 2 = INTx, MSI, MSI-X respectively). */ -static int t4_intr_types = INTR_MSIX | INTR_MSI | INTR_INTX; +int t4_intr_types = INTR_MSIX | INTR_MSI | INTR_INTX; TUNABLE_INT("hw.cxgbe.interrupt_types", &t4_intr_types); /* @@ -414,8 +414,6 @@ struct filter_entry { struct t4_filter_specification fs; }; -static int map_bars_0_and_4(struct adapter *); -static int map_bar_2(struct adapter *); static void setup_memwin(struct adapter *); static void position_memwin(struct adapter *, int, uint32_t); static int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); @@ -440,7 +438,6 @@ static void t4_set_desc(struct adapter * static void build_medialist(struct port_info *, struct ifmedia *); static int cxgbe_init_synchronized(struct vi_info *); static int cxgbe_uninit_synchronized(struct vi_info *); -static int setup_intr_handlers(struct adapter *); static void quiesce_txq(struct adapter *, struct sge_txq *); static void quiesce_wrq(struct adapter *, struct sge_wrq *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Sep 7 20:05: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 A4F1FBD0043; Wed, 7 Sep 2016 20:05:11 +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 77D3BE60; Wed, 7 Sep 2016 20:05:11 +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 u87K5A50052197; Wed, 7 Sep 2016 20:05:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87K5ADp052196; Wed, 7 Sep 2016 20:05:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609072005.u87K5ADp052196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 7 Sep 2016 20:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305561 - head/sys/cddl/contrib/opensolaris/uts/common/fs/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.23 Precedence: list List-Id: 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, 07 Sep 2016 20:05:11 -0000 Author: mav Date: Wed Sep 7 20:05:10 2016 New Revision: 305561 URL: https://svnweb.freebsd.org/changeset/base/305561 Log: MFV r305560: 7278 tuning zfs_arc_max does not impact arc_c_min When changing zfs_arc_max (e.g. as zdb does), it may be set to less than the default arc_c_min. arc_c_min should decrease to not be more than arc_c_max, but it doesn't; therefore tuning of arc_c_max is ineffective. Reviewed by: Dan Kimmel Reviewed by: Paul Dagnelie Reviewed by: Prakash Surya Reviewed by: Igor Kozhukhov Author: Matthew Ahrens openzfs/openzfs@608764beadaf4bb71c5d8fe1818e8392ac66a61b Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Sep 7 20:00:22 2016 (r305560) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Sep 7 20:05:10 2016 (r305561) @@ -6062,8 +6062,10 @@ arc_init(void) * Allow the tunables to override our calculations if they are * reasonable. */ - if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size()) + if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size()) { arc_c_max = zfs_arc_max; + arc_c_min = MIN(arc_c_min, arc_c_max); + } if (zfs_arc_min > arc_abs_min && zfs_arc_min <= arc_c_max) arc_c_min = zfs_arc_min; #endif From owner-svn-src-head@freebsd.org Wed Sep 7 20:09: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 8D0A2BD01A7; Wed, 7 Sep 2016 20:09:25 +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 43B39256; Wed, 7 Sep 2016 20:09:25 +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 u87K9OKt052428; Wed, 7 Sep 2016 20:09:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87K9OCw052427; Wed, 7 Sep 2016 20:09:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609072009.u87K9OCw052427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 7 Sep 2016 20:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305563 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 20:09:25 -0000 Author: mav Date: Wed Sep 7 20:09:24 2016 New Revision: 305563 URL: https://svnweb.freebsd.org/changeset/base/305563 Log: MFV r305562: 7259 DS_FIELD_LARGE_BLOCKS is unused The DS_FIELD_LARGE_BLOCKS macro has been unused since the integration of this patch: commit ca0cc3918a1789fa839194af2a9245f801a06b1a Author: Matthew Ahrens Date: Fri Jul 24 09:53:55 2015 -0700 5959 clean up per-dataset feature count code Reviewed by: Toomas Soome Reviewed by: George Wilson Reviewed by: Alex Reece Approved by: Richard Lowe This patch simply removes this macro from dsl_dataset.h. Reviewed by: Dan Kimmel Reviewed by: Prakash Surya Reviewed by: Dan McDonald Reviewed by: Igor Kozhukhov Author: Matthew Ahrens Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Sep 7 20:07:39 2016 (r305562) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Sep 7 20:09:24 2016 (r305563) @@ -86,13 +86,6 @@ struct dsl_pool; #define DS_FIELD_BOOKMARK_NAMES "com.delphix:bookmarks" /* - * This field is present (with value=0) if this dataset may contain large - * blocks (>128KB). If it is present, then this dataset - * is counted in the refcount of the SPA_FEATURE_LARGE_BLOCKS feature. - */ -#define DS_FIELD_LARGE_BLOCKS "org.open-zfs:large_blocks" - -/* * These fields are set on datasets that are in the middle of a resumable * receive, and allow the sender to resume the send if it is interrupted. */ From owner-svn-src-head@freebsd.org Wed Sep 7 23:35:39 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 BE265BD0936; Wed, 7 Sep 2016 23:35:39 +0000 (UTC) (envelope-from jkim@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 9125E23F; Wed, 7 Sep 2016 23:35:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87NZcVs033321; Wed, 7 Sep 2016 23:35:38 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87NZc9D033319; Wed, 7 Sep 2016 23:35:38 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201609072335.u87NZc9D033319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 7 Sep 2016 23:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305571 - head/share/timedef X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 23:35:39 -0000 Author: jkim Date: Wed Sep 7 23:35:38 2016 New Revision: 305571 URL: https://svnweb.freebsd.org/changeset/base/305571 Log: Suffix short month names with "ì›”" and replace %b with %_m for date formats. This change is analogous to r199179, r199271, and r289041 for japanese and chinese locales. Modified: head/share/timedef/ko_KR.UTF-8.src head/share/timedef/ko_KR.eucKR.src Modified: head/share/timedef/ko_KR.UTF-8.src ============================================================================== --- head/share/timedef/ko_KR.UTF-8.src Wed Sep 7 21:14:35 2016 (r305570) +++ head/share/timedef/ko_KR.UTF-8.src Wed Sep 7 23:35:38 2016 (r305571) @@ -4,18 +4,18 @@ # ----------------------------------------------------------------------------- # # Short month names - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 + 1ì›” + 2ì›” + 3ì›” + 4ì›” + 5ì›” + 6ì›” + 7ì›” + 8ì›” + 9ì›” +10ì›” +11ì›” +12ì›” # # Long month names (as in a date) 1ì›” @@ -53,7 +53,7 @@ %Hì‹œ %M분 %Sì´ˆ # # x_fmt -%Yë…„ %bì›” %eì¼ +%Yë…„ %_mì›” %eì¼ # # c_fmt %x %A %X Modified: head/share/timedef/ko_KR.eucKR.src ============================================================================== --- head/share/timedef/ko_KR.eucKR.src Wed Sep 7 21:14:35 2016 (r305570) +++ head/share/timedef/ko_KR.eucKR.src Wed Sep 7 23:35:38 2016 (r305571) @@ -4,18 +4,18 @@ # ----------------------------------------------------------------------------- # # Short month names - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 + 1¿ù + 2¿ù + 3¿ù + 4¿ù + 5¿ù + 6¿ù + 7¿ù + 8¿ù + 9¿ù +10¿ù +11¿ù +12¿ù # # Long month names (as in a date) 1¿ù @@ -53,7 +53,7 @@ %H½Ã %MºÐ %SÃÊ # # x_fmt -%Y³â %b¿ù %eÀÏ +%Y³â %_m¿ù %eÀÏ # # c_fmt %x %A %X From owner-svn-src-head@freebsd.org Wed Sep 7 23:37: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 3F5FEBD0A02; Wed, 7 Sep 2016 23:37:11 +0000 (UTC) (envelope-from jkim@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 0FEFD7D5; Wed, 7 Sep 2016 23:37:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u87NbAkg033478; Wed, 7 Sep 2016 23:37:10 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u87NbADe033477; Wed, 7 Sep 2016 23:37:10 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201609072337.u87NbADe033477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 7 Sep 2016 23:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305573 - head/tools/tools/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 23:37:11 -0000 Author: jkim Date: Wed Sep 7 23:37:10 2016 New Revision: 305573 URL: https://svnweb.freebsd.org/changeset/base/305573 Log: Fix an obvious typo. Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Wed Sep 7 23:36:46 2016 (r305572) +++ head/tools/tools/locale/Makefile Wed Sep 7 23:37:10 2016 (r305573) @@ -178,4 +178,4 @@ POSIX: .endif clean-POSIX: - rm -f {CLDRDIR}/posix/* + rm -f ${CLDRDIR}/posix/* From owner-svn-src-head@freebsd.org Wed Sep 7 23:49: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 DBB39BD0D8E; Wed, 7 Sep 2016 23:49:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 7929DDBC; Wed, 7 Sep 2016 23:49:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r305571 - head/share/timedef To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609072335.u87NZc9D033319@repo.freebsd.org> From: Jung-uk Kim Message-ID: Date: Wed, 7 Sep 2016 19:49:46 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609072335.u87NZc9D033319@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M3CsmOB75tOVVr6H92MnSltT16fahQoRM" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 07 Sep 2016 23:49:53 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --M3CsmOB75tOVVr6H92MnSltT16fahQoRM Content-Type: multipart/mixed; boundary="Uo4ateBUitwnroRTP67DfFTK11gtbVfDE" From: Jung-uk Kim To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r305571 - head/share/timedef References: <201609072335.u87NZc9D033319@repo.freebsd.org> In-Reply-To: <201609072335.u87NZc9D033319@repo.freebsd.org> --Uo4ateBUitwnroRTP67DfFTK11gtbVfDE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/07/2016 19:35, Jung-uk Kim wrote: > Author: jkim > Date: Wed Sep 7 23:35:38 2016 > New Revision: 305571 > URL: https://svnweb.freebsd.org/changeset/base/305571 >=20 > Log: > Suffix short month names with "=EC=9B=94" and replace %b with %_m for= date formats. > This change is analogous to r199179, r199271, and r289041 for japanes= e and > chinese locales. =2E.. I resisted this for very long time but I gave up. Now all CJK locales have the same mistake, i.e., short month names are longer than long month names for single-digit months and commonly used "%b %e" format looks ugly. For example, "ls -l" displays something like " 9=EC=9B=94 7= ". But I guess resistance is futile! :-( Jung-uk Kim --Uo4ateBUitwnroRTP67DfFTK11gtbVfDE-- --M3CsmOB75tOVVr6H92MnSltT16fahQoRM 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 iQEcBAEBCAAGBQJX0KeaAAoJEHyflib82/FGUScH/3hEDUfbHM8i6cWUHm4Yffi/ eerUT3Ps1oS4M0kMRhqVZLlLqWQq133CzAmlPAEDf4acORXS46zTN12/WD/or3f+ lIEdokdiTP7heedCO+cZ76V2PlmodHlhPl0ruXvePrN1QQe6hs/wF7ZgT2PQJVd2 jgtknYl54QlrthOkQ4wJc/B498m4nfdM5kgRCh8xffYJba3t9ONNQ1YcPFqhi8zj ipfBwLRWx2VX9Z6qNG3BlViI/uknAM4FldOpT9xg3i61xnXYOr4N4IIbbjcFrLUa VZct9gARgEO5LYAmTC2CQgjDGArKap4rOkKkJwwmp0AqW8pJCDBERwxsagP2LZU= =15Ys -----END PGP SIGNATURE----- --M3CsmOB75tOVVr6H92MnSltT16fahQoRM-- From owner-svn-src-head@freebsd.org Thu Sep 8 00:38: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 120BCBD0BAD; Thu, 8 Sep 2016 00:38:52 +0000 (UTC) (envelope-from brooks@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 C77C6750; Thu, 8 Sep 2016 00:38:51 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u880cox9056092; Thu, 8 Sep 2016 00:38:50 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u880coMs056090; Thu, 8 Sep 2016 00:38:50 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201609080038.u880coMs056090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 8 Sep 2016 00:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305574 - head/sys/compat/freebsd32 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 00:38:52 -0000 Author: brooks Date: Thu Sep 8 00:38:50 2016 New Revision: 305574 URL: https://svnweb.freebsd.org/changeset/base/305574 Log: Remove a pointless translation of struct ioc_toc_header. struct ioc_toc_header will be the same size (and thus IOREADTOCHEADER will have the same value on all supported platforms). Sponsored by: DARPA, AFRL Modified: head/sys/compat/freebsd32/freebsd32_ioctl.c head/sys/compat/freebsd32/freebsd32_ioctl.h Modified: head/sys/compat/freebsd32/freebsd32_ioctl.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_ioctl.c Wed Sep 7 23:37:10 2016 (r305573) +++ head/sys/compat/freebsd32/freebsd32_ioctl.c Thu Sep 8 00:38:50 2016 (r305574) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); /* Cannot get exact size in 64-bit due to alignment issue of entire struct. */ CTASSERT((sizeof(struct md_ioctl32)+4) == 436); CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8); -CTASSERT(sizeof(struct ioc_toc_header32) == 4); CTASSERT(sizeof(struct mem_range_op32) == 12); CTASSERT(sizeof(struct pci_conf_io32) == 36); CTASSERT(sizeof(struct pci_match_conf32) == 44); @@ -139,25 +138,6 @@ freebsd32_ioctl_md(struct thread *td, st static int -freebsd32_ioctl_ioc_toc_header(struct thread *td, - struct freebsd32_ioctl_args *uap, struct file *fp) -{ - struct ioc_toc_header toch; - struct ioc_toc_header32 toch32; - int error; - - if ((error = copyin(uap->data, &toch32, sizeof(toch32)))) - return (error); - CP(toch32, toch, len); - CP(toch32, toch, starting_track); - CP(toch32, toch, ending_track); - error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&toch, - td->td_ucred, td); - return (error); -} - - -static int freebsd32_ioctl_ioc_read_toc(struct thread *td, struct freebsd32_ioctl_args *uap, struct file *fp) { @@ -441,10 +421,6 @@ freebsd32_ioctl(struct thread *td, struc error = freebsd32_ioctl_ioc_read_toc(td, uap, fp); break; - case CDIOREADTOCHEADER_32: - error = freebsd32_ioctl_ioc_toc_header(td, uap, fp); - break; - case FIODGNAME_32: error = freebsd32_ioctl_fiodgname(td, uap, fp); break; Modified: head/sys/compat/freebsd32/freebsd32_ioctl.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_ioctl.h Wed Sep 7 23:37:10 2016 (r305573) +++ head/sys/compat/freebsd32/freebsd32_ioctl.h Thu Sep 8 00:38:50 2016 (r305574) @@ -36,12 +36,6 @@ typedef __uint32_t caddr_t32; -struct ioc_toc_header32 { - u_short len; - u_char starting_track; - u_char ending_track; -}; - struct ioc_read_toc_entry32 { u_char address_format; u_char starting_track; @@ -115,7 +109,6 @@ struct pci_conf_io32 { }; #define CDIOREADTOCENTRYS_32 _IOWR('c', 5, struct ioc_read_toc_entry32) -#define CDIOREADTOCHEADER_32 _IOR('c', 4, struct ioc_toc_header32) #define MDIOCATTACH_32 _IOC(IOC_INOUT, 'm', 0, sizeof(struct md_ioctl32) + 4) #define MDIOCDETACH_32 _IOC(IOC_INOUT, 'm', 1, sizeof(struct md_ioctl32) + 4) #define MDIOCQUERY_32 _IOC(IOC_INOUT, 'm', 2, sizeof(struct md_ioctl32) + 4) From owner-svn-src-head@freebsd.org Thu Sep 8 01:02: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 43C36BCF058; Thu, 8 Sep 2016 01:02:54 +0000 (UTC) (envelope-from kevlo@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 153A8171; Thu, 8 Sep 2016 01:02:54 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8812rGB067132; Thu, 8 Sep 2016 01:02:53 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8812rWA067131; Thu, 8 Sep 2016 01:02:53 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201609080102.u8812rWA067131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 8 Sep 2016 01:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305575 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 01:02:54 -0000 Author: kevlo Date: Thu Sep 8 01:02:53 2016 New Revision: 305575 URL: https://svnweb.freebsd.org/changeset/base/305575 Log: In m_devget(), if the data fits in a packet header mbuf, check the amount of data is less than or equal to MHLEN instead of MLEN when placing initial small packet header at end of mbuf. Reviewed by: glebius MFC after: 3 days Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Thu Sep 8 00:38:50 2016 (r305574) +++ head/sys/kern/uipc_mbuf.c Thu Sep 8 01:02:53 2016 (r305575) @@ -984,7 +984,7 @@ m_devget(char *buf, int totlen, int off, len = MHLEN; /* Place initial small packet/header at end of mbuf */ - if (m && totlen + off + max_linkhdr <= MLEN) { + if (m && totlen + off + max_linkhdr <= MHLEN) { m->m_data += max_linkhdr; len -= max_linkhdr; } From owner-svn-src-head@freebsd.org Thu Sep 8 02:38:56 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 B9D08BD15F3; Thu, 8 Sep 2016 02:38:56 +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 8C539FEC; Thu, 8 Sep 2016 02:38:56 +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 u882ctIZ001156; Thu, 8 Sep 2016 02:38:55 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u882ctwf001155; Thu, 8 Sep 2016 02:38:55 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201609080238.u882ctwf001155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 8 Sep 2016 02:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305576 - head/sys/crypto/skein/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 02:38:56 -0000 Author: allanjude Date: Thu Sep 8 02:38:55 2016 New Revision: 305576 URL: https://svnweb.freebsd.org/changeset/base/305576 Log: Fix typo in skein amd64 assembly Sponsored by: ScaleEngine Inc. Modified: head/sys/crypto/skein/amd64/skein_block_asm.s (contents, props changed) Modified: head/sys/crypto/skein/amd64/skein_block_asm.s ============================================================================== --- head/sys/crypto/skein/amd64/skein_block_asm.s Thu Sep 8 01:02:53 2016 (r305575) +++ head/sys/crypto/skein/amd64/skein_block_asm.s Thu Sep 8 02:38:55 2016 (r305576) @@ -6,6 +6,7 @@ # # This code is released to the public domain. #---------------------------------------------------------------- +# $FreeBSD$ # .text .altmacro @@ -869,7 +870,7 @@ _UNROLL_CNT = ROUNDS_512/8 .else _UNROLL_CNT = SKEIN_UNROLL_512 .if ((ROUNDS_512/8) % _UNROLL_CNT) - .err "Invalid SKEIN_UNROLL_512" + .error "Invalid SKEIN_UNROLL_512" .endif xorq %rdi,%rdi #rdi = round counter Skein_512_round_loop: From owner-svn-src-head@freebsd.org Thu Sep 8 05:27: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 C9332BD1B50; Thu, 8 Sep 2016 05:27:44 +0000 (UTC) (envelope-from sephe@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 990ECB1D; Thu, 8 Sep 2016 05:27:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u885RhjN064742; Thu, 8 Sep 2016 05:27:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u885Rh6M064737; Thu, 8 Sep 2016 05:27:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080527.u885Rh6M064737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 05:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305578 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 05:27:44 -0000 Author: sephe Date: Thu Sep 8 05:27:43 2016 New Revision: 305578 URL: https://svnweb.freebsd.org/changeset/base/305578 Log: hyperv/hn: Pull vmbus channel open up. While I'm here, pull up the channel callback related code too. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7805 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 05:13:50 2016 (r305577) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 05:27:43 2016 (r305578) @@ -57,20 +57,11 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static void hv_nv_on_channel_callback(struct vmbus_channel *chan, - void *xrxr); static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *, int); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); static int hv_nv_connect_to_vsp(struct hn_softc *sc); -static void hv_nv_on_send_completion(struct hn_softc *sc, - struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); -static void hv_nv_on_receive_completion(struct vmbus_channel *chan, - uint64_t tid); -static void hv_nv_on_receive(struct hn_softc *sc, - struct hn_rx_ring *rxr, struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); @@ -581,54 +572,19 @@ hv_nv_disconnect_from_vsp(struct hn_soft hv_nv_destroy_send_buffer(sc); } -void -hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr) -{ - KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), - ("chan%u subidx %u, rxr%d mismatch", - vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); - vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, - NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, - hv_nv_on_channel_callback, rxr); -} - /* * Net VSC on device add * * Callback when the device belonging to this driver is added */ int -hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr) +hv_nv_on_device_add(struct hn_softc *sc) { - struct vmbus_channel *chan = sc->hn_prichan; - int ret = 0; - - /* - * Open the channel - */ - KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), - ("chan%u subidx %u, rxr%d mismatch", - vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); - ret = vmbus_chan_open(chan, - NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, - NULL, 0, hv_nv_on_channel_callback, rxr); - if (ret != 0) - goto cleanup; /* * Connect with the NetVsp */ - ret = hv_nv_connect_to_vsp(sc); - if (ret != 0) - goto close; - - return (0); - -close: - /* Now, we can close the channel safely */ - vmbus_chan_close(chan); -cleanup: - return (ret); + return (hv_nv_connect_to_vsp(sc)); } /* @@ -684,25 +640,6 @@ hn_chim_free(struct hn_softc *sc, uint32 } /* - * Net VSC on send completion - */ -static void -hv_nv_on_send_completion(struct hn_softc *sc, struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkt) -{ - struct hn_send_ctx *sndc; - - sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; - sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), - VMBUS_CHANPKT_DATALEN(pkt)); - /* - * NOTE: - * 'sndc' CAN NOT be accessed anymore, since it can be freed by - * its callback. - */ -} - -/* * Net VSC on send * Sends a packet on the specified Hyper-V device. * Returns 0 on success, non-zero on failure. @@ -729,190 +666,3 @@ hv_nv_on_send(struct vmbus_channel *chan return (ret); } - -/* - * Net VSC on receive - * - * In the FreeBSD Hyper-V virtual world, this function deals exclusively - * with virtual addresses. - */ -static void -hv_nv_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, - struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) -{ - const struct vmbus_chanpkt_rxbuf *pkt; - const struct hn_nvs_hdr *nvs_hdr; - int count, i, hlen; - - if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { - if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); - return; - } - nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); - - /* Make sure that this is a RNDIS message. */ - if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { - if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", - nvs_hdr->nvs_type); - return; - } - - hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); - if (__predict_false(hlen < sizeof(*pkt))) { - if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); - return; - } - pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - - if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { - if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", - pkt->cp_rxbuf_id); - return; - } - - count = pkt->cp_rxbuf_cnt; - if (__predict_false(hlen < - __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { - if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); - return; - } - - /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ - for (i = 0; i < count; ++i) { - int ofs, len; - - ofs = pkt->cp_rxbuf[i].rb_ofs; - len = pkt->cp_rxbuf[i].rb_len; - if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { - if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " - "ofs %d, len %d\n", i, ofs, len); - continue; - } - hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); - } - - /* - * Moved completion call back here so that all received - * messages (not just data messages) will trigger a response - * message back to the host. - */ - hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid); -} - -/* - * Net VSC on receive completion - * - * Send a receive completion packet to RNDIS device (ie NetVsp) - */ -static void -hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid) -{ - struct hn_nvs_rndis_ack ack; - int retries = 0; - int ret = 0; - - ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; - ack.nvs_status = HN_NVS_STATUS_OK; - -retry_send_cmplt: - /* Send the completion */ - ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, - VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); - if (ret == 0) { - /* success */ - /* no-op */ - } else if (ret == EAGAIN) { - /* no more room... wait a bit and attempt to retry 3 times */ - retries++; - - if (retries < 4) { - DELAY(100); - goto retry_send_cmplt; - } - } -} - -static void -hn_proc_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) -{ - const struct hn_nvs_hdr *hdr; - - if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { - if_printf(sc->hn_ifp, "invalid nvs notify\n"); - return; - } - hdr = VMBUS_CHANPKT_CONST_DATA(pkt); - - if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { - /* Useless; ignore */ - return; - } - if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type); -} - -/* - * Net VSC on channel callback - */ -static void -hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr) -{ - struct hn_rx_ring *rxr = xrxr; - struct hn_softc *sc = rxr->hn_ifp->if_softc; - void *buffer; - int bufferlen = NETVSC_PACKET_SIZE; - - buffer = rxr->hn_rdbuf; - do { - struct vmbus_chanpkt_hdr *pkt = buffer; - uint32_t bytes_rxed; - int ret; - - bytes_rxed = bufferlen; - ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); - if (ret == 0) { - if (bytes_rxed > 0) { - switch (pkt->cph_type) { - case VMBUS_CHANPKT_TYPE_COMP: - hv_nv_on_send_completion(sc, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(sc, rxr, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_INBAND: - hn_proc_notify(sc, pkt); - break; - default: - if_printf(rxr->hn_ifp, - "unknown chan pkt %u\n", - pkt->cph_type); - break; - } - } - } else if (ret == ENOBUFS) { - /* Handle large packet */ - if (bufferlen > NETVSC_PACKET_SIZE) { - free(buffer, M_NETVSC); - buffer = NULL; - } - - /* alloc new buffer */ - buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); - if (buffer == NULL) { - if_printf(rxr->hn_ifp, - "hv_cb malloc buffer failed, len=%u\n", - bytes_rxed); - bufferlen = 0; - break; - } - bufferlen = bytes_rxed; - } else { - /* No more packets */ - break; - } - } while (1); - - if (bufferlen > NETVSC_PACKET_SIZE) - free(buffer, M_NETVSC); - - hv_rf_channel_rollup(rxr, rxr->hn_txr); -} Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 05:13:50 2016 (r305577) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 05:27:43 2016 (r305578) @@ -268,12 +268,10 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr); +int hv_nv_on_device_add(struct hn_softc *sc); int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); -void hv_nv_subchan_attach(struct vmbus_channel *chan, - struct hn_rx_ring *rxr); #endif /* __HV_NET_VSC_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Sep 8 05:13:50 2016 (r305577) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Sep 8 05:27:43 2016 (r305578) @@ -344,9 +344,18 @@ static int hn_encap(struct hn_tx_ring *, static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_chim_size(struct hn_softc *, int); -static void hn_channel_attach(struct hn_softc *, struct vmbus_channel *); -static void hn_subchan_attach(struct hn_softc *, struct vmbus_channel *); -static void hn_subchan_setup(struct hn_softc *); +static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); +static int hn_attach_subchans(struct hn_softc *); +static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); + +static void hn_nvs_handle_notify(struct hn_softc *sc, + const struct vmbus_chanpkt_hdr *pkt); +static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkt); +static void hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, + struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkthdr); +static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -512,7 +521,9 @@ netvsc_attach(device_t dev) /* * Associate the first TX/RX ring w/ the primary channel. */ - hn_channel_attach(sc, sc->hn_prichan); + error = hn_chan_attach(sc, sc->hn_prichan); + if (error) + goto failed; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; @@ -554,8 +565,7 @@ netvsc_attach(device_t dev) if (sc->hn_xact == NULL) goto failed; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, - &sc->hn_rx_ring[0]); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); if (error) goto failed; KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, @@ -572,8 +582,11 @@ netvsc_attach(device_t dev) device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); - if (sc->hn_rx_ring_inuse > 1) - hn_subchan_setup(sc); + if (sc->hn_rx_ring_inuse > 1) { + error = hn_attach_subchans(sc); + if (error) + goto failed; + } #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { @@ -1566,9 +1579,12 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* Wait for subchannels to be destroyed */ vmbus_subchan_drain(sc->hn_prichan); + sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; + sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; + hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ + ring_cnt = sc->hn_rx_ring_inuse; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, - &sc->hn_rx_ring[0]); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -1594,7 +1610,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, sc->hn_tx_ring[r].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; } - hn_subchan_setup(sc); + hn_attach_subchans(sc); /* XXX check error */ } if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) @@ -2948,14 +2964,18 @@ hn_xmit_txeof_taskfunc(void *xtxr, int p mtx_unlock(&txr->hn_tx_lock); } -static void -hn_channel_attach(struct hn_softc *sc, struct vmbus_channel *chan) +static int +hn_chan_attach(struct hn_softc *sc, struct vmbus_channel *chan) { struct hn_rx_ring *rxr; - int idx; + struct hn_tx_ring *txr = NULL; + int idx, error; idx = vmbus_chan_subidx(chan); + /* + * Link this channel to RX/TX ring. + */ KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", idx, sc->hn_rx_ring_inuse)); @@ -2965,60 +2985,260 @@ hn_channel_attach(struct hn_softc *sc, s rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; if (bootverbose) { - if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", + if_printf(sc->hn_ifp, "link RX ring %d to chan%u\n", idx, vmbus_chan_id(chan)); } if (idx < sc->hn_tx_ring_inuse) { - struct hn_tx_ring *txr = &sc->hn_tx_ring[idx]; - + txr = &sc->hn_tx_ring[idx]; KASSERT((txr->hn_tx_flags & HN_TX_FLAG_ATTACHED) == 0, ("TX ring %d already attached", idx)); txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED; txr->hn_chan = chan; if (bootverbose) { - if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", + if_printf(sc->hn_ifp, "link TX ring %d to chan%u\n", idx, vmbus_chan_id(chan)); } } - /* Bind channel to a proper CPU */ + /* Bind this channel to a proper CPU. */ vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); -} - -static void -hn_subchan_attach(struct hn_softc *sc, struct vmbus_channel *chan) -{ - KASSERT(!vmbus_chan_is_primary(chan), - ("subchannel callback on primary channel")); - hn_channel_attach(sc, chan); + /* Open this channel */ + error = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hn_chan_callback, rxr); + if (error) { + if_printf(sc->hn_ifp, "open chan%u failed: %d\n", + vmbus_chan_id(chan), error); + rxr->hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; + if (txr != NULL) + txr->hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; + } + return (error); } -static void -hn_subchan_setup(struct hn_softc *sc) +static int +hn_attach_subchans(struct hn_softc *sc) { struct vmbus_channel **subchans; int subchan_cnt = sc->hn_rx_ring_inuse - 1; - int i; + int i, error = 0; /* Wait for sub-channels setup to complete. */ subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { - struct vmbus_channel *subchan = subchans[i]; - - /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan); - hv_nv_subchan_attach(subchan, - &sc->hn_rx_ring[vmbus_chan_subidx(subchan)]); + error = hn_chan_attach(sc, subchans[i]); + if (error) + break; } /* Release the sub-channels */ vmbus_subchan_rel(subchans, subchan_cnt); - if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); + + if (error) { + if_printf(sc->hn_ifp, "sub-channels attach failed: %d\n", error); + } else { + if (bootverbose) { + if_printf(sc->hn_ifp, "%d sub-channels attached\n", + subchan_cnt); + } + } + return (error); +} + +static void +hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) +{ + const struct hn_nvs_hdr *hdr; + + if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { + if_printf(sc->hn_ifp, "invalid nvs notify\n"); + return; + } + hdr = VMBUS_CHANPKT_CONST_DATA(pkt); + + if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { + /* Useless; ignore */ + return; + } + if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type); +} + +static void +hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkt) +{ + struct hn_send_ctx *sndc; + + sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; + sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), + VMBUS_CHANPKT_DATALEN(pkt)); + /* + * NOTE: + * 'sndc' CAN NOT be accessed anymore, since it can be freed by + * its callback. + */ +} + +static void +hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, + struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) +{ + const struct vmbus_chanpkt_rxbuf *pkt; + const struct hn_nvs_hdr *nvs_hdr; + int count, i, hlen; + + if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { + if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); + return; + } + nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + + /* Make sure that this is a RNDIS message. */ + if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { + if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", + nvs_hdr->nvs_type); + return; + } + + hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); + if (__predict_false(hlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); + return; + } + pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; + + if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { + if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", + pkt->cp_rxbuf_id); + return; + } + + count = pkt->cp_rxbuf_cnt; + if (__predict_false(hlen < + __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { + if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); + return; + } + + /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ + for (i = 0; i < count; ++i) { + int ofs, len; + + ofs = pkt->cp_rxbuf[i].rb_ofs; + len = pkt->cp_rxbuf[i].rb_len; + if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " + "ofs %d, len %d\n", i, ofs, len); + continue; + } + hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); + } + + /* + * Moved completion call back here so that all received + * messages (not just data messages) will trigger a response + * message back to the host. + */ + hn_nvs_ack_rxbuf(chan, pkt->cp_hdr.cph_xactid); +} + +/* + * Net VSC on receive completion + * + * Send a receive completion packet to RNDIS device (ie NetVsp) + */ +static void +hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid) +{ + struct hn_nvs_rndis_ack ack; + int retries = 0; + int ret = 0; + + ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; + ack.nvs_status = HN_NVS_STATUS_OK; + +retry_send_cmplt: + /* Send the completion */ + ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, + VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); + if (ret == 0) { + /* success */ + /* no-op */ + } else if (ret == EAGAIN) { + /* no more room... wait a bit and attempt to retry 3 times */ + retries++; + + if (retries < 4) { + DELAY(100); + goto retry_send_cmplt; + } + } +} + +static void +hn_chan_callback(struct vmbus_channel *chan, void *xrxr) +{ + struct hn_rx_ring *rxr = xrxr; + struct hn_softc *sc = rxr->hn_ifp->if_softc; + void *buffer; + int bufferlen = NETVSC_PACKET_SIZE; + + buffer = rxr->hn_rdbuf; + do { + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); + if (ret == 0) { + switch (pkt->cph_type) { + case VMBUS_CHANPKT_TYPE_COMP: + hn_nvs_handle_comp(sc, chan, pkt); + break; + case VMBUS_CHANPKT_TYPE_RXBUF: + hn_nvs_handle_rxbuf(sc, rxr, chan, pkt); + break; + case VMBUS_CHANPKT_TYPE_INBAND: + hn_nvs_handle_notify(sc, pkt); + break; + default: + if_printf(rxr->hn_ifp, + "unknown chan pkt %u\n", + pkt->cph_type); + break; + } + } else if (ret == ENOBUFS) { + /* Handle large packet */ + if (bufferlen > NETVSC_PACKET_SIZE) { + free(buffer, M_NETVSC); + buffer = NULL; + } + + /* alloc new buffer */ + buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); + if (buffer == NULL) { + if_printf(rxr->hn_ifp, + "hv_cb malloc buffer failed, len=%u\n", + bytes_rxed); + bufferlen = 0; + break; + } + bufferlen = bytes_rxed; + } else { + /* No more packets */ + break; + } + } while (1); + + if (bufferlen > NETVSC_PACKET_SIZE) + free(buffer, M_NETVSC); + + hv_rf_channel_rollup(rxr, rxr->hn_txr); } static void Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Sep 8 05:13:50 2016 (r305577) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Sep 8 05:27:43 2016 (r305578) @@ -1012,7 +1012,7 @@ hv_rf_halt_device(struct hn_softc *sc) */ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, - int *nchan0, struct hn_rx_ring *rxr) + int *nchan0) { int ret; netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; @@ -1031,7 +1031,7 @@ hv_rf_on_device_add(struct hn_softc *sc, * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - ret = hv_nv_on_device_add(sc, rxr); + ret = hv_nv_on_device_add(sc); if (ret != 0) return (ret); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Sep 8 05:13:50 2016 (r305577) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Sep 8 05:27:43 2016 (r305578) @@ -43,8 +43,7 @@ struct hn_rx_ring; void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, - struct hn_rx_ring *rxr); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan); int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); From owner-svn-src-head@freebsd.org Thu Sep 8 06:06: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 A1133BD032B; Thu, 8 Sep 2016 06:06:55 +0000 (UTC) (envelope-from sephe@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 5B22BB38; Thu, 8 Sep 2016 06:06:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8866sjK079637; Thu, 8 Sep 2016 06:06:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8866sGQ079636; Thu, 8 Sep 2016 06:06:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080606.u8866sGQ079636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 06:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305579 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 06:06:55 -0000 Author: sephe Date: Thu Sep 8 06:06:54 2016 New Revision: 305579 URL: https://svnweb.freebsd.org/changeset/base/305579 Log: hyperv/hn: Push RXBUF size adjustment down. It is not used in other places. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7806 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 05:27:43 2016 (r305578) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:06:54 2016 (r305579) @@ -58,7 +58,7 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper * Forward declarations */ static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *, int); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); static int hv_nv_connect_to_vsp(struct hn_softc *sc); @@ -154,17 +154,22 @@ hn_nvs_req_send(struct hn_softc *sc, voi * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_rxbuf_conn *conn; const struct hn_nvs_rxbuf_connresp *resp; size_t resp_len; uint32_t status; - int error; + int error, rxbuf_size; - KASSERT(rxbuf_size <= NETVSC_RECEIVE_BUFFER_SIZE, - ("invalid rxbuf size %d", rxbuf_size)); + /* + * Limit RXBUF size for old NVS. + */ + if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + else + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; /* * Connect the RXBUF GPADL to the primary channel. @@ -496,7 +501,6 @@ hv_nv_connect_to_vsp(struct hn_softc *sc device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; struct hn_nvs_ndis_init ndis; - int rxbuf_size; /* * Negotiate the NVSP version. Try the latest NVSP first. @@ -548,13 +552,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc goto cleanup; } - /* Post the big receive buffer to NetVSP */ - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; - else - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; - - ret = hv_nv_init_rx_buffer_with_net_vsp(sc, rxbuf_size); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc); From owner-svn-src-head@freebsd.org Thu Sep 8 06:23: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 1A978BD07B6; Thu, 8 Sep 2016 06:23:10 +0000 (UTC) (envelope-from sephe@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 CFEC5264; Thu, 8 Sep 2016 06:23:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u886N93t087570; Thu, 8 Sep 2016 06:23:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u886N8MS087567; Thu, 8 Sep 2016 06:23:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080623.u886N8MS087567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 06:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305580 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 06:23:10 -0000 Author: sephe Date: Thu Sep 8 06:23:08 2016 New Revision: 305580 URL: https://svnweb.freebsd.org/changeset/base/305580 Log: hyperv/hn: Factor out function to do NVS initialization. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7807 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/if_hnreg.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:06:54 2016 (r305579) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:23:08 2016 (r305580) @@ -69,6 +69,13 @@ static void hn_nvs_sent_none(struct hn_s struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); +static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_5, + HN_NVS_VERSION_4, + HN_NVS_VERSION_2, + HN_NVS_VERSION_1 +}; + uint32_t hn_chim_alloc(struct hn_softc *sc) { @@ -166,7 +173,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* * Limit RXBUF size for old NVS. */ - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) + if (sc->hn_nvs_ver <= HN_NVS_VERSION_2) rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; else rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; @@ -424,7 +431,7 @@ hv_nv_destroy_send_buffer(struct hn_soft } static int -hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, uint32_t nvs_ver) +hn_nvs_doinit(struct hn_softc *sc, uint32_t nvs_ver) { struct vmbus_xact *xact; struct hn_nvs_init *init; @@ -485,55 +492,55 @@ hv_nv_send_ndis_config(struct hn_softc * return (error); } -/* - * Net VSC connect to VSP - */ static int -hv_nv_connect_to_vsp(struct hn_softc *sc) +hn_nvs_init(struct hn_softc *sc) { - uint32_t protocol_list[] = { NVSP_PROTOCOL_VERSION_1, - NVSP_PROTOCOL_VERSION_2, - NVSP_PROTOCOL_VERSION_4, - NVSP_PROTOCOL_VERSION_5 }; int i; - int protocol_number = nitems(protocol_list); - int ret = 0; - device_t dev = sc->hn_dev; - struct ifnet *ifp = sc->hn_ifp; - struct hn_nvs_ndis_init ndis; - /* - * Negotiate the NVSP version. Try the latest NVSP first. - */ - for (i = protocol_number - 1; i >= 0; i--) { - if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { - sc->hn_nvs_ver = protocol_list[i]; + for (i = 0; i < nitems(hn_nvs_version); ++i) { + int error; + + error = hn_nvs_doinit(sc, hn_nvs_version[i]); + if (!error) { + sc->hn_nvs_ver = hn_nvs_version[i]; + + /* Set NDIS version according to NVS version. */ sc->hn_ndis_ver = HN_NDIS_VERSION_6_30; - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) + if (sc->hn_nvs_ver <= HN_NVS_VERSION_4) sc->hn_ndis_ver = HN_NDIS_VERSION_6_1; + if (bootverbose) { if_printf(sc->hn_ifp, "NVS version 0x%x, " - "NDIS version %u.%u\n", - sc->hn_nvs_ver, + "NDIS version %u.%u\n", sc->hn_nvs_ver, HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - break; + return (0); } } + if_printf(sc->hn_ifp, "no NVS available\n"); + return (ENXIO); +} - if (i < 0) { - if (bootverbose) - device_printf(dev, "failed to negotiate a valid " - "protocol.\n"); - return (EPROTO); - } +/* + * Net VSC connect to VSP + */ +static int +hv_nv_connect_to_vsp(struct hn_softc *sc) +{ + int ret = 0; + struct ifnet *ifp = sc->hn_ifp; + struct hn_nvs_ndis_init ndis; + + ret = hn_nvs_init(sc); + if (ret != 0) + return (ret); /* * Set the MTU if supported by this NVSP protocol version * This needs to be right after the NVSP init message per Haiyang */ - if (sc->hn_nvs_ver >= NVSP_PROTOCOL_VERSION_2) + if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); /* Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 06:06:54 2016 (r305579) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 06:23:08 2016 (r305580) @@ -68,13 +68,6 @@ MALLOC_DECLARE(M_NETVSC); -#define NVSP_INVALID_PROTOCOL_VERSION (0xFFFFFFFF) - -#define NVSP_PROTOCOL_VERSION_1 2 -#define NVSP_PROTOCOL_VERSION_2 0x30002 -#define NVSP_PROTOCOL_VERSION_4 0x40000 -#define NVSP_PROTOCOL_VERSION_5 0x50000 - /* * The following arguably belongs in a separate header file */ Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Thu Sep 8 06:06:54 2016 (r305579) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Thu Sep 8 06:23:08 2016 (r305580) @@ -40,6 +40,14 @@ #define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) #define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) +/* + * NVS versions. + */ +#define HN_NVS_VERSION_1 0x00002 +#define HN_NVS_VERSION_2 0x30002 +#define HN_NVS_VERSION_4 0x40000 +#define HN_NVS_VERSION_5 0x50000 + #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface From owner-svn-src-head@freebsd.org Thu Sep 8 06:42: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 F39D4BD0E44; Thu, 8 Sep 2016 06:42:31 +0000 (UTC) (envelope-from sephe@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 ACB5CC66; Thu, 8 Sep 2016 06:42:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u886gUk6095599; Thu, 8 Sep 2016 06:42:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u886gUPP095594; Thu, 8 Sep 2016 06:42:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080642.u886gUPP095594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 06:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305581 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 06:42:32 -0000 Author: sephe Date: Thu Sep 8 06:42:30 2016 New Revision: 305581 URL: https://svnweb.freebsd.org/changeset/base/305581 Log: hyperv/hn: Pass MTU around. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7808 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:23:08 2016 (r305580) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:42:30 2016 (r305581) @@ -61,7 +61,7 @@ static int hv_nv_init_send_buffer_with_ static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); -static int hv_nv_connect_to_vsp(struct hn_softc *sc); +static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); @@ -526,10 +526,9 @@ hn_nvs_init(struct hn_softc *sc) * Net VSC connect to VSP */ static int -hv_nv_connect_to_vsp(struct hn_softc *sc) +hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) { int ret = 0; - struct ifnet *ifp = sc->hn_ifp; struct hn_nvs_ndis_init ndis; ret = hn_nvs_init(sc); @@ -541,7 +540,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc * This needs to be right after the NVSP init message per Haiyang */ if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) - ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); + ret = hv_nv_send_ndis_config(sc, mtu); /* * Initialize NDIS. @@ -583,13 +582,13 @@ hv_nv_disconnect_from_vsp(struct hn_soft * Callback when the device belonging to this driver is added */ int -hv_nv_on_device_add(struct hn_softc *sc) +hv_nv_on_device_add(struct hn_softc *sc, int mtu) { /* * Connect with the NetVsp */ - return (hv_nv_connect_to_vsp(sc)); + return (hv_nv_connect_to_vsp(sc, mtu)); } /* Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 06:23:08 2016 (r305580) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Sep 8 06:42:30 2016 (r305581) @@ -261,7 +261,7 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hv_nv_on_device_add(struct hn_softc *sc); +int hv_nv_on_device_add(struct hn_softc *sc, int mtu); int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Sep 8 06:23:08 2016 (r305580) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Sep 8 06:42:30 2016 (r305581) @@ -528,7 +528,6 @@ netvsc_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_ifinit; - /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -565,7 +564,7 @@ netvsc_attach(device_t dev) if (sc->hn_xact == NULL) goto failed; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU); if (error) goto failed; KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, @@ -1584,7 +1583,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ ring_cnt = sc->hn_rx_ring_inuse; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, + ifr->ifr_mtu); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Sep 8 06:23:08 2016 (r305580) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Sep 8 06:42:30 2016 (r305581) @@ -1012,7 +1012,7 @@ hv_rf_halt_device(struct hn_softc *sc) */ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, - int *nchan0) + int *nchan0, int mtu) { int ret; netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; @@ -1031,7 +1031,7 @@ hv_rf_on_device_add(struct hn_softc *sc, * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - ret = hv_nv_on_device_add(sc); + ret = hv_nv_on_device_add(sc, mtu); if (ret != 0) return (ret); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Sep 8 06:23:08 2016 (r305580) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Sep 8 06:42:30 2016 (r305581) @@ -43,7 +43,8 @@ struct hn_rx_ring; void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, + int mtu); int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); From owner-svn-src-head@freebsd.org Thu Sep 8 07:16:57 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 610B9BD186C; Thu, 8 Sep 2016 07:16:57 +0000 (UTC) (envelope-from sephe@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 19FD18B9; Thu, 8 Sep 2016 07:16:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u887Guv0008197; Thu, 8 Sep 2016 07:16:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u887GuLw008196; Thu, 8 Sep 2016 07:16:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080716.u887GuLw008196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 07:16:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305585 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 07:16:57 -0000 Author: sephe Date: Thu Sep 8 07:16:56 2016 New Revision: 305585 URL: https://svnweb.freebsd.org/changeset/base/305585 Log: hyperv/kvp: Fix IPv4/IPv6 address injection support. The GUID string provided by hypervisor has leading and trailing braces, while our GUID string does not have braces at all. Both braces should be ignored, when the GUID strings are compared. Submitted by: Hongjiang Zhang Modified by: sephe MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7809 Modified: head/sys/dev/hyperv/utilities/hv_kvp.c Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Thu Sep 8 07:16:15 2016 (r305584) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Thu Sep 8 07:16:56 2016 (r305585) @@ -332,20 +332,23 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) { for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { - /* XXX access other driver's softc? are you kidding? */ device_t dev = devs[devcnt]; struct vmbus_channel *chan; char buf[HYPERV_GUID_STRLEN]; + int n; - /* - * Trying to find GUID of Network Device - */ chan = vmbus_get_channel(dev); - hyperv_guid2str(vmbus_chan_guid_inst(chan), - buf, sizeof(buf)); + n = hyperv_guid2str(vmbus_chan_guid_inst(chan), buf, + sizeof(buf)); - if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, - HYPERV_GUID_STRLEN - 1) == 0) { + /* + * The string in the 'kvp_ip_val.adapter_id' has + * braces around the GUID; skip the leading brace + * in 'kvp_ip_val.adapter_id'. + */ + if (strncmp(buf, + ((char *)&umsg->body.kvp_ip_val.adapter_id) + 1, + n) == 0) { strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, device_get_nameunit(dev), MAX_ADAPTER_ID_SIZE); break; From owner-svn-src-head@freebsd.org Thu Sep 8 07:34: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 C1C1EBD1F13; Thu, 8 Sep 2016 07:34:32 +0000 (UTC) (envelope-from sephe@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 919E31E9; Thu, 8 Sep 2016 07:34:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u887YVk3015486; Thu, 8 Sep 2016 07:34:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u887YVAn015485; Thu, 8 Sep 2016 07:34:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080734.u887YVAn015485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 07:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305586 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 07:34:32 -0000 Author: sephe Date: Thu Sep 8 07:34:31 2016 New Revision: 305586 URL: https://svnweb.freebsd.org/changeset/base/305586 Log: hyperv/hn: Function renaming. While I'm here, remove obvious comment. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7810 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 07:16:56 2016 (r305585) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 07:34:31 2016 (r305586) @@ -470,12 +470,10 @@ hn_nvs_doinit(struct hn_softc *sc, uint3 } /* - * Send NDIS version 2 config packet containing MTU. - * - * Not valid for NDIS version 1. + * Configure MTU and enable VLAN. */ static int -hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) +hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) { struct hn_nvs_ndis_conf conf; int error; @@ -522,25 +520,27 @@ hn_nvs_init(struct hn_softc *sc) return (ENXIO); } -/* - * Net VSC connect to VSP - */ static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) { int ret = 0; struct hn_nvs_ndis_init ndis; + /* + * Initialize NVS. + */ ret = hn_nvs_init(sc); if (ret != 0) return (ret); - /* - * Set the MTU if supported by this NVSP protocol version - * This needs to be right after the NVSP init message per Haiyang - */ - if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) - ret = hv_nv_send_ndis_config(sc, mtu); + if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) { + /* + * Configure NDIS before initializing it. + */ + ret = hn_nvs_conf_ndis(sc, mtu); + if (ret != 0) + return (ret); + } /* * Initialize NDIS. From owner-svn-src-head@freebsd.org Thu Sep 8 07:45: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 A6E58BD1298; Thu, 8 Sep 2016 07:45:21 +0000 (UTC) (envelope-from sephe@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 5FDCA96B; Thu, 8 Sep 2016 07:45:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u887jK5w019177; Thu, 8 Sep 2016 07:45:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u887jKpt019176; Thu, 8 Sep 2016 07:45:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080745.u887jKpt019176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 07:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305587 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 07:45:21 -0000 Author: sephe Date: Thu Sep 8 07:45:20 2016 New Revision: 305587 URL: https://svnweb.freebsd.org/changeset/base/305587 Log: hyperv/hn: Factor out NVS NDIS initialization MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7811 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 07:34:31 2016 (r305586) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 07:45:20 2016 (r305587) @@ -491,6 +491,24 @@ hn_nvs_conf_ndis(struct hn_softc *sc, in } static int +hn_nvs_init_ndis(struct hn_softc *sc) +{ + struct hn_nvs_ndis_init ndis; + int error; + + memset(&ndis, 0, sizeof(ndis)); + ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; + ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); + if (error) + if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", error); + return (error); +} + +static int hn_nvs_init(struct hn_softc *sc) { int i; @@ -523,8 +541,7 @@ hn_nvs_init(struct hn_softc *sc) static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) { - int ret = 0; - struct hn_nvs_ndis_init ndis; + int ret; /* * Initialize NVS. @@ -545,24 +562,13 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* * Initialize NDIS. */ - - memset(&ndis, 0, sizeof(ndis)); - ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; - ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); - ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); - - /* NOTE: No response. */ - ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); - if (ret != 0) { - if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); - goto cleanup; - } + ret = hn_nvs_init_ndis(sc); + if (ret != 0) + return (ret); ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc); - -cleanup: return (ret); } From owner-svn-src-head@freebsd.org Thu Sep 8 09:11:14 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 DBAF8BD021F; Thu, 8 Sep 2016 09:11:14 +0000 (UTC) (envelope-from sephe@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 B7D16C65; Thu, 8 Sep 2016 09:11:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u889BDv2050644; Thu, 8 Sep 2016 09:11:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u889BD4m050642; Thu, 8 Sep 2016 09:11:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080911.u889BD4m050642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 09:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305588 - in head: lib/libstand sys/boot/i386/pxeldr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 09:11:15 -0000 Author: sephe Date: Thu Sep 8 09:11:13 2016 New Revision: 305588 URL: https://svnweb.freebsd.org/changeset/base/305588 Log: pxeboot: Add nfs.read_size tunable. Increase this tunable improves kernel loading speed. Submitted by: Jun Su Reviewed by: rpokala, wblock (previous version) Obtained from: DragonFlyBSD MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7756 Modified: head/lib/libstand/nfs.c head/sys/boot/i386/pxeldr/pxeboot.8 Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Thu Sep 8 07:45:20 2016 (r305587) +++ head/lib/libstand/nfs.c Thu Sep 8 09:11:13 2016 (r305588) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -50,7 +51,8 @@ __FBSDID("$FreeBSD$"); #define NFS_DEBUGxx -#define NFSREAD_SIZE 1024 +#define NFSREAD_MIN_SIZE 1024 +#define NFSREAD_MAX_SIZE 4096 /* Define our own NFS attributes without NQNFS stuff. */ #ifdef OLD_NFSV2 @@ -83,7 +85,7 @@ struct nfs_read_repl { n_long errno; struct nfsv2_fattrs fa; n_long count; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; }; #ifndef NFS_NOSYMLINK @@ -210,6 +212,8 @@ struct fs_ops nfs_fsops = { nfs_readdir }; +static int nfs_read_size = NFSREAD_MIN_SIZE; + #ifdef OLD_NFSV2 /* * Fetch the root file handle (call mount daemon) @@ -264,6 +268,17 @@ nfs_getrootfh(struct iodesc *d, char *pa if (repl->errno) return (ntohl(repl->errno)); bcopy(repl->fh, fhp, sizeof(repl->fh)); + + /* + * Improve boot performance over NFS + */ + if (getenv("nfs.read_size") != NULL) + nfs_read_size = strtol(getenv("nfs.read_size"), NULL, 0); + if (nfs_read_size < NFSREAD_MIN_SIZE) + nfs_read_size = NFSREAD_MIN_SIZE; + if (nfs_read_size > NFSREAD_MAX_SIZE) + nfs_read_size = NFSREAD_MAX_SIZE; + return (0); } @@ -401,11 +416,11 @@ nfs_readdata(struct nfs_iodesc *d, off_t bcopy(d->fh, args->fh, NFS_FHSIZE); args->off = htonl((n_long)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->len = htonl((n_long)len); args->xxx = htonl((n_long)0); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct nfs_read_rpl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ, args, sizeof(*args), @@ -1025,7 +1040,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t uint32_t count; uint32_t eof; uint32_t len; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; } *repl; struct { uint32_t h[RPC_HEADER_WORDS]; @@ -1048,10 +1063,10 @@ nfs_readdata(struct nfs_iodesc *d, off_t pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); args->fhoffcnt[pos++] = 0; args->fhoffcnt[pos++] = htonl((uint32_t)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->fhoffcnt[pos] = htonl((uint32_t)len); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct repl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ, args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)), Modified: head/sys/boot/i386/pxeldr/pxeboot.8 ============================================================================== --- head/sys/boot/i386/pxeldr/pxeboot.8 Thu Sep 8 07:45:20 2016 (r305587) +++ head/sys/boot/i386/pxeldr/pxeboot.8 Thu Sep 8 09:11:13 2016 (r305588) @@ -85,6 +85,14 @@ expects to fetch .Pa /boot/loader.rc from the specified server before loading any other files. .Pp +.Nm +defaults to a conservative 1024 byte NFS data packet size. +This may be changed by setting the +.Va nfs.read_size +variable in +.Pa /boot/loader.conf . +Valid values range from 1024 to 4096 bytes. +.Pp In all other respects, .Nm acts just like From owner-svn-src-head@freebsd.org Thu Sep 8 10:01:02 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 3C5D4BD1089; Thu, 8 Sep 2016 10:01:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E71C2AEF; Thu, 8 Sep 2016 10:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id NAA03546; Thu, 08 Sep 2016 13:00:52 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bhw8a-000Nj7-Hc; Thu, 08 Sep 2016 13:00:52 +0300 Subject: Re: svn commit: r305539 - head/sys/amd64/amd64 To: John Baldwin References: <201609071424.u87EOToA020864@repo.freebsd.org> <15727056.pEvyZgkc37@ralph.baldwin.cx> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org From: Andriy Gapon Message-ID: <4c7a7106-9f7b-3929-1453-8b020587895c@FreeBSD.org> Date: Thu, 8 Sep 2016 13:00:16 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <15727056.pEvyZgkc37@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 10:01:02 -0000 On 07/09/2016 19:39, John Baldwin wrote: > On Wednesday, September 07, 2016 02:24:29 PM Andriy Gapon wrote: >> Author: avg >> Date: Wed Sep 7 14:24:29 2016 >> New Revision: 305539 >> URL: https://svnweb.freebsd.org/changeset/base/305539 >> >> Log: >> work around AMD erratum 793 for family 16h, models 00h-0Fh > > Would this apply to FreeBSD/i386 as well? Yes. > Perhaps we need some > shared code in sys/x86 for initcpu.c on modern CPUs. That would be good to have. -- Andriy Gapon From owner-svn-src-head@freebsd.org Thu Sep 8 10:10:06 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 B5852BD158B; Thu, 8 Sep 2016 10:10:06 +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 8682B5E3; Thu, 8 Sep 2016 10:10:06 +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 u88AA5Ci071789; Thu, 8 Sep 2016 10:10:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88AA54X071788; Thu, 8 Sep 2016 10:10:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609081010.u88AA54X071788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 8 Sep 2016 10:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305590 - head/sys/dev/usb/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 10:10:06 -0000 Author: hselasky Date: Thu Sep 8 10:10:05 2016 New Revision: 305590 URL: https://svnweb.freebsd.org/changeset/base/305590 Log: Correctly map the USB mouse tilt delta values into buttons 5 and 6 instead of 3 and 4 which is used for the scroll wheel, according to X.org. PR: 170358 MFC after: 1 week Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Thu Sep 8 09:50:03 2016 (r305589) +++ head/sys/dev/usb/input/ums.c Thu Sep 8 10:10:05 2016 (r305590) @@ -288,9 +288,9 @@ ums_intr_callback(struct usb_xfer *xfer, /* translate T-axis into button presses until further */ if (dt > 0) - buttons |= 1UL << 3; + buttons |= 1UL << 5; else if (dt < 0) - buttons |= 1UL << 4; + buttons |= 1UL << 6; sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-head@freebsd.org Thu Sep 8 12:00:04 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 006FCBD16DB; Thu, 8 Sep 2016 12:00:04 +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 D24AB1BC; Thu, 8 Sep 2016 12:00: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 u88C03CZ013096; Thu, 8 Sep 2016 12:00:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C02sI013094; Thu, 8 Sep 2016 12:00:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609081200.u88C02sI013094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 8 Sep 2016 12:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305591 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:00:04 -0000 Author: mav Date: Thu Sep 8 12:00:02 2016 New Revision: 305591 URL: https://svnweb.freebsd.org/changeset/base/305591 Log: Decode ATA Status Return descriptor. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Thu Sep 8 10:10:05 2016 (r305590) +++ head/sys/cam/scsi/scsi_all.c Thu Sep 8 12:00:02 2016 (r305591) @@ -4652,6 +4652,53 @@ scsi_sense_progress_sbuf(struct sbuf *sb scsi_progress_sbuf(sb, progress_val); } +void +scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header) +{ + struct scsi_sense_ata_ret_desc *res; + + res = (struct scsi_sense_ata_ret_desc *)header; + + sbuf_printf(sb, "ATA status: %02x (%s%s%s%s%s%s%s%s), ", + res->status, + (res->status & 0x80) ? "BSY " : "", + (res->status & 0x40) ? "DRDY " : "", + (res->status & 0x20) ? "DF " : "", + (res->status & 0x10) ? "SERV " : "", + (res->status & 0x08) ? "DRQ " : "", + (res->status & 0x04) ? "CORR " : "", + (res->status & 0x02) ? "IDX " : "", + (res->status & 0x01) ? "ERR" : ""); + if (res->status & 1) { + sbuf_printf(sb, "error: %02x (%s%s%s%s%s%s%s%s), ", + res->error, + (res->error & 0x80) ? "ICRC " : "", + (res->error & 0x40) ? "UNC " : "", + (res->error & 0x20) ? "MC " : "", + (res->error & 0x10) ? "IDNF " : "", + (res->error & 0x08) ? "MCR " : "", + (res->error & 0x04) ? "ABRT " : "", + (res->error & 0x02) ? "NM " : "", + (res->error & 0x01) ? "ILI" : ""); + } + + if (res->flags & SSD_DESC_ATA_FLAG_EXTEND) { + sbuf_printf(sb, "count: %02x%02x, ", + res->count_15_8, res->count_7_0); + sbuf_printf(sb, "LBA: %02x%02x%02x%02x%02x%02x, ", + res->lba_47_40, res->lba_39_32, res->lba_31_24, + res->lba_23_16, res->lba_15_8, res->lba_7_0); + } else { + sbuf_printf(sb, "count: %02x, ", res->count_7_0); + sbuf_printf(sb, "LBA: %02x%02x%02x, ", + res->lba_23_16, res->lba_15_8, res->lba_7_0); + } + sbuf_printf(sb, "device: %02x, ", res->device); +} + /* * Generic sense descriptor printing routine. This is used when we have * not yet implemented a specific printing routine for this descriptor. @@ -4698,6 +4745,7 @@ struct scsi_sense_desc_printer { {SSD_DESC_FRU, scsi_sense_fru_sbuf}, {SSD_DESC_STREAM, scsi_sense_stream_sbuf}, {SSD_DESC_BLOCK, scsi_sense_block_sbuf}, + {SSD_DESC_ATA, scsi_sense_ata_sbuf}, {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf} }; Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu Sep 8 10:10:05 2016 (r305590) +++ head/sys/cam/scsi/scsi_all.h Thu Sep 8 12:00:02 2016 (r305591) @@ -3682,6 +3682,10 @@ void scsi_sense_progress_sbuf(struct sbu u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, struct scsi_sense_desc_header *header); +void scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header); void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, From owner-svn-src-head@freebsd.org Thu Sep 8 12:01: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 393B3BD1B0D; Thu, 8 Sep 2016 12:01:30 +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 10BA7ADF; Thu, 8 Sep 2016 12:01: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 u88C1Tj2013853; Thu, 8 Sep 2016 12:01:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C1S2p013850; Thu, 8 Sep 2016 12:01:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081201.u88C1S2p013850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305592 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:01:30 -0000 Author: kib Date: Thu Sep 8 12:01:28 2016 New Revision: 305592 URL: https://svnweb.freebsd.org/changeset/base/305592 Log: Partially lift suspension when ffs_reload() finished with cgs and going to re-read inodes. Secondary write initiators, e.g. ufs_inactive(), might need to start a write while owning the vnode lock. Since the suspended state established by /dev/ufssuspend prevents them from entering vn_start_secondary_write(), we get deadlock otherwise. Note that it is arguably not very useful to re-read inodes after /dev/ufssuspend suspension, because the suspension does not block readers, and other threads might read existing files in parallel with suspension owner (for now, only growfs(8)) operations. This effectively means that suspension owner cannot safely modify existing inodes, and then there is no sense in re-reading. But keep the code enabled for now. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_suspend.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Thu Sep 8 12:00:02 2016 (r305591) +++ head/sys/ufs/ffs/ffs_extern.h Thu Sep 8 12:01:28 2016 (r305592) @@ -106,6 +106,9 @@ void ffs_susp_uninitialize(void); #define FFSV_FORCEINSMQ 0x0001 +#define FFSR_FORCE 0x0001 +#define FFSR_UNSUSPEND 0x0002 + extern struct vop_vector ffs_vnodeops1; extern struct vop_vector ffs_fifoops1; extern struct vop_vector ffs_vnodeops2; Modified: head/sys/ufs/ffs/ffs_suspend.c ============================================================================== --- head/sys/ufs/ffs/ffs_suspend.c Thu Sep 8 12:00:02 2016 (r305591) +++ head/sys/ufs/ffs/ffs_suspend.c Thu Sep 8 12:01:28 2016 (r305592) @@ -235,7 +235,7 @@ ffs_susp_dtor(void *data) KASSERT((mp->mnt_kern_flag & MNTK_SUSPEND) != 0, ("MNTK_SUSPEND not set")); - error = ffs_reload(mp, curthread, 1); + error = ffs_reload(mp, curthread, FFSR_FORCE | FFSR_UNSUSPEND); if (error != 0) panic("failed to unsuspend writes on %s", fs->fs_fsmnt); Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Thu Sep 8 12:00:02 2016 (r305591) +++ head/sys/ufs/ffs/ffs_vfsops.c Thu Sep 8 12:01:28 2016 (r305592) @@ -573,11 +573,13 @@ ffs_cmount(struct mntarg *ma, void *data * 2) re-read superblock from disk. * 3) re-read summary information from disk. * 4) invalidate all inactive vnodes. - * 5) invalidate all cached file data. - * 6) re-read inode data for all active vnodes. + * 5) clear MNTK_SUSPEND2 and MNTK_SUSPENDED flags, allowing secondary + * writers, if requested. + * 6) invalidate all cached file data. + * 7) re-read inode data for all active vnodes. */ int -ffs_reload(struct mount *mp, struct thread *td, int force) +ffs_reload(struct mount *mp, struct thread *td, int flags) { struct vnode *vp, *mvp, *devvp; struct inode *ip; @@ -592,7 +594,7 @@ ffs_reload(struct mount *mp, struct thre ump = VFSTOUFS(mp); MNT_ILOCK(mp); - if ((mp->mnt_flag & MNT_RDONLY) == 0 && force == 0) { + if ((mp->mnt_flag & MNT_RDONLY) == 0 && (flags & FFSR_FORCE) == 0) { MNT_IUNLOCK(mp); return (EINVAL); } @@ -682,6 +684,12 @@ ffs_reload(struct mount *mp, struct thre size = fs->fs_ncg * sizeof(u_int8_t); fs->fs_contigdirs = (u_int8_t *)space; bzero(fs->fs_contigdirs, size); + if ((flags & FFSR_UNSUSPEND) != 0) { + MNT_ILOCK(mp); + mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | MNTK_SUSPEND2); + wakeup(&mp->mnt_flag); + MNT_IUNLOCK(mp); + } loop: MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { From owner-svn-src-head@freebsd.org Thu Sep 8 12:04: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 540C5BD1C9F; Thu, 8 Sep 2016 12:04:46 +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 0CD56D9B; Thu, 8 Sep 2016 12:04:45 +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 u88C4jgY016599; Thu, 8 Sep 2016 12:04:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C4jXF016598; Thu, 8 Sep 2016 12:04:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081204.u88C4jXF016598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305593 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:04:46 -0000 Author: kib Date: Thu Sep 8 12:04:45 2016 New Revision: 305593 URL: https://svnweb.freebsd.org/changeset/base/305593 Log: There is no need to upgrade the last dvp lock on lookups for modifying operations. Instead of upgrading, assert that the lock is exclusive. Explain the cause in comments. This effectively reverts r209367. Tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:01:28 2016 (r305592) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:04:45 2016 (r305593) @@ -76,32 +76,6 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C /* true if old FS format...*/ #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) -#ifdef QUOTA -static int -ufs_lookup_upgrade_lock(struct vnode *vp) -{ - int error; - - ASSERT_VOP_LOCKED(vp, __FUNCTION__); - if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) - return (0); - - error = 0; - - /* - * Upgrade vnode lock, since getinoquota() - * requires exclusive lock to modify inode. - */ - vhold(vp); - vn_lock(vp, LK_UPGRADE | LK_RETRY); - VI_LOCK(vp); - if (vp->v_iflag & VI_DOOMED) - error = ENOENT; - vdropl(vp); - return (error); -} -#endif - static int ufs_delete_denied(struct vnode *vdp, struct vnode *tdp, struct ucred *cred, struct thread *td) @@ -259,12 +233,25 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread); bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; -#ifdef QUOTA - if ((nameiop == DELETE || nameiop == RENAME) && (flags & ISLASTCN)) { - error = ufs_lookup_upgrade_lock(vdp); - if (error != 0) - return (error); - } + +#ifdef DEBUG_VFS_LOCKS + /* + * Assert that the directory vnode is locked, and locked + * exclusively for the last component lookup for modifying + * operations. + * + * The directory-modifying operations need to save + * intermediate state in the inode between namei() call and + * actual directory manipulations. See fields in the struct + * inode marked as 'used during directory lookup'. We must + * ensure that upgrade in namei() does not happen, since + * upgrade might need to unlock vdp. If quotas are enabled, + * getinoquota() also requires exclusive lock to modify inode. + */ + ASSERT_VOP_LOCKED(vdp, "ufs_lookup1"); + if ((nameiop == CREATE || nameiop == DELETE || nameiop == RENAME) && + (flags & (LOCKPARENT | ISLASTCN)) == (LOCKPARENT | ISLASTCN)) + ASSERT_VOP_ELOCKED(vdp, "ufs_lookup2"); #endif restart: From owner-svn-src-head@freebsd.org Thu Sep 8 12:05:14 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 E32E6BD1CEF; Thu, 8 Sep 2016 12:05:14 +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 B37DEF04; Thu, 8 Sep 2016 12:05:14 +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 u88C5DRu016668; Thu, 8 Sep 2016 12:05:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C5D78016667; Thu, 8 Sep 2016 12:05:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081205.u88C5D78016667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305594 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:05:15 -0000 Author: kib Date: Thu Sep 8 12:05:13 2016 New Revision: 305594 URL: https://svnweb.freebsd.org/changeset/base/305594 Log: In softdep_prealloc(), return early not only for snapshots, but for the quota files as well. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Sep 8 12:04:45 2016 (r305593) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Sep 8 12:05:13 2016 (r305594) @@ -2997,10 +2997,13 @@ softdep_prealloc(vp, waitok) ("softdep_prealloc called on non-softdep filesystem")); /* * Nothing to do if we are not running journaled soft updates. - * If we currently hold the snapshot lock, we must avoid handling - * other resources that could cause deadlock. + * If we currently hold the snapshot lock, we must avoid + * handling other resources that could cause deadlock. Do not + * touch quotas vnode since it is typically recursed with + * other vnode locks held. */ - if (DOINGSUJ(vp) == 0 || IS_SNAPSHOT(VTOI(vp))) + if (DOINGSUJ(vp) == 0 || IS_SNAPSHOT(VTOI(vp)) || + (vp->v_vflag & VV_SYSTEM) != 0) return (0); ump = VFSTOUFS(vp->v_mount); ACQUIRE_LOCK(ump); From owner-svn-src-head@freebsd.org Thu Sep 8 12:06:45 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 1511CBD1D72; Thu, 8 Sep 2016 12:06:45 +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 D4D3D126; Thu, 8 Sep 2016 12:06:44 +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 u88C6iib016759; Thu, 8 Sep 2016 12:06:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C6i8R016758; Thu, 8 Sep 2016 12:06:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081206.u88C6i8R016758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305595 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:06:45 -0000 Author: kib Date: Thu Sep 8 12:06:43 2016 New Revision: 305595 URL: https://svnweb.freebsd.org/changeset/base/305595 Log: In dqsync(), when called from quotactl(), um_quotas entry might appear cleared since nothing prevents completion of the parallel quotaoff. There is nothing to sync in this case, and no reason to panic. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Thu Sep 8 12:05:13 2016 (r305594) +++ head/sys/ufs/ufs/ufs_quota.c Thu Sep 8 12:06:43 2016 (r305595) @@ -1538,8 +1538,13 @@ dqsync(struct vnode *vp, struct dquot *d if ((ump = dq->dq_ump) == NULL) return (0); UFS_LOCK(ump); - if ((dqvp = ump->um_quotas[dq->dq_type]) == NULLVP) - panic("dqsync: file"); + if ((dqvp = ump->um_quotas[dq->dq_type]) == NULLVP) { + if (vp == NULL) { + UFS_UNLOCK(ump); + return (0); + } else + panic("dqsync: file"); + } vref(dqvp); UFS_UNLOCK(ump); From owner-svn-src-head@freebsd.org Thu Sep 8 12:07:26 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 9587EBD1E1A; Thu, 8 Sep 2016 12:07:26 +0000 (UTC) (envelope-from avg@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 65F3A2C5; Thu, 8 Sep 2016 12:07:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88C7PD3016864; Thu, 8 Sep 2016 12:07:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C7P3w016863; Thu, 8 Sep 2016 12:07:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081207.u88C7P3w016863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305596 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 12:07:26 -0000 Author: avg Date: Thu Sep 8 12:07:25 2016 New Revision: 305596 URL: https://svnweb.freebsd.org/changeset/base/305596 Log: intpm.4 update supported hardware list MFC after: 1 week Modified: head/share/man/man4/intpm.4 Modified: head/share/man/man4/intpm.4 ============================================================================== --- head/share/man/man4/intpm.4 Thu Sep 8 12:06:43 2016 (r305595) +++ head/share/man/man4/intpm.4 Thu Sep 8 12:07:25 2016 (r305596) @@ -55,7 +55,11 @@ Intel 82371AB/82443MX .It ATI IXP400 .It -AMD SB600/700/710/750 +AMD SB600/7x0/8x0/9x0 southbridges +.It +AMD Axx/Hudson/Bolton FCHs +.It +AMD FCH integrated into Family 16h Models 00h-0Fh Processors .El .Sh SEE ALSO .Xr amdpm 4 , From owner-svn-src-head@freebsd.org Thu Sep 8 12:07:26 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 B8A57BD1E27; Thu, 8 Sep 2016 12:07:26 +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 883DF2C7; Thu, 8 Sep 2016 12:07:26 +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 u88C7P8G016878; Thu, 8 Sep 2016 12:07:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C7Pwp016874; Thu, 8 Sep 2016 12:07:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081207.u88C7Pwp016874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305597 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:07:26 -0000 Author: kib Date: Thu Sep 8 12:07:25 2016 New Revision: 305597 URL: https://svnweb.freebsd.org/changeset/base/305597 Log: When externding directory inode in ufs_direnter(), adjust i_endoff. This change is formally not needed, since i_endoff not used in all code paths after the call to ufs_direnter(), and i_endoff is recalculated by the next lookup. But having the value correct makes the reasoning about code simpler. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:07:25 2016 (r305596) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:07:25 2016 (r305597) @@ -908,6 +908,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir } dp->i_size = dp->i_offset + DIRBLKSIZ; DIP_SET(dp, i_size, dp->i_size); + dp->i_endoff = dp->i_size; dp->i_flag |= IN_CHANGE | IN_UPDATE; dirp->d_reclen = DIRBLKSIZ; blkoff = dp->i_offset & From owner-svn-src-head@freebsd.org Thu Sep 8 12:08:09 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 4B15EBD1ED8; Thu, 8 Sep 2016 12:08:09 +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 18B60830; Thu, 8 Sep 2016 12:08:09 +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 u88C88TZ016953; Thu, 8 Sep 2016 12:08:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C88Jt016952; Thu, 8 Sep 2016 12:08:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081208.u88C88Jt016952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305598 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:08:09 -0000 Author: kib Date: Thu Sep 8 12:08:08 2016 New Revision: 305598 URL: https://svnweb.freebsd.org/changeset/base/305598 Log: When logging unlikely UFS_TRUNCATE() failure in ufs_direnter(), include error code. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:07:25 2016 (r305597) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 12:08:08 2016 (r305598) @@ -1124,7 +1124,8 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), cr); if (error != 0) - vn_printf(dvp, "ufs_direnter: failed to truncate "); + vn_printf(dvp, "ufs_direnter: failed to truncate " + "err %d", error); #ifdef UFS_DIRHASH if (error == 0 && dp->i_dirhash != NULL) ufsdirhash_dirtrunc(dp, dp->i_endoff); From owner-svn-src-head@freebsd.org Thu Sep 8 12:08: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 651A9BD1F5D; Thu, 8 Sep 2016 12:08:55 +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 383D29CF; Thu, 8 Sep 2016 12:08:55 +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 u88C8sqn017023; Thu, 8 Sep 2016 12:08:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C8sVB017022; Thu, 8 Sep 2016 12:08:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081208.u88C8sVB017022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305599 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:08:55 -0000 Author: kib Date: Thu Sep 8 12:08:54 2016 New Revision: 305599 URL: https://svnweb.freebsd.org/changeset/base/305599 Log: Do not leak transient ENOLCK error from flush_newblk_dep() loop. The buffer lock is retried on failed LK_SLEEPFAIL attempt, and error from the failed attempt is irrelevant. But since there is path after retry which does not clear error, it is possible to return spurious error from the function. The issue resulted in a spurious failure of softdep_sync_buf(), causing further spurious failure of ffs_sync(). In collaboration with: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Sep 8 12:08:08 2016 (r305598) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Sep 8 12:08:54 2016 (r305599) @@ -12954,6 +12954,7 @@ flush_newblk_dep(vp, mp, lbn) LK_INTERLOCK, BO_LOCKPTR(bo)); if (error == ENOLCK) { ACQUIRE_LOCK(ump); + error = 0; continue; /* Slept, retry */ } if (error != 0) From owner-svn-src-head@freebsd.org Thu Sep 8 12:09:14 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 EE245BD1FB9; Thu, 8 Sep 2016 12:09:14 +0000 (UTC) (envelope-from avg@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 BBF12B43; Thu, 8 Sep 2016 12:09:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88C9DWl017082; Thu, 8 Sep 2016 12:09:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C9DHd017081; Thu, 8 Sep 2016 12:09:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081209.u88C9DHd017081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305600 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 12:09:15 -0000 Author: avg Date: Thu Sep 8 12:09:13 2016 New Revision: 305600 URL: https://svnweb.freebsd.org/changeset/base/305600 Log: amdsbwd.4: update supported hardware list And place it into its own section. MFC after: 1 week Modified: head/share/man/man4/amdsbwd.4 Modified: head/share/man/man4/amdsbwd.4 ============================================================================== --- head/share/man/man4/amdsbwd.4 Thu Sep 8 12:08:54 2016 (r305599) +++ head/share/man/man4/amdsbwd.4 Thu Sep 8 12:09:13 2016 (r305600) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2016 +.Dd September 8, 2016 .Dt AMDSBWD 4 .Os .Sh NAME @@ -51,7 +51,22 @@ The driver provides .Xr watchdog 4 support for the watchdog timers present on -AMD SB600, SB7xx, SB8xx and SB9xx southbridges and Axx FCHs. +the supported chipsets. +.Sh HARDWARE +The +.Nm +driver supports the following chipsets: +.Pp +.Bl -bullet -compact +.It +AMD SB600/7x0/8x0/9x0 southbridges +.It +AMD Axx/Hudson/Bolton FCHs +.It +AMD FCHs integrated into Family 15h Models 60h-6Fh, 70h-7Fh Processors +.It +AMD FCHs integrated into Family 16h Models 00h-0Fh, 30h-3Fh Processors +.El .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdog 8 , From owner-svn-src-head@freebsd.org Thu Sep 8 12:09:35 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 AA6E4BD0041; Thu, 8 Sep 2016 12:09:35 +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 5F600CF5; Thu, 8 Sep 2016 12:09:35 +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 u88C9YPG017138; Thu, 8 Sep 2016 12:09:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88C9YVf017137; Thu, 8 Sep 2016 12:09:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609081209.u88C9YVf017137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Sep 2016 12:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305601 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:09:35 -0000 Author: kib Date: Thu Sep 8 12:09:34 2016 New Revision: 305601 URL: https://svnweb.freebsd.org/changeset/base/305601 Log: On rename, do not perform truncation of dirhash if the vnode truncation failed. Doing so resulted in inconsistent state of the ufs dirhash with regard to the actual directory inode state, and could lead to spurious ENOENT errors for lookups of existing files in production kernels, or assertion failures in the debugging kernels. Change the logic of calling ufsdirhash_dirtrunc() to be same as in ufs_direnter(). Execute UFS_TRUNCATE() first, log error, and only do dirtrunc() if UFS_TRUNCATE() succeeded. Note that the problem was exacerbated by the bug in the flush_newblk_dep() function (see r305599), which caused in the spurios errors from ffs_sync() and then ffs_truncate(). In collaboration with: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Thu Sep 8 12:09:13 2016 (r305600) +++ head/sys/ufs/ufs/ufs_vnops.c Thu Sep 8 12:09:34 2016 (r305601) @@ -1529,11 +1529,21 @@ unlockout: * are no longer needed. */ if (error == 0 && endoff != 0) { + error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, + tcnp->cn_cred); + if (error != 0) + vn_printf(tdvp, "ufs_rename: failed to truncate " + "err %d", error); #ifdef UFS_DIRHASH - if (tdp->i_dirhash != NULL) + else if (tdp->i_dirhash != NULL) ufsdirhash_dirtrunc(tdp, endoff); #endif - UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, tcnp->cn_cred); + /* + * Even if the directory compaction failed, rename was + * succesful. Do not propagate a UFS_TRUNCATE() error + * to the caller. + */ + error = 0; } if (error == 0 && tdp->i_flag & IN_NEEDSYNC) error = VOP_FSYNC(tdvp, MNT_WAIT, td); From owner-svn-src-head@freebsd.org Thu Sep 8 12:12: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 E5BA1BD0262; Thu, 8 Sep 2016 12:12:40 +0000 (UTC) (envelope-from avg@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 B7189189; Thu, 8 Sep 2016 12:12:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88CCdRM020782; Thu, 8 Sep 2016 12:12:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88CCdwV020781; Thu, 8 Sep 2016 12:12:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081212.u88CCdwV020781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305602 - head/sys/dev/intpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:12:41 -0000 Author: avg Date: Thu Sep 8 12:12:39 2016 New Revision: 305602 URL: https://svnweb.freebsd.org/changeset/base/305602 Log: intpm: fix attachment to supported AMD FCHs Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Thu Sep 8 12:09:34 2016 (r305601) +++ head/sys/dev/intpm/intpm.c Thu Sep 8 12:12:39 2016 (r305602) @@ -218,10 +218,12 @@ intsmb_attach(device_t dev) break; #endif case 0x43851002: - case 0x780b1022: if (pci_get_revid(dev) >= 0x40) sc->sb8xx = 1; break; + case 0x780b1022: + sc->sb8xx = 1; + break; } if (sc->sb8xx) { From owner-svn-src-head@freebsd.org Thu Sep 8 12:24:48 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 27049BD07E9; Thu, 8 Sep 2016 12:24:48 +0000 (UTC) (envelope-from avg@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 E8FA4C99; Thu, 8 Sep 2016 12:24:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88COl5x025443; Thu, 8 Sep 2016 12:24:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88COlKQ025442; Thu, 8 Sep 2016 12:24:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081224.u88COlKQ025442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305603 - head/sys/dev/intpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:24:48 -0000 Author: avg Date: Thu Sep 8 12:24:46 2016 New Revision: 305603 URL: https://svnweb.freebsd.org/changeset/base/305603 Log: intpm: do not try attaching to unsupported controller revisions While there set a different device description for the controllers found in various FCHs (Hudson, Bolton, CPU integrated). MFC after: 1 week Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Thu Sep 8 12:12:39 2016 (r305602) +++ head/sys/dev/intpm/intpm.c Thu Sep 8 12:24:46 2016 (r305603) @@ -104,9 +104,12 @@ intsmb_probe(device_t dev) device_set_desc(dev, "ATI IXP400 SMBus Controller"); break; case 0x43851002: - case 0x780b1022: /* AMD Hudson */ - device_set_desc(dev, "AMD SB600/7xx/8xx SMBus Controller"); - /* XXX Maybe force polling right here? */ + device_set_desc(dev, "AMD SB600/7xx/8xx/9xx SMBus Controller"); + break; + case 0x780b1022: /* AMD FCH */ + if (pci_get_revid(dev) < 0x40) + return (ENXIO); + device_set_desc(dev, "AMD FCH SMBus Controller"); break; default: return (ENXIO); From owner-svn-src-head@freebsd.org Thu Sep 8 12:27:35 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 6E13EBD08B3; Thu, 8 Sep 2016 12:27:35 +0000 (UTC) (envelope-from avg@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 258A6E97; Thu, 8 Sep 2016 12:27:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88CRYp3025581; Thu, 8 Sep 2016 12:27:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88CRYHN025580; Thu, 8 Sep 2016 12:27:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081227.u88CRYHN025580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305604 - head/sys/dev/intpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:27:35 -0000 Author: avg Date: Thu Sep 8 12:27:34 2016 New Revision: 305604 URL: https://svnweb.freebsd.org/changeset/base/305604 Log: intpm: better clean up resources after a failed attachment bus_generic_detach() fails when called from attach method thus preventing further clean up actions. MFC after: 1 week Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Thu Sep 8 12:24:46 2016 (r305603) +++ head/sys/dev/intpm/intpm.c Thu Sep 8 12:27:34 2016 (r305604) @@ -199,6 +199,23 @@ sb8xx_attach(device_t dev) return (0); } +static void +intsmb_release_resources(device_t dev) +{ + struct intsmb_softc *sc = device_get_softc(dev); + + if (sc->smbus) + device_delete_child(dev, sc->smbus); + if (sc->irq_hand) + bus_teardown_intr(dev, sc->irq_res, sc->irq_hand); + if (sc->irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->io_res) + bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, + sc->io_res); + mtx_destroy(&sc->lock); +} + static int intsmb_attach(device_t dev) { @@ -311,12 +328,15 @@ no_intr: sc->isbusy = 0; sc->smbus = device_add_child(dev, "smbus", -1); if (sc->smbus == NULL) { + device_printf(dev, "failed to add smbus child\n"); error = ENXIO; goto fail; } error = device_probe_and_attach(sc->smbus); - if (error) + if (error) { + device_printf(dev, "failed to probe+attach smbus child\n"); goto fail; + } #ifdef ENABLE_ALART /* Enable Arart */ @@ -325,30 +345,22 @@ no_intr: return (0); fail: - intsmb_detach(dev); + intsmb_release_resources(dev); return (error); } static int intsmb_detach(device_t dev) { - struct intsmb_softc *sc = device_get_softc(dev); int error; error = bus_generic_detach(dev); - if (error) + if (error) { + device_printf(dev, "bus detach failed\n"); return (error); + } - if (sc->smbus) - device_delete_child(dev, sc->smbus); - if (sc->irq_hand) - bus_teardown_intr(dev, sc->irq_res, sc->irq_hand); - if (sc->irq_res) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); - if (sc->io_res) - bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, - sc->io_res); - mtx_destroy(&sc->lock); + intsmb_release_resources(dev); return (0); } From owner-svn-src-head@freebsd.org Thu Sep 8 12:39:05 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 0C196BD0E9F; Thu, 8 Sep 2016 12:39:05 +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 D145794D; Thu, 8 Sep 2016 12:39:04 +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 u88Cd4Vs029397; Thu, 8 Sep 2016 12:39:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88Cd482029396; Thu, 8 Sep 2016 12:39:04 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609081239.u88Cd482029396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 8 Sep 2016 12:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305605 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 12:39:05 -0000 Author: andrew Date: Thu Sep 8 12:39:03 2016 New Revision: 305605 URL: https://svnweb.freebsd.org/changeset/base/305605 Log: Don't panic when we don't handle a userland exception, not all we may see are currently handled. Obtained from: ABT Systems Ltd MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Sep 8 12:27:34 2016 (r305604) +++ head/sys/arm64/arm64/trap.c Thu Sep 8 12:39:03 2016 (r305605) @@ -401,9 +401,9 @@ do_el0_sync(struct trapframe *frame) userret(td, frame); break; default: - print_registers(frame); - panic("Unknown userland exception %x esr_el1 %lx\n", exception, - esr); + call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr); + userret(td, frame); + break; } } From owner-svn-src-head@freebsd.org Thu Sep 8 12:43: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 C7EE4BD109A; Thu, 8 Sep 2016 12:43:25 +0000 (UTC) (envelope-from avg@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 9884CE23; Thu, 8 Sep 2016 12:43:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88ChOrv033221; Thu, 8 Sep 2016 12:43:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88ChOl1033220; Thu, 8 Sep 2016 12:43:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201609081243.u88ChOl1033220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 8 Sep 2016 12:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305606 - head/sys/dev/intpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:43:25 -0000 Author: avg Date: Thu Sep 8 12:43:24 2016 New Revision: 305606 URL: https://svnweb.freebsd.org/changeset/base/305606 Log: intpm: make sure to register smbus driver before intpm driver Otherwise we can fail to create an smbus child of intpm. MFC after: 1 week Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Thu Sep 8 12:39:03 2016 (r305605) +++ head/sys/dev/intpm/intpm.c Thu Sep 8 12:43:24 2016 (r305606) @@ -924,7 +924,8 @@ static driver_t intsmb_driver = { sizeof(struct intsmb_softc), }; -DRIVER_MODULE(intsmb, pci, intsmb_driver, intsmb_devclass, 0, 0); +DRIVER_MODULE_ORDERED(intsmb, pci, intsmb_driver, intsmb_devclass, 0, 0, + SI_ORDER_ANY); DRIVER_MODULE(smbus, intsmb, smbus_driver, smbus_devclass, 0, 0); MODULE_DEPEND(intsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_VERSION(intsmb, 1); From owner-svn-src-head@freebsd.org Thu Sep 8 12:53:02 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 3C501BD148C; Thu, 8 Sep 2016 12:53:02 +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 0AD30810; Thu, 8 Sep 2016 12:53:01 +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 u88Cr1c8036988; Thu, 8 Sep 2016 12:53:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88Cr18b036987; Thu, 8 Sep 2016 12:53:01 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609081253.u88Cr18b036987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 8 Sep 2016 12:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305607 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 12:53:02 -0000 Author: andrew Date: Thu Sep 8 12:53:01 2016 New Revision: 305607 URL: https://svnweb.freebsd.org/changeset/base/305607 Log: Trap msr/mrs instructions. These are privileged arm64 instructions and shouldn't normally be used. Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Sep 8 12:43:24 2016 (r305606) +++ head/sys/arm64/arm64/trap.c Thu Sep 8 12:53:01 2016 (r305607) @@ -391,6 +391,10 @@ do_el0_sync(struct trapframe *frame) call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr); userret(td, frame); break; + case EXCP_MSR: + call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr); + userret(td, frame); + break; case EXCP_SOFTSTP_EL0: td->td_frame->tf_spsr &= ~PSR_SS; td->td_pcb->pcb_flags &= ~PCB_SINGLE_STEP; From owner-svn-src-head@freebsd.org Thu Sep 8 12:58:35 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 0952DBD160C; Thu, 8 Sep 2016 12:58:35 +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 D078DA9F; Thu, 8 Sep 2016 12:58:34 +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 u88CwYRA037220; Thu, 8 Sep 2016 12:58:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88CwY4N037219; Thu, 8 Sep 2016 12:58:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609081258.u88CwY4N037219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 8 Sep 2016 12:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305608 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 12:58:35 -0000 Author: mav Date: Thu Sep 8 12:58:33 2016 New Revision: 305608 URL: https://svnweb.freebsd.org/changeset/base/305608 Log: "ATA pass through information available" is not an error. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Thu Sep 8 12:53:01 2016 (r305607) +++ head/sys/cam/scsi/scsi_all.c Thu Sep 8 12:58:33 2016 (r305608) @@ -1056,7 +1056,7 @@ static struct asc_table_entry asc_table[ { SST(0x00, 0x1C, SS_RDEF, /* XXX TBD */ "Verify operation in progress") }, /* DT B */ - { SST(0x00, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x00, 0x1D, SS_NOP, "ATA pass through information available") }, /* DT R MAEBKV */ { SST(0x00, 0x1E, SS_RDEF, /* XXX TBD */ From owner-svn-src-head@freebsd.org Thu Sep 8 13:03: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 0BA3DBD18E9; Thu, 8 Sep 2016 13:03:51 +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 CF0CF11C3; Thu, 8 Sep 2016 13:03:50 +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 u88D3o53041034; Thu, 8 Sep 2016 13:03:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88D3of9041033; Thu, 8 Sep 2016 13:03:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609081303.u88D3of9041033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 8 Sep 2016 13:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305609 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 13:03:51 -0000 Author: mav Date: Thu Sep 8 13:03:49 2016 New Revision: 305609 URL: https://svnweb.freebsd.org/changeset/base/305609 Log: "Extended copy information available" is not an error either. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Thu Sep 8 12:58:33 2016 (r305608) +++ head/sys/cam/scsi/scsi_all.c Thu Sep 8 13:03:49 2016 (r305609) @@ -1065,7 +1065,7 @@ static struct asc_table_entry asc_table[ { SST(0x00, 0x1F, SS_RDEF, /* XXX TBD */ "Logical unit transitioning to another power condition") }, /* DT P B */ - { SST(0x00, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x00, 0x20, SS_NOP, "Extended copy information available") }, /* D */ { SST(0x00, 0x21, SS_RDEF, /* XXX TBD */ From owner-svn-src-head@freebsd.org Thu Sep 8 13:33: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 CE4BDBD1F55; Thu, 8 Sep 2016 13:33:34 +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 9ED611F02; Thu, 8 Sep 2016 13:33:34 +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 u88DXXqT052190; Thu, 8 Sep 2016 13:33:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88DXXL0052189; Thu, 8 Sep 2016 13:33:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609081333.u88DXXL0052189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 8 Sep 2016 13:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305610 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 13:33:34 -0000 Author: mav Date: Thu Sep 8 13:33:33 2016 New Revision: 305610 URL: https://svnweb.freebsd.org/changeset/base/305610 Log: Don't report to devd statuses that CAM doesn't consider errors. Some statuses, such as "ATA pass through information available", are part part of absolutely normal operation and do not worth reporting. MFC after: 2 weeks Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Thu Sep 8 13:03:49 2016 (r305609) +++ head/sys/cam/cam_periph.c Thu Sep 8 13:33:33 2016 (r305610) @@ -1772,7 +1772,7 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Retrying command\n"); } - if (devctl_err) + if (devctl_err && (error != 0 || (action & SSQ_PRINT_SENSE) != 0)) cam_periph_devctl_notify(orig_ccb); if ((action & SSQ_LOST) != 0) { From owner-svn-src-head@freebsd.org Thu Sep 8 14:04:05 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 C4DFFBD0736; Thu, 8 Sep 2016 14:04:05 +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 94FC01CF; Thu, 8 Sep 2016 14:04:05 +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 u88E440V063601; Thu, 8 Sep 2016 14:04:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88E441s063600; Thu, 8 Sep 2016 14:04:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609081404.u88E441s063600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 8 Sep 2016 14:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305611 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 14:04:05 -0000 Author: emaste Date: Thu Sep 8 14:04:04 2016 New Revision: 305611 URL: https://svnweb.freebsd.org/changeset/base/305611 Log: Update capabilities.conf comment getdtablesize is per-process state, not global state Modified: head/sys/kern/capabilities.conf Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Thu Sep 8 13:33:33 2016 (r305610) +++ head/sys/kern/capabilities.conf Thu Sep 8 14:04:04 2016 (r305611) @@ -248,6 +248,10 @@ getdirentries ## Allow querying certain trivial global state. ## getdomainname + +## +## Allow querying certain per-process resource limit state. +## getdtablesize ## From owner-svn-src-head@freebsd.org Thu Sep 8 14:43: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 7B457BD1A40; Thu, 8 Sep 2016 14:43:40 +0000 (UTC) (envelope-from bde@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 56A8E791; Thu, 8 Sep 2016 14:43:40 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88Ehdn2079434; Thu, 8 Sep 2016 14:43:39 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88EhdnL079432; Thu, 8 Sep 2016 14:43:39 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609081443.u88EhdnL079432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 8 Sep 2016 14:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305612 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 14:43:40 -0000 Author: bde Date: Thu Sep 8 14:43:39 2016 New Revision: 305612 URL: https://svnweb.freebsd.org/changeset/base/305612 Log: Fix single-stepping of instructions emulated by vm86. In vm86.c, fix 2 (rarely used) cases where the return code lost the single-step indicator. While here, fix 2 misspellings of PSL_T as PSL_TF (TF is the CPU manufacturer's spelling, but we use T). In trap.c, turn T_PROTFLT and T_STKFLT into T_TRCTRAP if vm86_emulate() asked for this (it does this when the instruction is being traced and was successully emulated). In the kernel case, we used to deliver the trap as SIGTRAP to the process, where it always terminated the process; now we deliver the trap as T_TRCTRAP to kdb, where it normally gives single-stepping. In the user case, the only difference is that we now clear PSL_T and initialize ucode properly. Reviewed by: kib Modified: head/sys/i386/i386/trap.c head/sys/i386/i386/vm86.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Thu Sep 8 14:04:04 2016 (r305611) +++ head/sys/i386/i386/trap.c Thu Sep 8 14:43:39 2016 (r305612) @@ -335,6 +335,7 @@ trap(struct trapframe *frame) goto out; } #endif +user_trctrap_out: frame->tf_eflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -360,6 +361,10 @@ trap(struct trapframe *frame) case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { i = vm86_emulate((struct vm86frame *)frame); + if (i == SIGTRAP) { + type = T_TRCTRAP; + goto user_trctrap_out; + } if (i == 0) goto user; break; @@ -566,6 +571,10 @@ trap(struct trapframe *frame) case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { i = vm86_emulate((struct vm86frame *)frame); + if (i == SIGTRAP) { + type = T_TRCTRAP; + goto kernel_trctrap; + } if (i != 0) /* * returns to original process @@ -654,6 +663,7 @@ trap(struct trapframe *frame) break; case T_TRCTRAP: /* trace trap */ +kernel_trctrap: if (frame->tf_eip == (int)IDTVEC(lcall_syscall)) { /* * We've just entered system mode via the Modified: head/sys/i386/i386/vm86.c ============================================================================== --- head/sys/i386/i386/vm86.c Thu Sep 8 14:04:04 2016 (r305611) +++ head/sys/i386/i386/vm86.c Thu Sep 8 14:43:39 2016 (r305612) @@ -171,7 +171,7 @@ vm86_emulate(vmf) PUSHL((vmf->vmf_eflags & PUSH_MASK) | PSL_IOPL, vmf); vmf->vmf_ip += inc_ip; - return (0); + return (retcode); case POPF: temp_flags = POPL(vmf) & POP_MASK; @@ -185,7 +185,7 @@ vm86_emulate(vmf) } else { vmf->vmf_eflags &= ~PSL_VIF; } - return (0); + return (retcode); } break; @@ -203,7 +203,7 @@ vm86_emulate(vmf) case INTn: break; - /* VME if trying to set PSL_TF, or PSL_I when VIP is set */ + /* VME if trying to set PSL_T, or PSL_I when VIP is set */ case POPF: temp_flags = POP(vmf) & POP_MASK; vmf->vmf_flags = (vmf->vmf_flags & ~POP_MASK) @@ -218,7 +218,7 @@ vm86_emulate(vmf) } return (retcode); - /* VME if trying to set PSL_TF, or PSL_I when VIP is set */ + /* VME if trying to set PSL_T, or PSL_I when VIP is set */ case IRET: vmf->vmf_ip = POP(vmf); vmf->vmf_cs = POP(vmf); From owner-svn-src-head@freebsd.org Thu Sep 8 14:48:47 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 897B8BD1AFB for ; Thu, 8 Sep 2016 14:48:47 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5323BA01 for ; Thu, 8 Sep 2016 14:48:46 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x229.google.com with SMTP id u124so16643068ywg.3 for ; Thu, 08 Sep 2016 07:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=co5inFN0Sc7znysXoKfI3UeDxp0943BTQVxLXhQ0WNs=; b=Q6XuMy+nY73l540mNW95Bjls0vkLRAxiUcUR6D0KewqKmk0uPLAY4KcfgAOn4nUbXV 4ov78V4IafWdd/dFsmKl2ecWFtlZmWcEhjp1b2zwnevKGdw/nofGODdJIqaaMTrOJml5 1jnSKCAvXPKtsCvxktR1j1Wwqb3kqpt2ffnttJJMuQtsVzcwKn0cmMzEhvZGdqAiWbfb uxsTunAyKA6JTx+n1NYJVG/KJFhCl7VKtfxDToACOx7TO5fnQE3OoRmFKCHUTpy5W3ls mGw4b5gNlP1jkf0zRC3p/oCkgzClQoaHFOhJGr8o/lQTz4RSpi/CXgHicc3nt12TNpsY Wo2A== 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:from:date :message-id:subject:to:cc; bh=co5inFN0Sc7znysXoKfI3UeDxp0943BTQVxLXhQ0WNs=; b=Cw7X2AYvwuAVHWK+CY0gL2SnfRNfTz230/Fkh2zyZfLX2BTA0rcR+3VECGN22v5ZAN uvXHBCctt8INBp24bwpsp3Sngi8VMZN3y7G+frbj5tB8EWAdkfF3sprk4x8sC2ufxTpr 1EoGGkyiTg09iNOTsbAn2th6m0iUbDbkg8VPdHXGsfc+oeI88u7uw18/x4izqcyF2ntV kOCml1vwSR4RaSaaVLy+6Trv4cwz3zCTc08HPBPXpBO2LXM6zuR0Mw6tFSa/1nU3suWl tEzPGXWmCPv0cyj7xzb3PlpbIeMPSYaFlXJRcV7kwOSy/bJA5ieGycRLrGsL3sYOkkkZ +P/w== X-Gm-Message-State: AE9vXwPlKqkzKgD1ao0JEcUxIK7fuuAaoqgW519RQHUcbhgM01LJOJyie0Pm9E8KGEpmqnq3VQ4tWbYbLNiPZQ== X-Received: by 10.13.229.1 with SMTP id o1mr3938ywe.95.1473346126006; Thu, 08 Sep 2016 07:48:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.201.71 with HTTP; Thu, 8 Sep 2016 07:48:45 -0700 (PDT) In-Reply-To: <201609081253.u88Cr18b036987@repo.freebsd.org> References: <201609081253.u88Cr18b036987@repo.freebsd.org> From: Ed Schouten Date: Thu, 8 Sep 2016 16:48:45 +0200 Message-ID: Subject: Re: svn commit: r305607 - head/sys/arm64/arm64 To: Andrew Turner Cc: 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.23 Precedence: list List-Id: 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, 08 Sep 2016 14:48:47 -0000 Hi Andrew, 2016-09-08 14:53 GMT+02:00 Andrew Turner : > Trap msr/mrs instructions. These are privileged arm64 instructions and > shouldn't normally be used. It depends on which system register is being used, right? System registers like TPIDR_EL0 are accessed by userspace all the time. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Thu Sep 8 14:50:24 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 D4CB3BD1BC4; Thu, 8 Sep 2016 14:50:24 +0000 (UTC) (envelope-from gabor@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 A6031BB3; Thu, 8 Sep 2016 14:50:24 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88EoNUi079747; Thu, 8 Sep 2016 14:50:23 GMT (envelope-from gabor@FreeBSD.org) Received: (from gabor@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88EoNuf079746; Thu, 8 Sep 2016 14:50:23 GMT (envelope-from gabor@FreeBSD.org) Message-Id: <201609081450.u88EoNuf079746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gabor set sender to gabor@FreeBSD.org using -f From: Gabor Kovesdan Date: Thu, 8 Sep 2016 14:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305613 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 14:50:24 -0000 Author: gabor Date: Thu Sep 8 14:50:23 2016 New Revision: 305613 URL: https://svnweb.freebsd.org/changeset/base/305613 Log: - Fix typo PR: 211245 Submitted by: Christoph Schonweiler MFC after: 5 days Modified: head/usr.bin/sort/sort.1.in Modified: head/usr.bin/sort/sort.1.in ============================================================================== --- head/usr.bin/sort/sort.1.in Thu Sep 8 14:43:39 2016 (r305612) +++ head/usr.bin/sort/sort.1.in Thu Sep 8 14:50:23 2016 (r305613) @@ -133,7 +133,7 @@ also checks that there are no lines with .It Fl s Stable sort. This option maintains the original record order of records that have -and equal key. +an equal key. This is a non-standard feature, but it is widely accepted and used. .It Fl Fl version Print the version and silently exits. From owner-svn-src-head@freebsd.org Thu Sep 8 15:05:48 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 E0D14BD10C8; Thu, 8 Sep 2016 15:05:48 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id B0DE99CE; Thu, 8 Sep 2016 15:05:48 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-143.nat-2.net.cam.ac.uk [131.111.5.143]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 568B9D78FE; Thu, 8 Sep 2016 15:05:17 +0000 (UTC) Date: Thu, 8 Sep 2016 16:05:16 +0100 From: Andrew Turner To: Ed Schouten Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305607 - head/sys/arm64/arm64 Message-ID: <20160908160516.4bfe3045@zapp> In-Reply-To: References: <201609081253.u88Cr18b036987@repo.freebsd.org> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 15:05:49 -0000 On Thu, 8 Sep 2016 16:48:45 +0200 Ed Schouten wrote: > Hi Andrew, > > 2016-09-08 14:53 GMT+02:00 Andrew Turner : > > Trap msr/mrs instructions. These are privileged arm64 > > instructions and shouldn't normally be used. > > It depends on which system register is being used, right? System > registers like TPIDR_EL0 are accessed by userspace all the time. > Correct, the trap is only hit when userspace doesn't have permission to access the register. Andrew From owner-svn-src-head@freebsd.org Thu Sep 8 15:53: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 DC665BD2177; Thu, 8 Sep 2016 15:53:50 +0000 (UTC) (envelope-from vangyzen@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 A4DF5F35; Thu, 8 Sep 2016 15:53:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88Frn3j006305; Thu, 8 Sep 2016 15:53:49 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88Frnnn006304; Thu, 8 Sep 2016 15:53:49 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201609081553.u88Frnnn006304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Thu, 8 Sep 2016 15:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305620 - head/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 15:53:51 -0000 Author: vangyzen Date: Thu Sep 8 15:53:49 2016 New Revision: 305620 URL: https://svnweb.freebsd.org/changeset/base/305620 Log: etcupdate: preserve the metadata of the destination file When using diff3 to perform a three-way merge, etcupdate lost the destination file's metadata. The metadata from the temporary file were used instead. This was unpleasant for rc.d scripts, which require execute permission. Use "cat >" to overwrite the destination file's contents while preserving its metadata. Reviewed by: bapt Sponsored by: Dell Technologies Differential Revision: https://reviews.freebsd.org/D7817 Modified: head/usr.sbin/etcupdate/etcupdate.sh Modified: head/usr.sbin/etcupdate/etcupdate.sh ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.sh Thu Sep 8 15:27:42 2016 (r305619) +++ head/usr.sbin/etcupdate/etcupdate.sh Thu Sep 8 15:53:49 2016 (r305620) @@ -824,7 +824,9 @@ merge_file() if [ -z "$dryrun" ]; then temp=$(mktemp -t etcupdate) diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp} - mv -f ${temp} ${DESTDIR}$1 + # Use "cat >" to preserve metadata. + cat ${temp} > ${DESTDIR}$1 + rm -f ${temp} fi post_install_file $1 echo " M $1" From owner-svn-src-head@freebsd.org Thu Sep 8 17:37: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 581DEBD19AF; Thu, 8 Sep 2016 17:37:15 +0000 (UTC) (envelope-from br@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 3053DF98; Thu, 8 Sep 2016 17:37:15 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88HbEdT044202; Thu, 8 Sep 2016 17:37:14 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88HbD6A044194; Thu, 8 Sep 2016 17:37:13 GMT (envelope-from br@FreeBSD.org) Message-Id: <201609081737.u88HbD6A044194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 8 Sep 2016 17:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305621 - in head/sys/mips: cavium gxemul include mips nlm rmi sibyte X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 17:37:15 -0000 Author: br Date: Thu Sep 8 17:37:13 2016 New Revision: 305621 URL: https://svnweb.freebsd.org/changeset/base/305621 Log: Allow the use of soft-interrupts for sending IPIs. This will be required for SMP support on MIPS Malta platform. Reviewed by: adrian Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D7835 Modified: head/sys/mips/cavium/octeon_mp.c head/sys/mips/gxemul/gxemul_machdep.c head/sys/mips/include/hwfunc.h head/sys/mips/mips/mp_machdep.c head/sys/mips/nlm/xlp_machdep.c head/sys/mips/rmi/xlr_machdep.c head/sys/mips/sibyte/sb_machdep.c head/sys/mips/sibyte/sb_scd.c Modified: head/sys/mips/cavium/octeon_mp.c ============================================================================== --- head/sys/mips/cavium/octeon_mp.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/cavium/octeon_mp.c Thu Sep 8 17:37:13 2016 (r305621) @@ -63,11 +63,19 @@ platform_ipi_clear(void) } int -platform_ipi_intrnum(void) +platform_ipi_hardintr_num(void) { + return (1); } +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + void platform_init_ap(int cpuid) { @@ -93,7 +101,7 @@ platform_init_ap(int cpuid) */ ciu_int_mask = hard_int_mask(0); clock_int_mask = hard_int_mask(5); - ipi_int_mask = hard_int_mask(platform_ipi_intrnum()); + ipi_int_mask = hard_int_mask(platform_ipi_hardintr_num()); set_intr_mask(ciu_int_mask | clock_int_mask | ipi_int_mask); mips_wbflush(); Modified: head/sys/mips/gxemul/gxemul_machdep.c ============================================================================== --- head/sys/mips/gxemul/gxemul_machdep.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/gxemul/gxemul_machdep.c Thu Sep 8 17:37:13 2016 (r305621) @@ -186,11 +186,19 @@ platform_ipi_clear(void) } int -platform_ipi_intrnum(void) +platform_ipi_hardintr_num(void) { + return (GXEMUL_MP_DEV_IPI_INTERRUPT - 2); } +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + struct cpu_group * platform_smp_topo(void) { @@ -206,7 +214,7 @@ platform_init_ap(int cpuid) * Unmask the clock and ipi interrupts. */ clock_int_mask = hard_int_mask(5); - ipi_int_mask = hard_int_mask(platform_ipi_intrnum()); + ipi_int_mask = hard_int_mask(platform_ipi_hardintr_num()); set_intr_mask(ipi_int_mask | clock_int_mask); } Modified: head/sys/mips/include/hwfunc.h ============================================================================== --- head/sys/mips/include/hwfunc.h Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/include/hwfunc.h Thu Sep 8 17:37:13 2016 (r305621) @@ -67,7 +67,8 @@ void platform_init_ap(int processor_id); * This hardware interrupt is used to deliver IPIs exclusively and must * not be used for any other interrupt source. */ -int platform_ipi_intrnum(void); +int platform_ipi_hardintr_num(void); +int platform_ipi_softintr_num(void); /* * Trigger a IPI interrupt on 'cpuid'. Modified: head/sys/mips/mips/mp_machdep.c ============================================================================== --- head/sys/mips/mips/mp_machdep.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/mips/mp_machdep.c Thu Sep 8 17:37:13 2016 (r305621) @@ -345,9 +345,15 @@ release_aps(void *dummy __unused) /* * IPI handler */ - ipi_irq = platform_ipi_intrnum(); - cpu_establish_hardintr("ipi", mips_ipi_handler, NULL, NULL, ipi_irq, - INTR_TYPE_MISC | INTR_EXCL, NULL); + ipi_irq = platform_ipi_hardintr_num(); + if (ipi_irq != -1) { + cpu_establish_hardintr("ipi", mips_ipi_handler, NULL, NULL, + ipi_irq, INTR_TYPE_MISC | INTR_EXCL, NULL); + } else { + ipi_irq = platform_ipi_softintr_num(); + cpu_establish_softintr("ipi", mips_ipi_handler, NULL, NULL, + ipi_irq, INTR_TYPE_MISC | INTR_EXCL, NULL); + } atomic_store_rel_int(&aps_ready, 1); Modified: head/sys/mips/nlm/xlp_machdep.c ============================================================================== --- head/sys/mips/nlm/xlp_machdep.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/nlm/xlp_machdep.c Thu Sep 8 17:37:13 2016 (r305621) @@ -687,18 +687,25 @@ platform_init_ap(int cpuid) } int -platform_ipi_intrnum(void) +platform_ipi_hardintr_num(void) { return (IRQ_IPI); } +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + void platform_ipi_send(int cpuid) { nlm_pic_send_ipi(xlp_pic_base, xlp_cpuid_to_hwtid[cpuid], - platform_ipi_intrnum(), 0); + platform_ipi_hardintr_num(), 0); } void Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/rmi/xlr_machdep.c Thu Sep 8 17:37:13 2016 (r305621) @@ -571,17 +571,24 @@ platform_init_ap(int cpuid) } int -platform_ipi_intrnum(void) +platform_ipi_hardintr_num(void) { return (IRQ_IPI); } +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + void platform_ipi_send(int cpuid) { - pic_send_ipi(xlr_cpuid_to_hwtid[cpuid], platform_ipi_intrnum()); + pic_send_ipi(xlr_cpuid_to_hwtid[cpuid], platform_ipi_hardintr_num()); } void Modified: head/sys/mips/sibyte/sb_machdep.c ============================================================================== --- head/sys/mips/sibyte/sb_machdep.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/sibyte/sb_machdep.c Thu Sep 8 17:37:13 2016 (r305621) @@ -124,7 +124,7 @@ sb_intr_init(int cpuid) * with any other interrupt source. */ if (intsrc == INTSRC_MAILBOX3) { - intrnum = platform_ipi_intrnum(); + intrnum = platform_ipi_hardintr_num(); sb_write_intmap(cpuid, INTSRC_MAILBOX3, intrnum); sb_enable_intsrc(cpuid, INTSRC_MAILBOX3); } @@ -313,12 +313,19 @@ platform_ipi_clear(void) } int -platform_ipi_intrnum(void) +platform_ipi_hardintr_num(void) { return (4); } +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + struct cpu_group * platform_smp_topo(void) { @@ -344,7 +351,7 @@ platform_init_ap(int cpuid) * Unmask the clock and ipi interrupts. */ clock_int_mask = hard_int_mask(5); - ipi_int_mask = hard_int_mask(platform_ipi_intrnum()); + ipi_int_mask = hard_int_mask(platform_ipi_hardintr_num()); set_intr_mask(ipi_int_mask | clock_int_mask); } Modified: head/sys/mips/sibyte/sb_scd.c ============================================================================== --- head/sys/mips/sibyte/sb_scd.c Thu Sep 8 15:53:49 2016 (r305620) +++ head/sys/mips/sibyte/sb_scd.c Thu Sep 8 17:37:13 2016 (r305621) @@ -207,7 +207,7 @@ sb_route_intsrc(int intsrc) * Use a deterministic mapping for the remaining sources. */ #ifdef SMP - KASSERT(platform_ipi_intrnum() == 4, + KASSERT(platform_ipi_hardintr_num() == 4, ("Unexpected interrupt number used for IPI")); intrnum = intsrc % 4; #else From owner-svn-src-head@freebsd.org Thu Sep 8 17:40:41 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 DA03BBD1A79; Thu, 8 Sep 2016 17:40:41 +0000 (UTC) (envelope-from bde@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 9ECDB231; Thu, 8 Sep 2016 17:40:41 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88HeeBH044376; Thu, 8 Sep 2016 17:40:40 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88HeeRK044371; Thu, 8 Sep 2016 17:40:40 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609081740.u88HeeRK044371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 8 Sep 2016 17:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305622 - in head/sys/ufs: ffs ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 17:40:41 -0000 Author: bde Date: Thu Sep 8 17:40:40 2016 New Revision: 305622 URL: https://svnweb.freebsd.org/changeset/base/305622 Log: Sprinkle DOINGASYNC() checks so as to do delayed writes for async mounts in almost all cases instead of in most cases. Don't override DOINGASYNC() by any condition except IO_SYNC. Fix previous sprinking of DOINGASYNC() checks. Don't override IO_SYNC by DOINGASYNC(). In ffs_write() and ffs_extwrite(), there were intentional overrides that just broke O_SYNC of data. In ffs_truncate(), there are 5 calls to ffs_update(), 4 with apparently-unintentional overrides and 1 without; this had no effect due to the main async mount hack descibed below. Fix 1 place in ffs_truncate() where the caller's IO_ASYNC was overridden for the soft updates case too (to do a delayed write instead of a sync write). This is supposed to be the only change that affects anything except async mounts. In ffs_update(), remove the 19 year old efficiency hack of ignoring the waitfor flag for async mounts, so that fsync() almost works for async mounts. All callers are supposed to be fixed to not ask for a sync update unless they are for fsync() or [I]O_SYNC operations. fsync() now almost works for async mounts. It used to sync the data but not the most important metdata (the inode). It still doesn't sync associated directories. This gave 10-20% fewer writes for my makeworld benchmark with async mounted tmp and obj directories from an already small number. Style fixes: - in ffs_balloc.c, remove rotted quadruplicated comments about the simplest part of the DOING*() decisions and rearrange the nearly- quadruplicated code to be more nearly so. - in ufs_vnops.c, use a consistent style with less negative logic and no manual "optimization" of || to | in DOING*() expressions. Reviewed by: kib (previous version) Modified: head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Thu Sep 8 17:37:13 2016 (r305621) +++ head/sys/ufs/ffs/ffs_balloc.c Thu Sep 8 17:40:40 2016 (r305622) @@ -154,6 +154,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t ip->i_flag |= IN_CHANGE | IN_UPDATE; if (flags & IO_SYNC) bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); else bawrite(bp); } @@ -266,14 +268,12 @@ ffs_balloc_ufs1(struct vnode *vp, off_t softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off, newb, 0, fs->fs_bsize, 0, bp); bdwrite(bp); + } else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) { + if (bp->b_bufsize == fs->fs_bsize) + bp->b_flags |= B_CLUSTEROK; + bdwrite(bp); } else { - /* - * Write synchronously so that indirect blocks - * never point at garbage. - */ - if (DOINGASYNC(vp)) - bdwrite(bp); - else if ((error = bwrite(bp)) != 0) + if ((error = bwrite(bp)) != 0) goto fail; } allocib = &dp->di_ib[indirs[0].in_off]; @@ -338,11 +338,11 @@ retry: softdep_setup_allocindir_meta(nbp, ip, bp, indirs[i - 1].in_off, nb); bdwrite(nbp); + } else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) { + if (nbp->b_bufsize == fs->fs_bsize) + nbp->b_flags |= B_CLUSTEROK; + bdwrite(nbp); } else { - /* - * Write synchronously so that indirect blocks - * never point at garbage. - */ if ((error = bwrite(nbp)) != 0) { brelse(bp); goto fail; @@ -854,14 +854,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off, newb, 0, fs->fs_bsize, 0, bp); bdwrite(bp); + } else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) { + if (bp->b_bufsize == fs->fs_bsize) + bp->b_flags |= B_CLUSTEROK; + bdwrite(bp); } else { - /* - * Write synchronously so that indirect blocks - * never point at garbage. - */ - if (DOINGASYNC(vp)) - bdwrite(bp); - else if ((error = bwrite(bp)) != 0) + if ((error = bwrite(bp)) != 0) goto fail; } allocib = &dp->di_ib[indirs[0].in_off]; @@ -927,11 +925,11 @@ retry: softdep_setup_allocindir_meta(nbp, ip, bp, indirs[i - 1].in_off, nb); bdwrite(nbp); + } else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) { + if (nbp->b_bufsize == fs->fs_bsize) + nbp->b_flags |= B_CLUSTEROK; + bdwrite(nbp); } else { - /* - * Write synchronously so that indirect blocks - * never point at garbage. - */ if ((error = bwrite(nbp)) != 0) { brelse(bp); goto fail; Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Thu Sep 8 17:37:13 2016 (r305621) +++ head/sys/ufs/ffs/ffs_inode.c Thu Sep 8 17:40:40 2016 (r305622) @@ -154,7 +154,7 @@ loop: /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */ random_harvest_queue(&(ip->i_din2), sizeof(ip->i_din2), 1, RANDOM_FS_ATIME); } - if (waitfor && !DOINGASYNC(vp)) + if (waitfor) error = bwrite(bp); else if (vm_page_count_severe() || buf_dirty_count_severe()) { bawrite(bp); @@ -193,7 +193,7 @@ ffs_truncate(vp, length, flags, cred) int softdeptrunc, journaltrunc; int needextclean, extblocks; int offset, size, level, nblocks; - int i, error, allerror, indiroff; + int i, error, allerror, indiroff, waitforupdate; off_t osize; ip = VTOI(vp); @@ -221,6 +221,7 @@ ffs_truncate(vp, length, flags, cred) flags |= IO_NORMAL; if (!DOINGSOFTDEP(vp) && !DOINGASYNC(vp)) flags |= IO_SYNC; + waitforupdate = (flags & IO_SYNC) != 0 || !DOINGASYNC(vp); /* * If we are truncating the extended-attributes, and cannot * do it with soft updates, then do it slowly here. If we are @@ -264,7 +265,7 @@ ffs_truncate(vp, length, flags, cred) ip->i_din2->di_extb[i] = 0; } ip->i_flag |= IN_CHANGE; - if ((error = ffs_update(vp, !DOINGASYNC(vp)))) + if ((error = ffs_update(vp, waitforupdate))) return (error); for (i = 0; i < NXADDR; i++) { if (oldblks[i] == 0) @@ -290,7 +291,7 @@ ffs_truncate(vp, length, flags, cred) ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) goto extclean; - return (ffs_update(vp, !DOINGASYNC(vp))); + return (ffs_update(vp, waitforupdate)); } if (ip->i_size == length) { ip->i_flag |= IN_CHANGE | IN_UPDATE; @@ -328,7 +329,7 @@ ffs_truncate(vp, length, flags, cred) else bawrite(bp); ip->i_flag |= IN_CHANGE | IN_UPDATE; - return (ffs_update(vp, !DOINGASYNC(vp))); + return (ffs_update(vp, waitforupdate)); } /* * Lookup block number for a given offset. Zero length files @@ -357,10 +358,10 @@ ffs_truncate(vp, length, flags, cred) */ if (blkno != 0) brelse(bp); - else if (DOINGSOFTDEP(vp) || DOINGASYNC(vp)) - bdwrite(bp); - else + else if (flags & IO_SYNC) bwrite(bp); + else + bdwrite(bp); } /* * If the block number at the new end of the file is zero, @@ -478,7 +479,7 @@ ffs_truncate(vp, length, flags, cred) DIP_SET(ip, i_db[i], 0); } ip->i_flag |= IN_CHANGE | IN_UPDATE; - allerror = ffs_update(vp, !DOINGASYNC(vp)); + allerror = ffs_update(vp, waitforupdate); /* * Having written the new inode to disk, save its new configuration @@ -610,7 +611,7 @@ extclean: softdep_journal_freeblocks(ip, cred, length, IO_EXT); else softdep_setup_freeblocks(ip, length, IO_EXT); - return (ffs_update(vp, (flags & IO_SYNC) != 0 || !DOINGASYNC(vp))); + return (ffs_update(vp, waitforupdate)); } /* Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Thu Sep 8 17:37:13 2016 (r305621) +++ head/sys/ufs/ffs/ffs_vnops.c Thu Sep 8 17:40:40 2016 (r305622) @@ -757,7 +757,7 @@ ffs_write(ap) flags = BA_SEQMAX << BA_SEQSHIFT; else flags = seqcount << BA_SEQSHIFT; - if ((ioflag & IO_SYNC) && !DOINGASYNC(vp)) + if (ioflag & IO_SYNC) flags |= IO_SYNC; flags |= BA_UNMAPPED; @@ -1077,7 +1077,7 @@ ffs_extwrite(struct vnode *vp, struct ui resid = uio->uio_resid; osize = dp->di_extsize; flags = IO_EXT; - if ((ioflag & IO_SYNC) && !DOINGASYNC(vp)) + if (ioflag & IO_SYNC) flags |= IO_SYNC; for (error = 0; uio->uio_resid > 0;) { Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 17:37:13 2016 (r305621) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Sep 8 17:40:40 2016 (r305622) @@ -1237,7 +1237,7 @@ out: } else { if (flags & DOWHITEOUT) error = bwrite(bp); - else if (DOINGASYNC(dvp) && dp->i_count != 0) + else if (DOINGASYNC(dvp)) bdwrite(bp); else error = bwrite(bp); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Thu Sep 8 17:37:13 2016 (r305621) +++ head/sys/ufs/ufs/ufs_vnops.c Thu Sep 8 17:40:40 2016 (r305622) @@ -991,7 +991,7 @@ ufs_link(ap) ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(vp)) softdep_setup_link(VTOI(tdvp), ip); - error = UFS_UPDATE(vp, !(DOINGSOFTDEP(vp) | DOINGASYNC(vp))); + error = UFS_UPDATE(vp, !DOINGSOFTDEP(vp) && !DOINGASYNC(vp)); if (!error) { ufs_makedirentry(ip, cnp, &newdir); error = ufs_direnter(tdvp, vp, &newdir, cnp, NULL, 0); @@ -1335,7 +1335,7 @@ relock: fip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(fvp)) softdep_setup_link(tdp, fip); - error = UFS_UPDATE(fvp, !(DOINGSOFTDEP(fvp) | DOINGASYNC(fvp))); + error = UFS_UPDATE(fvp, !DOINGSOFTDEP(fvp) && !DOINGASYNC(fvp)); if (error) goto bad; @@ -1488,8 +1488,8 @@ relock: tdp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(tdvp)) softdep_setup_dotdot_link(tdp, fip); - error = UFS_UPDATE(tdvp, !(DOINGSOFTDEP(tdvp) | - DOINGASYNC(tdvp))); + error = UFS_UPDATE(tdvp, !DOINGSOFTDEP(tdvp) && + !DOINGASYNC(tdvp)); /* Don't go to bad here as the new link exists. */ if (error) goto unlockout; @@ -1529,8 +1529,8 @@ unlockout: * are no longer needed. */ if (error == 0 && endoff != 0) { - error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, - tcnp->cn_cred); + error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | + (DOINGASYNC(tdvp) ? 0 : IO_SYNC), tcnp->cn_cred); if (error != 0) vn_printf(tdvp, "ufs_rename: failed to truncate " "err %d", error); @@ -1888,7 +1888,7 @@ ufs_mkdir(ap) dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(dvp)) softdep_setup_mkdir(dp, ip); - error = UFS_UPDATE(dvp, !(DOINGSOFTDEP(dvp) | DOINGASYNC(dvp))); + error = UFS_UPDATE(dvp, !DOINGSOFTDEP(dvp) && !DOINGASYNC(dvp)); if (error) goto bad; #ifdef MAC @@ -1945,8 +1945,8 @@ ufs_mkdir(ap) blkoff += DIRBLKSIZ; } } - if ((error = UFS_UPDATE(tvp, !(DOINGSOFTDEP(tvp) | - DOINGASYNC(tvp)))) != 0) { + if ((error = UFS_UPDATE(tvp, !DOINGSOFTDEP(tvp) && + !DOINGASYNC(tvp))) != 0) { (void)bwrite(bp); goto bad; } @@ -2680,7 +2680,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) /* * Make sure inode goes to disk before directory entry. */ - error = UFS_UPDATE(tvp, !(DOINGSOFTDEP(tvp) | DOINGASYNC(tvp))); + error = UFS_UPDATE(tvp, !DOINGSOFTDEP(tvp) && !DOINGASYNC(tvp)); if (error) goto bad; #ifdef MAC From owner-svn-src-head@freebsd.org Thu Sep 8 18:45: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 20DAEBD2A04 for ; Thu, 8 Sep 2016 18:45:32 +0000 (UTC) (envelope-from citrin+bsd@citrin.ru) Received: from hz.citrin.ru (hz.citrin.ru [IPv6:2a01:4f8:d16:10c3::2]) (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 DD064D0C; Thu, 8 Sep 2016 18:45:31 +0000 (UTC) (envelope-from citrin+bsd@citrin.ru) Received: from [192.168.0.144] (c-24-60-168-172.hsd1.ct.comcast.net [24.60.168.172]) (Authenticated sender: citrin@citrin.ru) by hz.citrin.ru (Postfix) with ESMTPSA id 1C09F287AE6; Thu, 8 Sep 2016 18:45:26 +0000 (UTC) Subject: Re: svn commit: r305620 - head/usr.sbin/etcupdate To: svn-src-head@freebsd.org References: <201609081553.u88Frnnn006304@repo.freebsd.org> Cc: Eric van Gyzen From: Anton Yuzhaninov Message-ID: <81fb0474-0b66-465d-ecc4-22d67624741a@citrin.ru> Date: Thu, 8 Sep 2016 14:45:20 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609081553.u88Frnnn006304@repo.freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrin.ru; s=s0; t=1473360327; bh=p1ntOptTaV7zJBt5bwrRDS28+zMvn/kO4JX8rmMwMl8=; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=03COT9RVd5rhvyFgz8E6/EumS9jTZ5mVElTsdf7Q4ou+vXdoOpLkkuegMt2WWzhGIiBG5xseXevPBulFoeWxyCnRuJibXTE2SmYME/AgrgvGUN6F3eq4z2OZpzhUDSbAEgucki98sPYD4Zritwob/97P6L8jUmi4mxcWgQSQy94= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 18:45:32 -0000 On 2016-09-08 11:53, Eric van Gyzen wrote: > if [ -z "$dryrun" ]; then > temp=$(mktemp -t etcupdate) > diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp} > - mv -f ${temp} ${DESTDIR}$1 > + # Use "cat >" to preserve metadata. > + cat ${temp} > ${DESTDIR}$1 > + rm -f ${temp} > fi In previous code file update was atomic if /tmp/ (or TMPDIR) is on root file system. With new code file update is not atomic in any case - if etcupdate will be interrupted for some reason (e. g. unexpected power failure) destination file can be half-written or empty. If destination file is important system config (like /etc/rc.d/netif of /etc/rc.d/sshd) remote access to host will be lost. To keep update atomic and preserve owner/mode something like this can be used: eval $(stat -s ${DESTDIR}$1) # XXX possible security problem install -CS -m ${st_mode} -o ${st_uid} -g ${st_gid} ${temp} ${DESTDIR}$1 rm -f ${temp} But even with install -S race is still possible, because there is no fsync() in install(1). More reliable way to update important files 1. write temp_file in dest dir 2. fsync tepm_file 3. mv temp_file dest_file install -S does only 1 and 3. From owner-svn-src-head@freebsd.org Thu Sep 8 19:17: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 CAF1FBD2EFE for ; Thu, 8 Sep 2016 19:17:52 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x234.google.com (mail-yb0-x234.google.com [IPv6:2607:f8b0:4002: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 8A778A81 for ; Thu, 8 Sep 2016 19:17:52 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x234.google.com with SMTP id g5so20630482yba.2 for ; Thu, 08 Sep 2016 12:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bxUS5zIgq0DVHTvPkjkMtHh9LE5ZysyvhiGRF8gpFU0=; b=iBE/ZG+RkSXHTscoPd+URLOI7bbVx7yuW+Mg7gMSrtICbADVkvZEZWcwCmNA84+/Yr ve2U2KjZarku9IEJCA2BTWzs5VUTOJnMnpCAxOB7UzbgX2Y2qUlnu1NY71ByBczwr73Y bOZsnXYynSOwUN6hjYX+h4R8fufctSbY4tZJAlVbCkzyzGjJBZaTIx+mNki5t7tdF+7k zdj3x51RNaH9Saj3SaCDMvIQhIkDRf8DziZF1eGemPfbITl528m5HGkzRUdk4hKeEUYO MrI9RIBhDaa/jZbiwQPqThxRDieBLrUk7P8RoIg/ie9smwAAS9v89AyJzMIX1aSh86OU PReQ== 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:from:date :message-id:subject:to:cc; bh=bxUS5zIgq0DVHTvPkjkMtHh9LE5ZysyvhiGRF8gpFU0=; b=c54aKsTVz+Eaj2MmDYjtlYeG4vDLiKUXtnSYrip/oXRaoEdMxG4fzGq3uq1ekJJKt3 BxUVA06JMj8NgLi6qxuQIkk1FaPJWBjzNA5D8qpsXcyevoVSjbOR59LE4dwVkFXtUk5g JwdDA+6Xv+/rtOPInO3DN7Jo1A5SWRMjTwYADT/Lom3w6EBJp9ky8xMUn6n5ObpDQyNZ Jzl4MdDfvo8r35IMatiKg76iH7Zj5ORZ9BFDWP8mYvYVnS0tGhwfDPD4n5BZzxtpxOh2 FYYDyVZLkTEn5SoicHhxyoN6ozkgGDjahFfdE3F95ersu3ZgTnh0DryAIu2lBF450wBP /ySA== X-Gm-Message-State: AE9vXwO22lsFxqKauapaU+DMJvUEDaiEmXYgjc4KbvkcxSUTS1reQfUMF/EdfPlWY4LecoSPpNzSoWP1OhDHUQ== X-Received: by 10.37.6.198 with SMTP id 189mr1484959ybg.119.1473362271617; Thu, 08 Sep 2016 12:17:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.201.71 with HTTP; Thu, 8 Sep 2016 12:17:51 -0700 (PDT) In-Reply-To: <20160908160516.4bfe3045@zapp> References: <201609081253.u88Cr18b036987@repo.freebsd.org> <20160908160516.4bfe3045@zapp> From: Ed Schouten Date: Thu, 8 Sep 2016 21:17:51 +0200 Message-ID: Subject: Re: svn commit: r305607 - head/sys/arm64/arm64 To: Andrew Turner Cc: 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.23 Precedence: list List-Id: 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, 08 Sep 2016 19:17:52 -0000 2016-09-08 17:05 GMT+02:00 Andrew Turner : > On Thu, 8 Sep 2016 16:48:45 +0200 > Ed Schouten wrote: >> It depends on which system register is being used, right? System >> registers like TPIDR_EL0 are accessed by userspace all the time. > > Correct, the trap is only hit when userspace doesn't have permission to > access the register. Got it. Thanks for clarifying! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Thu Sep 8 19:42: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 7B8FFBD1810; Thu, 8 Sep 2016 19:42:50 +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 3AF4F975; Thu, 8 Sep 2016 19:42:50 +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 u88Jgn9r093448; Thu, 8 Sep 2016 19:42:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88Jgnif093447; Thu, 8 Sep 2016 19:42:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609081942.u88Jgnif093447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 8 Sep 2016 19:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305624 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 19:42:50 -0000 Author: jhb Date: Thu Sep 8 19:42:49 2016 New Revision: 305624 URL: https://svnweb.freebsd.org/changeset/base/305624 Log: Document PCI_HP and PCI_IOV kernel options and various tunables in pci(4). Describe PCI-related kernel options for HotPlug and SR-IOV support in the pci(4) manual page. While here, add a section describing the various tunables supported by the PCI bus driver as well. Reviewed by: wblock MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7754 Modified: head/share/man/man4/pci.4 Modified: head/share/man/man4/pci.4 ============================================================================== --- head/share/man/man4/pci.4 Thu Sep 8 18:15:36 2016 (r305623) +++ head/share/man/man4/pci.4 Thu Sep 8 19:42:49 2016 (r305624) @@ -24,21 +24,47 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2016 +.Dd September 8, 2016 .Dt PCI 4 .Os .Sh NAME .Nm pci -.Nd generic PCI driver +.Nd generic PCI bus driver .Sh SYNOPSIS +To compile the PCI bus driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent .Cd device pci +.Ed +.Pp +To compile in support for Single Root I/O Virtualization +.Pq SR-IOV : +.Bd -ragged -offset indent +.Cd options PCI_IOV +.Ed +.Pp +To compile in support for native PCI-express HotPlug: +.Bd -ragged -offset indent +.Cd options PCI_HP +.Ed .Sh DESCRIPTION The .Nm -driver provides a way for userland programs to read and write +driver provides support for +.Tn PCI +devices in the kernel and limited access to +.Tn PCI +devices for userland. +.Pp +The +.Nm +driver provides a +.Pa /dev/pci +character device that can be used by userland programs to read and write .Tn PCI configuration registers. -It also provides a way for userland programs to get a list of all +Programs can also use this device to get a list of all .Tn PCI devices, or all .Tn PCI @@ -73,14 +99,13 @@ children when .Tn PCI client drivers are dynamically loaded at runtime. -.Sh KERNEL CONFIGURATION -The -.Nm -device is included in the kernel as described in the SYNOPSIS section. The .Nm -driver cannot be built as a -.Xr kld 4 . +driver also includes support for PCI-PCI bridges, +various platform-specific Host-PCI bridges, +and basic support for +.Tn PCI +VGA adapters. .Sh IOCTLS The following .Xr ioctl 2 @@ -309,6 +334,164 @@ reading registers, above, also apply to .Tn PCI configuration registers. .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel, or stored in +.Xr loader.conf 5 . +The current value of these tunables can be examined at runtime via +.Xr sysctl 8 +nodes of the same name. +Unless otherwise specified, +each of these tunables is a boolean that can be enabled by setting the +tunable to a non-zero value. +.Bl -tag -width indent +.It Va hw.pci.clear_bars Pq Defaults to 0 +Ignore any firmware-assigned memory and I/O port resources. +This forces the +.Tn PCI +bus driver to allocate resource ranges for memory and I/O port resources +from scratch. +.It Va hw.pci.clear_buses Pq Defaults to 0 +Ignore any firmware-assigned bus number registers in PCI-PCI bridges. +This forces the +.Tn PCI +bus driver and PCI-PCI bridge driver to allocate bus numbers for secondary +buses behind PCI-PCI bridges. +.It Va hw.pci.clear_pcib Pq Defaults to 0 +Ignore any firmware-assigned memory and I/O port resource windows in PCI-PCI +bridges. +This forces the PCI-PCI bridge driver to allocate memory and I/O port resources +for resource windows from scratch. +.Pp +By default the PCI-PCI bridge driver will allocate windows that +contain the firmware-assigned resources devices behind the bridge. +In addition, the PCI-PCI bridge driver will suballocate from existing window +regions when possible to satisfy a resource request. +As a result, +both +.Va hw.pci.clear_bars +and +.Va hw.pci.clear_pcib +must be enabled to fully ignore firmware-supplied resource assignments. +.It Va hw.pci.default_vgapci_unit Pq Defaults to -1 +By default, +the first +.Tn PCI +VGA adapter encountered by the system is assumed to be the boot display device. +This tunable can be set to choose a specific VGA adapter by specifying the +unit number of the associated +.Va vgapci Ns Ar X +device. +.It Va hw.pci.do_power_nodriver Pq Defaults to 0 +Place devices into a low power state +.Pq D3 +when a suitable device driver is not found. +Can be set to one of the following values: +.Bl -tag -width indent +.It 3 +Powers down all +.Tn PCI +devices without a device driver. +.It 2 +Powers down most devices without a device driver. +PCI devices with the display, memory, and base peripheral device classes +are not powered down. +.It 1 +Similar to a setting of 2 except that storage controllers are also not +powered down. +.It 0 +All devices are left fully powered. +.El +.Pp +A +.Tn PCI +device must support power management to be powered down. +Placing a device into a low power state may not reduce power consumption. +.It Va hw.pci.do_power_resume Pq Defaults to 1 +Place +.Tn PCI +devices into the fully powered state when resuming either the system or an +individual device. +Setting this to zero is discouraged as the system will not attempt to power +up non-powered PCI devices after a suspend. +.It Va hw.pci.do_power_suspend Pq Defaults to 1 +Place +.Tn PCI +devices into a low power state when suspending either the system or individual +devices. +Normally the D3 state is used as the low power state, +but firmware may override the desired power state during a system suspend. +.It Va hw.pci.enable_ari Pq Defaults to 1 +Enable support for PCI-express Alternative RID Interpretation. +This is often used in conjunction with SR-IOV. +.It Va hw.pci.enable_io_modes Pq Defaults to 1 +Enable memory or I/O port decoding in a PCI device's command register if it has +firmware-assigned memory or I/O port resources. +The firmware +.Pq BIOS +in some systems does not enable memory or I/O port decoding for some devices +even when it has assigned resources to the device. +This enables decoding for such resources during bus probe. +.It Va hw.pci.enable_msi Pq Defaults to 1 +Enable support for Message Signalled Interrupts +.Pq MSI . +MSI interrupts can be disabled by setting this tunable to 0. +.It Va hw.pci.enable_msix Pq Defaults to 1 +Enable support for extended Message Signalled Interrupts +.Pq MSI-X . +MSI-X interrupts can be disabled by setting this tunable to 0. +.It Va hw.pci.enable_pcie_hp Pq Defaults to 1 +Enable support for native PCI-express HotPlug. +.It Va hw.pci.honor_msi_blacklist Pq Defaults to 1 +MSI and MSI-X interrupts are disabled for certain chipsets known to have +broken MSI and MSI-X implementations when this tunable is set. +It can be set to zero to permit use of MSI and MSI-X interrupts if the +chipset match is a false positive. +.It Va hw.pci.iov_max_config Pq Defaults to 1MB +The maximum amount of memory permitted for the configuration parameters +used when creating Virtual Functions via SR-IOV. +This tunable can also be changed at runtime via +.Xr sysctl 8 . +.It Va hw.pci.realloc_bars Pq Defaults to 0 +Attempt to allocate a new resource range during the initial device scan +for any memory or I/O port resources with firmware-assigned ranges that +conflict with another active resource. +.It Va hw.pci.usb_early_takeover Pq Defaults to 1 on Tn amd64 and Tn i386 +Disable legacy device emulation of USB devices during the initial device +scan. +Set this tunable to zero to use USB devices via legacy emulation when +using a custom kernel without USB controller drivers. +.It Va hw.pci...INT

.irq +These tunables can be used to override the interrupt routing for legacy +PCI INTx interrupts. +Unlike other tunables in this list, +these do not have corresponding sysctl nodes. +The tunable name includes the address of the PCI device as well as the +pin of the desired INTx IRQ to override: +.Bl -tag -width indent +.It +The domain +.Pq or segment +of the PCI device in decimal. +.It +The bus address of the PCI device in decimal. +.It +The slot of the PCI device in decimal. +.It

+The interrupt pin of the PCI slot to override. +One of +.Ql A , +.Ql B , +.Ql C , +or +.Ql D . +.El +.Pp +The value of the tunable is the raw IRQ value to use for the INTx interrupt +pin identified by the tunable name. +Mapping of IRQ values to platform interrupt sources is machine dependent. +.El .Sh FILES .Bl -tag -width /dev/pci -compact .It Pa /dev/pci From owner-svn-src-head@freebsd.org Thu Sep 8 19:47: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 902DCBD19BB; Thu, 8 Sep 2016 19:47:58 +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 5E258D99; Thu, 8 Sep 2016 19:47: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 u88Jlvhx093696; Thu, 8 Sep 2016 19:47:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88JlvhF093695; Thu, 8 Sep 2016 19:47:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609081947.u88JlvhF093695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 8 Sep 2016 19:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305625 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 19:47:58 -0000 Author: jhb Date: Thu Sep 8 19:47:57 2016 New Revision: 305625 URL: https://svnweb.freebsd.org/changeset/base/305625 Log: Don't check aq64_minfree which is unsigned for negative values. This fixes a tautological comparison warning. Reviewed by: rwatson Differential Revision: https://reviews.freebsd.org/D7682 Modified: head/sys/security/audit/audit_syscalls.c Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Thu Sep 8 19:42:49 2016 (r305624) +++ head/sys/security/audit/audit_syscalls.c Thu Sep 8 19:47:57 2016 (r305625) @@ -299,12 +299,12 @@ sys_auditon(struct thread *td, struct au case A_OLDSETQCTRL: case A_SETQCTRL: if (uap->length == sizeof(udata.au_qctrl64)) { + /* NB: aq64_minfree is unsigned unlike aq_minfree. */ if ((udata.au_qctrl64.aq64_hiwater > AQ_MAXHIGH) || (udata.au_qctrl64.aq64_lowater >= udata.au_qctrl.aq_hiwater) || (udata.au_qctrl64.aq64_bufsz > AQ_MAXBUFSZ) || - (udata.au_qctrl64.aq64_minfree > 100) || - (udata.au_qctrl64.aq64_minfree < 0)) + (udata.au_qctrl64.aq64_minfree > 100)) return (EINVAL); audit_qctrl.aq_hiwater = (int)udata.au_qctrl64.aq64_hiwater; From owner-svn-src-head@freebsd.org Thu Sep 8 20:01: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 BB4E2BD1C9F; Thu, 8 Sep 2016 20:01:27 +0000 (UTC) (envelope-from oshogbo@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 88EAF825; Thu, 8 Sep 2016 20:01:27 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88K1QB2098711; Thu, 8 Sep 2016 20:01:26 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88K1QYU098501; Thu, 8 Sep 2016 20:01:26 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201609082001.u88K1QYU098501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 8 Sep 2016 20:01:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305626 - in head: lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests lib/libcasper/services/cap_grp lib/libcasper/services/cap_grp/tests lib/libcasper/services/cap_pwd... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 20:01:27 -0000 Author: oshogbo Date: Thu Sep 8 20:01:26 2016 New Revision: 305626 URL: https://svnweb.freebsd.org/changeset/base/305626 Log: Move libcasper tests from regression/capsicum/libcasper/ to lib/libcasper/service/${service_name}/tests. Reviewed by: emaste, ngie Differential Revision: https://reviews.freebsd.org/D7759 Added: head/lib/libcasper/services/cap_dns/tests/ head/lib/libcasper/services/cap_dns/tests/Makefile (contents, props changed) head/lib/libcasper/services/cap_dns/tests/dns_test.c - copied unchanged from r305625, head/tools/regression/capsicum/libcasper/dns.c head/lib/libcasper/services/cap_grp/tests/ head/lib/libcasper/services/cap_grp/tests/Makefile (contents, props changed) head/lib/libcasper/services/cap_grp/tests/grp_test.c - copied unchanged from r305625, head/tools/regression/capsicum/libcasper/grp.c head/lib/libcasper/services/cap_pwd/tests/ head/lib/libcasper/services/cap_pwd/tests/Makefile (contents, props changed) head/lib/libcasper/services/cap_pwd/tests/pwd_test.c - copied unchanged from r305625, head/tools/regression/capsicum/libcasper/pwd.c head/lib/libcasper/services/cap_sysctl/tests/ head/lib/libcasper/services/cap_sysctl/tests/Makefile (contents, props changed) head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c - copied unchanged from r305625, head/tools/regression/capsicum/libcasper/sysctl.c Deleted: head/tools/regression/capsicum/libcasper/ Modified: head/lib/libcasper/services/cap_dns/Makefile head/lib/libcasper/services/cap_grp/Makefile head/lib/libcasper/services/cap_pwd/Makefile head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/Makefile Thu Sep 8 19:47:57 2016 (r305625) +++ head/lib/libcasper/services/cap_dns/Makefile Thu Sep 8 20:01:26 2016 (r305626) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE=libcasper LIB= cap_dns @@ -15,4 +17,8 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/lib/libcasper/services/cap_dns/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_dns/tests/Makefile Thu Sep 8 20:01:26 2016 (r305626) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +TAP_TESTS_C= dns_test + +LIBADD+= casper +LIBADD+= cap_dns +LIBADD+= nv + +WARNS?= 3 + +.include Copied: head/lib/libcasper/services/cap_dns/tests/dns_test.c (from r305625, head/tools/regression/capsicum/libcasper/dns.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_dns/tests/dns_test.c Thu Sep 8 20:01:26 2016 (r305626, copy of r305625, head/tools/regression/capsicum/libcasper/dns.c) @@ -0,0 +1,702 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +static int ntest = 1; + +#define CHECK(expr) do { \ + if ((expr)) \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + else \ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + ntest++; \ +} while (0) +#define CHECKX(expr) do { \ + if ((expr)) { \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + } else { \ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + exit(1); \ + } \ + ntest++; \ +} while (0) + +#define GETHOSTBYNAME 0x01 +#define GETHOSTBYNAME2_AF_INET 0x02 +#define GETHOSTBYNAME2_AF_INET6 0x04 +#define GETHOSTBYADDR_AF_INET 0x08 +#define GETHOSTBYADDR_AF_INET6 0x10 +#define GETADDRINFO_AF_UNSPEC 0x20 +#define GETADDRINFO_AF_INET 0x40 +#define GETADDRINFO_AF_INET6 0x80 + +static bool +addrinfo_compare(struct addrinfo *ai0, struct addrinfo *ai1) +{ + struct addrinfo *at0, *at1; + + if (ai0 == NULL && ai1 == NULL) + return (true); + if (ai0 == NULL || ai1 == NULL) + return (false); + + at0 = ai0; + at1 = ai1; + while (true) { + if ((at0->ai_flags == at1->ai_flags) && + (at0->ai_family == at1->ai_family) && + (at0->ai_socktype == at1->ai_socktype) && + (at0->ai_protocol == at1->ai_protocol) && + (at0->ai_addrlen == at1->ai_addrlen) && + (memcmp(at0->ai_addr, at1->ai_addr, + at0->ai_addrlen) == 0)) { + if (at0->ai_canonname != NULL && + at1->ai_canonname != NULL) { + if (strcmp(at0->ai_canonname, + at1->ai_canonname) != 0) { + return (false); + } + } + + if (at0->ai_canonname == NULL && + at1->ai_canonname != NULL) { + return (false); + } + if (at0->ai_canonname != NULL && + at1->ai_canonname == NULL) { + return (false); + } + + if (at0->ai_next == NULL && at1->ai_next == NULL) + return (true); + if (at0->ai_next == NULL || at1->ai_next == NULL) + return (false); + + at0 = at0->ai_next; + at1 = at1->ai_next; + } else { + return (false); + } + } + + /* NOTREACHED */ + fprintf(stderr, "Dead code reached in addrinfo_compare()\n"); + exit(1); +} + +static bool +hostent_aliases_compare(char **aliases0, char **aliases1) +{ + int i0, i1; + + if (aliases0 == NULL && aliases1 == NULL) + return (true); + if (aliases0 == NULL || aliases1 == NULL) + return (false); + + for (i0 = 0; aliases0[i0] != NULL; i0++) { + for (i1 = 0; aliases1[i1] != NULL; i1++) { + if (strcmp(aliases0[i0], aliases1[i1]) == 0) + break; + } + if (aliases1[i1] == NULL) + return (false); + } + + return (true); +} + +static bool +hostent_addr_list_compare(char **addr_list0, char **addr_list1, int length) +{ + int i0, i1; + + if (addr_list0 == NULL && addr_list1 == NULL) + return (true); + if (addr_list0 == NULL || addr_list1 == NULL) + return (false); + + for (i0 = 0; addr_list0[i0] != NULL; i0++) { + for (i1 = 0; addr_list1[i1] != NULL; i1++) { + if (memcmp(addr_list0[i0], addr_list1[i1], length) == 0) + break; + } + if (addr_list1[i1] == NULL) + return (false); + } + + return (true); +} + +static bool +hostent_compare(const struct hostent *hp0, const struct hostent *hp1) +{ + + if (hp0 == NULL && hp1 != NULL) + return (true); + + if (hp0 == NULL || hp1 == NULL) + return (false); + + if (hp0->h_name != NULL || hp1->h_name != NULL) { + if (hp0->h_name == NULL || hp1->h_name == NULL) + return (false); + if (strcmp(hp0->h_name, hp1->h_name) != 0) + return (false); + } + + if (!hostent_aliases_compare(hp0->h_aliases, hp1->h_aliases)) + return (false); + if (!hostent_aliases_compare(hp1->h_aliases, hp0->h_aliases)) + return (false); + + if (hp0->h_addrtype != hp1->h_addrtype) + return (false); + + if (hp0->h_length != hp1->h_length) + return (false); + + if (!hostent_addr_list_compare(hp0->h_addr_list, hp1->h_addr_list, + hp0->h_length)) { + return (false); + } + if (!hostent_addr_list_compare(hp1->h_addr_list, hp0->h_addr_list, + hp0->h_length)) { + return (false); + } + + return (true); +} + +static unsigned int +runtest(cap_channel_t *capdns) +{ + unsigned int result; + struct addrinfo *ais, *aic, hints, *hintsp; + struct hostent *hps, *hpc; + struct in_addr ip4; + struct in6_addr ip6; + + result = 0; + + hps = gethostbyname("example.com"); + if (hps == NULL) + fprintf(stderr, "Unable to resolve %s IPv4.\n", "example.com"); + hpc = cap_gethostbyname(capdns, "example.com"); + if (hostent_compare(hps, hpc)) + result |= GETHOSTBYNAME; + + hps = gethostbyname2("example.com", AF_INET); + if (hps == NULL) + fprintf(stderr, "Unable to resolve %s IPv4.\n", "example.com"); + hpc = cap_gethostbyname2(capdns, "example.com", AF_INET); + if (hostent_compare(hps, hpc)) + result |= GETHOSTBYNAME2_AF_INET; + + hps = gethostbyname2("example.com", AF_INET6); + if (hps == NULL) + fprintf(stderr, "Unable to resolve %s IPv6.\n", "example.com"); + hpc = cap_gethostbyname2(capdns, "example.com", AF_INET6); + if (hostent_compare(hps, hpc)) + result |= GETHOSTBYNAME2_AF_INET6; + + hints.ai_flags = 0; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + hints.ai_addrlen = 0; + hints.ai_addr = NULL; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + + hintsp = &hints; + + if (getaddrinfo("freebsd.org", "25", hintsp, &ais) != 0) { + fprintf(stderr, + "Unable to issue [system] getaddrinfo() for AF_UNSPEC: %s\n", + gai_strerror(errno)); + } + if (cap_getaddrinfo(capdns, "freebsd.org", "25", hintsp, &aic) == 0) { + if (addrinfo_compare(ais, aic)) + result |= GETADDRINFO_AF_UNSPEC; + freeaddrinfo(ais); + freeaddrinfo(aic); + } + + hints.ai_family = AF_INET; + if (getaddrinfo("freebsd.org", "25", hintsp, &ais) != 0) { + fprintf(stderr, + "Unable to issue [system] getaddrinfo() for AF_UNSPEC: %s\n", + gai_strerror(errno)); + } + if (cap_getaddrinfo(capdns, "freebsd.org", "25", hintsp, &aic) == 0) { + if (addrinfo_compare(ais, aic)) + result |= GETADDRINFO_AF_INET; + freeaddrinfo(ais); + freeaddrinfo(aic); + } + + hints.ai_family = AF_INET6; + if (getaddrinfo("freebsd.org", "25", hintsp, &ais) != 0) { + fprintf(stderr, + "Unable to issue [system] getaddrinfo() for AF_UNSPEC: %s\n", + gai_strerror(errno)); + } + if (cap_getaddrinfo(capdns, "freebsd.org", "25", hintsp, &aic) == 0) { + if (addrinfo_compare(ais, aic)) + result |= GETADDRINFO_AF_INET6; + freeaddrinfo(ais); + freeaddrinfo(aic); + } + + /* + * 8.8.178.135 is IPv4 address of freefall.freebsd.org + * as of 27 October 2013. + */ + inet_pton(AF_INET, "8.8.178.135", &ip4); + hps = gethostbyaddr(&ip4, sizeof(ip4), AF_INET); + if (hps == NULL) + fprintf(stderr, "Unable to resolve %s.\n", "8.8.178.135"); + hpc = cap_gethostbyaddr(capdns, &ip4, sizeof(ip4), AF_INET); + if (hostent_compare(hps, hpc)) + result |= GETHOSTBYADDR_AF_INET; + + /* + * 2001:1900:2254:206c::16:87 is IPv6 address of freefall.freebsd.org + * as of 27 October 2013. + */ + inet_pton(AF_INET6, "2001:1900:2254:206c::16:87", &ip6); + hps = gethostbyaddr(&ip6, sizeof(ip6), AF_INET6); + if (hps == NULL) { + fprintf(stderr, "Unable to resolve %s.\n", + "2001:1900:2254:206c::16:87"); + } + hpc = cap_gethostbyaddr(capdns, &ip6, sizeof(ip6), AF_INET6); + if (hostent_compare(hps, hpc)) + result |= GETHOSTBYADDR_AF_INET6; + + return (result); +} + +int +main(void) +{ + cap_channel_t *capcas, *capdns, *origcapdns; + const char *types[2]; + int families[2]; + + printf("1..91\n"); + + capcas = cap_init(); + CHECKX(capcas != NULL); + + origcapdns = capdns = cap_service_open(capcas, "system.dns"); + CHECKX(capdns != NULL); + + cap_close(capcas); + + /* No limits set. */ + + CHECK(runtest(capdns) == + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6 | + GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_UNSPEC | GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6)); + + /* + * Allow: + * type: NAME, ADDR + * family: AF_INET, AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + + CHECK(runtest(capdns) == + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6 | + GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6)); + + cap_close(capdns); + + /* + * Allow: + * type: NAME + * family: AF_INET, AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + + CHECK(runtest(capdns) == + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6)); + + cap_close(capdns); + + /* + * Allow: + * type: ADDR + * family: AF_INET, AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + + CHECK(runtest(capdns) == + (GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6)); + + cap_close(capdns); + + /* + * Allow: + * type: NAME, ADDR + * family: AF_INET + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYADDR_AF_INET | + GETADDRINFO_AF_INET)); + + cap_close(capdns); + + /* + * Allow: + * type: NAME, ADDR + * family: AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == + (GETHOSTBYNAME2_AF_INET6 | GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_INET6)); + + cap_close(capdns); + + /* Below we also test further limiting capability. */ + + /* + * Allow: + * type: NAME + * family: AF_INET + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET)); + + cap_close(capdns); + + /* + * Allow: + * type: NAME + * family: AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == GETHOSTBYNAME2_AF_INET6); + + cap_close(capdns); + + /* + * Allow: + * type: ADDR + * family: AF_INET + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET | GETADDRINFO_AF_INET)); + + cap_close(capdns); + + /* + * Allow: + * type: ADDR + * family: AF_INET6 + */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == 0); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == 0); + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + types[1] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + families[1] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_INET6)); + + cap_close(capdns); + + /* Trying to rise the limits. */ + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(cap_dns_type_limit(capdns, NULL, 0) == -1 && + errno == ENOTCAPABLE); + CHECK(cap_dns_family_limit(capdns, NULL, 0) == -1 && + errno == ENOTCAPABLE); + + /* Do the limits still hold? */ + CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET)); + + cap_close(capdns); + + capdns = cap_clone(origcapdns); + CHECK(capdns != NULL); + + types[0] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 1) == 0); + families[0] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 1) == 0); + + types[0] = "NAME"; + types[1] = "ADDR"; + CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + families[1] = AF_INET6; + CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && + errno == ENOTCAPABLE); + + types[0] = "NAME"; + CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && + errno == ENOTCAPABLE); + families[0] = AF_INET; + CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && + errno == ENOTCAPABLE); + + CHECK(cap_dns_type_limit(capdns, NULL, 0) == -1 && + errno == ENOTCAPABLE); + CHECK(cap_dns_family_limit(capdns, NULL, 0) == -1 && + errno == ENOTCAPABLE); + + /* Do the limits still hold? */ + CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET6 | + GETADDRINFO_AF_INET6)); + + cap_close(capdns); + + cap_close(origcapdns); + + exit(0); +} Modified: head/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/Makefile Thu Sep 8 19:47:57 2016 (r305625) +++ head/lib/libcasper/services/cap_grp/Makefile Thu Sep 8 20:01:26 2016 (r305626) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE=libcasper LIB= cap_grp @@ -15,4 +17,8 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/lib/libcasper/services/cap_grp/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_grp/tests/Makefile Thu Sep 8 20:01:26 2016 (r305626) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +TAP_TESTS_C= grp_test + +LIBADD+= casper +LIBADD+= cap_grp +LIBADD+= nv + +WARNS?= 3 + +.include Copied: head/lib/libcasper/services/cap_grp/tests/grp_test.c (from r305625, head/tools/regression/capsicum/libcasper/grp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_grp/tests/grp_test.c Thu Sep 8 20:01:26 2016 (r305626, copy of r305625, head/tools/regression/capsicum/libcasper/grp.c) @@ -0,0 +1,1550 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +static int ntest = 1; + +#define CHECK(expr) do { \ + if ((expr)) \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + else \ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + ntest++; \ +} while (0) +#define CHECKX(expr) do { \ + if ((expr)) { \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + } else { \ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + exit(1); \ + } \ + ntest++; \ +} while (0) + +#define GID_WHEEL 0 +#define GID_OPERATOR 5 + +#define GETGRENT0 0x0001 +#define GETGRENT1 0x0002 +#define GETGRENT2 0x0004 +#define GETGRENT (GETGRENT0 | GETGRENT1 | GETGRENT2) +#define GETGRENT_R0 0x0008 +#define GETGRENT_R1 0x0010 +#define GETGRENT_R2 0x0020 +#define GETGRENT_R (GETGRENT_R0 | GETGRENT_R1 | GETGRENT_R2) +#define GETGRNAM 0x0040 +#define GETGRNAM_R 0x0080 +#define GETGRGID 0x0100 +#define GETGRGID_R 0x0200 +#define SETGRENT 0x0400 + +static bool +group_mem_compare(char **mem0, char **mem1) +{ + int i0, i1; + + if (mem0 == NULL && mem1 == NULL) + return (true); + if (mem0 == NULL || mem1 == NULL) + return (false); + + for (i0 = 0; mem0[i0] != NULL; i0++) { + for (i1 = 0; mem1[i1] != NULL; i1++) { + if (strcmp(mem0[i0], mem1[i1]) == 0) + break; + } + if (mem1[i1] == NULL) + return (false); + } + + return (true); +} + +static bool +group_compare(const struct group *grp0, const struct group *grp1) +{ + + if (grp0 == NULL && grp1 == NULL) + return (true); + if (grp0 == NULL || grp1 == NULL) + return (false); + + if (strcmp(grp0->gr_name, grp1->gr_name) != 0) + return (false); + + if (grp0->gr_passwd != NULL || grp1->gr_passwd != NULL) { + if (grp0->gr_passwd == NULL || grp1->gr_passwd == NULL) + return (false); + if (strcmp(grp0->gr_passwd, grp1->gr_passwd) != 0) + return (false); + } + + if (grp0->gr_gid != grp1->gr_gid) + return (false); + + if (!group_mem_compare(grp0->gr_mem, grp1->gr_mem)) + return (false); + + return (true); +} + +static unsigned int +runtest_cmds(cap_channel_t *capgrp) +{ + char bufs[1024], bufc[1024]; + unsigned int result; + struct group *grps, *grpc; + struct group sts, stc; + + result = 0; + + (void)setgrent(); + if (cap_setgrent(capgrp) == 1) + result |= SETGRENT; + + grps = getgrent(); + grpc = cap_getgrent(capgrp); + if (group_compare(grps, grpc)) { + result |= GETGRENT0; + grps = getgrent(); + grpc = cap_getgrent(capgrp); + if (group_compare(grps, grpc)) + result |= GETGRENT1; + } + + getgrent_r(&sts, bufs, sizeof(bufs), &grps); + cap_getgrent_r(capgrp, &stc, bufc, sizeof(bufc), &grpc); + if (group_compare(grps, grpc)) { + result |= GETGRENT_R0; + getgrent_r(&sts, bufs, sizeof(bufs), &grps); + cap_getgrent_r(capgrp, &stc, bufc, sizeof(bufc), &grpc); + if (group_compare(grps, grpc)) + result |= GETGRENT_R1; + } + + (void)setgrent(); + if (cap_setgrent(capgrp) == 1) + result |= SETGRENT; + + getgrent_r(&sts, bufs, sizeof(bufs), &grps); + cap_getgrent_r(capgrp, &stc, bufc, sizeof(bufc), &grpc); + if (group_compare(grps, grpc)) + result |= GETGRENT_R2; + + grps = getgrent(); + grpc = cap_getgrent(capgrp); + if (group_compare(grps, grpc)) + result |= GETGRENT2; + + grps = getgrnam("wheel"); + grpc = cap_getgrnam(capgrp, "wheel"); + if (group_compare(grps, grpc)) { + grps = getgrnam("operator"); + grpc = cap_getgrnam(capgrp, "operator"); + if (group_compare(grps, grpc)) + result |= GETGRNAM; + } + + getgrnam_r("wheel", &sts, bufs, sizeof(bufs), &grps); + cap_getgrnam_r(capgrp, "wheel", &stc, bufc, sizeof(bufc), &grpc); + if (group_compare(grps, grpc)) { + getgrnam_r("operator", &sts, bufs, sizeof(bufs), &grps); + cap_getgrnam_r(capgrp, "operator", &stc, bufc, sizeof(bufc), + &grpc); + if (group_compare(grps, grpc)) + result |= GETGRNAM_R; + } + + grps = getgrgid(GID_WHEEL); + grpc = cap_getgrgid(capgrp, GID_WHEEL); + if (group_compare(grps, grpc)) { + grps = getgrgid(GID_OPERATOR); + grpc = cap_getgrgid(capgrp, GID_OPERATOR); + if (group_compare(grps, grpc)) + result |= GETGRGID; + } + + getgrgid_r(GID_WHEEL, &sts, bufs, sizeof(bufs), &grps); + cap_getgrgid_r(capgrp, GID_WHEEL, &stc, bufc, sizeof(bufc), &grpc); + if (group_compare(grps, grpc)) { + getgrgid_r(GID_OPERATOR, &sts, bufs, sizeof(bufs), &grps); + cap_getgrgid_r(capgrp, GID_OPERATOR, &stc, bufc, sizeof(bufc), + &grpc); + if (group_compare(grps, grpc)) + result |= GETGRGID_R; + } + + return (result); +} + +static void +test_cmds(cap_channel_t *origcapgrp) +{ + cap_channel_t *capgrp; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Sep 8 21:20:02 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 E96A3BD223A; Thu, 8 Sep 2016 21:20:02 +0000 (UTC) (envelope-from cem@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 C57CA405; Thu, 8 Sep 2016 21:20:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88LK2Me028853; Thu, 8 Sep 2016 21:20:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88LK13f028849; Thu, 8 Sep 2016 21:20:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201609082120.u88LK13f028849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Thu, 8 Sep 2016 21:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305627 - in head: . share/man/man3 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.23 Precedence: list List-Id: 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, 08 Sep 2016 21:20:03 -0000 Author: cem Date: Thu Sep 8 21:20:01 2016 New Revision: 305627 URL: https://svnweb.freebsd.org/changeset/base/305627 Log: queue(3): Enhance queue debugging macros Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and QUEUE_MACRO_DEBUG_TRASH. Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR(). Document these in queue.3. Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3984 Modified: head/UPDATING head/share/man/man3/Makefile head/share/man/man3/queue.3 head/sys/sys/queue.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Sep 8 20:01:26 2016 (r305626) +++ head/UPDATING Thu Sep 8 21:20:01 2016 (r305627) @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160908: + The queue(3) debugging macro, QUEUE_MACRO_DEBUG, has been split into + two separate components, QUEUE_MACRO_DEBUG_TRACE and + QUEUE_MACRO_DEBUG_TRASH. Define both for the original + QUEUE_MACRO_DEBUG behavior. + 20160824: r304787 changed some ioctl interfaces between the iSCSI userspace programs and the kernel. ctladm, ctld, iscsictl, and iscsid must be Modified: head/share/man/man3/Makefile ============================================================================== --- head/share/man/man3/Makefile Thu Sep 8 20:01:26 2016 (r305626) +++ head/share/man/man3/Makefile Thu Sep 8 21:20:01 2016 (r305627) @@ -106,6 +106,7 @@ MLINKS+= queue.3 LIST_CLASS_ENTRY.3 \ queue.3 SLIST_REMOVE.3 \ queue.3 SLIST_REMOVE_AFTER.3 \ queue.3 SLIST_REMOVE_HEAD.3 \ + queue.3 SLIST_REMOVE_PREVPTR.3 \ queue.3 SLIST_SWAP.3 \ queue.3 STAILQ_CLASS_ENTRY.3 \ queue.3 STAILQ_CLASS_HEAD.3 \ Modified: head/share/man/man3/queue.3 ============================================================================== --- head/share/man/man3/queue.3 Thu Sep 8 20:01:26 2016 (r305626) +++ head/share/man/man3/queue.3 Thu Sep 8 21:20:01 2016 (r305627) @@ -28,7 +28,7 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd August 15, 2016 +.Dd September 8, 2016 .Dt QUEUE 3 .Os .Sh NAME @@ -1284,6 +1284,50 @@ while (n1 != NULL) { } TAILQ_INIT(&head); .Ed +.Sh DIAGNOSTICS +When debugging +.Nm queue(3) , +it can be useful to trace queue changes. +To enable tracing, define the macro +.Va QUEUE_MACRO_DEBUG_TRACE +at compile time. +.Pp +It can also be useful to trash pointers that have been unlinked from a queue, +to detect use after removal. +To enable pointer trashing, define the macro +.Va QUEUE_MACRO_DEBUG_TRASH +at compile time. +The macro +.Fn QMD_IS_TRASHED "void *ptr" +returns true if +.Fa ptr +has been trashed by the +.Va QUEUE_MACRO_DEBUG_TRASH +option. +.Pp +In the kernel (with +.Va INVARIANTS +enabled), the +.Fn SLIST_REMOVE_PREVPTR +macro is available to aid debugging: +.Bl -hang -offset indent +.It Fn SLIST_REMOVE_PREVPTR "TYPE **prev" "TYPE *elm" "SLIST_ENTRY NAME" +.Pp +Removes +.Fa elm , +which must directly follow the element whose +.Va &SLIST_NEXT() +is +.Fa prev , +from the SLIST. +This macro validates that +.Fa elm +follows +.Fa prev +in +.Va INVARIANTS +mode. +.El .Sh SEE ALSO .Xr tree 3 .Sh HISTORY Modified: head/sys/sys/queue.h ============================================================================== --- head/sys/sys/queue.h Thu Sep 8 20:01:26 2016 (r305626) +++ head/sys/sys/queue.h Thu Sep 8 21:20:01 2016 (r305627) @@ -113,6 +113,12 @@ * */ #ifdef QUEUE_MACRO_DEBUG +#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH +#define QUEUE_MACRO_DEBUG_TRACE +#define QUEUE_MACRO_DEBUG_TRASH +#endif + +#ifdef QUEUE_MACRO_DEBUG_TRACE /* Store the last 2 places the queue element or head was altered */ struct qm_trace { unsigned long lastline; @@ -123,8 +129,6 @@ struct qm_trace { #define TRACEBUF struct qm_trace trace; #define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } , -#define TRASHIT(x) do {(x) = (void *)-1;} while (0) -#define QMD_SAVELINK(name, link) void **name = (void *)&(link) #define QMD_TRACE_HEAD(head) do { \ (head)->trace.prevline = (head)->trace.lastline; \ @@ -140,14 +144,26 @@ struct qm_trace { (elem)->trace.lastfile = __FILE__; \ } while (0) -#else +#else /* !QUEUE_MACRO_DEBUG_TRACE */ #define QMD_TRACE_ELEM(elem) #define QMD_TRACE_HEAD(head) -#define QMD_SAVELINK(name, link) #define TRACEBUF #define TRACEBUF_INITIALIZER +#endif /* QUEUE_MACRO_DEBUG_TRACE */ + +#ifdef QUEUE_MACRO_DEBUG_TRASH +#define TRASHIT(x) do {(x) = (void *)-1;} while (0) +#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1) +#else /* !QUEUE_MACRO_DEBUG_TRASH */ #define TRASHIT(x) -#endif /* QUEUE_MACRO_DEBUG */ +#define QMD_IS_TRASHED(x) 0 +#endif /* QUEUE_MACRO_DEBUG_TRASH */ + +#if defined(QUEUE_MACRO_DEBUG_TRACE) || defined(QUEUE_MACRO_DEBUG_TRASH) +#define QMD_SAVELINK(name, link) void **name = (void *)&(link) +#else /* !QUEUE_MACRO_DEBUG_TRACE && !QUEUE_MACRO_DEBUG_TRASH */ +#define QMD_SAVELINK(name, link) +#endif /* QUEUE_MACRO_DEBUG_TRACE || QUEUE_MACRO_DEBUG_TRASH */ #ifdef __cplusplus /* @@ -187,6 +203,16 @@ struct { \ /* * Singly-linked List functions. */ +#if (defined(_KERNEL) && defined(INVARIANTS)) +#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \ + if (*(prevp) != (elm)) \ + panic("Bad prevptr *(%p) == %p != %p", \ + (prevp), *(prevp), (elm)); \ +} while (0) +#else +#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) +#endif + #define SLIST_CONCAT(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \ if (curelm == NULL) { \ @@ -268,6 +294,12 @@ struct { \ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ } while (0) +#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \ + QMD_SLIST_CHECK_PREVPTR(prevp, elm); \ + *(prevp) = SLIST_NEXT(elm, field); \ + TRASHIT((elm)->field.sle_next); \ +} while (0) + #define SLIST_SWAP(head1, head2, type) do { \ QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ SLIST_FIRST(head1) = SLIST_FIRST(head2); \ From owner-svn-src-head@freebsd.org Thu Sep 8 21:50:05 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 15EDBBD2BF0; Thu, 8 Sep 2016 21:50:05 +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 AF147BA3; Thu, 8 Sep 2016 21:50:04 +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 u88Lo3Sq040248; Thu, 8 Sep 2016 21:50:03 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88Lo3Ff040246; Thu, 8 Sep 2016 21:50:03 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201609082150.u88Lo3Ff040246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 8 Sep 2016 21:50:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305628 - 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.23 Precedence: list List-Id: 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, 08 Sep 2016 21:50:05 -0000 Author: jilles Date: Thu Sep 8 21:50:03 2016 New Revision: 305628 URL: https://svnweb.freebsd.org/changeset/base/305628 Log: intro(2),_exit(2): Update for reaper (procctl(PROC_REAP_ACQUIRE)). MFC after: 1 week Modified: head/lib/libc/sys/_exit.2 head/lib/libc/sys/intro.2 Modified: head/lib/libc/sys/_exit.2 ============================================================================== --- head/lib/libc/sys/_exit.2 Thu Sep 8 21:20:01 2016 (r305627) +++ head/lib/libc/sys/_exit.2 Thu Sep 8 21:50:03 2016 (r305628) @@ -28,7 +28,7 @@ .\" @(#)_exit.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 8, 2016 .Dt EXIT 2 .Os .Sh NAME @@ -64,9 +64,11 @@ is set as defined by .Xr wait 2 . .It The parent process-ID of all of the calling process's existing child -processes are set to 1; the initialization process +processes are set to the process-ID of the calling process's reaper; +the reaper (normally the initialization process) inherits each of these processes (see +.Xr procctl 2 , .Xr init 8 and the .Sx DEFINITIONS Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Thu Sep 8 21:20:01 2016 (r305627) +++ head/lib/libc/sys/intro.2 Thu Sep 8 21:50:03 2016 (r305628) @@ -28,7 +28,7 @@ .\" @(#)intro.2 8.5 (Berkeley) 2/27/95 .\" $FreeBSD$ .\" -.Dd May 4, 2013 +.Dd September 8, 2016 .Dt INTRO 2 .Os .Sh NAME @@ -484,7 +484,10 @@ A new process is created by a currently .Xr fork 2 ) . The parent process ID of a process is initially the process ID of its creator. If the creating process exits, -the parent process ID of each child is set to the ID of a system process, +the parent process ID of each child is set to the ID of the calling process's +reaper (see +.Xr procctl 2 ) , +normally .Xr init 8 . .It Process Group Each active process is a member of a process group that is identified by @@ -533,7 +536,7 @@ when none of its members has a parent pr as the group, but is in a different process group. Note that when a process exits, the parent process for its children -is changed to be +is normally changed to be .Xr init 8 , which is in a separate session. Not all members of an orphaned process group are necessarily orphaned From owner-svn-src-head@freebsd.org Thu Sep 8 21:59:35 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 9B07ABD2DAF; Thu, 8 Sep 2016 21:59:35 +0000 (UTC) (envelope-from jkim@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 6B8B426D; Thu, 8 Sep 2016 21:59:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88LxYeJ044407; Thu, 8 Sep 2016 21:59:34 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88LxYl5044406; Thu, 8 Sep 2016 21:59:34 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201609082159.u88LxYl5044406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 8 Sep 2016 21:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305629 - head/etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 08 Sep 2016 21:59:35 -0000 Author: jkim Date: Thu Sep 8 21:59:34 2016 New Revision: 305629 URL: https://svnweb.freebsd.org/changeset/base/305629 Log: Add new directories added in r305626 to fix "make installworld". Modified: head/etc/mtree/BSD.tests.dist Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Sep 8 21:50:03 2016 (r305628) +++ head/etc/mtree/BSD.tests.dist Thu Sep 8 21:59:34 2016 (r305629) @@ -308,6 +308,18 @@ ttyio .. .. + libcasper + services + cap_dns + .. + cap_grp + .. + cap_pwd + .. + cap_sysctl + .. + .. + .. libcrypt .. libdevdctl From owner-svn-src-head@freebsd.org Thu Sep 8 22:33: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 47041BD1833; Thu, 8 Sep 2016 22:33:29 +0000 (UTC) (envelope-from oshogbo.vx@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 D25A1E6; Thu, 8 Sep 2016 22:33:28 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id w12so204578wmf.1; Thu, 08 Sep 2016 15:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QBW0Y6jzZAH/ljJPtLFtsGGMZzOsx+fzUoUcl2tYUPA=; b=S2IWBG4t5aUskCH0ND/zfeYqye+Lr5Mrdbp5DhhumP4TvNyeY8oi8iRJEGo30bZaZD Y0CFHizrBjbL5BQJtmG+F8RcNWIOKABBKVD5My30kiSCCw5T+4TFjirS27Qp29u+u9vF oKSASTKSi8BYWV9vN29ZXWGSuJjyX83VN+LRFGZdJHwglg82V7s5PexilfJvc8y/c3tg ZmFnBAIfre/BKpw8XyFbV61FsNBN/pMZ01iFYDe019Aq8YBVL+sUnWfr9RfnUQeRVsJm pi01Xsl/ssbLDSSrbF4Jh8qwe0XDnXVSYEjdsSIuzboXCQhCFtPeJ2DZKkkomZ+DdM74 +XSQ== 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:from :date:message-id:subject:to:cc; bh=QBW0Y6jzZAH/ljJPtLFtsGGMZzOsx+fzUoUcl2tYUPA=; b=NSbiMxdGwTia+pKksBAGkCYGnnlXq8hhlHOkllfxAbUEgnTsIwReEZEbuySwVzTbEu gXKem7NyU6dffdH+Rhcl0J/rh/tBjRGzqaFg5juXgGsXyUZSBhr46+OzO6NzYlff5Y1e GhJu7UuMCEnslnHl5TWBSta/KGNF1DpCzf52AalY4dRcGhcCsI5dQmt91/AkE3CvAID3 lSXQ6le5Pte2cpKu3ZOEGfTou77arrWYAcqz8sAffVZTaIJDa7wF8knxcOGV+t6qy1RE cuPuFcrGx8ujO6kKGkjffOUjKtDEi8ilvTpHf08vz9P/YVjLGpu0rxH9VSU1hu+H1lae 2Upw== X-Gm-Message-State: AE9vXwPpF6wkFL8tkELs+TbgjnG11B0lzC0ky/NPlxRUqaYNa9EiES+G2ls6j0CqV3yiFWAfQ/By4fItmifEpw== X-Received: by 10.28.238.88 with SMTP id m85mr556313wmh.92.1473374007055; Thu, 08 Sep 2016 15:33:27 -0700 (PDT) MIME-Version: 1.0 Sender: oshogbo.vx@gmail.com Received: by 10.28.158.193 with HTTP; Thu, 8 Sep 2016 15:33:26 -0700 (PDT) In-Reply-To: <201609082159.u88LxYl5044406@repo.freebsd.org> References: <201609082159.u88LxYl5044406@repo.freebsd.org> From: Mariusz Zaborski Date: Fri, 9 Sep 2016 00:33:26 +0200 X-Google-Sender-Auth: GHwCq61A2Kr700WPQObTNLsMMUk Message-ID: Subject: Re: svn commit: r305629 - head/etc/mtree To: Jung-uk Kim Cc: 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.23 Precedence: list List-Id: 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, 08 Sep 2016 22:33:29 -0000 Thanks for that! On 8 September 2016 at 23:59, Jung-uk Kim wrote: > Author: jkim > Date: Thu Sep 8 21:59:34 2016 > New Revision: 305629 > URL: https://svnweb.freebsd.org/changeset/base/305629 > > Log: > Add new directories added in r305626 to fix "make installworld". > > Modified: > head/etc/mtree/BSD.tests.dist > > Modified: head/etc/mtree/BSD.tests.dist > ============================================================================== > --- head/etc/mtree/BSD.tests.dist Thu Sep 8 21:50:03 2016 (r305628) > +++ head/etc/mtree/BSD.tests.dist Thu Sep 8 21:59:34 2016 (r305629) > @@ -308,6 +308,18 @@ > ttyio > .. > .. > + libcasper > + services > + cap_dns > + .. > + cap_grp > + .. > + cap_pwd > + .. > + cap_sysctl > + .. > + .. > + .. > libcrypt > .. > libdevdctl > _______________________________________________ > 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 Sep 8 22:38: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 2D76DBD1953; Thu, 8 Sep 2016 22:38:22 +0000 (UTC) (envelope-from brooks@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 05775314; Thu, 8 Sep 2016 22:38:21 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u88McLre059444; Thu, 8 Sep 2016 22:38:21 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u88McKn1059434; Thu, 8 Sep 2016 22:38:20 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201609082238.u88McKn1059434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 8 Sep 2016 22:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305630 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/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.23 Precedence: list List-Id: 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, 08 Sep 2016 22:38:22 -0000 Author: brooks Date: Thu Sep 8 22:38:20 2016 New Revision: 305630 URL: https://svnweb.freebsd.org/changeset/base/305630 Log: Reduce duplicate NOASM and PSEUDO definitions The initial value of NOASM is nearly the same in all cases and the initial value of PSEUDO is the same in all cases so reduce duplication (and hopefully, future merge conflicts) by machine independent defaults. Also document the PSEUDO variable. Reviewed by: jhb, kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D7820 Modified: head/lib/libc/aarch64/sys/Makefile.inc head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/arm/sys/Makefile.inc head/lib/libc/i386/sys/Makefile.inc head/lib/libc/mips/sys/Makefile.inc head/lib/libc/powerpc/sys/Makefile.inc head/lib/libc/powerpc64/sys/Makefile.inc head/lib/libc/riscv/sys/Makefile.inc head/lib/libc/sparc64/sys/Makefile.inc head/lib/libc/sys/Makefile.inc Modified: head/lib/libc/aarch64/sys/Makefile.inc ============================================================================== --- head/lib/libc/aarch64/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/aarch64/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -11,13 +11,5 @@ MDASM= cerror.S \ vfork.S # Don't generate default code for these syscalls: -NOASM= break.o \ - exit.o \ - getlogin.o \ - sbrk.o \ - sstk.o \ - vfork.o \ - yield.o - -PSEUDO= _exit.o \ - _getlogin.o +NOASM+= sbrk.o \ + vfork.o Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/amd64/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -8,6 +8,4 @@ MDASM= vfork.S brk.S cerror.S exect.S ge sbrk.S setlogin.S sigreturn.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o - -PSEUDO= _getlogin.o _exit.o +NOASM+= vfork.o Modified: head/lib/libc/arm/sys/Makefile.inc ============================================================================== --- head/lib/libc/arm/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/arm/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -5,6 +5,4 @@ SRCS+= __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S sbrk.S shmat.S sigreturn.S syscall.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o - -PSEUDO= _exit.o _getlogin.o +NOASM+= vfork.o Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/i386/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -10,10 +10,7 @@ SRCS+= i386_get_fsbase.c i386_get_gsbase MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \ sbrk.S setlogin.S sigreturn.S syscall.S -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o - -PSEUDO= _getlogin.o _exit.o +NOASM+= vfork.o MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 Modified: head/lib/libc/mips/sys/Makefile.inc ============================================================================== --- head/lib/libc/mips/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/mips/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -6,6 +6,4 @@ MDASM= Ovfork.S brk.S cerror.S exect.S sbrk.S syscall.S # Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o - -PSEUDO= _exit.o _getlogin.o +NOASM+= vfork.o Modified: head/lib/libc/powerpc/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/powerpc/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -1,8 +1,3 @@ # $FreeBSD$ MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o yield.o - -PSEUDO= _getlogin.o _exit.o Modified: head/lib/libc/powerpc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc64/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/powerpc64/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -1,8 +1,3 @@ # $FreeBSD$ MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o yield.o - -PSEUDO= _getlogin.o _exit.o Modified: head/lib/libc/riscv/sys/Makefile.inc ============================================================================== --- head/lib/libc/riscv/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/riscv/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -10,13 +10,4 @@ MDASM= cerror.S \ vfork.S # Don't generate default code for these syscalls: -NOASM= break.o \ - exit.o \ - getlogin.o \ - sbrk.o \ - sstk.o \ - vfork.o \ - yield.o - -PSEUDO= _exit.o \ - _getlogin.o +NOASM+= vfork.o Modified: head/lib/libc/sparc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/sparc64/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/sparc64/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -13,8 +13,3 @@ SRCS+= __sparc_sigtramp_setup.c \ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S sigaction1.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o sstk.o yield.o - -PSEUDO= _getlogin.o _exit.o Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Thu Sep 8 21:59:34 2016 (r305629) +++ head/lib/libc/sys/Makefile.inc Thu Sep 8 22:38:20 2016 (r305630) @@ -12,7 +12,18 @@ # # MDASM names override the default syscall names in MIASM. # NOASM will prevent the default syscall code from being generated. +# PSEUDO generates _() and __sys_() symbols, but not (). # +# While historically machine dependent, all archictures have the following +# declerations in common: +# +NOASM= break.o \ + exit.o \ + getlogin.o \ + sstk.o \ + yield.o +PSEUDO= _exit.o \ + _getlogin.o .sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/sys/Makefile.inc" SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c From owner-svn-src-head@freebsd.org Fri Sep 9 01:09: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 70D8FBD2238; Fri, 9 Sep 2016 01:09:42 +0000 (UTC) (envelope-from sjg@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 0B8929A3; Fri, 9 Sep 2016 01:09:41 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8919f3l015934; Fri, 9 Sep 2016 01:09:41 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8919dQk015918; Fri, 9 Sep 2016 01:09:39 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201609090109.u8919dQk015918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 9 Sep 2016 01:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305633 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 01:09:42 -0000 Author: sjg Date: Fri Sep 9 01:09:39 2016 New Revision: 305633 URL: https://svnweb.freebsd.org/changeset/base/305633 Log: Update to bmake-20170818 This version has some new knobs for dealing with troublesome targets in meta mode. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/main.c head/contrib/bmake/make.1 head/contrib/bmake/meta.c head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/lib.mk head/contrib/bmake/mk/meta.sys.mk head/contrib/bmake/mk/prog.mk head/contrib/bmake/os.sh head/contrib/bmake/suff.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/ChangeLog Fri Sep 9 01:09:39 2016 (r305633) @@ -1,3 +1,32 @@ +2016-08-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160818 + its a neater number; pick up whitespace fixes to man page. + +2016-08-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160817 + Merge with NetBSD make, pick up + o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore() + so we can call it before adding entries to missingFiles. + Thus we do not track files we have been told to ignore. + +2016-08-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160815 + Merge with NetBSD make, pick up + o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to + pathnames, and skip if the expansion is empty. + Useful for dirdeps.mk when checking DIRDEPS_CACHE. + +2016-08-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160812 + Merge with NetBSD make, pick up + o meta.c: remove all missingFiles entries that match a deleted + dir. + o main.c: set .ERROR_CMD if possible. + 2016-06-06 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160606 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/Makefile Fri Sep 9 01:09:39 2016 (r305633) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $ +# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160606 +_MAKE_VERSION= 20160818 PROG= bmake Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/bmake.1 Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 wiz Exp $ +.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 2, 2016 +.Dd August 15, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -927,6 +927,9 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -974,7 +977,19 @@ per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/bmake.cat1 Fri Sep 9 01:09:39 2016 (r305633) @@ -604,6 +604,10 @@ VVAARRIIAABBLLEE AASSSSIIGG Provides a list of patterns to match against pathnames. Ignore any that match. + _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R + Provides a list of variable modifiers to apply to each + pathname. Ignore if the expansion is an empty string. + _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -635,9 +639,14 @@ VVAARRIIAABBLLEE AASSSSIIGG becomes `$' per normal evaluation rules. _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R - When bbmmaakkee stops due to an error, it prints its name and - the value of `_._C_U_R_D_I_R' as well as the value of any vari- - ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. + When bbmmaakkee stops due to an error, it sets `_._E_R_R_O_R___T_A_R_G_E_T' + to the name of the target that failed, `_._E_R_R_O_R___C_M_D' to + the commands of the failed target, and in "meta" mode, it + also sets `_._E_R_R_O_R___C_W_D' to the getcwd(3), and + `_._E_R_R_O_R___M_E_T_A___F_I_L_E' to the path of the meta file (if any) + describing the failed target. It then prints its name + and the value of `_._C_U_R_D_I_R' as well as the value of any + variables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. _._n_e_w_l_i_n_e This variable is simply assigned a newline character as its value. This allows expansions using the ::@@ modifier @@ -1489,4 +1498,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 June 2, 2016 NetBSD 5.1 +NetBSD 5.1 August 15, 2016 NetBSD 5.1 Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/main.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $ */ +/* $NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -1903,11 +1903,10 @@ cached_realpath(const char *pathname, ch #endif } - rp = Var_Value(pathname, cache, &cp); - if (rp) { + if ((rp = Var_Value(pathname, cache, &cp)) != NULL) { /* a hit */ strlcpy(resolved, rp, MAXPATHLEN); - } else if ((rp = realpath(pathname, resolved))) { + } else if ((rp = realpath(pathname, resolved)) != NULL) { Var_Set(pathname, rp, cache, 0); } free(cp); @@ -1922,6 +1921,14 @@ PrintAddr(void *a, void *b) } +static int +addErrorCMD(void *cmdp, void *gnp) +{ + if (cmdp == NULL) + return 1; /* stop */ + Var_Append(".ERROR_CMD", cmdp, VAR_GLOBAL); + return 0; +} void PrintOnError(GNode *gn, const char *s) @@ -1942,6 +1949,8 @@ PrintOnError(GNode *gn, const char *s) * We can print this even if there is no .ERROR target. */ Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL, 0); + Var_Delete(".ERROR_CMD", VAR_GLOBAL); + Lst_ForEach(gn->commands, addErrorCMD, gn); } strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}", sizeof(tmp) - 1); Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/make.1 Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 wiz Exp $ +.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 2, 2016 +.Dd August 15, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -938,6 +938,9 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -985,7 +988,19 @@ per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . Modified: head/contrib/bmake/meta.c ============================================================================== --- head/contrib/bmake/meta.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/meta.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.61 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */ /* * Implement 'meta' mode. @@ -69,6 +69,9 @@ static char *metaIgnorePathsStr; /* stri #ifndef MAKE_META_IGNORE_PATTERNS #define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS" #endif +#ifndef MAKE_META_IGNORE_FILTER +#define MAKE_META_IGNORE_FILTER ".MAKE.META.IGNORE_FILTER" +#endif Boolean useMeta = FALSE; static Boolean useFilemon = FALSE; @@ -79,6 +82,7 @@ static Boolean metaEnv = FALSE; /* don' static Boolean metaVerbose = FALSE; static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */ static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */ +static Boolean metaIgnoreFilter = FALSE; /* do we have more complex filtering? */ static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */ static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */ @@ -645,6 +649,11 @@ meta_mode_init(const char *make_mode) metaIgnorePatterns = TRUE; free(cp); } + cp = NULL; + if (Var_Value(MAKE_META_IGNORE_FILTER, VAR_GLOBAL, &cp)) { + metaIgnoreFilter = TRUE; + free(cp); + } } /* @@ -869,6 +878,7 @@ fgetLine(char **bufp, size_t *szp, int o return 0; } +/* Lst_ForEach wants 1 to stop search */ static int prefix_match(void *p, void *q) { @@ -879,6 +889,32 @@ prefix_match(void *p, void *q) return (0 == strncmp(path, prefix, n)); } +/* + * looking for exact or prefix/ match to + * Lst_Find wants 0 to stop search + */ +static int +path_match(const void *p, const void *q) +{ + const char *prefix = q; + const char *path = p; + size_t n = strlen(prefix); + int rc; + + if ((rc = strncmp(path, prefix, n)) == 0) { + switch (path[n]) { + case '\0': + case '/': + break; + default: + rc = 1; + break; + } + } + return rc; +} + +/* Lst_Find wants 0 to stop search */ static int string_match(const void *p, const void *q) { @@ -889,6 +925,67 @@ string_match(const void *p, const void * } +static int +meta_ignore(GNode *gn, const char *p) +{ + char fname[MAXPATHLEN]; + + if (p == NULL) + return TRUE; + + if (*p == '/') { + cached_realpath(p, fname); /* clean it up */ + if (Lst_ForEach(metaIgnorePaths, prefix_match, fname)) { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring path: %s\n", + p); +#endif + return TRUE; + } + } + + if (metaIgnorePatterns) { + char *pm; + + snprintf(fname, sizeof(fname), + "${%s:@m@${%s:L:M$m}@}", + MAKE_META_IGNORE_PATTERNS, p); + pm = Var_Subst(NULL, fname, gn, VARF_WANTRES); + if (*pm) { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n", + p); +#endif + free(pm); + return TRUE; + } + free(pm); + } + + if (metaIgnoreFilter) { + char *fm; + + /* skip if filter result is empty */ + snprintf(fname, sizeof(fname), + "${%s:L:${%s:ts:}}", + p, MAKE_META_IGNORE_FILTER); + fm = Var_Subst(NULL, fname, gn, VARF_WANTRES); + if (*fm == '\0') { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring filtered: %s\n", + p); +#endif + free(fm); + return TRUE; + } + free(fm); + } + return FALSE; +} + /* * When running with 'meta' functionality, a target can be out-of-date * if any of the references in its meta data file is more recent. @@ -1170,12 +1267,19 @@ meta_oodate(GNode *gn, Boolean oodate) /* FALLTHROUGH */ case 'D': /* unlink */ if (*p == '/' && !Lst_IsEmpty(missingFiles)) { - /* remove p from the missingFiles list if present */ - if ((ln = Lst_Find(missingFiles, p, string_match)) != NULL) { - char *tp = Lst_Datum(ln); - Lst_Remove(missingFiles, ln); - free(tp); - ln = NULL; /* we're done with it */ + /* remove any missingFiles entries that match p */ + if ((ln = Lst_Find(missingFiles, p, + path_match)) != NULL) { + LstNode nln; + char *tp; + + do { + nln = Lst_FindFrom(missingFiles, Lst_Succ(ln), + p, path_match); + tp = Lst_Datum(ln); + Lst_Remove(missingFiles, ln); + free(tp); + } while ((ln = nln) != NULL); } } if (buf[0] == 'M') { @@ -1240,8 +1344,10 @@ meta_oodate(GNode *gn, Boolean oodate) if ((link_src != NULL && cached_lstat(p, &fs) < 0) || (link_src == NULL && cached_stat(p, &fs) < 0)) { - if (Lst_Find(missingFiles, p, string_match) == NULL) + if (!meta_ignore(gn, p)) { + if (Lst_Find(missingFiles, p, string_match) == NULL) Lst_AtEnd(missingFiles, bmake_strdup(p)); + } } break; check_link_src: @@ -1259,37 +1365,9 @@ meta_oodate(GNode *gn, Boolean oodate) * be part of the dependencies because * they are _expected_ to change. */ - if (*p == '/') { - cached_realpath(p, fname1); /* clean it up */ - if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) { -#ifdef DEBUG_META_MODE - if (DEBUG(META)) - fprintf(debug_file, "meta_oodate: ignoring path: %s\n", - p); -#endif - break; - } - } - - if (metaIgnorePatterns) { - char *pm; - - snprintf(fname1, sizeof(fname1), - "${%s:@m@${%s:L:M$m}@}", - MAKE_META_IGNORE_PATTERNS, p); - pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES); - if (*pm) { -#ifdef DEBUG_META_MODE - if (DEBUG(META)) - fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n", - p); -#endif - free(pm); - break; - } - free(pm); - } - + if (meta_ignore(gn, p)) + break; + /* * The rest of the record is the file name. * Check if it's not an absolute path. @@ -1547,7 +1625,7 @@ meta_compat_parent(void) while (fgets(buf, sizeof(buf), fp)) { meta_job_output(NULL, buf, ""); printf("%s", buf); - (void)fflush(stdout); + fflush(stdout); } fclose(fp); } Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/ChangeLog Fri Sep 9 01:09:39 2016 (r305633) @@ -1,3 +1,34 @@ +2016-08-15 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160815 + + * dirdeps.mk (.MAKE.META.IGNORE_FILTER): set filter to only + consider Makefile.depend* when checking if DIRDEPS_CACHE is up-to-date. + +2016-08-13 Simon J. Gerraty + + * meta.sys.mk (.MAKE.META.IGNORE_PATHS): + in meta mode we can ignore the mtime of makefiles + +2016-08-02 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160802 + + * lib.mk (libinstall): depends on beforinstall + + * prog.mk (proginstall): depends on beforinstall + patch from Lauri Tirkkonen + + * dirdeps.mk (bootstrap): When bootstrapping; creat + .MAKE.DEPENDFILE_DEFAULT and allow additional filtering via + .MAKE.DEPENDFILE_BOOTSTRAP_SED + + * dirdeps.mk: move some comments to where they make sense. + +2016-07-27 Simon J. Gerraty + + * dirdeps.mk (DIRDEPS_CACHE): no dirname. + 2016-06-02 Simon J. Gerraty * install-mk (MK_VERSION): 20160602 Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/dirdeps.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.67 2016/04/18 21:50:47 sjg Exp $ +# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -116,12 +116,17 @@ _DIRDEP_USE_LEVEL?= 0 .if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL} # only the first instance is interested in all this -# First off, we want to know what ${MACHINE} to build for. -# This can be complicated if we are using a mixture of ${MACHINE} specific -# and non-specific Makefile.depend* - .if !target(_DIRDEP_USE) +# do some setup we only need once +_CURDIR ?= ${.CURDIR} +_OBJDIR ?= ${.OBJDIR} + +now_utc = ${%s:L:gmtime} +.if !defined(start_utc) +start_utc := ${now_utc} +.endif + .if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" # This little trick let's us do # @@ -144,15 +149,6 @@ MK_DIRDEPS_CACHE = no # make sure we get the behavior we expect .MAKE.SAVE_DOLLARS = no -# do some setup we only need once -_CURDIR ?= ${.CURDIR} -_OBJDIR ?= ${.OBJDIR} - -now_utc = ${%s:L:gmtime} -.if !defined(start_utc) -start_utc := ${now_utc} -.endif - # make sure these are empty to start with _DEP_TARGET_SPEC = @@ -223,6 +219,10 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFE .endif # !target(_DIRDEP_USE) +# First off, we want to know what ${MACHINE} to build for. +# This can be complicated if we are using a mixture of ${MACHINE} specific +# and non-specific Makefile.depend* + # if we were included recursively _DEP_TARGET_SPEC should be valid. .if empty(_DEP_TARGET_SPEC) # we may or may not have included a dependfile yet @@ -385,7 +385,7 @@ BUILD_DIRDEPS ?= yes .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -397,6 +397,9 @@ M_oneperline = @x@\\${.newline} $$x@ # we do this via sub-make BUILD_DIRDEPS = no +# ignore anything but these +.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}* + dirdeps: dirdeps-cached dirdeps-cached: ${DIRDEPS_CACHE} .MAKE @echo "${TRACER}Using ${DIRDEPS_CACHE}" @@ -669,7 +672,10 @@ _DEP_RELDIR := ${RELDIR} make(bootstrap-recurse) || \ make(bootstrap-empty)) -.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) +# if we are bootstrapping create the default +_want = ${.CURDIR}/${.MAKE.DEPENDFILE_DEFAULT:T} + +.if exists(${_want}) # stop here ${.TARGETS:Mboot*}: .elif !make(bootstrap-empty) @@ -679,12 +685,19 @@ _src != cd ${.CURDIR} && for m in ${.MAK .error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}Use: bootstrap-empty .endif -_src?= ${.MAKE.DEPENDFILE:T} +_src?= ${.MAKE.DEPENDFILE} + +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN - @echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T} - (cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T}) + @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ + echo You need to build ${RELDIR} to correctly populate it. +.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) +.else + cp ${.CURDIR}/${_src} ${_want} +.endif # create Makefile.depend* for this dir and its dependencies bootstrap: bootstrap-recurse @@ -704,8 +717,8 @@ bootstrap-recurse: .NOTMAIN .MAKE # create an empty Makefile.depend* to get the ball rolling. bootstrap-empty: .NOTMAIN .NOMETA - @echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \ + @echo Creating empty ${RELDIR}/${_want:T}; \ echo You need to build ${RELDIR} to correctly populate it. - @{ echo DIRDEPS=; echo ".include "; } > ${.CURDIR}/${.MAKE.DEPENDFILE:T} + @{ echo DIRDEPS=; echo ".include "; } > ${_want} .endif Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/install-mk Fri Sep 9 01:09:39 2016 (r305633) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.128 2016/06/03 17:22:32 sjg Exp $ +# $Id: install-mk,v 1.130 2016/08/15 19:28:13 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20160602 +MK_VERSION=20160815 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/lib.mk ============================================================================== --- head/contrib/bmake/mk/lib.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/lib.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.53 2016/03/22 20:45:14 sjg Exp $ +# $Id: lib.mk,v 1.54 2016/08/02 20:52:17 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -564,6 +564,7 @@ libinstall: install: maninstall _SUBDIRUSE maninstall: afterinstall afterinstall: realinstall +libinstall: beforeinstall realinstall: beforeinstall .endif Modified: head/contrib/bmake/mk/meta.sys.mk ============================================================================== --- head/contrib/bmake/mk/meta.sys.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/meta.sys.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.28 2016/04/05 15:58:37 sjg Exp $ +# $Id: meta.sys.mk,v 1.29 2016/08/13 17:51:45 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -25,6 +25,10 @@ # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} +.if !defined(SYS_MK_DIR) +SYS_MK_DIR := ${_PARSEDIR} +.endif + META_MODE += meta verbose .MAKE.MODE ?= ${META_MODE} @@ -119,6 +123,15 @@ MKDEP_MK = meta.autodep.mk # re-running needlessly META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}} META_NOPHONY= + +# some targets involve old pre-built targets +# ignore mtime of shell +# and mtime of makefiles does not matter in meta mode +.MAKE.META.IGNORE_PATHS += \ + ${MAKEFILE} \ + ${SHELL} \ + ${SYS_MK_DIR} + .if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" .if ${.MAKEFLAGS:Uno:M-k} != "" # make this more obvious Modified: head/contrib/bmake/mk/prog.mk ============================================================================== --- head/contrib/bmake/mk/prog.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/prog.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: prog.mk,v 1.26 2016/03/22 20:45:14 sjg Exp $ +# $Id: prog.mk,v 1.27 2016/08/02 20:52:17 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -191,6 +191,7 @@ install_links: maninstall: afterinstall afterinstall: realinstall +proginstall: beforeinstall realinstall: beforeinstall .endif Modified: head/contrib/bmake/os.sh ============================================================================== --- head/contrib/bmake/os.sh Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/os.sh Fri Sep 9 01:09:39 2016 (r305633) @@ -17,7 +17,7 @@ # Simon J. Gerraty # RCSid: -# $Id: os.sh,v 1.50 2015/12/17 17:06:29 sjg Exp $ +# $Id: os.sh,v 1.52 2016/06/17 05:15:14 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -139,7 +139,7 @@ SunOS) case $OS in NetBSD) HOST_ARCH=$MACHINE - SHARE_ARCH=$OS/$HOST + SHARE_ARCH=$OS/$HOST_ARCH ;; OpenBSD) arch=`Which arch /usr/bin:/usr/ucb:$PATH` @@ -208,7 +208,8 @@ TMP_DIRS=${TMP_DIRS:-"/tmp /var/tmp"} MACHINE_ARCH=${MACHINE_ARCH:-$MACHINE} HOST_ARCH=${HOST_ARCH:-$MACHINE_ARCH} # we mount server:/share/arch/$SHARE_ARCH as /usr/local -SHARE_ARCH=${SHARE_ARCH:-$OS/$OSMAJOR.X/$HOST_ARCH} +SHARE_ARCH_DEFAULT=$OS/$OSMAJOR.X/$HOST_ARCH +SHARE_ARCH=${SHARE_ARCH:-$SHARE_ARCH_DEFAULT} LN=${LN:-ln} TR=${TR:-tr} Modified: head/contrib/bmake/suff.c ============================================================================== --- head/contrib/bmake/suff.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/suff.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $ */ +/* $NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -__RCSID("$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $"); +__RCSID("$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -766,6 +766,8 @@ Suff_EndTransform(void *gnp, void *dummy { GNode *gn = (GNode *)gnp; + (void)dummy; + if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts)); if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && @@ -809,7 +811,7 @@ Suff_EndTransform(void *gnp, void *dummy fprintf(debug_file, "transformation %s complete\n", gn->name); } - return(dummy ? 0 : 0); + return 0; } /*- @@ -1215,7 +1217,7 @@ SuffAddSrc(void *sp, void *lsp) #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "1 add %x %x to %x:", targ, s2, ls->l); + fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l); Lst_ForEach(ls->l, PrintAddr, NULL); fprintf(debug_file, "\n"); #endif @@ -1233,7 +1235,7 @@ SuffAddSrc(void *sp, void *lsp) #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "2 add %x %x to %x:", targ, s2, ls->l); + fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l); Lst_ForEach(ls->l, PrintAddr, NULL); fprintf(debug_file, "\n"); #endif @@ -1305,14 +1307,14 @@ SuffRemoveSrc(Lst l) free(s->pref); else { #ifdef DEBUG_SRC - LstNode ln = Lst_Member(s->parent->cp, s); - if (ln != NULL) - Lst_Remove(s->parent->cp, ln); + LstNode ln2 = Lst_Member(s->parent->cp, s); + if (ln2 != NULL) + Lst_Remove(s->parent->cp, ln2); #endif --s->parent->children; } #ifdef DEBUG_SRC - fprintf(debug_file, "free: [l=%x] p=%x %d\n", l, s, s->children); + fprintf(debug_file, "free: [l=%p] p=%p %d\n", l, s, s->children); Lst_Destroy(s->cp, NULL); #endif Lst_Remove(l, ln); @@ -1323,7 +1325,7 @@ SuffRemoveSrc(Lst l) } #ifdef DEBUG_SRC else { - fprintf(debug_file, "keep: [l=%x] p=%x %d: ", l, s, s->children); + fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children); Lst_ForEach(s->cp, PrintAddr, NULL); fprintf(debug_file, "\n"); } @@ -1372,7 +1374,7 @@ SuffFindThem(Lst srcs, Lst slst) */ if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) { #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif rs = s; break; @@ -1381,7 +1383,7 @@ SuffFindThem(Lst srcs, Lst slst) if ((ptr = Dir_FindFile(s->file, s->suff->searchPath)) != NULL) { rs = s; #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif free(ptr); break; @@ -1497,7 +1499,7 @@ SuffFindCmds(Src *targ, Lst slst) targ->children += 1; #ifdef DEBUG_SRC ret->cp = Lst_Init(FALSE); - fprintf(debug_file, "3 add %x %x\n", targ, ret); + fprintf(debug_file, "3 add %p %p\n", targ, ret); Lst_AtEnd(targ->cp, ret); #endif Lst_AtEnd(slst, ret); @@ -1616,7 +1618,7 @@ SuffExpandChildren(LstNode cln, GNode *p } free(freeIt); - } else if (*cp == '\\' && *cp != '\0') { + } else if (*cp == '\\' && cp[1] != '\0') { /* * Escaped something -- skip over it */ @@ -2597,8 +2599,10 @@ Suff_End(void) static int SuffPrintName(void *s, void *dummy) { + (void)dummy; + fprintf(debug_file, "%s ", ((Suff *)s)->name); - return (dummy ? 0 : 0); + return 0; } static int @@ -2608,6 +2612,8 @@ SuffPrintSuff(void *sp, void *dummy) int flags; int flag; + (void)dummy; + fprintf(debug_file, "# `%s' [%d] ", s->name, s->refCount); flags = s->flags; @@ -2640,7 +2646,7 @@ SuffPrintSuff(void *sp, void *dummy) fprintf(debug_file, "#\tSearch Path: "); Dir_PrintPath(s->searchPath); fputc('\n', debug_file); - return (dummy ? 0 : 0); + return 0; } static int @@ -2648,12 +2654,14 @@ SuffPrintTrans(void *tp, void *dummy) { GNode *t = (GNode *)tp; + (void)dummy; + fprintf(debug_file, "%-16s: ", t->name); Targ_PrintType(t->type); fputc('\n', debug_file); Lst_ForEach(t->commands, Targ_PrintCmd, NULL); fputc('\n', debug_file); - return(dummy ? 0 : 0); + return 0; } void Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Thu Sep 8 23:49:47 2016 (r305632) +++ head/usr.bin/bmake/Makefile Fri Sep 9 01:09:39 2016 (r305633) @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $ +# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160606 +_MAKE_VERSION= 20160818 PROG?= ${.CURDIR:T} From owner-svn-src-head@freebsd.org Fri Sep 9 01:21: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 A964EBD26E1; Fri, 9 Sep 2016 01:21:36 +0000 (UTC) (envelope-from sjg@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 8046BD8; Fri, 9 Sep 2016 01:21:36 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u891LZPM023158; Fri, 9 Sep 2016 01:21:35 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u891LZOO023156; Fri, 9 Sep 2016 01:21:35 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201609090121.u891LZOO023156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 9 Sep 2016 01:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305634 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 01:21:36 -0000 Author: sjg Date: Fri Sep 9 01:21:35 2016 New Revision: 305634 URL: https://svnweb.freebsd.org/changeset/base/305634 Log: Update to latest dirdeps.mk Take advantage of new bmake feature to only consider Makefile.depend as invalidating DIRDEPS_CACHE. When bootstrapping allow more filtering via .MAKE.DEPENDFILE_BOOTSTRAP_SED Move some comments back to where they make sense. meta.sys.mk: add META_COOKIE_TOUCH and META_NOPHONY to better handle some targets in meta mode vs non-meta mode. Also use .MAKE.META.IGNORE_PATHS to ignore mtime of makefiles - which do not matter in meta mode. Modified: head/share/mk/dirdeps.mk head/share/mk/meta.sys.mk Modified: head/share/mk/dirdeps.mk ============================================================================== --- head/share/mk/dirdeps.mk Fri Sep 9 01:09:39 2016 (r305633) +++ head/share/mk/dirdeps.mk Fri Sep 9 01:21:35 2016 (r305634) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: dirdeps.mk,v 1.62 2016/03/16 00:11:53 sjg Exp $ +# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -117,12 +117,17 @@ _DIRDEP_USE_LEVEL?= 0 .if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL} # only the first instance is interested in all this -# First off, we want to know what ${MACHINE} to build for. -# This can be complicated if we are using a mixture of ${MACHINE} specific -# and non-specific Makefile.depend* - .if !target(_DIRDEP_USE) +# do some setup we only need once +_CURDIR ?= ${.CURDIR} +_OBJDIR ?= ${.OBJDIR} + +now_utc = ${%s:L:gmtime} +.if !defined(start_utc) +start_utc := ${now_utc} +.endif + .if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" # This little trick let's us do # @@ -145,15 +150,6 @@ MK_DIRDEPS_CACHE = no # make sure we get the behavior we expect .MAKE.SAVE_DOLLARS = no -# do some setup we only need once -_CURDIR ?= ${.CURDIR} -_OBJDIR ?= ${.OBJDIR} - -now_utc = ${%s:L:gmtime} -.if !defined(start_utc) -start_utc := ${now_utc} -.endif - # make sure these are empty to start with _DEP_TARGET_SPEC = @@ -224,6 +220,10 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFE .endif # !target(_DIRDEP_USE) +# First off, we want to know what ${MACHINE} to build for. +# This can be complicated if we are using a mixture of ${MACHINE} specific +# and non-specific Makefile.depend* + # if we were included recursively _DEP_TARGET_SPEC should be valid. .if empty(_DEP_TARGET_SPEC) # we may or may not have included a dependfile yet @@ -386,7 +386,7 @@ BUILD_DIRDEPS ?= yes .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -398,6 +398,9 @@ M_oneperline = @x@\\${.newline} $$x@ # we do this via sub-make BUILD_DIRDEPS = no +# ignore anything but these +.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}* + dirdeps: dirdeps-cached dirdeps-cached: ${DIRDEPS_CACHE} .MAKE @echo "${TRACER}Using ${DIRDEPS_CACHE}" @@ -670,7 +673,10 @@ _DEP_RELDIR := ${RELDIR} make(bootstrap-recurse) || \ make(bootstrap-empty)) -.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) +# if we are bootstrapping create the default +_want = ${.CURDIR}/${.MAKE.DEPENDFILE_DEFAULT:T} + +.if exists(${_want}) # stop here ${.TARGETS:Mboot*}: .elif !make(bootstrap-empty) @@ -680,12 +686,19 @@ _src != cd ${.CURDIR} && for m in ${.MAK .error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}Use: bootstrap-empty .endif -_src?= ${.MAKE.DEPENDFILE:T} +_src?= ${.MAKE.DEPENDFILE} + +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN - @echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T} - (cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T}) + @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ + echo You need to build ${RELDIR} to correctly populate it. +.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) +.else + cp ${.CURDIR}/${_src:T} ${_want} +.endif # create Makefile.depend* for this dir and its dependencies bootstrap: bootstrap-recurse @@ -705,8 +718,8 @@ bootstrap-recurse: .NOTMAIN .MAKE # create an empty Makefile.depend* to get the ball rolling. bootstrap-empty: .NOTMAIN .NOMETA - @echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \ + @echo Creating empty ${RELDIR}/${_want:T}; \ echo You need to build ${RELDIR} to correctly populate it. - @{ echo DIRDEPS=; echo ".include "; } > ${.CURDIR}/${.MAKE.DEPENDFILE:T} + @{ echo DIRDEPS=; echo ".include "; } > ${_want} .endif Modified: head/share/mk/meta.sys.mk ============================================================================== --- head/share/mk/meta.sys.mk Fri Sep 9 01:09:39 2016 (r305633) +++ head/share/mk/meta.sys.mk Fri Sep 9 01:21:35 2016 (r305634) @@ -26,6 +26,10 @@ # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} +.if !defined(SYS_MK_DIR) +SYS_MK_DIR := ${_PARSEDIR} +.endif + META_MODE += meta verbose .MAKE.MODE ?= ${META_MODE} @@ -110,10 +114,26 @@ _metaError: .NOMETA .NOTMAIN .endif +META_COOKIE_TOUCH= +# some targets need to be .PHONY in non-meta mode +META_NOPHONY= .PHONY # Are we, after all, in meta mode? .if ${.MAKE.MODE:Uno:Mmeta*} != "" MKDEP_MK = meta.autodep.mk +# we can afford to use cookies to prevent some targets +# re-running needlessly +META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}} +META_NOPHONY= + +# some targets involve old pre-built targets +# ignore mtime of shell +# and mtime of makefiles does not matter in meta mode +.MAKE.META.IGNORE_PATHS += \ + ${MAKEFILE} \ + ${SHELL} \ + ${SYS_MK_DIR} + # if we think we are updating dependencies, # then filemon had better be present .if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) From owner-svn-src-head@freebsd.org Fri Sep 9 01:22:19 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 99567BD27F7; Fri, 9 Sep 2016 01:22:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::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 652BF2E8; Fri, 9 Sep 2016 01:22:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x242.google.com with SMTP id h5so3081721pao.0; Thu, 08 Sep 2016 18:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Dse0UFKVhQ+E7UPG7uA+1L5q7QZCIHok9aQMAbkQkXw=; b=KzqswiMXI56/9w41a50OfkOnvlfO1UvaC/nwBpezaZvSltV3shVOTY/TOy7NaKPcx9 WaKyJN2YVJIynRxWCX91cPV1jd3eBCQnqg5M07F00lmFgBnAI+OMpJtNH3T9j4LNH0tq kZQMNNOpmnW4Yo9rsm10mKMdrENyzHzXBLU/o+hRB6NE/ObDMiwiX09ERXHv0MTPkCGu hJ3h07k0dNr/lkKAX7FGNNtOjGqg6LA5dfmpgbqV4v4NT/tPl39JW4zR73ovBs56F0F4 xkeEhGFlRMrw7sxLYMnkKjAro9E5vOzOV51lvbz8d++OohyyjogXZJk91sAs8oUtt6LI yMRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Dse0UFKVhQ+E7UPG7uA+1L5q7QZCIHok9aQMAbkQkXw=; b=ixe5i8o3N6PrIUFB3FtnfGI3TFoa7SgzJvsjAEDcex3IKPtraE8ZA2lUuLi6+FXWci EnhF6yH2eH8bHFytfUhX+6Z5zTMvENOTQLN3fCK3SMdaIdkwo6ymZypTuHrb4NlypiET VU20hIrpq/LNQLwuEcUlzctp/pu9LhZFlJFoYJeA3ojSdi2J3fkBTu561r/3qxX91OcC 8TvxF1tGCXMD9sC5zyRBx1gE+tbm/yBZZwft0kjrkSWOPjLkIcMnO5cJoi6KAJ+CXaDW DxehFvy+RdVx07rJo6Ka2f0keoIXAcYe0WAJcY4u2P4BQECVdWmI+5VmuqB/auZYAyEe dFyQ== X-Gm-Message-State: AE9vXwOJqnuk7SZbwl7JuenGh7i+u75mNhHC6wyb6cCV65J7wWcvUIsJct0lu1GpmxH9Pw== X-Received: by 10.66.233.166 with SMTP id tx6mr1759551pac.120.1473384138800; Thu, 08 Sep 2016 18:22:18 -0700 (PDT) Received: from [100.197.173.143] ([172.56.42.35]) by smtp.gmail.com with ESMTPSA id p17sm585966pfi.7.2016.09.08.18.22.17 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Sep 2016 18:22:18 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r305629 - head/etc/mtree From: Ngie Cooper X-Mailer: iPhone Mail (13G36) In-Reply-To: Date: Thu, 8 Sep 2016 18:22:16 -0700 Cc: Jung-uk Kim , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201609082159.u88LxYl5044406@repo.freebsd.org> To: Mariusz Zaborski X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 01:22:19 -0000 > On Sep 8, 2016, at 15:33, Mariusz Zaborski wrote: >=20 > Thanks for that! +1 >> On 8 September 2016 at 23:59, Jung-uk Kim wrote: >> Author: jkim >> Date: Thu Sep 8 21:59:34 2016 >> New Revision: 305629 >> URL: https://svnweb.freebsd.org/changeset/base/305629 >>=20 >> Log: >> Add new directories added in r305626 to fix "make installworld". >>=20 >> Modified: >> head/etc/mtree/BSD.tests.dist >>=20 >> Modified: head/etc/mtree/BSD.tests.dist >> =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/etc/mtree/BSD.tests.dist Thu Sep 8 21:50:03 2016 (= r305628) >> +++ head/etc/mtree/BSD.tests.dist Thu Sep 8 21:59:34 2016 (= r305629) >> @@ -308,6 +308,18 @@ >> ttyio >> .. >> .. >> + libcasper >> + services >> + cap_dns >> + .. >> + cap_grp >> + .. >> + cap_pwd >> + .. >> + cap_sysctl >> + .. >> + .. >> + .. >> libcrypt >> .. >> libdevdctl >> _______________________________________________ >> 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" >=20 From owner-svn-src-head@freebsd.org Fri Sep 9 02:02: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 0A9B0BD20CC; Fri, 9 Sep 2016 02:02:15 +0000 (UTC) (envelope-from sjg@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 D016FB20; Fri, 9 Sep 2016 02:02:14 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8922EoN037983; Fri, 9 Sep 2016 02:02:14 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8922E9R037982; Fri, 9 Sep 2016 02:02:14 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201609090202.u8922E9R037982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 9 Sep 2016 02:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305635 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 02:02:15 -0000 Author: sjg Date: Fri Sep 9 02:02:13 2016 New Revision: 305635 URL: https://svnweb.freebsd.org/changeset/base/305635 Log: Missed part of patch Modified: head/share/mk/meta.sys.mk Modified: head/share/mk/meta.sys.mk ============================================================================== --- head/share/mk/meta.sys.mk Fri Sep 9 01:21:35 2016 (r305634) +++ head/share/mk/meta.sys.mk Fri Sep 9 02:02:13 2016 (r305635) @@ -123,7 +123,7 @@ MKDEP_MK = meta.autodep.mk # we can afford to use cookies to prevent some targets # re-running needlessly -META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}} +META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}} META_NOPHONY= # some targets involve old pre-built targets From owner-svn-src-head@freebsd.org Fri Sep 9 04:16: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 06F3ABD1986; Fri, 9 Sep 2016 04:16:55 +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 C13E7B7; Fri, 9 Sep 2016 04:16:54 +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 u894GrTG087317; Fri, 9 Sep 2016 04:16:53 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u894GriK087316; Fri, 9 Sep 2016 04:16:53 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201609090416.u894GriK087316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 9 Sep 2016 04:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305636 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 04:16:55 -0000 Author: jhibbits Date: Fri Sep 9 04:16:53 2016 New Revision: 305636 URL: https://svnweb.freebsd.org/changeset/base/305636 Log: Correct the type of db_cmd_loop_done. On big endian hardware that uses 1 byte bool a type mismatch of bool vs int will cause the least signifcant byte of db_cmd_loop_done to be set, but the MSB to be read, and read as 0. This causes ddb to stay in an infinite loop. MFC after: 1 week Modified: head/sys/ddb/db_command.c Modified: head/sys/ddb/db_command.c ============================================================================== --- head/sys/ddb/db_command.c Fri Sep 9 02:02:13 2016 (r305635) +++ head/sys/ddb/db_command.c Fri Sep 9 04:16:53 2016 (r305636) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); /* * Exported global variables */ -bool db_cmd_loop_done; +int db_cmd_loop_done; db_addr_t db_dot; db_addr_t db_last_addr; db_addr_t db_prev; From owner-svn-src-head@freebsd.org Fri Sep 9 04:45: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 72216BD1E35; Fri, 9 Sep 2016 04:45:27 +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 35F4CDC1; Fri, 9 Sep 2016 04:45:27 +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 u894jQtG098323; Fri, 9 Sep 2016 04:45:26 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u894jQVr098319; Fri, 9 Sep 2016 04:45:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201609090445.u894jQVr098319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 9 Sep 2016 04:45:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305637 - in head/sys/dev/ath/ath_hal: . ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 04:45:27 -0000 Author: adrian Date: Fri Sep 9 04:45:25 2016 New Revision: 305637 URL: https://svnweb.freebsd.org/changeset/base/305637 Log: [ath_hal] fixes for finer grain timestamping, some 11n macros * change the HT_RC_2_MCS to do MCS0..23 * Use it when looking up the ht20/ht40 array for bits-per-symbol * add a clk_to_psec (picoseconds) routine, so we can get sub-microsecond accuracy for the math * .. and make that + clk_to_usec public, so higher layer code that is returning clocks (eg the ANI diag routines, some upcoming locationing experiments) can be converted to microseconds. Whilst here, add a comment in ar5416 so i or someone else can revisit the latency values. Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Fri Sep 9 04:16:53 2016 (r305636) +++ head/sys/dev/ath/ath_hal/ah.c Fri Sep 9 04:45:25 2016 (r305637) @@ -275,7 +275,7 @@ ath_hal_reverseBits(uint32_t val, uint32 #define HT_STF 4 #define HT_LTF(n) ((n) * 4) -#define HT_RC_2_MCS(_rc) ((_rc) & 0xf) +#define HT_RC_2_MCS(_rc) ((_rc) & 0x1f) #define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) #define IS_HT_RATE(_rc) ( (_rc) & IEEE80211_RATE_MCS) @@ -334,9 +334,9 @@ ath_computedur_ht(uint32_t frameLen, uin KASSERT((rate &~ IEEE80211_RATE_MCS) < 31, ("bad mcs 0x%x", rate)); if (isht40) - bitsPerSymbol = ht40_bps[rate & 0x1f]; + bitsPerSymbol = ht40_bps[HT_RC_2_MCS(rate)]; else - bitsPerSymbol = ht20_bps[rate & 0x1f]; + bitsPerSymbol = ht20_bps[HT_RC_2_MCS(rate)]; numBits = OFDM_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); if (isShortGI) @@ -490,6 +490,11 @@ typedef enum { WIRELESS_MODE_MAX } WIRELESS_MODE; +/* + * XXX TODO: for some (?) chips, an 11b mode still runs at 11bg. + * Maybe AR5211 has separate 11b and 11g only modes, so 11b is 22MHz + * and 11g is 44MHz, but AR5416 and later run 11b in 11bg mode, right? + */ static WIRELESS_MODE ath_hal_chan2wmode(struct ath_hal *ah, const struct ieee80211_channel *chan) { @@ -543,22 +548,34 @@ ath_hal_mac_clks(struct ath_hal *ah, u_i u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks) { + uint64_t psec; + + psec = ath_hal_mac_psec(ah, clks); + return (psec / 1000000); +} + +/* + * XXX TODO: half, quarter rates. + */ +uint64_t +ath_hal_mac_psec(struct ath_hal *ah, u_int clks) +{ const struct ieee80211_channel *c = AH_PRIVATE(ah)->ah_curchan; - u_int usec; + uint64_t psec; /* NB: ah_curchan may be null when called attach time */ /* XXX merlin and later specific workaround - 5ghz fast clock is 44 */ if (c != AH_NULL && IS_5GHZ_FAST_CLOCK_EN(ah, c)) { - usec = clks / CLOCK_FAST_RATE_5GHZ_OFDM; + psec = (clks * 1000000ULL) / CLOCK_FAST_RATE_5GHZ_OFDM; if (IEEE80211_IS_CHAN_HT40(c)) - usec >>= 1; + psec >>= 1; } else if (c != AH_NULL) { - usec = clks / CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; + psec = (clks * 1000000ULL) / CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; if (IEEE80211_IS_CHAN_HT40(c)) - usec >>= 1; + psec >>= 1; } else - usec = clks / CLOCK_RATE[WIRELESS_MODE_11b]; - return usec; + psec = (clks * 1000000ULL) / CLOCK_RATE[WIRELESS_MODE_11b]; + return psec; } /* Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Sep 9 04:16:53 2016 (r305636) +++ head/sys/dev/ath/ath_hal/ah.h Fri Sep 9 04:45:25 2016 (r305637) @@ -1674,4 +1674,11 @@ ath_hal_get_mfp_qos(struct ath_hal *ah) return HAL_MFP_QOSDATA; } +/* + * Convert between microseconds and core system clocks. + */ +extern u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs); +extern u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks); +extern uint64_t ath_hal_mac_psec(struct ath_hal *ah, u_int clks); + #endif /* _ATH_AH_H_ */ Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Fri Sep 9 04:16:53 2016 (r305636) +++ head/sys/dev/ath/ath_hal/ah_internal.h Fri Sep 9 04:45:25 2016 (r305637) @@ -727,12 +727,6 @@ ath_hal_gethwchannel(struct ath_hal *ah, } /* - * Convert between microseconds and core system clocks. - */ -extern u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs); -extern u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks); - -/* * Generic get/set capability support. Each chip overrides * this routine to support chip-specific capabilities. */ Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 9 04:16:53 2016 (r305636) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 9 04:45:25 2016 (r305637) @@ -2833,6 +2833,9 @@ ar5416SetIFSTiming(struct ath_hal *ah, c clk_44 = 1; /* XXX does this need save/restoring for the 11n chips? */ + /* + * XXX TODO: should mask out the txlat/rxlat/usec values? + */ refClock = OS_REG_READ(ah, AR_USEC) & AR_USEC_USEC32; /* From owner-svn-src-head@freebsd.org Fri Sep 9 04:47: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 B51FABD1ED4; Fri, 9 Sep 2016 04:47:49 +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 6E428F46; Fri, 9 Sep 2016 04:47:49 +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 u894lmZ5098439; Fri, 9 Sep 2016 04:47:48 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u894lmsw098437; Fri, 9 Sep 2016 04:47:48 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201609090447.u894lmsw098437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 9 Sep 2016 04:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305638 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 04:47:49 -0000 Author: adrian Date: Fri Sep 9 04:47:48 2016 New Revision: 305638 URL: https://svnweb.freebsd.org/changeset/base/305638 Log: [net80211] add in ToA/ToD based location mbuf tags for some experimenting. Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Fri Sep 9 04:45:25 2016 (r305637) +++ head/sys/net80211/ieee80211_freebsd.c Fri Sep 9 04:47:48 2016 (r305638) @@ -530,6 +530,42 @@ ieee80211_get_rx_params(struct mbuf *m, } /* + * Add TOA parameters to the given mbuf. + */ +int +ieee80211_add_toa_params(struct mbuf *m, const struct ieee80211_toa_params *p) +{ + struct m_tag *mtag; + struct ieee80211_toa_params *rp; + + mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_TOA_PARAMS, + sizeof(struct ieee80211_toa_params), M_NOWAIT); + if (mtag == NULL) + return (0); + + rp = (struct ieee80211_toa_params *)(mtag + 1); + memcpy(rp, p, sizeof(*rp)); + m_tag_prepend(m, mtag); + return (1); +} + +int +ieee80211_get_toa_params(struct mbuf *m, struct ieee80211_toa_params *p) +{ + struct m_tag *mtag; + struct ieee80211_toa_params *rp; + + mtag = m_tag_locate(m, MTAG_ABI_NET80211, NET80211_TAG_TOA_PARAMS, + NULL); + if (mtag == NULL) + return (0); + rp = (struct ieee80211_toa_params *)(mtag + 1); + if (p != NULL) + memcpy(p, rp, sizeof(*p)); + return (1); +} + +/* * Transmit a frame to the parent interface. */ int Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Fri Sep 9 04:45:25 2016 (r305637) +++ head/sys/net80211/ieee80211_freebsd.h Fri Sep 9 04:47:48 2016 (r305638) @@ -331,6 +331,8 @@ void ieee80211_process_callback(struct i #define NET80211_TAG_RECV_PARAMS 2 +#define NET80211_TAG_TOA_PARAMS 3 + struct ieee80211com; int ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *); int ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *); @@ -656,6 +658,14 @@ int ieee80211_add_rx_params(struct mbuf const struct ieee80211_rx_stats *rxs); int ieee80211_get_rx_params(struct mbuf *m, struct ieee80211_rx_stats *rxs); + +struct ieee80211_toa_params { + int request_id; +}; +int ieee80211_add_toa_params(struct mbuf *m, + const struct ieee80211_toa_params *p); +int ieee80211_get_toa_params(struct mbuf *m, + struct ieee80211_toa_params *p); #endif /* _KERNEL */ /* From owner-svn-src-head@freebsd.org Fri Sep 9 04:54: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 598A8BD2074; Fri, 9 Sep 2016 04:54:42 +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 1C9FC3C5; Fri, 9 Sep 2016 04:54:42 +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 u894sfox002290; Fri, 9 Sep 2016 04:54:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u894sf2l002289; Fri, 9 Sep 2016 04:54:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201609090454.u894sf2l002289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 9 Sep 2016 04:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305639 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 04:54:42 -0000 Author: adrian Date: Fri Sep 9 04:54:41 2016 New Revision: 305639 URL: https://svnweb.freebsd.org/changeset/base/305639 Log: [gpio] include intr.h when building with INTRNG. Trying to build a MIPS platform that uses INTRNG needs this for this to work right in gpiobusvar.h : #ifdef INTRNG struct intr_map_data_gpio { struct intr_map_data hdr; ... }; #endif Modified: head/sys/dev/gpio/gpiobusvar.h Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Fri Sep 9 04:47:48 2016 (r305638) +++ head/sys/dev/gpio/gpiobusvar.h Fri Sep 9 04:54:41 2016 (r305639) @@ -41,6 +41,10 @@ #include #endif +#ifdef INTRNG +#include +#endif + #include "gpio_if.h" #ifdef FDT From owner-svn-src-head@freebsd.org Fri Sep 9 05:27: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 E5AE1BD2696; Fri, 9 Sep 2016 05:27:11 +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 76B413D1; Fri, 9 Sep 2016 05:27:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id AD057104824F; Fri, 9 Sep 2016 15:27:03 +1000 (AEST) Date: Fri, 9 Sep 2016 15:27:02 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305636 - head/sys/ddb In-Reply-To: <201609090416.u894GriK087316@repo.freebsd.org> Message-ID: <20160909142012.W864@besplex.bde.org> References: <201609090416.u894GriK087316@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=VIkg5I7X c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=TitAgUKP1XWEueYwuxwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 05:27:12 -0000 On Fri, 9 Sep 2016, Justin Hibbits wrote: > Log: > Correct the type of db_cmd_loop_done. > > On big endian hardware that uses 1 byte bool a type mismatch of bool vs int will > cause the least signifcant byte of db_cmd_loop_done to be set, but the MSB to be > read, and read as 0. This causes ddb to stay in an infinite loop. Hrmph. I objected to converting ddb to bool. > Modified: head/sys/ddb/db_command.c > ============================================================================== > --- head/sys/ddb/db_command.c Fri Sep 9 02:02:13 2016 (r305635) > +++ head/sys/ddb/db_command.c Fri Sep 9 04:16:53 2016 (r305636) > @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); > /* > * Exported global variables > */ > -bool db_cmd_loop_done; > +int db_cmd_loop_done; > db_addr_t db_dot; > db_addr_t db_last_addr; > db_addr_t db_prev; It used to use boolean_t, but was misinitialized with 0 and 1 instead of FALSE and TRUE. Then it used bool, but was misinitialized with 0 and 1 instead of false and true. Now it is initialized with matching types for the literals, but its type regressed 2 steps. But what was the problem? (int)1 (or any nonzero value) is converted to (bool)true on assigment. The final value is always 1 if converted back to an int, and probably also when viewed as bits in memory. When bool has 8 bits big endian, this means that it has bits 0b00000001 where you can't really know the bit order within a byte. The bugs were actually that: - this variable was not declared in a header file, first as boolean_t, then as bool - it was misdeclared as 'extern int' in db_run.c. This accidentally matched boolean_t, but not bool - conversion to bool in 1 place gave a type mismatch. This might have caused memory overruns on all systems, but the bug was more obvious on big-endian systems. On i386, I get the variable addresses: ... c0bc8288 B db_dot c0bc828c B db_last_addr c0bc8290 B db_prev c0bc8294 B db_next c0bc8298 B db_cmd_loop_done c0bc829c b db_last_command c0bc82a0 b escstate.4091 c0bc82a4 b db_lbuf_start c0bc82a8 b db_lbuf_end ... when compiled by gcc-4.2.1 (gcc-4.2.1 generates the same '.comm xxx,1,1' directive as clang, as required by the ABI. The variable is pessimized for both space and time (one reason I don't like to use compiler bool). The ABI specifies packing to 8 bits but not to 1 bit and not expansion to 32 bits. The linker expands it to 32 bits anyway, but the compiler doesn't know this so it has to use slightly larger and slower instructions to use it. Compilers do OK for bools in static functions, but for public functions they don't even trust the ABI, and on x86 do 2 extra movzbl (register) instructions and a few extra loads and stores to do null conversions of bools in each of the caller and callee in code like 'extern bool b(bool); bool q(bool r) { return (b(r)); }'. These extra instructions fix some bool-int mismatches on little-endian systems only. Loading 32 bits from db_cmd_loop_done might give garbage in the top bits if the top bits are actually for another variable, but zero-extending the low bits fixes this (a 32-bit store would clobber the other variable). But in the big-endian case, it would be the garbage top bits that are zero-extended. It is impossible to determine where the low bits are so as to adjust, starting from the incorrect type. This is perhaps the main disadvantage of big-endian format. Bruce From owner-svn-src-head@freebsd.org Fri Sep 9 07:10: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 68B2EBD21A1; Fri, 9 Sep 2016 07:10:51 +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 1F79F974; Fri, 9 Sep 2016 07:10:51 +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 u897AoCb051363; Fri, 9 Sep 2016 07:10:50 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u897AoSQ051362; Fri, 9 Sep 2016 07:10:50 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201609090710.u897AoSQ051362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 9 Sep 2016 07:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305651 - head/usr.sbin/newsyslog X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 07:10:51 -0000 Author: ed Date: Fri Sep 9 07:10:50 2016 New Revision: 305651 URL: https://svnweb.freebsd.org/changeset/base/305651 Log: Properly patch up dirname()/basename() calls to not clobber ent->log. It turns out that we had a couple of more calls to dirname()/basename() in newsyslog(8) that assume the input isn't clobbered. This is bad, because it apparently breaks log rotation now that the new dirname() implementation has been merged. Fix this by first copying the input and then calling dirname()/basename(). While there, improve the naming of variables in this function a bit. Reported by: Ryan Steinmetz, gjb Reviewed by: bdrewery, allanjude Differential Revision: https://reviews.freebsd.org/D7838 Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Fri Sep 9 07:00:50 2016 (r305650) +++ head/usr.sbin/newsyslog/newsyslog.c Fri Sep 9 07:10:50 2016 (r305651) @@ -1510,11 +1510,11 @@ validate_old_timelog(int fd, const struc static void delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir) { - char *logfname, *s, *dir, errbuf[80]; + char *basebuf, *dirbuf, errbuf[80]; + const char *base, *dir; int dir_fd, i, logcnt, max_logcnt; struct oldlog_entry *oldlogs; struct dirent *dp; - const char *cdir; struct tm tm; DIR *dirp; @@ -1522,19 +1522,19 @@ delete_oldest_timelog(const struct conf_ max_logcnt = MAX_OLDLOGS; logcnt = 0; - if (archive_dir != NULL && archive_dir[0] != '\0') - cdir = archive_dir; - else - if ((cdir = dirname(ent->log)) == NULL) - err(1, "dirname()"); - if ((dir = strdup(cdir)) == NULL) - err(1, "strdup()"); + if (archive_dir != NULL && archive_dir[0] != '\0') { + dirbuf = NULL; + dir = archive_dir; + } else { + if ((dirbuf = strdup(ent->log)) == NULL) + err(1, "strdup()"); + dir = dirname(dirbuf); + } - if ((s = basename(ent->log)) == NULL) - err(1, "basename()"); - if ((logfname = strdup(s)) == NULL) + if ((basebuf = strdup(ent->log)) == NULL) err(1, "strdup()"); - if (strcmp(logfname, "/") == 0) + base = basename(basebuf); + if (strcmp(base, "/") == 0) errx(1, "Invalid log filename - became '/'"); if (verbose > 2) @@ -1545,7 +1545,7 @@ delete_oldest_timelog(const struct conf_ err(1, "Cannot open log directory '%s'", dir); dir_fd = dirfd(dirp); while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) + if (validate_old_timelog(dir_fd, dp, base, &tm) == 0) continue; /* @@ -1610,8 +1610,8 @@ delete_oldest_timelog(const struct conf_ free(oldlogs[i].fname); } free(oldlogs); - free(logfname); - free(dir); + free(dirbuf); + free(basebuf); } /* From owner-svn-src-head@freebsd.org Fri Sep 9 07:34: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 0E965BD28E3; Fri, 9 Sep 2016 07:34:16 +0000 (UTC) (envelope-from np@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 C8B8C66E; Fri, 9 Sep 2016 07:34:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u897YFPQ062124; Fri, 9 Sep 2016 07:34:15 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u897YFNm062123; Fri, 9 Sep 2016 07:34:15 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609090734.u897YFNm062123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 9 Sep 2016 07:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305652 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 07:34:16 -0000 Author: np Date: Fri Sep 9 07:34:14 2016 New Revision: 305652 URL: https://svnweb.freebsd.org/changeset/base/305652 Log: cxgbe(4): Do not prescreen frames before attempting LRO. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Sep 9 07:10:50 2016 (r305651) +++ head/sys/dev/cxgbe/t4_sge.c Fri Sep 9 07:34:14 2016 (r305652) @@ -1830,8 +1830,7 @@ t4_eth_rx(struct sge_iq *iq, const struc } #if defined(INET) || defined(INET6) - if (cpl->l2info & htobe32(F_RXF_LRO) && - iq->flags & IQ_LRO_ENABLED && + if (iq->flags & IQ_LRO_ENABLED && tcp_lro_rx(lro, m0, 0) == 0) { /* queued for LRO */ } else From owner-svn-src-head@freebsd.org Fri Sep 9 10:40:56 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 BA947BD48B3; Fri, 9 Sep 2016 10:40:56 +0000 (UTC) (envelope-from mjg@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 8D43674B; Fri, 9 Sep 2016 10:40:56 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89Aet2h030439; Fri, 9 Sep 2016 10:40:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89Aetgh030438; Fri, 9 Sep 2016 10:40:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609091040.u89Aetgh030438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 9 Sep 2016 10:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305659 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 10:40:56 -0000 Author: mjg Date: Fri Sep 9 10:40:55 2016 New Revision: 305659 URL: https://svnweb.freebsd.org/changeset/base/305659 Log: nullfs: plug vnode ref leak in null_vptocnp The lower vnode is already referenced and nodeget is supposed to consume the reference. Thus the extra vref call was causing a leak. Reported by: pho Reviewed by: kib 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 Fri Sep 9 10:04:38 2016 (r305658) +++ head/sys/fs/nullfs/null_vnops.c Fri Sep 9 10:40:55 2016 (r305659) @@ -893,7 +893,6 @@ null_vptocnp(struct vop_vptocnp_args *ap vn_lock(vp, locked | LK_RETRY); return (ENOENT); } - vref(ldvp); error = null_nodeget(vp->v_mount, ldvp, dvp); if (error == 0) { #ifdef DIAGNOSTIC From owner-svn-src-head@freebsd.org Fri Sep 9 13:23: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 5A3F3BD25A8; Fri, 9 Sep 2016 13:23:08 +0000 (UTC) (envelope-from bde@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 3553AA17; Fri, 9 Sep 2016 13:23:08 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89DN7kA094836; Fri, 9 Sep 2016 13:23:07 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89DN7DR094835; Fri, 9 Sep 2016 13:23:07 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609091323.u89DN7DR094835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 9 Sep 2016 13:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305661 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 13:23:08 -0000 Author: bde Date: Fri Sep 9 13:23:07 2016 New Revision: 305661 URL: https://svnweb.freebsd.org/changeset/base/305661 Log: Give the full syntax of the 'count' arg for all commmands that support it. This arg is most interesting for the 'break' command where it never worked, and for the step command where it is powerful but too fragile to use much. Give the full syntax of the 'addr' arg for these commands and some others. Rename it from 'address' for the generic command. Fix description of how 'count' is supposed to work for the 'break' command. Don't (mis)describe the syntax of the comma for the 'step' command. Expand the description for the generic command. Give the full syntax for the 'examine' command. It was also missing the possible values for the modifier. Fix mdoc syntax error for the 'search' command. Remove FUD about consequences of not having a trap handler for the 'search' command. Modified: head/share/man/man4/ddb.4 Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Fri Sep 9 12:22:55 2016 (r305660) +++ head/share/man/man4/ddb.4 Fri Sep 9 13:23:07 2016 (r305661) @@ -146,25 +146,32 @@ to be the same as .Pp The general command syntax is: .Ar command Ns Op Li / Ns Ar modifier -.Ar address Ns Op Li , Ns Ar count +.Oo Ar addr Oc Ns Op Li , Ns Ar count .Pp A blank line repeats the previous command from the address .Va next with count 1 and no modifiers. Specifying -.Ar address +.Ar addr sets .Va dot to the address. Omitting -.Ar address +.Ar addr uses .Va dot . A missing .Ar count is taken to be 1 for printing commands or infinity for stack traces. +A +.Ar count +of -1 is equivalent to a missing +.Ar count . +Options that are supplied but not supported by the given +.Ar command +are usually ignored. .Pp The .Nm @@ -204,8 +211,14 @@ browse through the history buffer, and m current line. .Sh COMMANDS .Bl -tag -width indent -compact -.It Ic examine -.It Ic x +.It Xo +.Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ... +.Oo Ar addr Oc Ns Op Li , Ns Ar count +.Xc +.It Xo +.Ic x Ns Op Li / Ns Cm AISabcdghilmorsuxz ... +.Oo Ar addr Oc Ns Op Li , Ns Ar count +.Xc Display the addressed locations according to the formats in the modifier. Multiple modifier formats display multiple locations. If no format is specified, the last format specified for this command @@ -251,7 +264,7 @@ The location is also displayed in hex at display as an instruction .It Cm I display as an instruction with possible alternate formats depending on the -machine, but none of the supported architectures have an alternate format. +machine, but none of the supported architectures have an alternate format .It Cm S display a symbol name for the pointer stored at the address .El @@ -328,16 +341,17 @@ Set the named variable or register with .Ar expr . Valid variable names are described below. .Pp -.It Ic break Ns Op Li / Ns Cm u -.It Ic b Ns Op Li / Ns Cm u +.It Ic break Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count +.It Ic b Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count Set a break point at .Ar addr . If .Ar count -is supplied, continues +is supplied, the +.Ic continue +command will not stop at this break point on the first .Ar count -\- 1 times before stopping at the -break point. +\- 1 times that it is hit. If the break point is set, a break point number is printed with .Ql # . @@ -361,21 +375,24 @@ user space break points may not work cor Setting a break point at the low-level code paths may also cause strange behavior. .Pp -.It Ic delete Ar addr -.It Ic d Ar addr +.It Ic delete Op Ar addr +.It Ic d Op Ar addr .It Ic delete Li # Ns Ar number -.It Ic d Li # Ns Ar number -Delete the break point. -The target break point can be specified by a +.It Ic d Li # Ns Ar number +Delete the specified break point. +The break point can be specified by a break point number with .Ql # , or by using the same .Ar addr specified in the original .Ic break -command. +command, or by omitting +.Ar addr +to get the default address of +.Va dot . .Pp -.It Ic watch Ar addr Ns Li , Ns Ar size +.It Ic watch Oo Ar addr Oc Ns Op Li , Ns Ar size Set a watchpoint for a region. Execution stops when an attempt to modify the region occurs. The @@ -389,7 +406,7 @@ Attempts to watch wired kernel memory may cause unrecoverable error in some systems such as i386. Watchpoints on user addresses work best. .Pp -.It Ic hwatch Ar addr Ns Li , Ns Ar size +.It Ic hwatch Oo Ar addr Oc Ns Op Li , Ns Ar size Set a hardware watchpoint for a region if supported by the architecture. Execution stops when an attempt to modify the region occurs. @@ -405,14 +422,14 @@ Use for setting watchpoints on kernel address locations only, and avoid its use on user mode address spaces. .Pp -.It Ic dhwatch Ar addr Ns Li , Ns Ar size +.It Ic dhwatch Oo Ar addr Oc Ns Op Li , Ns Ar size Delete specified hardware watchpoint. .Pp -.It Ic step Ns Op Li / Ns Cm p -.It Ic s Ns Op Li / Ns Cm p +.It Ic step Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count +.It Ic s Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count Single step .Ar count -times (the comma is a mandatory part of the syntax). +times. If the .Cm p modifier is specified, print each instruction at each step. @@ -458,22 +475,22 @@ Otherwise, only print when the matching .Pp .It Xo .Ic trace Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic t Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic where Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic bt Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc Stack trace. @@ -498,16 +515,11 @@ only if the machine dependent code suppo .Ic search Ns Op Li / Ns Cm bhl .Ar addr .Ar value -.Op Ar mask +.Op Ar mask Ns .Op Li , Ns Ar count .Xc Search memory for .Ar value . -This command might fail in interesting -ways if it does not find the searched-for value. -This is because -.Nm -does not always recover from touching bad memory. The optional .Ar count argument limits the search. @@ -537,7 +549,6 @@ addresses for the process and not show o .Pp .It Ic show Cm all trace .It Ic alltrace -.Xc Show a stack trace for every thread in the system. .Pp .It Ic show Cm all ttys From owner-svn-src-head@freebsd.org Fri Sep 9 14:09: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 C7DAFBD2242; Fri, 9 Sep 2016 14:09:51 +0000 (UTC) (envelope-from bde@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 9A6773B6; Fri, 9 Sep 2016 14:09:51 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89E9okZ010361; Fri, 9 Sep 2016 14:09:50 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89E9oXI010360; Fri, 9 Sep 2016 14:09:50 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609091409.u89E9oXI010360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 9 Sep 2016 14:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305663 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 14:09:51 -0000 Author: bde Date: Fri Sep 9 14:09:50 2016 New Revision: 305663 URL: https://svnweb.freebsd.org/changeset/base/305663 Log: Fix stopping when the specified breakpoint count is reached. The countdown was done correctly, but the action when the count was not reduced to 0 was to fall through to generic code which almost always stopped. Modified: head/sys/ddb/db_run.c Modified: head/sys/ddb/db_run.c ============================================================================== --- head/sys/ddb/db_run.c Fri Sep 9 13:27:20 2016 (r305662) +++ head/sys/ddb/db_run.c Fri Sep 9 14:09:50 2016 (r305663) @@ -125,6 +125,7 @@ db_stop_at_pc(bool *is_breakpoint) *is_breakpoint = true; return (true); /* stop here */ } + return (false); /* continue the countdown */ } else if (*is_breakpoint) { #ifdef BKPT_SKIP BKPT_SKIP; From owner-svn-src-head@freebsd.org Fri Sep 9 14:50: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 39E92BD403A; Fri, 9 Sep 2016 14:50:46 +0000 (UTC) (envelope-from br@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 F0D39EB7; Fri, 9 Sep 2016 14:50:45 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89Eoj9B026221; Fri, 9 Sep 2016 14:50:45 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89EoilO026215; Fri, 9 Sep 2016 14:50:44 GMT (envelope-from br@FreeBSD.org) Message-Id: <201609091450.u89EoilO026215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 9 Sep 2016 14:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305664 - in head/sys: conf mips/malta mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 14:50:46 -0000 Author: br Date: Fri Sep 9 14:50:44 2016 New Revision: 305664 URL: https://svnweb.freebsd.org/changeset/base/305664 Log: Add support for SMP on MIPS Malta platform. Tested in QEMU on Malta32, Malta64. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Added: head/sys/mips/malta/asm_malta.S (contents, props changed) head/sys/mips/malta/malta_mp.c (contents, props changed) Modified: head/sys/conf/options.mips head/sys/mips/malta/files.malta head/sys/mips/malta/std.malta head/sys/mips/mips/locore.S Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Fri Sep 9 14:09:50 2016 (r305663) +++ head/sys/conf/options.mips Fri Sep 9 14:50:44 2016 (r305664) @@ -45,6 +45,7 @@ CPU_CNMIPS opt_global.h CPU_RMI opt_global.h CPU_NLM opt_global.h CPU_BERI opt_global.h +CPU_MALTA opt_global.h # which MACHINE_ARCH architecture MIPS Added: head/sys/mips/malta/asm_malta.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/malta/asm_malta.S Fri Sep 9 14:50:44 2016 (r305664) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * Portions of this software were developed by SRI International and the + * University of Cambridge Computer Laboratory under DARPA/AFRL contract + * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Portions of this software were developed by the University of Cambridge + * Computer Laboratory as part of the CTSRD Project, with support from the + * UK Higher Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#define VPECONF0_MVP (1 << 1) + + .set noreorder + +#ifdef SMP +/* + * This function must be implemented in assembly because it is called early + * in AP boot without a valid stack. + */ +LEAF(platform_processor_id) + .set push + .set mips32r2 + mfc0 v0, $15, 1 + jr ra + andi v0, 0x1f + .set pop +END(platform_processor_id) + +LEAF(enable_mvp) + .set push + .set mips32r2 + .set noat + li t2, (VPECONF0_MVP) + move $1, t2 + jr ra + .word 0x41810000 | (1 << 11) | 2 # mttc0 t2, $1, 2 + .set pop +END(enable_mvp) + +/* + * Called on APs to wait until they are told to launch. + */ +LEAF(malta_ap_wait) + jal platform_processor_id + nop + +1: + ll t0, malta_ap_boot + bne v0, t0, 1b + nop + + move t0, zero + sc t0, malta_ap_boot + + beqz t0, 1b + nop + + j mpentry + nop +END(malta_ap_wait) +#endif Modified: head/sys/mips/malta/files.malta ============================================================================== --- head/sys/mips/malta/files.malta Fri Sep 9 14:09:50 2016 (r305663) +++ head/sys/mips/malta/files.malta Fri Sep 9 14:50:44 2016 (r305664) @@ -10,3 +10,7 @@ mips/malta/malta_machdep.c standard mips/malta/yamon.c standard mips/mips/intr_machdep.c standard mips/mips/tick.c standard + +# SMP +mips/malta/asm_malta.S optional smp +mips/malta/malta_mp.c optional smp Added: head/sys/mips/malta/malta_mp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/malta/malta_mp.c Fri Sep 9 14:50:44 2016 (r305664) @@ -0,0 +1,226 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * Portions of this software were developed by SRI International and the + * University of Cambridge Computer Laboratory under DARPA/AFRL contract + * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Portions of this software were developed by the University of Cambridge + * Computer Laboratory as part of the CTSRD Project, with support from the + * UK Higher Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define MALTA_MAXCPU 2 + +unsigned malta_ap_boot = ~0; + +#define C_SW0 (1 << 8) +#define C_SW1 (1 << 9) +#define C_IRQ0 (1 << 10) +#define C_IRQ1 (1 << 11) +#define C_IRQ2 (1 << 12) +#define C_IRQ3 (1 << 13) +#define C_IRQ4 (1 << 14) +#define C_IRQ5 (1 << 15) + +static inline void +ehb(void) +{ + __asm __volatile( + " .set mips32r2 \n" + " ehb \n" + " .set mips0 \n"); +} + +#define mttc0(rd, sel, val) \ +({ \ + __asm __volatile( \ + " .set push \n" \ + " .set mips32r2 \n" \ + " .set noat \n" \ + " move $1, %0 \n" \ + " .word 0x41810000 | (" #rd " << 11) | " #sel " \n" \ + " .set pop \n" \ + :: "r" (val)); \ +}) + +#define mftc0(rt, sel) \ +({ \ + unsigned long __res; \ + __asm __volatile( \ + " .set push \n" \ + " .set mips32r2 \n" \ + " .set noat \n" \ + " .word 0x41000800 | (" #rt " << 16) | " #sel " \n" \ + " move %0, $1 \n" \ + " .set pop \n" \ + : "=r" (__res)); \ + __res; \ +}) + +#define write_c0_register32(reg, sel, val) \ +({ \ + __asm __volatile( \ + " .set push \n" \ + " .set mips32 \n" \ + " mtc0 %0, $%1, %2 \n" \ + " .set pop \n" \ + :: "r" (val), "i" (reg), "i" (sel)); \ +}) + +#define read_c0_register32(reg, sel) \ +({ \ + uint32_t __retval; \ + __asm __volatile( \ + " .set push \n" \ + " .set mips32 \n" \ + " mfc0 %0, $%1, %2 \n" \ + " .set pop \n" \ + : "=r" (__retval) : "i" (reg), "i" (sel)); \ + __retval; \ +}) + +void +platform_ipi_send(int cpuid) +{ + uint32_t reg; + + /* + * Set thread context. + * Note this is not global, so we don't need lock. + */ + reg = read_c0_register32(1, 1); + reg &= ~(0xff); + reg |= cpuid; + write_c0_register32(1, 1, reg); + + ehb(); + + /* Set cause */ + reg = mftc0(13, 0); + mttc0(13, 0, (reg | C_SW1)); +} + +void +platform_ipi_clear(void) +{ + uint32_t reg; + + reg = mips_rd_cause(); + reg &= ~(C_SW1); + mips_wr_cause(reg); +} + +int +platform_ipi_hardintr_num(void) +{ + + return (-1); +} + +int +platform_ipi_softintr_num(void) +{ + + return (1); +} + +void +platform_init_ap(int cpuid) +{ + uint32_t clock_int_mask; + uint32_t ipi_intr_mask; + + /* + * Clear any pending IPIs. + */ + platform_ipi_clear(); + + /* + * Unmask the clock and ipi interrupts. + */ + ipi_intr_mask = soft_int_mask(platform_ipi_softintr_num()); + clock_int_mask = hard_int_mask(5); + set_intr_mask(ipi_intr_mask | clock_int_mask); + + mips_wbflush(); +} + +void +platform_cpu_mask(cpuset_t *mask) +{ + uint32_t i, m; + + CPU_ZERO(mask); + for (i = 0, m = 1 ; i < MALTA_MAXCPU; i++, m <<= 1) + CPU_SET(i, mask); +} + +struct cpu_group * +platform_smp_topo(void) +{ + + return (smp_topo_none()); +} + +int +platform_start_ap(int cpuid) +{ + int timeout; + + if (atomic_cmpset_32(&malta_ap_boot, ~0, cpuid) == 0) + return (-1); + + printf("Waiting for cpu%d to start\n", cpuid); + + timeout = 100; + do { + DELAY(1000); + if (atomic_cmpset_32(&malta_ap_boot, 0, ~0) != 0) { + printf("CPU %d started\n", cpuid); + return (0); + } + } while (timeout--); + + printf("CPU %d failed to start\n", cpuid); + + return (0); +} Modified: head/sys/mips/malta/std.malta ============================================================================== --- head/sys/mips/malta/std.malta Fri Sep 9 14:09:50 2016 (r305663) +++ head/sys/mips/malta/std.malta Fri Sep 9 14:50:44 2016 (r305664) @@ -1,7 +1,7 @@ # $FreeBSD$ files "../malta/files.malta" -cpu CPU_MIPS4KC +cpu CPU_MALTA device pci device ata Modified: head/sys/mips/mips/locore.S ============================================================================== --- head/sys/mips/mips/locore.S Fri Sep 9 14:09:50 2016 (r305663) +++ head/sys/mips/mips/locore.S Fri Sep 9 14:50:44 2016 (r305664) @@ -158,6 +158,21 @@ VECTOR(_locore, unknown) 1: #endif +#if defined(CPU_MALTA) && defined(SMP) + .set push + .set mips32r2 + jal enable_mvp + nop + jal platform_processor_id + nop + beqz v0, 1f + nop + j malta_ap_wait + nop + .set pop +1: +#endif + /* * Initialize stack and call machine startup. */ From owner-svn-src-head@freebsd.org Fri Sep 9 15:53: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 95B12BD2091; Fri, 9 Sep 2016 15:53:43 +0000 (UTC) (envelope-from bde@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 4B6E6138; Fri, 9 Sep 2016 15:53:43 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89FrgO5051572; Fri, 9 Sep 2016 15:53:42 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89FrgFn051569; Fri, 9 Sep 2016 15:53:42 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609091553.u89FrgFn051569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 9 Sep 2016 15:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305665 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 15:53:43 -0000 Author: bde Date: Fri Sep 9 15:53:42 2016 New Revision: 305665 URL: https://svnweb.freebsd.org/changeset/base/305665 Log: Pass the trap type and code down from db_trap() to db_stop_at_pc() so that the latter can easily determine what the trap type actually is after callers are fixed to encode the type unambigously. ddb currently barely understands breakpoints, and it treats all non-breakpoints as single-step traps. This works OK for stopping after every instruction when single-stepping, but is broken for single-stepping with a count > 1 (especially with a large count). ddb needs to stop on the first non-single-step trap while single- stepping. Otherwise, ddb doesn't even stop the first time for fatal traps and external breakpoints like the one in kdb_enter(). Modified: head/sys/ddb/db_main.c head/sys/ddb/db_run.c head/sys/ddb/ddb.h Modified: head/sys/ddb/db_main.c ============================================================================== --- head/sys/ddb/db_main.c Fri Sep 9 14:50:44 2016 (r305664) +++ head/sys/ddb/db_main.c Fri Sep 9 15:53:42 2016 (r305665) @@ -226,10 +226,7 @@ db_trap(int type, int code) if (cnunavailable()) return (0); - bkpt = IS_BREAKPOINT_TRAP(type, code); - watchpt = IS_WATCHPOINT_TRAP(type, code); - - if (db_stop_at_pc(&bkpt)) { + if (db_stop_at_pc(type, code, &bkpt, &watchpt)) { if (db_inst_count) { db_printf("After %d instructions (%d loads, %d stores),\n", db_inst_count, db_load_count, db_store_count); Modified: head/sys/ddb/db_run.c ============================================================================== --- head/sys/ddb/db_run.c Fri Sep 9 14:50:44 2016 (r305664) +++ head/sys/ddb/db_run.c Fri Sep 9 15:53:42 2016 (r305665) @@ -90,13 +90,14 @@ db_pc_is_singlestep(db_addr_t pc) #endif bool -db_stop_at_pc(bool *is_breakpoint) +db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint) { db_addr_t pc; db_breakpoint_t bkpt; + *is_breakpoint = IS_BREAKPOINT_TRAP(type, code); + *is_watchpoint = IS_WATCHPOINT_TRAP(type, code); pc = PC_REGS(); - if (db_pc_is_singlestep(pc)) *is_breakpoint = false; Modified: head/sys/ddb/ddb.h ============================================================================== --- head/sys/ddb/ddb.h Fri Sep 9 14:50:44 2016 (r305664) +++ head/sys/ddb/ddb.h Fri Sep 9 15:53:42 2016 (r305665) @@ -215,7 +215,8 @@ void db_restart_at_pc(bool watchpt); int db_set_variable(db_expr_t value); void db_set_watchpoints(void); void db_skip_to_eol(void); -bool db_stop_at_pc(bool *is_breakpoint); +bool db_stop_at_pc(int type, int code, bool *is_breakpoint, + bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); int db_trace_thread(struct thread *, int); From owner-svn-src-head@freebsd.org Fri Sep 9 16:18:45 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 3AA0BBD2756; Fri, 9 Sep 2016 16:18:45 +0000 (UTC) (envelope-from brooks@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 0AA3E108; Fri, 9 Sep 2016 16:18:44 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89GIi50059375; Fri, 9 Sep 2016 16:18:44 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89GIiUV059374; Fri, 9 Sep 2016 16:18:44 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201609091618.u89GIiUV059374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 9 Sep 2016 16:18:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305666 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 16:18:45 -0000 Author: brooks Date: Fri Sep 9 16:18:44 2016 New Revision: 305666 URL: https://svnweb.freebsd.org/changeset/base/305666 Log: Fix spelling in comment. Submitted by: brueffer Modified: head/lib/libc/sys/Makefile.inc Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Fri Sep 9 15:53:42 2016 (r305665) +++ head/lib/libc/sys/Makefile.inc Fri Sep 9 16:18:44 2016 (r305666) @@ -14,8 +14,8 @@ # NOASM will prevent the default syscall code from being generated. # PSEUDO generates _() and __sys_() symbols, but not (). # -# While historically machine dependent, all archictures have the following -# declerations in common: +# While historically machine dependent, all architectures have the following +# declarations in common: # NOASM= break.o \ exit.o \ From owner-svn-src-head@freebsd.org Fri Sep 9 16:27: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 6B70CBD298B for ; Fri, 9 Sep 2016 16:27:54 +0000 (UTC) (envelope-from pfg@apache.org) Received: from nm13-vm0.bullet.mail.bf1.yahoo.com (nm13-vm0.bullet.mail.bf1.yahoo.com [98.139.213.79]) (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 23F05873 for ; Fri, 9 Sep 2016 16:27:54 +0000 (UTC) (envelope-from pfg@apache.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1473438466; bh=vPiPLrEUKJey3MRKs8TTneqX0w4e5zQEju1UyQqTA0Q=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=k8N0n5E++cFiaPf0hjzFBHfJUlRNG1J0GkuwAimqZBQNpefzGUA3MKVBgFROlYv3JdokctSWvSvD9btgIRtoL2lTQyYhkUePqbsG4Qg9Ow22N34oaSOjCahAXvaEwBCrNaZ8vXZc7bUz12TQldsRSG/8hSupmKb47WalzTuJPx1Fba7pbKQHQhzJtjYrElV91VU3c+Sm46leEWpUoldiCzwWbzvsilU1rjXDb1dY8XjTfhT1atXedFycqXdl/TtIcl5V6qPFM5hVZKSjjWy6ZGICvr4fjmOWxc45/KdeDNFjm1rZGa9aEEUz5Ys+yl5YCsoga9yVkVnqcYkKoEBGuA== Received: from [98.139.170.179] by nm13.bullet.mail.bf1.yahoo.com with NNFMP; 09 Sep 2016 16:27:46 -0000 Received: from [98.139.213.14] by tm22.bullet.mail.bf1.yahoo.com with NNFMP; 09 Sep 2016 16:27:46 -0000 Received: from [127.0.0.1] by smtp114.mail.bf1.yahoo.com with NNFMP; 09 Sep 2016 16:27:46 -0000 X-Yahoo-Newman-Id: 411001.47212.bm@smtp114.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 50ppjCkVM1n6shYqnEk_9nidrUKazEoLULZeL1a8ZHOSKxb ZU6fSa6Win3bJobBAV97bXKOXZxKj6ejtG5aXqiNEDofiGrtbCqn0OP9szlf hWOaJKqmoHPKJLQAsEkLAaDm3EpwH5pCBSbWz3N0b9q.j5AOwtjMEh0wlkeU aOkaFaVeYJvPu5KNKMlV2My9ANLQAzaKeumXp.A8HQ.EEiTvthGjPHCxjTms 8QwAP34prDPN_m2ggSLowlF.iHp7v2VNcKrhC.D4SZbmDv0lQqHXwJ_9RPIB p3F87F8c1YKBMdHLFpYK8SfSXZqYKXToVNtGsvj4NA.RLY_GzYE9j52mLPxu 5KJy26smLS9v4oepoPxl6qbA4Ev9u4xLjUN_0qh_4B7zHXvZfvOmOb0V.DY9 0gViSYmUWC_eC.XUstKj7RAsfv.NyqjkGxrIwM.0obGaFf.7NTZQ5ZUOsAcv qqUv1sqa.OqIYaXwVSIWyRGSfegkj3uL7XpmCWhUvEIpGKeDlb.yxCF7p.e0 3dEbSCC0YzfauMg76.J7hfX_DGZoSRcUKJjWbf64f3WUl X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r305636 - head/sys/ddb To: Bruce Evans , Justin Hibbits References: <201609090416.u894GriK087316@repo.freebsd.org> <20160909142012.W864@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Organization: Apache Software Foundation Message-ID: <4672379f-5288-8fac-29ac-dcc655bfe12a@apache.org> Date: Fri, 9 Sep 2016 11:27:46 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160909142012.W864@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 16:27:54 -0000 Hello; On 09/09/2016 00:27, Bruce Evans wrote: > On Fri, 9 Sep 2016, Justin Hibbits wrote: > >> Log: >> Correct the type of db_cmd_loop_done. >> >> On big endian hardware that uses 1 byte bool a type mismatch of bool >> vs int will >> cause the least signifcant byte of db_cmd_loop_done to be set, but >> the MSB to be >> read, and read as 0. This causes ddb to stay in an infinite loop. > > Hrmph. I objected to converting ddb to bool. > True. Changing to bool also uncovered some missing ANSIfication though. >> Modified: head/sys/ddb/db_command.c >> ============================================================================== >> >> --- head/sys/ddb/db_command.c Fri Sep 9 02:02:13 2016 (r305635) >> +++ head/sys/ddb/db_command.c Fri Sep 9 04:16:53 2016 (r305636) >> @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); >> /* >> * Exported global variables >> */ >> -bool db_cmd_loop_done; >> +int db_cmd_loop_done; >> db_addr_t db_dot; >> db_addr_t db_last_addr; >> db_addr_t db_prev; > > It used to use boolean_t, but was misinitialized with 0 and 1 instead of > FALSE and TRUE. Then it used bool, but was misinitialized with 0 and 1 > instead of false and true. Now it is initialized with matching types > for the literals, but its type regressed 2 steps. > > But what was the problem? (int)1 (or any nonzero value) is converted > to (bool)true on assigment. The final value is always 1 if converted > back to an int, and probably also when viewed as bits in memory. When > bool has 8 bits big endian, this means that it has bits 0b00000001 > where you can't really know the bit order within a byte. > Changing to bool unhides type mismatches. It may cause pain now but on the long run it may be better ... I think. It's a shame this will still hit 11.0 though. Pedro. From owner-svn-src-head@freebsd.org Fri Sep 9 17:15:17 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 87A51BD4595; Fri, 9 Sep 2016 17:15:17 +0000 (UTC) (envelope-from np@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 47F0AECB; Fri, 9 Sep 2016 17:15:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89HFGxr081530; Fri, 9 Sep 2016 17:15:16 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89HFGVY081529; Fri, 9 Sep 2016 17:15:16 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609091715.u89HFGVY081529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 9 Sep 2016 17:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305667 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 17:15:17 -0000 Author: np Date: Fri Sep 9 17:15:16 2016 New Revision: 305667 URL: https://svnweb.freebsd.org/changeset/base/305667 Log: cxgbe(4): Avoid a NULL dereference in the clearstats ioctl handler. Port softc's are not initialized when the adapter is in recovery mode. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Sep 9 16:18:44 2016 (r305666) +++ head/sys/dev/cxgbe/t4_main.c Fri Sep 9 17:15:16 2016 (r305667) @@ -8867,6 +8867,8 @@ t4_ioctl(struct cdev *dev, unsigned long if (port_id >= sc->params.nports) return (EINVAL); pi = sc->port[port_id]; + if (pi == NULL) + return (EIO); /* MAC stats */ t4_clr_port_stats(sc, pi->tx_chan); From owner-svn-src-head@freebsd.org Fri Sep 9 17:40: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 A4DD0BD4947; Fri, 9 Sep 2016 17:40:27 +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 687C5185C; Fri, 9 Sep 2016 17:40:27 +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 u89HeQt7089013; Fri, 9 Sep 2016 17:40:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89HeQnN089012; Fri, 9 Sep 2016 17:40:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609091740.u89HeQnN089012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 9 Sep 2016 17:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305668 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 17:40:27 -0000 Author: emaste Date: Fri Sep 9 17:40:26 2016 New Revision: 305668 URL: https://svnweb.freebsd.org/changeset/base/305668 Log: ANSIfy uipc_syscalls.c Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7839 Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Fri Sep 9 17:15:16 2016 (r305667) +++ head/sys/kern/uipc_syscalls.c Fri Sep 9 17:40:26 2016 (r305668) @@ -119,13 +119,7 @@ getsock_cap(struct thread *td, int fd, c #endif int -sys_socket(td, uap) - struct thread *td; - struct socket_args /* { - int domain; - int type; - int protocol; - } */ *uap; +sys_socket(struct thread *td, struct socket_args *uap) { struct socket *so; struct file *fp; @@ -169,15 +163,8 @@ sys_socket(td, uap) return (error); } -/* ARGSUSED */ int -sys_bind(td, uap) - struct thread *td; - struct bind_args /* { - int s; - caddr_t name; - int namelen; - } */ *uap; +sys_bind(struct thread *td, struct bind_args *uap) { struct sockaddr *sa; int error; @@ -224,16 +211,8 @@ kern_bindat(struct thread *td, int dirfd return (error); } -/* ARGSUSED */ int -sys_bindat(td, uap) - struct thread *td; - struct bindat_args /* { - int fd; - int s; - caddr_t name; - int namelen; - } */ *uap; +sys_bindat(struct thread *td, struct bindat_args *uap) { struct sockaddr *sa; int error; @@ -246,14 +225,8 @@ sys_bindat(td, uap) return (error); } -/* ARGSUSED */ int -sys_listen(td, uap) - struct thread *td; - struct listen_args /* { - int s; - int backlog; - } */ *uap; +sys_listen(struct thread *td, struct listen_args *uap) { struct socket *so; struct file *fp; @@ -513,15 +486,8 @@ oaccept(td, uap) } #endif /* COMPAT_OLDSOCK */ -/* ARGSUSED */ int -sys_connect(td, uap) - struct thread *td; - struct connect_args /* { - int s; - caddr_t name; - int namelen; - } */ *uap; +sys_connect(struct thread *td, struct connect_args *uap) { struct sockaddr *sa; int error; @@ -597,16 +563,8 @@ done1: return (error); } -/* ARGSUSED */ int -sys_connectat(td, uap) - struct thread *td; - struct connectat_args /* { - int fd; - int s; - caddr_t name; - int namelen; - } */ *uap; +sys_connectat(struct thread *td, struct connectat_args *uap) { struct sockaddr *sa; int error; @@ -718,11 +676,7 @@ sys_socketpair(struct thread *td, struct } static int -sendit(td, s, mp, flags) - struct thread *td; - int s; - struct msghdr *mp; - int flags; +sendit(struct thread *td, int s, struct msghdr *mp, int flags) { struct mbuf *control; struct sockaddr *to; @@ -780,13 +734,8 @@ bad: } int -kern_sendit(td, s, mp, flags, control, segflg) - struct thread *td; - int s; - struct msghdr *mp; - int flags; - struct mbuf *control; - enum uio_seg segflg; +kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, + struct mbuf *control, enum uio_seg segflg) { struct file *fp; struct uio auio; @@ -872,16 +821,7 @@ bad: } int -sys_sendto(td, uap) - struct thread *td; - struct sendto_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t to; - int tolen; - } */ *uap; +sys_sendto(struct thread *td, struct sendto_args *uap) { struct msghdr msg; struct iovec aiov; @@ -901,14 +841,7 @@ sys_sendto(td, uap) #ifdef COMPAT_OLDSOCK int -osend(td, uap) - struct thread *td; - struct osend_args /* { - int s; - caddr_t buf; - int len; - int flags; - } */ *uap; +osend(struct thread *td, struct osend_args *uap) { struct msghdr msg; struct iovec aiov; @@ -925,13 +858,7 @@ osend(td, uap) } int -osendmsg(td, uap) - struct thread *td; - struct osendmsg_args /* { - int s; - caddr_t msg; - int flags; - } */ *uap; +osendmsg(struct thread *td, struct osendmsg_args *uap) { struct msghdr msg; struct iovec *iov; @@ -952,13 +879,7 @@ osendmsg(td, uap) #endif int -sys_sendmsg(td, uap) - struct thread *td; - struct sendmsg_args /* { - int s; - caddr_t msg; - int flags; - } */ *uap; +sys_sendmsg(struct thread *td, struct sendmsg_args *uap) { struct msghdr msg; struct iovec *iov; @@ -980,12 +901,8 @@ sys_sendmsg(td, uap) } int -kern_recvit(td, s, mp, fromseg, controlp) - struct thread *td; - int s; - struct msghdr *mp; - enum uio_seg fromseg; - struct mbuf **controlp; +kern_recvit(struct thread *td, int s, struct msghdr *mp, enum uio_seg fromseg, + struct mbuf **controlp) { struct uio auio; struct iovec *iov; @@ -1142,11 +1059,7 @@ out: } static int -recvit(td, s, mp, namelenp) - struct thread *td; - int s; - struct msghdr *mp; - void *namelenp; +recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp) { int error; @@ -1164,16 +1077,7 @@ recvit(td, s, mp, namelenp) } int -sys_recvfrom(td, uap) - struct thread *td; - struct recvfrom_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - struct sockaddr * __restrict from; - socklen_t * __restrict fromlenaddr; - } */ *uap; +sys_recvfrom(struct thread *td, struct recvfrom_args *uap) { struct msghdr msg; struct iovec aiov; @@ -1201,9 +1105,7 @@ done2: #ifdef COMPAT_OLDSOCK int -orecvfrom(td, uap) - struct thread *td; - struct recvfrom_args *uap; +orecvfrom(struct thread *td, struct recvfrom_args *uap) { uap->flags |= MSG_COMPAT; @@ -1213,14 +1115,7 @@ orecvfrom(td, uap) #ifdef COMPAT_OLDSOCK int -orecv(td, uap) - struct thread *td; - struct orecv_args /* { - int s; - caddr_t buf; - int len; - int flags; - } */ *uap; +orecv(struct thread *td, struct orecv_args) { struct msghdr msg; struct iovec aiov; @@ -1242,13 +1137,7 @@ orecv(td, uap) * rights where the control fields are now. */ int -orecvmsg(td, uap) - struct thread *td; - struct orecvmsg_args /* { - int s; - struct omsghdr *msg; - int flags; - } */ *uap; +orecvmsg(struct thread *td, struct orecvmsg_args *uap) { struct msghdr msg; struct iovec *iov; @@ -1272,13 +1161,7 @@ orecvmsg(td, uap) #endif int -sys_recvmsg(td, uap) - struct thread *td; - struct recvmsg_args /* { - int s; - struct msghdr *msg; - int flags; - } */ *uap; +sys_recvmsg(struct thread *td, struct recvmsg_args *uap) { struct msghdr msg; struct iovec *uiov, *iov; @@ -1305,14 +1188,8 @@ sys_recvmsg(td, uap) return (error); } -/* ARGSUSED */ int -sys_shutdown(td, uap) - struct thread *td; - struct shutdown_args /* { - int s; - int how; - } */ *uap; +sys_shutdown(struct thread *td, struct shutdown_args *uap) { struct socket *so; struct file *fp; @@ -1339,17 +1216,8 @@ sys_shutdown(td, uap) return (error); } -/* ARGSUSED */ int -sys_setsockopt(td, uap) - struct thread *td; - struct setsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int valsize; - } */ *uap; +sys_setsockopt(struct thread *td, struct setsockopt_args *uap) { return (kern_setsockopt(td, uap->s, uap->level, uap->name, @@ -1357,14 +1225,8 @@ sys_setsockopt(td, uap) } int -kern_setsockopt(td, s, level, name, val, valseg, valsize) - struct thread *td; - int s; - int level; - int name; - void *val; - enum uio_seg valseg; - socklen_t valsize; +kern_setsockopt(struct thread *td, int s, int level, int name, void *val, + enum uio_seg valseg, socklen_t valsize) { struct socket *so; struct file *fp; @@ -1404,17 +1266,8 @@ kern_setsockopt(td, s, level, name, val, return(error); } -/* ARGSUSED */ int -sys_getsockopt(td, uap) - struct thread *td; - struct getsockopt_args /* { - int s; - int level; - int name; - void * __restrict val; - socklen_t * __restrict avalsize; - } */ *uap; +sys_getsockopt(struct thread *td, struct getsockopt_args *uap) { socklen_t valsize; int error; @@ -1438,14 +1291,8 @@ sys_getsockopt(td, uap) * optval can be a userland or userspace. optlen is always a kernel pointer. */ int -kern_getsockopt(td, s, level, name, val, valseg, valsize) - struct thread *td; - int s; - int level; - int name; - void *val; - enum uio_seg valseg; - socklen_t *valsize; +kern_getsockopt(struct thread *td, int s, int level, int name, void *val, + enum uio_seg valseg, socklen_t *valsize) { struct socket *so; struct file *fp; @@ -1489,16 +1336,8 @@ kern_getsockopt(td, s, level, name, val, /* * getsockname1() - Get socket name. */ -/* ARGSUSED */ static int -getsockname1(td, uap, compat) - struct thread *td; - struct getsockname_args /* { - int fdes; - struct sockaddr * __restrict asa; - socklen_t * __restrict alen; - } */ *uap; - int compat; +getsockname1(struct thread *td, struct getsockname_args *uap, int compat) { struct sockaddr *sa; socklen_t len; @@ -1566,9 +1405,7 @@ bad: } int -sys_getsockname(td, uap) - struct thread *td; - struct getsockname_args *uap; +sys_getsockname(struct thread *td, struct getsockname_args *uap) { return (getsockname1(td, uap, 0)); @@ -1576,9 +1413,7 @@ sys_getsockname(td, uap) #ifdef COMPAT_OLDSOCK int -ogetsockname(td, uap) - struct thread *td; - struct getsockname_args *uap; +ogetsockname(struct thread *td, struct getsockname_args *uap) { return (getsockname1(td, uap, 1)); @@ -1588,16 +1423,8 @@ ogetsockname(td, uap) /* * getpeername1() - Get name of peer for connected socket. */ -/* ARGSUSED */ static int -getpeername1(td, uap, compat) - struct thread *td; - struct getpeername_args /* { - int fdes; - struct sockaddr * __restrict asa; - socklen_t * __restrict alen; - } */ *uap; - int compat; +getpeername1(struct thread *td, struct getpeername_args *uap, int compat) { struct sockaddr *sa; socklen_t len; @@ -1670,9 +1497,7 @@ done: } int -sys_getpeername(td, uap) - struct thread *td; - struct getpeername_args *uap; +sys_getpeername(struct thread *td, struct getpeername_args *uap) { return (getpeername1(td, uap, 0)); @@ -1680,9 +1505,7 @@ sys_getpeername(td, uap) #ifdef COMPAT_OLDSOCK int -ogetpeername(td, uap) - struct thread *td; - struct ogetpeername_args *uap; +ogetpeername(struct thread *td, struct ogetpeername_args *uap) { /* XXX uap should have type `getpeername_args *' to begin with. */ @@ -1727,10 +1550,7 @@ sockargs(struct mbuf **mp, char *buf, so } int -getsockaddr(namp, uaddr, len) - struct sockaddr **namp; - caddr_t uaddr; - size_t len; +getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) { struct sockaddr *sa; int error; From owner-svn-src-head@freebsd.org Fri Sep 9 18:24: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 43D8ABD4499; Fri, 9 Sep 2016 18:24:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 2BD281B3; Fri, 9 Sep 2016 18:24:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 11F641CA5; Fri, 9 Sep 2016 18:24:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id B86EF240E1; Fri, 9 Sep 2016 18:24:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id FjU20hcc1VbK; Fri, 9 Sep 2016 18:24:31 +0000 (UTC) Subject: Re: svn commit: r305634 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com AFB51240DC To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609090121.u891LZOO023156@repo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: Date: Fri, 9 Sep 2016 11:24:27 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <201609090121.u891LZOO023156@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PcFSMTIux9EKEPS6KoGo3qwL1cV4LMvcV" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 18:24:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PcFSMTIux9EKEPS6KoGo3qwL1cV4LMvcV Content-Type: multipart/mixed; boundary="bgE9gdGpkrBXFgD5wOIBaia4GB6mFp6SX"; protected-headers="v1" From: Bryan Drewery To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r305634 - head/share/mk References: <201609090121.u891LZOO023156@repo.freebsd.org> In-Reply-To: <201609090121.u891LZOO023156@repo.freebsd.org> --bgE9gdGpkrBXFgD5wOIBaia4GB6mFp6SX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 9/8/16 6:21 PM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Sep 9 01:21:35 2016 > New Revision: 305634 > URL: https://svnweb.freebsd.org/changeset/base/305634 >=20 > Log: > Update to latest dirdeps.mk > =20 > Take advantage of new bmake feature to only consider Makefile.depend > as invalidating DIRDEPS_CACHE. > =20 > When bootstrapping allow more filtering via .MAKE.DEPENDFILE_BOOTSTRA= P_SED > =20 > Move some comments back to where they make sense. > =20 > meta.sys.mk: add META_COOKIE_TOUCH and META_NOPHONY to better handle = some > targets in meta mode vs non-meta mode. > Also use .MAKE.META.IGNORE_PATHS to ignore mtime of makefiles - which= do > not matter in meta mode. >=20 > Modified: > head/share/mk/dirdeps.mk > head/share/mk/meta.sys.mk >=20 > Modified: head/share/mk/dirdeps.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/dirdeps.mk Fri Sep 9 01:09:39 2016 (r305633) > +++ head/share/mk/dirdeps.mk Fri Sep 9 01:21:35 2016 (r305634) > @@ -1,5 +1,5 @@ > # $FreeBSD$ > -# $Id: dirdeps.mk,v 1.62 2016/03/16 00:11:53 sjg Exp $ > +# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ > =20 > # Copyright (c) 2010-2013, Juniper Networks, Inc. > # All rights reserved. > @@ -117,12 +117,17 @@ _DIRDEP_USE_LEVEL?=3D 0 > .if ${.MAKE.LEVEL} =3D=3D ${_DIRDEP_USE_LEVEL} > # only the first instance is interested in all this > =20 > -# First off, we want to know what ${MACHINE} to build for. > -# This can be complicated if we are using a mixture of ${MACHINE} spec= ific > -# and non-specific Makefile.depend* > - > .if !target(_DIRDEP_USE) > =20 > +# do some setup we only need once > +_CURDIR ?=3D ${.CURDIR} > +_OBJDIR ?=3D ${.OBJDIR} > + > +now_utc =3D ${%s:L:gmtime} > +.if !defined(start_utc) > +start_utc :=3D ${now_utc} > +.endif > + > .if ${MAKEFILE:T} =3D=3D ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS= :Uall:M*/*} !=3D "" > # This little trick let's us do > # > @@ -145,15 +150,6 @@ MK_DIRDEPS_CACHE =3D no > # make sure we get the behavior we expect > .MAKE.SAVE_DOLLARS =3D no > =20 > -# do some setup we only need once > -_CURDIR ?=3D ${.CURDIR} > -_OBJDIR ?=3D ${.OBJDIR} > - > -now_utc =3D ${%s:L:gmtime} > -.if !defined(start_utc) > -start_utc :=3D ${now_utc} > -.endif > - > # make sure these are empty to start with > _DEP_TARGET_SPEC =3D > =20 > @@ -224,6 +220,10 @@ N_notmachine :=3D ${.MAKE.DEPENDFILE_PREFE > =20 > .endif # !target(_DIRDEP_USE) > =20 > +# First off, we want to know what ${MACHINE} to build for. > +# This can be complicated if we are using a mixture of ${MACHINE} spec= ific > +# and non-specific Makefile.depend* > + > # if we were included recursively _DEP_TARGET_SPEC should be valid. > .if empty(_DEP_TARGET_SPEC) > # we may or may not have included a dependfile yet > @@ -386,7 +386,7 @@ BUILD_DIRDEPS ?=3D yes > .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) > .if ${MK_DIRDEPS_CACHE} =3D=3D "yes" > # this is where we will cache all our work > -DIRDEPS_CACHE?=3D ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,= _,g:S,^,.,:N.} > +DIRDEPS_CACHE?=3D ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S= ,/,_,g:S,^,.,:N.} > =20 > # just ensure this exists > build-dirdeps: > @@ -398,6 +398,9 @@ M_oneperline =3D @x@\\${.newline} $$x@ > # we do this via sub-make > BUILD_DIRDEPS =3D no > =20 > +# ignore anything but these > +.MAKE.META.IGNORE_FILTER =3D M*/${.MAKE.DEPENDFILE_PREFIX}* > + > dirdeps: dirdeps-cached > dirdeps-cached: ${DIRDEPS_CACHE} .MAKE > @echo "${TRACER}Using ${DIRDEPS_CACHE}" > @@ -670,7 +673,10 @@ _DEP_RELDIR :=3D ${RELDIR} > make(bootstrap-recurse) || \ > make(bootstrap-empty)) > =20 > -.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) > +# if we are bootstrapping create the default > +_want =3D ${.CURDIR}/${.MAKE.DEPENDFILE_DEFAULT:T} > + > +.if exists(${_want}) > # stop here > ${.TARGETS:Mboot*}: > .elif !make(bootstrap-empty) > @@ -680,12 +686,19 @@ _src !=3D cd ${.CURDIR} && for m in ${.MAK > .error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}U= se: bootstrap-empty > .endif > =20 > -_src?=3D ${.MAKE.DEPENDFILE:T} > +_src?=3D ${.MAKE.DEPENDFILE} > + > +.MAKE.DEPENDFILE_BOOTSTRAP_SED+=3D -e 's,${_src:E},${MACHINE},g' > =20 > # just create Makefile.depend* for this dir > bootstrap-this: .NOTMAIN > - @echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T} > - (cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DE= PENDFILE:T}) > + @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ > + echo You need to build ${RELDIR} to correctly populate it. > +.if ${_src:T} !=3D ${.MAKE.DEPENDFILE_PREFIX:T} > + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_= want}) > +.else > + cp ${.CURDIR}/${_src:T} ${_want} > +.endif > =20 > # create Makefile.depend* for this dir and its dependencies > bootstrap: bootstrap-recurse > @@ -705,8 +718,8 @@ bootstrap-recurse: .NOTMAIN .MAKE > =20 > # create an empty Makefile.depend* to get the ball rolling. > bootstrap-empty: .NOTMAIN .NOMETA > - @echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \ > + @echo Creating empty ${RELDIR}/${_want:T}; \ > echo You need to build ${RELDIR} to correctly populate it. > - @{ echo DIRDEPS=3D; echo ".include "; } > ${.CURDIR}/${.M= AKE.DEPENDFILE:T} > + @{ echo DIRDEPS=3D; echo ".include "; } > ${_want} > =20 > .endif >=20 > Modified: head/share/mk/meta.sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/meta.sys.mk Fri Sep 9 01:09:39 2016 (r305633) > +++ head/share/mk/meta.sys.mk Fri Sep 9 01:21:35 2016 (r305634) > @@ -26,6 +26,10 @@ > # absoulte path to what we are reading. > _PARSEDIR =3D ${.PARSEDIR:tA} > =20 > +.if !defined(SYS_MK_DIR) > +SYS_MK_DIR :=3D ${_PARSEDIR} > +.endif > + > META_MODE +=3D meta verbose > .MAKE.MODE ?=3D ${META_MODE} > =20 > @@ -110,10 +114,26 @@ _metaError: .NOMETA .NOTMAIN > =20 > .endif > =20 > +META_COOKIE_TOUCH=3D > +# some targets need to be .PHONY in non-meta mode > +META_NOPHONY=3D .PHONY > # Are we, after all, in meta mode? > .if ${.MAKE.MODE:Uno:Mmeta*} !=3D "" > MKDEP_MK =3D meta.autodep.mk > =20 > +# we can afford to use cookies to prevent some targets > +# re-running needlessly > +META_COOKIE_TOUCH=3D touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}= Could you use ?=3D here please? I have a META_COOKIE_TOUCH in local.sys.m= k that is slightly different for handling absolute pathed cookies (with =2EOBJDIR in them). Also note that you need to remove this cookie immediately in any target that uses it. I covered this a bit in my BSDCan presentation. The problem is if meta mode determines that a target is outdated, then partially rebuilds the target, then fails before touching the cookie. The next build may not consider the target out-of-date anymore and fail to retry. Consider something like: foo: foo.c target_install: cp foo ${DESTDIR}/usr/bin/ touch target_install It may consider this target out-of-date due to foo rebuilding (and detected in target_install.meta), but the cp may fail. The next build, target_install.meta was overwritten with the failed attempt, and is now newer than foo and still has its target_install cookie. Nothing will cause it to retry copying, and it proceeds on with the build without properly failing again. I hit this case in at least include/ (which went through a lot of further changes, finally of which was the removal of cookies in r300346) and some other cases which I don't recall the specifics for. > +META_NOPHONY=3D > + > +# some targets involve old pre-built targets > +# ignore mtime of shell > +# and mtime of makefiles does not matter in meta mode > +.MAKE.META.IGNORE_PATHS +=3D \ > + ${MAKEFILE} \ > + ${SHELL} \ > + ${SYS_MK_DIR} > + > # if we think we are updating dependencies,=20 > # then filemon had better be present > .if ${UPDATE_DEPENDFILE:Uyes:tl} !=3D "no" && !exists(/dev/filemon) >=20 --=20 Regards, Bryan Drewery --bgE9gdGpkrBXFgD5wOIBaia4GB6mFp6SX-- --PcFSMTIux9EKEPS6KoGo3qwL1cV4LMvcV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJX0v5cAAoJEDXXcbtuRpfP+zIIAIabEawHgnsctmnHUdfsctKx lUJl7kz2Teil11cq/wNiD6vohkmEXNB+3zAh6iWkva3JpgCNdXcrqC1i1pcZM1GV bC5oE/b9imbp58EeaQlOrcev5qU5IOaGEMDnU1lUkoJnnqeQYw0VhLWdaTgErEWK /XRq2kFGxc7QOYoRzexf4SC8RjthbZY/AquR6ShQeIGXmefDzBZE2Sc9YcIaVjmx JuOOnw3ywoP0hdb5vLAHxw0dZ7E1ZK743S2XrYe4r2BHFU9nqpoOCwl0R987Gycx YBgnp9PqjBPLd7fN5UxPqz77wz+B99PXhKM1FlMWpBpBhNbmr+WKd0VFO+o714c= =t09I -----END PGP SIGNATURE----- --PcFSMTIux9EKEPS6KoGo3qwL1cV4LMvcV-- From owner-svn-src-head@freebsd.org Fri Sep 9 18:29:24 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 4DAC0BD45FC; Fri, 9 Sep 2016 18:29:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 35B4B7A0; Fri, 9 Sep 2016 18:29:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 2453A1F94; Fri, 9 Sep 2016 18:29:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id E1750240FF; Fri, 9 Sep 2016 18:29:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id A26aTxo4KfbC; Fri, 9 Sep 2016 18:29:18 +0000 (UTC) Subject: Re: svn commit: r305634 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com B16FE240F6 To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609090121.u891LZOO023156@repo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: Date: Fri, 9 Sep 2016 11:29:16 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <201609090121.u891LZOO023156@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="b2LLHF3rXQuC7goSJGUI0wKvg1qFKiJC4" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 09 Sep 2016 18:29:24 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --b2LLHF3rXQuC7goSJGUI0wKvg1qFKiJC4 Content-Type: multipart/mixed; boundary="kdxOXeX0WTFb1VliHB6D3XS12MGCssu1X"; protected-headers="v1" From: Bryan Drewery To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r305634 - head/share/mk References: <201609090121.u891LZOO023156@repo.freebsd.org> In-Reply-To: <201609090121.u891LZOO023156@repo.freebsd.org> --kdxOXeX0WTFb1VliHB6D3XS12MGCssu1X Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 9/8/16 6:21 PM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Sep 9 01:21:35 2016 > New Revision: 305634 > URL: https://svnweb.freebsd.org/changeset/base/305634 >=20 > Log: > Update to latest dirdeps.mk > =20 > Take advantage of new bmake feature to only consider Makefile.depend > as invalidating DIRDEPS_CACHE. > =20 > When bootstrapping allow more filtering via .MAKE.DEPENDFILE_BOOTSTRA= P_SED > =20 > Move some comments back to where they make sense. > =20 > meta.sys.mk: add META_COOKIE_TOUCH and META_NOPHONY to better handle = some > targets in meta mode vs non-meta mode. > Also use .MAKE.META.IGNORE_PATHS to ignore mtime of makefiles - which= do > not matter in meta mode. >=20 > Modified: > head/share/mk/dirdeps.mk > head/share/mk/meta.sys.mk >=20 > Modified: head/share/mk/dirdeps.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/dirdeps.mk Fri Sep 9 01:09:39 2016 (r305633) > +++ head/share/mk/dirdeps.mk Fri Sep 9 01:21:35 2016 (r305634) > @@ -1,5 +1,5 @@ > # $FreeBSD$ > -# $Id: dirdeps.mk,v 1.62 2016/03/16 00:11:53 sjg Exp $ > +# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ > =20 > # Copyright (c) 2010-2013, Juniper Networks, Inc. > # All rights reserved. > @@ -117,12 +117,17 @@ _DIRDEP_USE_LEVEL?=3D 0 > .if ${.MAKE.LEVEL} =3D=3D ${_DIRDEP_USE_LEVEL} > # only the first instance is interested in all this > =20 > -# First off, we want to know what ${MACHINE} to build for. > -# This can be complicated if we are using a mixture of ${MACHINE} spec= ific > -# and non-specific Makefile.depend* > - > .if !target(_DIRDEP_USE) > =20 > +# do some setup we only need once > +_CURDIR ?=3D ${.CURDIR} > +_OBJDIR ?=3D ${.OBJDIR} > + > +now_utc =3D ${%s:L:gmtime} > +.if !defined(start_utc) > +start_utc :=3D ${now_utc} > +.endif > + > .if ${MAKEFILE:T} =3D=3D ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS= :Uall:M*/*} !=3D "" > # This little trick let's us do > # > @@ -145,15 +150,6 @@ MK_DIRDEPS_CACHE =3D no > # make sure we get the behavior we expect > .MAKE.SAVE_DOLLARS =3D no > =20 > -# do some setup we only need once > -_CURDIR ?=3D ${.CURDIR} > -_OBJDIR ?=3D ${.OBJDIR} > - > -now_utc =3D ${%s:L:gmtime} > -.if !defined(start_utc) > -start_utc :=3D ${now_utc} > -.endif > - > # make sure these are empty to start with > _DEP_TARGET_SPEC =3D > =20 > @@ -224,6 +220,10 @@ N_notmachine :=3D ${.MAKE.DEPENDFILE_PREFE > =20 > .endif # !target(_DIRDEP_USE) > =20 > +# First off, we want to know what ${MACHINE} to build for. > +# This can be complicated if we are using a mixture of ${MACHINE} spec= ific > +# and non-specific Makefile.depend* > + > # if we were included recursively _DEP_TARGET_SPEC should be valid. > .if empty(_DEP_TARGET_SPEC) > # we may or may not have included a dependfile yet > @@ -386,7 +386,7 @@ BUILD_DIRDEPS ?=3D yes > .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) > .if ${MK_DIRDEPS_CACHE} =3D=3D "yes" > # this is where we will cache all our work > -DIRDEPS_CACHE?=3D ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,= _,g:S,^,.,:N.} > +DIRDEPS_CACHE?=3D ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S= ,/,_,g:S,^,.,:N.} > =20 > # just ensure this exists > build-dirdeps: > @@ -398,6 +398,9 @@ M_oneperline =3D @x@\\${.newline} $$x@ > # we do this via sub-make > BUILD_DIRDEPS =3D no > =20 > +# ignore anything but these > +.MAKE.META.IGNORE_FILTER =3D M*/${.MAKE.DEPENDFILE_PREFIX}* > + > dirdeps: dirdeps-cached > dirdeps-cached: ${DIRDEPS_CACHE} .MAKE > @echo "${TRACER}Using ${DIRDEPS_CACHE}" > @@ -670,7 +673,10 @@ _DEP_RELDIR :=3D ${RELDIR} > make(bootstrap-recurse) || \ > make(bootstrap-empty)) > =20 > -.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) > +# if we are bootstrapping create the default > +_want =3D ${.CURDIR}/${.MAKE.DEPENDFILE_DEFAULT:T} > + > +.if exists(${_want}) > # stop here > ${.TARGETS:Mboot*}: > .elif !make(bootstrap-empty) > @@ -680,12 +686,19 @@ _src !=3D cd ${.CURDIR} && for m in ${.MAK > .error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}U= se: bootstrap-empty > .endif > =20 > -_src?=3D ${.MAKE.DEPENDFILE:T} > +_src?=3D ${.MAKE.DEPENDFILE} > + > +.MAKE.DEPENDFILE_BOOTSTRAP_SED+=3D -e 's,${_src:E},${MACHINE},g' > =20 > # just create Makefile.depend* for this dir > bootstrap-this: .NOTMAIN > - @echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T} > - (cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DE= PENDFILE:T}) > + @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ > + echo You need to build ${RELDIR} to correctly populate it. > +.if ${_src:T} !=3D ${.MAKE.DEPENDFILE_PREFIX:T} > + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_= want}) > +.else > + cp ${.CURDIR}/${_src:T} ${_want} > +.endif > =20 > # create Makefile.depend* for this dir and its dependencies > bootstrap: bootstrap-recurse > @@ -705,8 +718,8 @@ bootstrap-recurse: .NOTMAIN .MAKE > =20 > # create an empty Makefile.depend* to get the ball rolling. > bootstrap-empty: .NOTMAIN .NOMETA > - @echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \ > + @echo Creating empty ${RELDIR}/${_want:T}; \ > echo You need to build ${RELDIR} to correctly populate it. > - @{ echo DIRDEPS=3D; echo ".include "; } > ${.CURDIR}/${.M= AKE.DEPENDFILE:T} > + @{ echo DIRDEPS=3D; echo ".include "; } > ${_want} > =20 > .endif >=20 > Modified: head/share/mk/meta.sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/meta.sys.mk Fri Sep 9 01:09:39 2016 (r305633) > +++ head/share/mk/meta.sys.mk Fri Sep 9 01:21:35 2016 (r305634) > @@ -26,6 +26,10 @@ > # absoulte path to what we are reading. > _PARSEDIR =3D ${.PARSEDIR:tA} > =20 > +.if !defined(SYS_MK_DIR) > +SYS_MK_DIR :=3D ${_PARSEDIR} > +.endif > + > META_MODE +=3D meta verbose > .MAKE.MODE ?=3D ${META_MODE} > =20 > @@ -110,10 +114,26 @@ _metaError: .NOMETA .NOTMAIN > =20 > .endif > =20 > +META_COOKIE_TOUCH=3D > +# some targets need to be .PHONY in non-meta mode > +META_NOPHONY=3D .PHONY > # Are we, after all, in meta mode? > .if ${.MAKE.MODE:Uno:Mmeta*} !=3D "" > MKDEP_MK =3D meta.autodep.mk > =20 > +# we can afford to use cookies to prevent some targets > +# re-running needlessly > +META_COOKIE_TOUCH=3D touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}= > +META_NOPHONY=3D > + > +# some targets involve old pre-built targets > +# ignore mtime of shell > +# and mtime of makefiles does not matter in meta mode > +.MAKE.META.IGNORE_PATHS +=3D \ > + ${MAKEFILE} \ > + ${SHELL} \ > + ${SYS_MK_DIR} I think it could be problematic to ignore *.mk changes. The build commands may stay the same, but targets could grow new dependencies. If those dependencies are already "met" then meta mode won't reconsider them= =2E Consider: Build 1: bar: touch dep touch bar foo: touch foo all: bar foo In the first build, all generates dep, bar and foo. Then the code is changed to: bar: touch bar dep: touch notmade touch dep foo: dep touch foo all: foo bar Now in the second build, all finds bar command changes and rebuilds, finds foo command is the same and that dep is already satisfied from the last build. So 'notmade' is never made. > + > # if we think we are updating dependencies,=20 > # then filemon had better be present > .if ${UPDATE_DEPENDFILE:Uyes:tl} !=3D "no" && !exists(/dev/filemon) >=20 --=20 Regards, Bryan Drewery --kdxOXeX0WTFb1VliHB6D3XS12MGCssu1X-- --b2LLHF3rXQuC7goSJGUI0wKvg1qFKiJC4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJX0v99AAoJEDXXcbtuRpfPjFgH/3VJYrei1zJwZ7up0EoxKAR6 432UIDjDACoHmoi/2zVRJ/9WRXqj0MB6HHwOo1Hg+kxtgU8Urq20Iwoc07ExpPZp 1XFj2Tevu4OD1He4MqJ/bGxxaxv5yrPrU+E3dVjrKK9CmoXXmxSZZP5/8+pVQc+N srJgSmL5Nui66bVg6buiPooQWtUNdvPsJbDyjzN+D79ias12L7lx5AxhhGrK6xme buw3CImAlb81bWG06kb4DPTXlykigubSQUWcB7gJFAyd6y2Tj27HKEQ71as5GwQj CTXl1L6HF9txfw9K/jWA/ckiUmO18RLA0YKtbE2cF3QG9LrdsOOCTAr0YSlCuUM= =BpF4 -----END PGP SIGNATURE----- --b2LLHF3rXQuC7goSJGUI0wKvg1qFKiJC4-- From owner-svn-src-head@freebsd.org Fri Sep 9 18:49: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 A8276BD49E6; Fri, 9 Sep 2016 18:49:46 +0000 (UTC) (envelope-from bdrewery@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 7809D308; Fri, 9 Sep 2016 18:49:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89InjWx015606; Fri, 9 Sep 2016 18:49:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89Injol015605; Fri, 9 Sep 2016 18:49:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201609091849.u89Injol015605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 9 Sep 2016 18:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305670 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 18:49:46 -0000 Author: bdrewery Date: Fri Sep 9 18:49:45 2016 New Revision: 305670 URL: https://svnweb.freebsd.org/changeset/base/305670 Log: Fix regression from r304644 which could cause .WAITs in SUBDIR to be ignored. This was possible if a STANDALONE_SUBDIR_TARGET item came in SUBDIR_TARGETS before 'all', which would then cause SUBDIR to have all .WAIT's removed. Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.subdir.mk Modified: head/share/mk/bsd.subdir.mk ============================================================================== --- head/share/mk/bsd.subdir.mk Fri Sep 9 18:18:37 2016 (r305669) +++ head/share/mk/bsd.subdir.mk Fri Sep 9 18:49:45 2016 (r305670) @@ -141,12 +141,13 @@ ${__dir}: all_subdir_${DIRPRFX}${__dir} # Can ordering be skipped for this and SUBDIR_PARALLEL forced? .if ${STANDALONE_SUBDIR_TARGETS:M${__target}} _is_standalone_target= 1 -SUBDIR:= ${SUBDIR:N.WAIT} +_subdir_filter= N.WAIT .else _is_standalone_target= 0 +_subdir_filter= .endif __subdir_targets= -.for __dir in ${SUBDIR} +.for __dir in ${SUBDIR:${_subdir_filter}} .if ${__dir} == .WAIT __subdir_targets+= .WAIT .else From owner-svn-src-head@freebsd.org Fri Sep 9 19:13:04 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 1959ABD431A; Fri, 9 Sep 2016 19:13:04 +0000 (UTC) (envelope-from mjg@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 E7995872; Fri, 9 Sep 2016 19:13:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u89JD3YP027227; Fri, 9 Sep 2016 19:13:03 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89JD3k5027226; Fri, 9 Sep 2016 19:13:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609091913.u89JD3k5027226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 9 Sep 2016 19:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305671 - 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.23 Precedence: list List-Id: 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, 09 Sep 2016 19:13:04 -0000 Author: mjg Date: Fri Sep 9 19:13:02 2016 New Revision: 305671 URL: https://svnweb.freebsd.org/changeset/base/305671 Log: locks: add backoff for spin mutexes and thread lock Reviewed by: jhb Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Sep 9 18:49:45 2016 (r305670) +++ head/sys/kern/kern_mutex.c Fri Sep 9 19:13:02 2016 (r305671) @@ -170,6 +170,36 @@ mtx_delay_sysinit(void *dummy) LOCK_DELAY_SYSINIT(mtx_delay_sysinit); #endif +static SYSCTL_NODE(_debug, OID_AUTO, mtx_spin, CTLFLAG_RD, NULL, + "mtx spin debugging"); + +static struct lock_delay_config mtx_spin_delay = { + .initial = 1000, + .step = 500, + .min = 100, + .max = 5000, +}; + +SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_initial, CTLFLAG_RW, + &mtx_spin_delay.initial, 0, ""); +SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_step, CTLFLAG_RW, &mtx_spin_delay.step, + 0, ""); +SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_min, CTLFLAG_RW, &mtx_spin_delay.min, + 0, ""); +SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_max, CTLFLAG_RW, &mtx_spin_delay.max, + 0, ""); + +static void +mtx_spin_delay_sysinit(void *dummy) +{ + + mtx_spin_delay.initial = mp_ncpus * 25; + mtx_spin_delay.step = (mp_ncpus * 25) / 2; + mtx_spin_delay.min = mp_ncpus * 5; + mtx_spin_delay.max = mp_ncpus * 25 * 10; +} +LOCK_DELAY_SYSINIT(mtx_spin_delay_sysinit); + /* * System-wide mutexes */ @@ -641,7 +671,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t const char *file, int line) { struct mtx *m; - int i = 0; + struct lock_delay_arg lda; #ifdef LOCK_PROFILING int contested = 0; uint64_t waittime = 0; @@ -653,6 +683,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t if (SCHEDULER_STOPPED()) return; + lock_delay_arg_init(&lda, &mtx_spin_delay); m = mtxlock2mtx(c); if (LOCK_LOG_TEST(&m->lock_object, opts)) @@ -673,11 +704,13 @@ _mtx_lock_spin_cookie(volatile uintptr_t /* Give interrupts a chance while we spin. */ spinlock_exit(); while (m->mtx_lock != MTX_UNOWNED) { - if (i++ < 10000000) { - cpu_spinwait(); + if (lda.spin_cnt < 10000000) { + lock_delay(&lda); continue; } - if (i < 60000000 || kdb_active || panicstr != NULL) + lda.spin_cnt++; + if (lda.spin_cnt < 60000000 || kdb_active || + panicstr != NULL) DELAY(1); else _mtx_lock_spin_failed(m); @@ -708,7 +741,7 @@ thread_lock_flags_(struct thread *td, in { struct mtx *m; uintptr_t tid; - int i; + struct lock_delay_arg lda; #ifdef LOCK_PROFILING int contested = 0; uint64_t waittime = 0; @@ -717,7 +750,6 @@ thread_lock_flags_(struct thread *td, in int64_t spin_time = 0; #endif - i = 0; tid = (uintptr_t)curthread; if (SCHEDULER_STOPPED()) { @@ -730,6 +762,8 @@ thread_lock_flags_(struct thread *td, in return; } + lock_delay_arg_init(&lda, &mtx_spin_delay); + #ifdef KDTRACE_HOOKS spin_time -= lockstat_nsecs(&td->td_lock->lock_object); #endif @@ -763,14 +797,17 @@ retry: /* Give interrupts a chance while we spin. */ spinlock_exit(); while (m->mtx_lock != MTX_UNOWNED) { - if (i++ < 10000000) + if (lda.spin_cnt < 10000000) { + lock_delay(&lda); + } else { + lda.spin_cnt++; + if (lda.spin_cnt < 60000000 || + kdb_active || panicstr != NULL) + DELAY(1); + else + _mtx_lock_spin_failed(m); cpu_spinwait(); - else if (i < 60000000 || - kdb_active || panicstr != NULL) - DELAY(1); - else - _mtx_lock_spin_failed(m); - cpu_spinwait(); + } if (m != td->td_lock) goto retry; } From owner-svn-src-head@freebsd.org Fri Sep 9 21:58: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 81FD9BD4E25; Fri, 9 Sep 2016 21:58:49 +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 443B3EC0; Fri, 9 Sep 2016 21:58:49 +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 u89LwmXT089436; Fri, 9 Sep 2016 21:58:48 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u89LwmrA089433; Fri, 9 Sep 2016 21:58:48 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201609092158.u89LwmrA089433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 9 Sep 2016 21:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305676 - in head: sys/kern 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.23 Precedence: list List-Id: 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, 09 Sep 2016 21:58:49 -0000 Author: jilles Date: Fri Sep 9 21:58:48 2016 New Revision: 305676 URL: https://svnweb.freebsd.org/changeset/base/305676 Log: wait: Do not copyout uninitialized status/rusage/wrusage. If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and wrusage information should not be returned. PR: 212048 Reported by: Casey Lucas MFC after: 2 weeks Added: head/tests/sys/kern/waitpid_nohang.c (contents, props changed) Modified: head/sys/kern/kern_exit.c head/tests/sys/kern/Makefile Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Fri Sep 9 21:19:31 2016 (r305675) +++ head/sys/kern/kern_exit.c Fri Sep 9 21:58:48 2016 (r305676) @@ -723,9 +723,9 @@ sys_wait4(struct thread *td, struct wait else rup = NULL; error = kern_wait(td, uap->pid, &status, uap->options, rup); - if (uap->status != NULL && error == 0) + if (uap->status != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&status, uap->status, sizeof(status)); - if (uap->rusage != NULL && error == 0) + if (uap->rusage != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&ru, uap->rusage, sizeof(struct rusage)); return (error); } @@ -759,9 +759,9 @@ sys_wait6(struct thread *td, struct wait */ error = kern_wait6(td, idtype, id, &status, uap->options, wrup, sip); - if (uap->status != NULL && error == 0) + if (uap->status != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&status, uap->status, sizeof(status)); - if (uap->wrusage != NULL && error == 0) + if (uap->wrusage != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&wru, uap->wrusage, sizeof(wru)); if (uap->info != NULL && error == 0) error = copyout(&si, uap->info, sizeof(si)); Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Fri Sep 9 21:19:31 2016 (r305675) +++ head/tests/sys/kern/Makefile Fri Sep 9 21:58:48 2016 (r305676) @@ -12,6 +12,7 @@ PLAIN_TESTS_C+= subr_unit_test ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test TEST_METADATA.unix_seqpacket_test+= timeout="15" +ATF_TESTS_C+= waitpid_nohang LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread Added: head/tests/sys/kern/waitpid_nohang.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kern/waitpid_nohang.c Fri Sep 9 21:58:48 2016 (r305676) @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2016 Jilles Tjoelker + * 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 + +ATF_TC_WITHOUT_HEAD(waitpid_nohang); +ATF_TC_BODY(waitpid_nohang, tc) +{ + pid_t child, pid; + int status, r; + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + sleep(10); + _exit(1); + } + + status = 42; + pid = waitpid(child, &status, WNOHANG); + ATF_REQUIRE(pid == 0); + ATF_CHECK(status == 42); + + r = kill(child, SIGTERM); + ATF_REQUIRE(r == 0); + r = waitid(P_PID, child, NULL, WEXITED | WNOWAIT); + ATF_REQUIRE(r == 0); + + status = -1; + pid = waitpid(child, &status, WNOHANG); + ATF_REQUIRE(pid == child); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, waitpid_nohang); + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Sat Sep 10 01:09:59 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 82131BD48A3; Sat, 10 Sep 2016 01:09:59 +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 43D2D212; Sat, 10 Sep 2016 01:09:59 +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 u8A19wkW060844; Sat, 10 Sep 2016 01:09:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8A19wVu060843; Sat, 10 Sep 2016 01:09:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201609100109.u8A19wVu060843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 10 Sep 2016 01:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305677 - head/sys/powerpc/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.23 Precedence: list List-Id: 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, 10 Sep 2016 01:09:59 -0000 Author: jhibbits Date: Sat Sep 10 01:09:58 2016 New Revision: 305677 URL: https://svnweb.freebsd.org/changeset/base/305677 Log: Add ehci to the MPC85XX build Many QorIQ and MPC85xx SoCs have USB support, so add it to the kernel. MFC after: 1 week Modified: head/sys/powerpc/conf/MPC85XX Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Fri Sep 9 21:58:48 2016 (r305676) +++ head/sys/powerpc/conf/MPC85XX Sat Sep 10 01:09:58 2016 (r305677) @@ -89,6 +89,7 @@ device tun device uart options USB_DEBUG # enable debug msgs #device uhci +device ehci device umass device usb device vlan From owner-svn-src-head@freebsd.org Sat Sep 10 07:12: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 B696CBD49B1; Sat, 10 Sep 2016 07:12:29 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0103.outbound.protection.outlook.com [104.47.36.103]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3061C998; Sat, 10 Sep 2016 07:12:28 +0000 (UTC) (envelope-from sjg@juniper.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=junipernetworks.onmicrosoft.com; s=selector1-juniper-net; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5y3EUQErqJrDHL3xt9C32LFqayevorTx9OwjJ581R/c=; b=bF3H/I55LcA2NpkPevCqnyPQxvso/PH0/GqGFglLMTvGoIC6baGqaj9jh07oxent9D/Sqv34u6cHDASGOvb4x1mOCxM/Q4+StuC3gaOa/smMnSQlRv7o2KoUYGnCNdDEHvjLPU08WVoMSg6eV5edWLO9e7vFxTvKTFXZ/0+Twwg= Received: from MWHPR05CA0023.namprd05.prod.outlook.com (10.168.242.161) by DM2PR0501MB986.namprd05.prod.outlook.com (10.242.174.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.3; Sat, 10 Sep 2016 00:37:48 +0000 Received: from BN1BFFO11FD028.protection.gbl (2a01:111:f400:7c10::1:142) by MWHPR05CA0023.outlook.office365.com (2603:10b6:300:59::33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.544.10 via Frontend Transport; Sat, 10 Sep 2016 00:37:48 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.18) smtp.mailfrom=juniper.net; freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.18 as permitted sender) Received: from p-emfe01a-sac.jnpr.net (66.129.239.18) by BN1BFFO11FD028.mail.protection.outlook.com (10.58.144.91) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.6 via Frontend Transport; Sat, 10 Sep 2016 00:37:48 +0000 Received: from p-mailhub01.juniper.net (10.160.2.17) by p-emfe01a-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 9 Sep 2016 17:37:28 -0700 Received: from kaos.jnpr.net (kaos.jnpr.net [172.21.30.60]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id u8A0bRuD013622; Fri, 9 Sep 2016 17:37:27 -0700 (envelope-from sjg@juniper.net) Received: from kaos.jnpr.net (localhost [127.0.0.1]) by kaos.jnpr.net (Postfix) with ESMTP id 5B1BD38551E; Fri, 9 Sep 2016 17:37:27 -0700 (PDT) To: Bryan Drewery CC: , , , Subject: Re: svn commit: r305634 - head/share/mk In-Reply-To: References: <201609090121.u891LZOO023156@repo.freebsd.org> Comments: In-reply-to: Bryan Drewery message dated "Fri, 09 Sep 2016 11:29:16 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 24.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <76523.1473467847.1@kaos.jnpr.net> Date: Fri, 9 Sep 2016 17:37:27 -0700 Message-ID: <76524.1473467847@kaos.jnpr.net> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.18; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(189002)(24454002)(199003)(2810700001)(23726003)(47776003)(4001430100002)(8676002)(92566002)(8936002)(97756001)(19580395003)(81156014)(2906002)(117636001)(9686002)(86362001)(50226002)(81166006)(586003)(19580405001)(68736007)(7126002)(77096005)(189998001)(110136002)(87936001)(97736004)(107886002)(50986999)(69596002)(2950100001)(356003)(5660300001)(76176999)(50466002)(7846002)(106466001)(105596002)(305945005)(46406003)(76506005)(53416004)(11100500001)(626004)(4326007)(450100001)(7696004)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0501MB986; H:p-emfe01a-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD028; 1:BVBd+I88dNyBUWmsC2LxWZQf0Nbns2DglNtcpiin1/BYxtMmCKLGw0NIFV1/JJ5OInHOXvLEey7RnEY+9jgl3GkHJcN6e4E24MAaxP3MElFFiTsBtMPixzMaaQJczzSLp4KyfJ8VLkGJJXaqjalkxG9nQhHqeNW7U+575UdZ19IQmfe3vzajeofGZDXN43UWkgjM0280Mm7R9lY8Ucxw4iV1+CCYeFS8YiJWu9AS9xtiNiqch7g7CiNJ1MNUm5FFVt7J6HrhlymOMXYwsl/vH4SwoXoYU8NNseaaGgPtuudeNVpXCk0E5adN+y9l2GV9TOK2whvUmGJkRVaLvqLty/jPYrCw1BIrLCQc4cDnT08vJMUuK/bvm55bVqjJxDhrXcmr7UNXjg8oMczhN4Z5hcMS9ZjnUyr3ut448EbZWb2VUKI7FG+eNZY/u+QXNcADRY/tuqYc2s4XFSVs8w4scHQ8CiI7DSJogvkdbeyGONGsRNpg1nVZtRf87VAqt8gAOyGaVHihAStMEV1DpKHV/JBE4tG4aKGZh5VoVIWJMHg= X-MS-Office365-Filtering-Correlation-Id: 7bdc4754-7cf3-4eea-bfa6-08d3d912b090 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB986; 2:+xD0v9OphE7fk9sO3FGX3G/xe36uTtDYtv5oyKG2rCYF+KPQVAKNfTvwuTTjibfXrsq8QcF/PbdnZKtCN7zFhuZlfp0H/EHo1el0qLC2ATNwqGa6rsg1Gf9+ZnIlTkjq6a4VzVW/ueOOEUA64RW85BtC8ahdzkCwOtiUIDFBhm8uAWad081hZINSF0WWSC5Z; 3:pLABGRGA4dmXwFFPny01XhxxODqfQcouIh0AM8DesB8n0kmivzCifjuUiMR3SrGsFceYUWhsjnhOhMSXTdx+PEpWLy+afcVQTclsEMTrJJXJbJAqPi16+lGx7BuhiUPcMsRHgB+/FDKNpA/HuhJMYYrLxOxlx4M9cFD7StbxllNR06E9HKEmJMTvOSqpf1p5QeQw8xp+hglBjl/s0pHlS+rtNcYTM86wh/+XJOftXf8=; 25:jzIOA64bvXlcT+kXHwwukMl0INTVzU7lf9xYVdMT4HfTGhDKhYBY/yU2TwJrfzki3o06qwnHdUIC4ayKmzCZ1RrBgShnHmMKSiosi9yLLmBWxS+vqDJp5Xq20BexaqKhklUHgBhFAyvQBBEEamr2d5+p0gw74Q2c5l0qcfTxx4G6p3cqnQ1EQOM/e0ydg261u2WBW+emI+8dqbd+Mr7bn0bd/PpxHYdEb9UAuQXFBelGY1yrGelZjaNPlfJGJ4/xQ40j/unQ2qRIQFWP770WZROm2z6g4w3E+K0UQEMI4CfGwNNWKu1xBNxvC8dchv0E9aXhzjYmGDesnw8l/9BWA/qSRtjhC5y/bTThYdqj60/ow7Z/SXIp2ehNLDEoJz2B1CWLO9gt01z0g+zpekzLN+Y7sy/NPI2PP92w1j89nFo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0501MB986; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB986; 31:O0t8UrHbqaxqZCskoor7mV1D/L71nns2xFDdzin3dlYP6jWrRHx/XionYHS9aFD2z/TbaRf0/5Pp1Q5PPCCRAtMN9Lt0QYubkoUCMiBl7oPvenXP415zzeztxMnN1fXEGK1zQpE6XWU03HPdiTkoF0ld4sXbHyTy7PnD8IU5/PIXXoL3Eon3m3NWUYuS5jLGrWlN3Lz+kF0KiZGr0R6lvDh+V8BWdICIo5Qsi7IKhH4=; 20:bapJ9Tcvrq15mN9/8GC+3bGv9zSSp4zfOXyQt4QZ9ey/6Jou3h8MQkE4DL6X1lenpzKv7zcRzdlwl3u5fdbIGONLTfXe4AEUJcvv9AROYEZuX5LVT4pxHE/2CsgzL45acQ5tQRm/VD+E8G4SWPyWswtmUiy2OAkmUMuw1tdqvTHXSF3R5m2T13Djaim9xOiiJhq7Try20zJ89o35hjFCnRpEonWN6DwjMisVBTqEI/o/EWTjQZJ38gJKIsdfe/bf2+8wqLUDkQLMdCGD8tiOSiyDF7UXXpeR5A5b43TZ56afoxLDIFscYD7ND2z1LGk4RZfPhloZJ5ZEtMeNp9vIP3WH245+mNsmrXyr3T0rTElwr0Ij4ml3lljIYSpBsiYTgbgYcUgZ4sSgeX8UrgNOe7rPAyZY35DwjGvFy4iXGwOUwvmG2zKKAL5qzOGdPyj9bp44KgPR34RPL/xrGY7sZg++oyqZEYRwGR7J+RWUZwpImlb5tt2qKLI/QU+LBKdt X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13017025)(13015025)(13024025)(13023025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DM2PR0501MB986; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0501MB986; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB986; 4:lzgFE5sjpqbCS1fWmrMDdJCv0RDnc2ABoEgsA1G4NkZ8LYsz9yVk5/QxpuLShSVqz3tlJQhKi0S+PMMb/NM6a9roLorAegUq0hv7XGQibzjri9BNhBF+M7li1ohqEEW6VoZBSb2rMVG888kqte5Z9vUnBAlyqXxjw4xS6e2o6e8YXwRuGqTTn1Nv4PcDLcQti66ycV9CMUK2H/C2Yfvn4GP9FUfeXlkUxB9YhvEPjqn+btYxZEvfZRhqN0heCDN61KGw3LeIbe9W8UtBRjC3aEbGS7WBgjqS1aCUhh+sBCkeU9QhXc9UcIjguDv2ir7RJmgz+ZjvEWJYFlh2Rm+Jyq/kUjiUV4XyMLNlgKxOeSHIu24XZ4ACs4Chscb1s+vzeEQdBIaohbqaPwZn6vGbPTrs8gkNo0dJN4HWbY0TJft/l7v7RjYnISLWsdpPNNmRJX5rDvWDGJzWoG3YMWLJDQOwImH0xSp0CMbvoayyNEGjVaYFkNcPxDGxG6VPPLAU X-Forefront-PRVS: 0061C35778 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0501MB986; 23:tfyza0vACZH6Ihrh/Kw9qJhTJFv0ZIFMQ1vukaG6?= =?us-ascii?Q?zYcZ4qReICMNRPJJUy0tcrm9uF5sgrg+nVJLoleQIjjS6JzUvy30/09gplFO?= =?us-ascii?Q?ZR96NwgwBxhjljU9m1bx915m5tt1uFFCMkuiJwzIZlHRRZttWVM/vDrvnQg7?= =?us-ascii?Q?WAsKZL38+HUxkS6LuWXRgqbWxTltPQR/juMXQdWJqJSR4bYIopvV5+5b4A/N?= =?us-ascii?Q?H8DtCrz6twEjUKgoKPpumFbr/spUjg68l7xKiFebeBva2SiUEtvJ978Fx4GF?= =?us-ascii?Q?Wb5GmZoPk+b73ecFfqaBYGqfiVNo5JuO9KLHAc5fPjFCVIsnc2vF2VD5Z20n?= =?us-ascii?Q?rpZ/e0LSbQp5uSfhRryYXEjdFAXAS9Hh4KWop4C5A4+cxb+0G+KC4U7lIPjz?= =?us-ascii?Q?68/uSxcirWBZe2W5yScL+h0dxQ5vf2TN9dtI2f37PYFelnsH1dlrwoqZYArk?= =?us-ascii?Q?GIljq92LxxsiCnpdjEr5swZgCKnHoi10mrhw6/kZBBwcfRPodsRlYYLGwBDe?= =?us-ascii?Q?CIXPjr8+tprF+xKHpaDdpynPSAnZnIJJBPMfOKCBJ3mXyE1o7o0DcKPYdQRW?= =?us-ascii?Q?Q8KqnSAAQ/054HRVGOc5bFFowMOn0CKAtx8MvM7jrWyeuIS43P/NtwHOwLB5?= =?us-ascii?Q?PFJysZUkC372I5yJl5vx8wLMJytoq3LQDHIwOnjCpiBVVFAme6JwPKxszdmW?= =?us-ascii?Q?TWobO2nUP3MJ67mAZ4NKVtemHnhqt7S2eqAWmX8Dy+hozcDbGBH5z1pcclyF?= =?us-ascii?Q?QI3afSwLYYTrjFTz0acPaGBYbyWPsH7QNApddcJnoVBSVje8tA+ibm0agjNx?= =?us-ascii?Q?RKM8xVNtgR8tUwqf+YL0x1y1mLOj70BKtbDRSE6T/PZliU99ildXrpWzKzhp?= =?us-ascii?Q?rCgbE7dj4gmHVfHhEdRN2NCAJb+s470nQrDpPWwB2QHRVcDyZ3aNrBo/3W6y?= =?us-ascii?Q?Hx4GZC6f8xf801VqExFfx84ucFzLbEslJMX3T755W5U7tFUeK0YdPl8psmdV?= =?us-ascii?Q?28+O1TRyfR5tDGJV3fuU8wZdSWvmVdZkCOAxM3Srss9kquCyMW1ndv4+MQFI?= =?us-ascii?Q?j677mpZSPztlDQte7MVdprd7nygglAJVqjuY4IGdGRZRYinAE688bqF60Djf?= =?us-ascii?Q?fgl9pa97m7r7DP09surFTEe5LEusG6afSBkV9XiWrTVaEaUI3lBZguVUmNDU?= =?us-ascii?Q?mPx/wvstHmllb+w5mIMycc0eh02VG9jNi5ytLqP1pp8FxyWvOQjDjDMrd0ZX?= =?us-ascii?Q?B7SW3GNveJ6vaBWfrKk=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB986; 6:Pm/2CR+H+bjWjyZVsd5bUejoaxj9eajB6YGhUR04fq7GLxm69ydzuzk+V7L9DKYXGqJPmRPkLOiIsLY+OCM0lpMfGjLCppvYSk20W0rtYXSQRnvN9QnNu7YDDnQyDgizt9W+kX4O8uEip4bCXmYypeNdQlEm4MqN6NDday79W2oBqbRJHAAIVy5Dz5EksZQTYay+x2pIvByuDphvDu51AhsP//Iigu/B0sn9BBuxEZvfRV8oYR/YMMt4AyN1aAVboPAUFD3i9zsNu6Rkk9vExuC8knBB07OsUhv41VgvaehBQxUu13wrDbeWgNTpAVoBJ2Bwa2RKeZnolzKze1YQ8w==; 5:b4Vp9zqF5lVUzhS8B/B0ivRGnDb9PZ9g53cCMH+y8qJw84FzSWtQ8Xs60FeruWnJy2t5WNU1sIzfQM8hW6S3+PcFXsySJpV81UaFLZ06erLf7NOnM5kflrqx9JLJ39DIcVYT+ydjuPqLsLscXuzkKw==; 24:CguQt141N/IZdMQEEDDHG2dXRRD5X+EtR7Ijs0CqtnUeZ6u7nfiZNJzORqdFVSLT4DdyfTtcoWc0kDJt6uX/UJ7vl3WWLaL/7FLCgkB9oiQ=; 7:Qc3X2F5R0RoyXT8ozzdeiGChNWQQ2t9cH9O8BcGdOMaOTsZ28ah9MPySiprx+WMpzhwL8CENa+PRKmoBrR7mT9usRhdlH2/PuJHICSjI18++5fzjzq4psZmd0AoAbcfBP7LDON4OICVOt43TcNHQalNjXg856oAOI232roRY8L5HaG9B0DEvqRHMd1K39rg5DIyLkyTNKUEWuvouc3jkq4aoy6QglYioU+KphlpKGEl07yMfT7qw/e4y3F7Rx4Cl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2016 00:37:48.0386 (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.18]; Helo=[p-emfe01a-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0501MB986 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 10 Sep 2016 07:12:29 -0000 Bryan Drewery wrote: > > +# some targets involve old pre-built targets > > +# ignore mtime of shell > > +# and mtime of makefiles does not matter in meta mode > > +.MAKE.META.IGNORE_PATHS += \ > > + ${MAKEFILE} \ > > + ${SHELL} \ > > + ${SYS_MK_DIR} > > I think it could be problematic to ignore *.mk changes. The build If you're not concerned with build optimization, this can be disabled - but pretty much any sub-make for which there is a .meta file will be out-of-date by any changed to *.mk > commands may stay the same, but targets could grow new dependencies. If > those dependencies are already "met" then meta mode won't reconsider them. I'm not sure how easy it is to accomplish that situation. > Consider: > Build 1: > bar: > touch dep > touch bar > > foo: > touch foo > > all: bar foo > > In the first build, all generates dep, bar and foo. > > Then the code is changed to: > > bar: > touch bar > > dep: > touch notmade > touch dep > > foo: dep > touch foo > > all: foo bar > > Now in the second build, all finds bar command changes and rebuilds, > finds foo command is the same and that dep is already satisfied from the > last build. So 'notmade' is never made. Actually given you have missing-meta=yes target dep would be remade, either because there is no .meta file, or because its commands changed. Thus notmade should be. From owner-svn-src-head@freebsd.org Sat Sep 10 09:00: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 52187BD264C; Sat, 10 Sep 2016 09:00:13 +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 22529F9D; Sat, 10 Sep 2016 09:00:13 +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 u8A90Cpn040458; Sat, 10 Sep 2016 09:00:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8A90CCp040457; Sat, 10 Sep 2016 09:00:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609100900.u8A90CCp040457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 10 Sep 2016 09:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305678 - 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.23 Precedence: list List-Id: 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, 10 Sep 2016 09:00:13 -0000 Author: kib Date: Sat Sep 10 09:00:12 2016 New Revision: 305678 URL: https://svnweb.freebsd.org/changeset/base/305678 Log: Fix build Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sat Sep 10 01:09:58 2016 (r305677) +++ head/sys/kern/uipc_syscalls.c Sat Sep 10 09:00:12 2016 (r305678) @@ -1115,7 +1115,7 @@ orecvfrom(struct thread *td, struct recv #ifdef COMPAT_OLDSOCK int -orecv(struct thread *td, struct orecv_args) +orecv(struct thread *td, struct orecv_args *uap) { struct msghdr msg; struct iovec aiov; From owner-svn-src-head@freebsd.org Sat Sep 10 09:37: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 3C2DCBD113B; Sat, 10 Sep 2016 09:37:42 +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 0B7D01B9; Sat, 10 Sep 2016 09:37:41 +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 u8A9bfxM055458; Sat, 10 Sep 2016 09:37:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8A9bfbP055457; Sat, 10 Sep 2016 09:37:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609100937.u8A9bfbP055457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 10 Sep 2016 09:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305679 - head/sys/cddl/compat/opensolaris/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.23 Precedence: list List-Id: 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, 10 Sep 2016 09:37:42 -0000 Author: mav Date: Sat Sep 10 09:37:41 2016 New Revision: 305679 URL: https://svnweb.freebsd.org/changeset/base/305679 Log: Switch random_get_pseudo_bytes() shim to arc4rand(). Our shim for Solaris random_get_bytes() uses read_random(), that looks reasonable, since it guaranties reliably seeded random data. On the other side Solaris random_get_pseudo_bytes() does not provide this guarantie, and its original Solaris implementation is equivalent to our arc4rand(), using software crypto without stressing slower hardware RNG. Modified: head/sys/cddl/compat/opensolaris/sys/random.h Modified: head/sys/cddl/compat/opensolaris/sys/random.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/random.h Sat Sep 10 09:00:12 2016 (r305678) +++ head/sys/cddl/compat/opensolaris/sys/random.h Sat Sep 10 09:37:41 2016 (r305679) @@ -32,6 +32,6 @@ #include_next #define random_get_bytes(p, s) read_random((p), (int)(s)) -#define random_get_pseudo_bytes(p, s) read_random((p), (int)(s)) +#define random_get_pseudo_bytes(p, s) arc4rand((p), (int)(s), 0) #endif /* !_OPENSOLARIS_SYS_RANDOM_H_ */ From owner-svn-src-head@freebsd.org Sat Sep 10 16:29: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 0759ABD46ED; Sat, 10 Sep 2016 16:29:55 +0000 (UTC) (envelope-from mjg@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 C90C5CD9; Sat, 10 Sep 2016 16:29:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8AGTsV5013019; Sat, 10 Sep 2016 16:29:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8AGTrmG013017; Sat, 10 Sep 2016 16:29:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609101629.u8AGTrmG013017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 10 Sep 2016 16:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305684 - 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.23 Precedence: list List-Id: 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, 10 Sep 2016 16:29:55 -0000 Author: mjg Date: Sat Sep 10 16:29:53 2016 New Revision: 305684 URL: https://svnweb.freebsd.org/changeset/base/305684 Log: cache: improve scalability by introducing bucket locks An array of bucket locks is added. All modifications still require the global cache_lock to be held for writing. However, most readers only need the relevant bucket lock and in effect can run concurrently to the writer as long as they use a different lock. See the added comment for more details. This is an intermediate step towards removal of the global lock. Reviewed by: kib Tested by: pho Modified: head/sys/kern/subr_witness.c head/sys/kern/vfs_cache.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Sep 10 16:11:42 2016 (r305683) +++ head/sys/kern/subr_witness.c Sat Sep 10 16:29:53 2016 (r305684) @@ -623,6 +623,14 @@ static struct witness_order_list_entry o { "vnode interlock", &lock_class_mtx_sleep }, { NULL, NULL }, /* + * VFS namecache + */ + { "ncglobal", &lock_class_rw }, + { "ncbuc", &lock_class_rw }, + { "vnode interlock", &lock_class_mtx_sleep }, + { "ncneg", &lock_class_mtx_sleep }, + { NULL, NULL }, + /* * ZFS locking */ { "dn->dn_mtx", &lock_class_sx }, Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Sep 10 16:11:42 2016 (r305683) +++ head/sys/kern/vfs_cache.c Sat Sep 10 16:29:53 2016 (r305684) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -148,6 +149,23 @@ struct namecache_ts { * Upon reaching the last segment of a path, if the reference * is for DELETE, or NOCACHE is set (rewrite), and the * name is located in the cache, it will be dropped. + * + * These locks are used (in the order in which they can be taken): + * NAME TYPE ROLE + * cache_lock rwlock global, needed for all modifications + * bucketlock rwlock for access to given hash bucket + * ncneg_mtx mtx negative entry LRU management + * + * A name -> vnode lookup can be safely performed by either locking cache_lock + * or the relevant hash bucket. + * + * ".." and vnode -> name lookups require cache_lock. + * + * Modifications require both cache_lock and relevant bucketlock taken for + * writing. + * + * Negative entry LRU management requires ncneg_mtx taken on top of either + * cache_lock or bucketlock. */ /* @@ -179,8 +197,9 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor struct nchstats nchstats; /* cache effectiveness statistics */ static struct rwlock cache_lock; -RW_SYSINIT(vfscache, &cache_lock, "Name Cache"); +RW_SYSINIT(vfscache, &cache_lock, "ncglobal"); +#define CACHE_TRY_WLOCK() rw_try_wlock(&cache_lock) #define CACHE_UPGRADE_LOCK() rw_try_upgrade(&cache_lock) #define CACHE_RLOCK() rw_rlock(&cache_lock) #define CACHE_RUNLOCK() rw_runlock(&cache_lock) @@ -188,7 +207,12 @@ RW_SYSINIT(vfscache, &cache_lock, "Name #define CACHE_WUNLOCK() rw_wunlock(&cache_lock) static struct mtx_padalign ncneg_mtx; -MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "Name Cache neg", MTX_DEF); +MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "ncneg", MTX_DEF); + +static u_int numbucketlocks; +static struct rwlock_padalign *bucketlocks; +#define HASH2BUCKETLOCK(hash) \ + ((struct rwlock *)(&bucketlocks[((hash) % numbucketlocks)])) /* * UMA zones for the VFS cache. @@ -307,6 +331,8 @@ STATNODE_COUNTER(numfullpathfail4, "Numb STATNODE_COUNTER(numfullpathfound, "Number of successful fullpath calls"); static long numupgrades; STATNODE_ULONG(numupgrades, "Number of updates of the cache after lookup (write lock + retry)"); +static long zap_and_exit_bucket_fail; STATNODE_ULONG(zap_and_exit_bucket_fail, + "Number of times bucketlocked zap_and_exit case failed to writelock"); static void cache_zap(struct namecache *ncp); static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf, @@ -326,6 +352,39 @@ cache_get_hash(char *name, u_char len, s return (hash); } +#ifdef INVARIANTS +static void +cache_assert_bucket_locked(struct namecache *ncp, int mode) +{ + struct rwlock *bucketlock; + uint32_t hash; + + hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); + bucketlock = HASH2BUCKETLOCK(hash); + rw_assert(bucketlock, mode); +} +#else +#define cache_assert_bucket_locked(x, y) do { } while (0) +#endif + +static void +cache_lock_all_buckets(void) +{ + u_int i; + + for (i = 0; i < numbucketlocks; i++) + rw_wlock(&bucketlocks[i]); +} + +static void +cache_unlock_all_buckets(void) +{ + u_int i; + + for (i = 0; i < numbucketlocks; i++) + rw_wunlock(&bucketlocks[i]); +} + static int sysctl_nchstats(SYSCTL_HANDLER_ARGS) { @@ -442,21 +501,13 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n * Negative entries management */ static void -cache_negative_hit(struct namecache *ncp, int wlocked) +cache_negative_hit(struct namecache *ncp) { - if (!wlocked) { - rw_assert(&cache_lock, RA_RLOCKED); - mtx_lock(&ncneg_mtx); - } else { - rw_assert(&cache_lock, RA_WLOCKED); - } - + mtx_lock(&ncneg_mtx); TAILQ_REMOVE(&ncneg, ncp, nc_dst); TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - - if (!wlocked) - mtx_unlock(&ncneg_mtx); + mtx_unlock(&ncneg_mtx); } static void @@ -464,9 +515,12 @@ cache_negative_insert(struct namecache * { rw_assert(&cache_lock, RA_WLOCKED); + cache_assert_bucket_locked(ncp, RA_WLOCKED); MPASS(ncp->nc_vp == NULL); + mtx_lock(&ncneg_mtx); TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); numneg++; + mtx_unlock(&ncneg_mtx); } static void @@ -474,9 +528,12 @@ cache_negative_remove(struct namecache * { rw_assert(&cache_lock, RA_WLOCKED); + cache_assert_bucket_locked(ncp, RA_WLOCKED); MPASS(ncp->nc_vp == NULL); + mtx_lock(&ncneg_mtx); TAILQ_REMOVE(&ncneg, ncp, nc_dst); numneg--; + mtx_unlock(&ncneg_mtx); } static struct namecache * @@ -499,10 +556,11 @@ cache_negative_zap_one(void) * pointer to a vnode or if it is just a negative cache entry. */ static void -cache_zap(struct namecache *ncp) +cache_zap_locked(struct namecache *ncp) { rw_assert(&cache_lock, RA_WLOCKED); + cache_assert_bucket_locked(ncp, RA_WLOCKED); CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); if (ncp->nc_vp != NULL) { SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, @@ -532,6 +590,21 @@ cache_zap(struct namecache *ncp) numcache--; } +static void +cache_zap(struct namecache *ncp) +{ + struct rwlock *bucketlock; + uint32_t hash; + + rw_assert(&cache_lock, RA_WLOCKED); + + hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); + bucketlock = HASH2BUCKETLOCK(hash); + rw_wlock(bucketlock); + cache_zap_locked(ncp); + rw_wunlock(bucketlock); +} + /* * Lookup an entry in the cache * @@ -549,22 +622,42 @@ cache_zap(struct namecache *ncp) * not recursively acquired. */ +enum { UNLOCKED, WLOCKED, RLOCKED }; + +static void +cache_unlock(int cache_locked) +{ + + switch (cache_locked) { + case UNLOCKED: + break; + case WLOCKED: + CACHE_WUNLOCK(); + break; + case RLOCKED: + CACHE_RUNLOCK(); + break; + } +} + int cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp) { + struct rwlock *bucketlock; struct namecache *ncp; uint32_t hash; - int error, ltype, wlocked; + int error, ltype, cache_locked; if (!doingcache) { cnp->cn_flags &= ~MAKEENTRY; return (0); } retry: - wlocked = 0; - counter_u64_add(numcalls, 1); + bucketlock = NULL; + cache_locked = UNLOCKED; error = 0; + counter_u64_add(numcalls, 1); retry_wlocked: if (cnp->cn_nameptr[0] == '.') { @@ -598,17 +691,21 @@ retry_wlocked: } return (-1); } - if (!wlocked) - CACHE_RLOCK(); if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { counter_u64_add(dotdothits, 1); + if (cache_locked == UNLOCKED) { + CACHE_RLOCK(); + cache_locked = RLOCKED; + } + if (dvp->v_cache_dd == NULL) { SDT_PROBE3(vfs, namecache, lookup, miss, dvp, "..", NULL); goto unlock; } if ((cnp->cn_flags & MAKEENTRY) == 0) { - if (!wlocked && !CACHE_UPGRADE_LOCK()) + if (cache_locked != WLOCKED && + !CACHE_UPGRADE_LOCK()) goto wlock; ncp = NULL; if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) { @@ -639,10 +736,14 @@ retry_wlocked: nc_dotdottime; goto success; } - } else if (!wlocked) - CACHE_RLOCK(); + } hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); + if (cache_locked == UNLOCKED) { + bucketlock = HASH2BUCKETLOCK(hash); + rw_rlock(bucketlock); + } + LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { counter_u64_add(numchecks, 1); if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && @@ -665,12 +766,7 @@ retry_wlocked: /* We don't want to have an entry, so dump it */ if ((cnp->cn_flags & MAKEENTRY) == 0) { counter_u64_add(numposzaps, 1); - if (!wlocked && !CACHE_UPGRADE_LOCK()) - goto wlock; - cache_zap(ncp); - CACHE_WUNLOCK(); - cache_free(ncp); - return (0); + goto zap_and_exit; } /* We found a "positive" match, return the vnode */ @@ -689,25 +785,20 @@ negative_success: /* We found a negative match, and want to create it, so purge */ if (cnp->cn_nameiop == CREATE) { counter_u64_add(numnegzaps, 1); - if (!wlocked && !CACHE_UPGRADE_LOCK()) - goto wlock; - cache_zap(ncp); - CACHE_WUNLOCK(); - cache_free(ncp); - return (0); + goto zap_and_exit; } counter_u64_add(numneghits, 1); - cache_negative_hit(ncp, wlocked); + cache_negative_hit(ncp); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, nc_get_name(ncp)); cache_out_ts(ncp, tsp, ticksp); - if (wlocked) - CACHE_WUNLOCK(); - else - CACHE_RUNLOCK(); + MPASS(bucketlock != NULL || cache_locked != UNLOCKED); + if (bucketlock != NULL) + rw_runlock(bucketlock); + cache_unlock(cache_locked); return (ENOENT); wlock: @@ -716,9 +807,10 @@ wlock: * a write lock and retry the operation. */ CACHE_RUNLOCK(); +wlock_unlocked: CACHE_WLOCK(); numupgrades++; - wlocked = 1; + cache_locked = WLOCKED; goto retry_wlocked; success: @@ -733,10 +825,10 @@ success: VOP_UNLOCK(dvp, 0); } vhold(*vpp); - if (wlocked) - CACHE_WUNLOCK(); - else - CACHE_RUNLOCK(); + MPASS(bucketlock != NULL || cache_locked != UNLOCKED); + if (bucketlock != NULL) + rw_runlock(bucketlock); + cache_unlock(cache_locked); error = vget(*vpp, cnp->cn_lkflags | LK_VNHELD, cnp->cn_thread); if (cnp->cn_flags & ISDOTDOT) { vn_lock(dvp, ltype | LK_RETRY); @@ -758,10 +850,29 @@ success: return (-1); unlock: - if (wlocked) - CACHE_WUNLOCK(); - else - CACHE_RUNLOCK(); + MPASS(bucketlock != NULL || cache_locked != UNLOCKED); + if (bucketlock != NULL) + rw_runlock(bucketlock); + cache_unlock(cache_locked); + return (0); + +zap_and_exit: + if (bucketlock != NULL) { + rw_assert(&cache_lock, RA_UNLOCKED); + if (!CACHE_TRY_WLOCK()) { + rw_runlock(bucketlock); + bucketlock = NULL; + zap_and_exit_bucket_fail++; + goto wlock_unlocked; + } + cache_locked = WLOCKED; + rw_runlock(bucketlock); + bucketlock = NULL; + } else if (cache_locked != WLOCKED && !CACHE_UPGRADE_LOCK()) + goto wlock; + cache_zap(ncp); + CACHE_WUNLOCK(); + cache_free(ncp); return (0); } @@ -772,6 +883,7 @@ void cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct timespec *tsp, struct timespec *dtsp) { + struct rwlock *bucketlock; struct namecache *ncp, *n2, *ndd, *nneg; struct namecache_ts *n3; struct nchashhead *ncpp; @@ -924,11 +1036,6 @@ cache_enter_time(struct vnode *dvp, stru } } - /* - * Insert the new namecache entry into the appropriate chain - * within the cache entries table. - */ - LIST_INSERT_HEAD(ncpp, ncp, nc_hash); if (flag != NCF_ISDOTDOT) { if (LIST_EMPTY(&dvp->v_cache_src)) { vhold(dvp); @@ -937,6 +1044,15 @@ cache_enter_time(struct vnode *dvp, stru LIST_INSERT_HEAD(&dvp->v_cache_src, ncp, nc_src); } + bucketlock = HASH2BUCKETLOCK(hash); + rw_wlock(bucketlock); + + /* + * Insert the new namecache entry into the appropriate chain + * within the cache entries table. + */ + LIST_INSERT_HEAD(ncpp, ncp, nc_hash); + /* * If the entry is "negative", we place it into the * "negative" cache queue, otherwise, we place it into the @@ -953,6 +1069,7 @@ cache_enter_time(struct vnode *dvp, stru SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, nc_get_name(ncp)); } + rw_wunlock(bucketlock); if (numneg * ncnegfactor > numcache) nneg = cache_negative_zap_one(); CACHE_WUNLOCK(); @@ -960,12 +1077,24 @@ cache_enter_time(struct vnode *dvp, stru cache_free(nneg); } +static u_int +cache_roundup_2(u_int val) +{ + u_int res; + + for (res = 1; res <= val; res <<= 1) + continue; + + return (res); +} + /* * Name cache initialization, from vfs_init() when we are booting */ static void nchinit(void *dummy __unused) { + u_int i; TAILQ_INIT(&ncneg); @@ -983,6 +1112,13 @@ nchinit(void *dummy __unused) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); + numbucketlocks = cache_roundup_2(mp_ncpus * 16); + if (numbucketlocks > nchash) + numbucketlocks = nchash; + bucketlocks = malloc(sizeof(*bucketlocks) * numbucketlocks, M_VFSCACHE, + M_WAITOK | M_ZERO); + for (i = 0; i < numbucketlocks; i++) + rw_init_flags(&bucketlocks[i], "ncbuc", RW_DUPOK); numcalls = counter_u64_alloc(M_WAITOK); dothits = counter_u64_alloc(M_WAITOK); @@ -1023,6 +1159,7 @@ cache_changesize(int newmaxvnodes) * because to do so, they have to be removed from the hash table. */ CACHE_WLOCK(); + cache_lock_all_buckets(); old_nchashtbl = nchashtbl; old_nchash = nchash; nchashtbl = new_nchashtbl; @@ -1035,6 +1172,7 @@ cache_changesize(int newmaxvnodes) LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); } } + cache_unlock_all_buckets(); CACHE_WUNLOCK(); free(old_nchashtbl, M_VFSCACHE); } @@ -1108,20 +1246,30 @@ void cache_purgevfs(struct mount *mp) { TAILQ_HEAD(, namecache) ncps; - struct nchashhead *ncpp; + struct rwlock *bucketlock; + struct nchashhead *bucket; struct namecache *ncp, *nnp; + u_long i, j, n_nchash; /* Scan hash tables for applicable entries */ SDT_PROBE1(vfs, namecache, purgevfs, done, mp); TAILQ_INIT(&ncps); CACHE_WLOCK(); - for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { - LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { - if (ncp->nc_dvp->v_mount != mp) - continue; - cache_zap(ncp); - TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + n_nchash = nchash + 1; + for (i = 0; i < numbucketlocks; i++) { + bucketlock = (struct rwlock *)&bucketlocks[i]; + rw_wlock(bucketlock); + for (j = i; j < n_nchash; j += numbucketlocks) { + bucket = &nchashtbl[j]; + LIST_FOREACH_SAFE(ncp, bucket, nc_hash, nnp) { + cache_assert_bucket_locked(ncp, RA_WLOCKED); + if (ncp->nc_dvp->v_mount != mp) + continue; + cache_zap_locked(ncp); + TAILQ_INSERT_HEAD(&ncps, ncp, nc_dst); + } } + rw_wunlock(bucketlock); } CACHE_WUNLOCK(); TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { From owner-svn-src-head@freebsd.org Sat Sep 10 16:49: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 9CE8BBD4AE6; Sat, 10 Sep 2016 16:49:27 +0000 (UTC) (envelope-from alc@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 783098CA; Sat, 10 Sep 2016 16:49:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8AGnQb3020539; Sat, 10 Sep 2016 16:49:26 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8AGnPvr020530; Sat, 10 Sep 2016 16:49:25 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201609101649.u8AGnPvr020530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 10 Sep 2016 16:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305685 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 powerpc/booke riscv/riscv sparc64/sparc64 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.23 Precedence: list List-Id: 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, 10 Sep 2016 16:49:27 -0000 Author: alc Date: Sat Sep 10 16:49:25 2016 New Revision: 305685 URL: https://svnweb.freebsd.org/changeset/base/305685 Log: Various changes to pmap_ts_referenced() Move PMAP_TS_REFERENCED_MAX out of the various pmap implementations and into vm/pmap.h, and describe what its purpose is. Eliminate the archaic "XXX" comment about its value. I don't believe that its exact value, e.g., 5 versus 6, matters. Update the arm64 and riscv pmap implementations of pmap_ts_referenced() to opportunistically update the page's dirty field. On amd64, use the PDE value already cached in a local variable rather than dereferencing a pointer again and again. Reviewed by: kib, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D7836 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/pmap.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/amd64/amd64/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -5816,8 +5816,6 @@ safe_to_clear_referenced(pmap_t pmap, pt return (FALSE); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * pmap_ts_referenced: * @@ -5826,10 +5824,6 @@ safe_to_clear_referenced(pmap_t pmap, pt * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - * * As an optimization, update the page's dirty field if a modified bit is * found while counting reference bits. This opportunistic update can be * performed at low cost and can eliminate the need for some future calls @@ -5898,7 +5892,7 @@ retry: */ vm_page_dirty(m); } - if ((*pde & PG_A) != 0) { + if ((oldpde & PG_A) != 0) { /* * Since this reference bit is shared by 512 4KB * pages, it should not be cleared every time it is @@ -5919,7 +5913,7 @@ retry: */ if ((((pa >> PAGE_SHIFT) ^ (pv->pv_va >> PDRSHIFT) ^ (uintptr_t)pmap) & (NPTEPG - 1)) == 0 && - (*pde & PG_W) == 0) { + (oldpde & PG_W) == 0) { if (safe_to_clear_referenced(pmap, oldpde)) { atomic_clear_long(pde, PG_A); pmap_invalidate_page(pmap, pv->pv_va); Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/arm/arm/pmap-v6.c Sat Sep 10 16:49:25 2016 (r305685) @@ -5161,8 +5161,6 @@ pmap_is_referenced(vm_page_t m) return (rv); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * pmap_ts_referenced: * @@ -5171,10 +5169,6 @@ pmap_is_referenced(vm_page_t m) * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - * * As an optimization, update the page's dirty field if a modified bit is * found while counting reference bits. This opportunistic update can be * performed at low cost and can eliminate the need for some future calls Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/arm64/arm64/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -3880,8 +3880,6 @@ safe_to_clear_referenced(pmap_t pmap, pt return (FALSE); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * pmap_ts_referenced: * @@ -3890,9 +3888,13 @@ safe_to_clear_referenced(pmap_t pmap, pt * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. + * As an optimization, update the page's dirty field if a modified bit is + * found while counting reference bits. This opportunistic update can be + * performed at low cost and can eliminate the need for some future calls + * to pmap_is_modified(). However, since this function stops after + * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some + * dirty pages. Those dirty pages will only be detected by a future call + * to pmap_is_modified(). */ int pmap_ts_referenced(vm_page_t m) @@ -3947,6 +3949,14 @@ retry: ("pmap_ts_referenced: found an invalid l1 table")); pte = pmap_l1_to_l2(pde, pv->pv_va); tpte = pmap_load(pte); + if (pmap_page_dirty(tpte)) { + /* + * Although "tpte" is mapping a 2MB page, because + * this function is called at a 4KB page granularity, + * we only update the 4KB page under test. + */ + vm_page_dirty(m); + } if ((tpte & ATTR_AF) != 0) { /* * Since this reference bit is shared by 512 4KB @@ -4043,6 +4053,8 @@ small_mappings: ("pmap_ts_referenced: found an invalid l2 table")); pte = pmap_l2_to_l3(pde, pv->pv_va); tpte = pmap_load(pte); + if (pmap_page_dirty(tpte)) + vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) { if (safe_to_clear_referenced(pmap, tpte)) { /* Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/i386/i386/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -4765,8 +4765,6 @@ retry: rw_wunlock(&pvh_global_lock); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * pmap_ts_referenced: * @@ -4775,10 +4773,6 @@ retry: * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - * * As an optimization, update the page's dirty field if a modified bit is * found while counting reference bits. This opportunistic update can be * performed at low cost and can eliminate the need for some future calls Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/powerpc/booke/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -2499,9 +2499,13 @@ mmu_booke_clear_modify(mmu_t mmu, vm_pag * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. + * As an optimization, update the page's dirty field if a modified bit is + * found while counting reference bits. This opportunistic update can be + * performed at low cost and can eliminate the need for some future calls + * to pmap_is_modified(). However, since this function stops after + * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some + * dirty pages. Those dirty pages will only be detected by a future call + * to pmap_is_modified(). */ static int mmu_booke_ts_referenced(mmu_t mmu, vm_page_t m) @@ -2518,6 +2522,8 @@ mmu_booke_ts_referenced(mmu_t mmu, vm_pa PMAP_LOCK(pv->pv_pmap); if ((pte = pte_find(mmu, pv->pv_pmap, pv->pv_va)) != NULL && PTE_ISVALID(pte)) { + if (PTE_ISMODIFIED(pte)) + vm_page_dirty(m); if (PTE_ISREFERENCED(pte)) { mtx_lock_spin(&tlbivax_mutex); tlb_miss_lock(); @@ -2528,7 +2534,7 @@ mmu_booke_ts_referenced(mmu_t mmu, vm_pa tlb_miss_unlock(); mtx_unlock_spin(&tlbivax_mutex); - if (++count > 4) { + if (++count >= PMAP_TS_REFERENCED_MAX) { PMAP_UNLOCK(pv->pv_pmap); break; } Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/riscv/riscv/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -2991,8 +2991,6 @@ safe_to_clear_referenced(pmap_t pmap, pt return (FALSE); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * pmap_ts_referenced: * @@ -3001,9 +2999,13 @@ safe_to_clear_referenced(pmap_t pmap, pt * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. + * As an optimization, update the page's dirty field if a modified bit is + * found while counting reference bits. This opportunistic update can be + * performed at low cost and can eliminate the need for some future calls + * to pmap_is_modified(). However, since this function stops after + * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some + * dirty pages. Those dirty pages will only be detected by a future call + * to pmap_is_modified(). */ int pmap_ts_referenced(vm_page_t m) @@ -3012,7 +3014,7 @@ pmap_ts_referenced(vm_page_t m) pmap_t pmap; struct rwlock *lock; pd_entry_t *l2; - pt_entry_t *l3; + pt_entry_t *l3, old_l3; vm_paddr_t pa; int cleared, md_gen, not_cleared; struct spglist free; @@ -3050,15 +3052,18 @@ retry: ("pmap_ts_referenced: found an invalid l2 table")); l3 = pmap_l2_to_l3(l2, pv->pv_va); - if ((pmap_load(l3) & PTE_A) != 0) { - if (safe_to_clear_referenced(pmap, pmap_load(l3))) { + old_l3 = pmap_load(l3); + if (pmap_page_dirty(old_l3)) + vm_page_dirty(m); + if ((old_l3 & PTE_A) != 0) { + if (safe_to_clear_referenced(pmap, old_l3)) { /* * TODO: We don't handle the access flag * at all. We need to be able to set it in * the exception handler. */ panic("RISCVTODO: safe_to_clear_referenced\n"); - } else if ((pmap_load(l3) & PTE_SW_WIRED) == 0) { + } else if ((old_l3 & PTE_SW_WIRED) == 0) { /* * Wired pages cannot be paged out so * doing accessed bit emulation for Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/sparc64/sparc64/pmap.c Sat Sep 10 16:49:25 2016 (r305685) @@ -2073,18 +2073,12 @@ pmap_page_is_mapped(vm_page_t m) return (rv); } -#define PMAP_TS_REFERENCED_MAX 5 - /* * Return a count of reference bits for a page, clearing those bits. * It is not necessary for every reference bit to be cleared, but it * is necessary that 0 only be returned when there are truly no * reference bits set. * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - * * As an optimization, update the page's dirty field if a modified bit is * found while counting reference bits. This opportunistic update can be * performed at low cost and can eliminate the need for some future calls Modified: head/sys/vm/pmap.h ============================================================================== --- head/sys/vm/pmap.h Sat Sep 10 16:29:53 2016 (r305684) +++ head/sys/vm/pmap.h Sat Sep 10 16:49:25 2016 (r305685) @@ -104,6 +104,16 @@ extern vm_offset_t kernel_vm_end; #define PMAP_ENTER_NOSLEEP 0x0100 #define PMAP_ENTER_WIRED 0x0200 +/* + * Define the maximum number of machine-dependent reference bits that are + * cleared by a call to pmap_ts_referenced(). This limit serves two purposes. + * First, it bounds the cost of reference bit maintenance on widely shared + * pages. Second, it prevents numeric overflow during maintenance of a + * widely shared page's "act_count" field. An overflow could result in the + * premature deactivation of the page. + */ +#define PMAP_TS_REFERENCED_MAX 5 + void pmap_activate(struct thread *td); void pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice); From owner-svn-src-head@freebsd.org Sat Sep 10 17:45: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 2390ABD5422; Sat, 10 Sep 2016 17:45:37 +0000 (UTC) (envelope-from manu@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 BB0BDBBB; Sat, 10 Sep 2016 17:45:36 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8AHjatf042808; Sat, 10 Sep 2016 17:45:36 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8AHjZXv042806; Sat, 10 Sep 2016 17:45:35 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201609101745.u8AHjZXv042806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 10 Sep 2016 17:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305689 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 10 Sep 2016 17:45:37 -0000 Author: manu Date: Sat Sep 10 17:45:35 2016 New Revision: 305689 URL: https://svnweb.freebsd.org/changeset/base/305689 Log: a10_mmc: Remove completly the PIO code now all access is done by DMA. Rename registers as in the manual. Do a hard reset of the controller before a soft one. Since DMA is always used remove dependancy on allwinner_soc_family, it was used to differentiate SoC as the fdt compatible string were the same. Tested on A10, A20, H3 and A64. Reviewed by: jmcneill Differential Revision: https://reviews.freebsd.org/D6868 Modified: head/sys/arm/allwinner/a10_mmc.c head/sys/arm/allwinner/a10_mmc.h Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Sat Sep 10 17:14:57 2016 (r305688) +++ head/sys/arm/allwinner/a10_mmc.c Sat Sep 10 17:45:35 2016 (r305689) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -56,16 +55,12 @@ __FBSDID("$FreeBSD$"); #define A10_MMC_MEMRES 0 #define A10_MMC_IRQRES 1 #define A10_MMC_RESSZ 2 -#define A10_MMC_DMA_SEGS 16 +#define A10_MMC_DMA_SEGS ((MAXPHYS / PAGE_SIZE) + 1) #define A10_MMC_DMA_MAX_SIZE 0x2000 #define A10_MMC_DMA_FTRGLEVEL 0x20070008 #define CARD_ID_FREQUENCY 400000 -static int a10_mmc_pio_mode = 0; - -TUNABLE_INT("hw.a10.mmc.pio_mode", &a10_mmc_pio_mode); - static struct ofw_compat_data compat_data[] = { {"allwinner,sun4i-a10-mmc", 1}, {"allwinner,sun5i-a13-mmc", 1}, @@ -73,14 +68,11 @@ static struct ofw_compat_data compat_dat }; struct a10_mmc_softc { - bus_space_handle_t a10_bsh; - bus_space_tag_t a10_bst; device_t a10_dev; clk_t a10_clk_ahb; clk_t a10_clk_mmc; hwreset_t a10_rst_ahb; int a10_bus_busy; - int a10_id; int a10_resid; int a10_timeout; struct callout a10_timeoutc; @@ -91,7 +83,6 @@ struct a10_mmc_softc { uint32_t a10_intr; uint32_t a10_intr_wait; void * a10_intrhand; - bus_size_t a10_fifo_reg; /* Fields required for DMA access. */ bus_addr_t a10_dma_desc_phys; @@ -100,7 +91,6 @@ struct a10_mmc_softc { void * a10_dma_desc; bus_dmamap_t a10_dma_buf_map; bus_dma_tag_t a10_dma_buf_tag; - int a10_dma_inuse; int a10_dma_map_err; }; @@ -116,7 +106,7 @@ static int a10_mmc_detach(device_t); static int a10_mmc_setup_dma(struct a10_mmc_softc *); static int a10_mmc_reset(struct a10_mmc_softc *); static void a10_mmc_intr(void *); -static int a10_mmc_update_clock(struct a10_mmc_softc *); +static int a10_mmc_update_clock(struct a10_mmc_softc *, uint32_t); static int a10_mmc_update_ios(device_t, device_t); static int a10_mmc_request(device_t, device_t, struct mmc_request *); @@ -127,9 +117,9 @@ static int a10_mmc_release_host(device_t #define A10_MMC_LOCK(_sc) mtx_lock(&(_sc)->a10_mtx) #define A10_MMC_UNLOCK(_sc) mtx_unlock(&(_sc)->a10_mtx) #define A10_MMC_READ_4(_sc, _reg) \ - bus_space_read_4((_sc)->a10_bst, (_sc)->a10_bsh, _reg) + bus_read_4((_sc)->a10_res[A10_MMC_MEMRES], _reg) #define A10_MMC_WRITE_4(_sc, _reg, _value) \ - bus_space_write_4((_sc)->a10_bst, (_sc)->a10_bsh, _reg, _value) + bus_write_4((_sc)->a10_res[A10_MMC_MEMRES], _reg, _value) static int a10_mmc_probe(device_t dev) @@ -160,17 +150,10 @@ a10_mmc_attach(device_t dev) sc = device_get_softc(dev); sc->a10_dev = dev; sc->a10_req = NULL; - sc->a10_id = device_get_unit(dev); - if (sc->a10_id > 3) { - device_printf(dev, "only 4 hosts are supported (0-3)\n"); - return (ENXIO); - } if (bus_alloc_resources(dev, a10_mmc_res_spec, sc->a10_res) != 0) { device_printf(dev, "cannot allocate device resources\n"); return (ENXIO); } - sc->a10_bst = rman_get_bustag(sc->a10_res[A10_MMC_MEMRES]); - sc->a10_bsh = rman_get_bushandle(sc->a10_res[A10_MMC_MEMRES]); if (bus_setup_intr(dev, sc->a10_res[A10_MMC_IRQRES], INTR_TYPE_MISC | INTR_MPSAFE, NULL, a10_mmc_intr, sc, &sc->a10_intrhand)) { @@ -182,31 +165,12 @@ a10_mmc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->a10_timeoutc, &sc->a10_mtx, 0); -#if defined(__arm__) - /* - * Later chips use a different FIFO offset. Unfortunately the FDT - * uses the same compatible string for old and new implementations. - */ - switch (allwinner_soc_family()) { - case ALLWINNERSOC_SUN4I: - case ALLWINNERSOC_SUN5I: - case ALLWINNERSOC_SUN7I: - sc->a10_fifo_reg = A10_MMC_FIFO; - break; - default: - sc->a10_fifo_reg = A31_MMC_FIFO; - break; - } -#else /* __aarch64__ */ - sc->a10_fifo_reg = A31_MMC_FIFO; -#endif - /* De-assert reset */ if (hwreset_get_by_ofw_name(dev, 0, "ahb", &sc->a10_rst_ahb) == 0) { error = hwreset_deassert(sc->a10_rst_ahb); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); - return (error); + goto fail; } } @@ -244,19 +208,22 @@ a10_mmc_attach(device_t dev) SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "req_timeout", CTLFLAG_RW, &sc->a10_timeout, 0, "Request timeout in seconds"); - /* Reset controller. */ + /* Hardware reset */ + A10_MMC_WRITE_4(sc, A10_MMC_HWRST, 1); + DELAY(100); + A10_MMC_WRITE_4(sc, A10_MMC_HWRST, 0); + DELAY(500); + + /* Soft Reset controller. */ if (a10_mmc_reset(sc) != 0) { device_printf(dev, "cannot reset the controller\n"); goto fail; } - if (a10_mmc_pio_mode == 0 && a10_mmc_setup_dma(sc) != 0) { + if (a10_mmc_setup_dma(sc) != 0) { device_printf(sc->a10_dev, "Couldn't setup DMA!\n"); - a10_mmc_pio_mode = 1; + goto fail; } - if (bootverbose) - device_printf(sc->a10_dev, "DMA status: %s\n", - a10_mmc_pio_mode ? "disabled" : "enabled"); if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) bus_width = 4; @@ -369,7 +336,6 @@ a10_dma_cb(void *arg, bus_dma_segment_t return; dma_desc = sc->a10_dma_desc; - /* Note nsegs is guaranteed to be zero if err is non-zero. */ for (i = 0; i < nsegs; i++) { dma_desc[i].buf_size = segs[i].ds_len; dma_desc[i].buf_addr = segs[i].ds_addr; @@ -386,7 +352,7 @@ a10_dma_cb(void *arg, bus_dma_segment_t A10_MMC_DMA_CONFIG_ER; dma_desc[i].next = 0; } - } + } } static int @@ -401,13 +367,12 @@ a10_mmc_prepare_dma(struct a10_mmc_softc if (cmd->data->len > A10_MMC_DMA_MAX_SIZE * A10_MMC_DMA_SEGS) return (EFBIG); error = bus_dmamap_load(sc->a10_dma_buf_tag, sc->a10_dma_buf_map, - cmd->data->data, cmd->data->len, a10_dma_cb, sc, BUS_DMA_NOWAIT); + cmd->data->data, cmd->data->len, a10_dma_cb, sc, 0); if (error) return (error); if (sc->a10_dma_map_err) return (sc->a10_dma_map_err); - sc->a10_dma_inuse = 1; if (cmd->data->flags & MMC_DATA_WRITE) sync_op = BUS_DMASYNC_PREWRITE; else @@ -415,27 +380,32 @@ a10_mmc_prepare_dma(struct a10_mmc_softc bus_dmamap_sync(sc->a10_dma_buf_tag, sc->a10_dma_buf_map, sync_op); bus_dmamap_sync(sc->a10_dma_tag, sc->a10_dma_map, BUS_DMASYNC_PREWRITE); - val = A10_MMC_READ_4(sc, A10_MMC_IMASK); - val &= ~(A10_MMC_RX_DATA_REQ | A10_MMC_TX_DATA_REQ); - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, val); - val = A10_MMC_READ_4(sc, A10_MMC_GCTRL); - val &= ~A10_MMC_ACCESS_BY_AHB; - val |= A10_MMC_DMA_ENABLE; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - val |= A10_MMC_DMA_RESET; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - A10_MMC_WRITE_4(sc, A10_MMC_DMAC, A10_MMC_IDMAC_SOFT_RST); + /* Enable DMA */ + val = A10_MMC_READ_4(sc, A10_MMC_GCTL); + val &= ~A10_MMC_CTRL_FIFO_AC_MOD; + val |= A10_MMC_CTRL_DMA_ENB; + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, val); + + /* Reset DMA */ + val |= A10_MMC_CTRL_DMA_RST; + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, val); + + A10_MMC_WRITE_4(sc, A10_MMC_DMAC, A10_MMC_DMAC_IDMAC_SOFT_RST); A10_MMC_WRITE_4(sc, A10_MMC_DMAC, - A10_MMC_IDMAC_IDMA_ON | A10_MMC_IDMAC_FIX_BURST); - val = A10_MMC_READ_4(sc, A10_MMC_IDIE); - val &= ~(A10_MMC_IDMAC_RECEIVE_INT | A10_MMC_IDMAC_TRANSMIT_INT); + A10_MMC_DMAC_IDMAC_IDMA_ON | A10_MMC_DMAC_IDMAC_FIX_BURST); + + /* Enable RX or TX DMA interrupt */ if (cmd->data->flags & MMC_DATA_WRITE) - val |= A10_MMC_IDMAC_TRANSMIT_INT; + val |= A10_MMC_IDST_TX_INT; else - val |= A10_MMC_IDMAC_RECEIVE_INT; + val |= A10_MMC_IDST_RX_INT; A10_MMC_WRITE_4(sc, A10_MMC_IDIE, val); + + /* Set DMA descritptor list address */ A10_MMC_WRITE_4(sc, A10_MMC_DLBA, sc->a10_dma_desc_phys); - A10_MMC_WRITE_4(sc, A10_MMC_FTRGL, A10_MMC_DMA_FTRGLEVEL); + + /* FIFO trigger level */ + A10_MMC_WRITE_4(sc, A10_MMC_FWLR, A10_MMC_DMA_FTRGLEVEL); return (0); } @@ -445,11 +415,10 @@ a10_mmc_reset(struct a10_mmc_softc *sc) { int timeout; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_RESET); + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, A10_MMC_RESET); timeout = 1000; while (--timeout > 0) { - if ((A10_MMC_READ_4(sc, A10_MMC_GCTRL) & A10_MMC_RESET) == 0) + if ((A10_MMC_READ_4(sc, A10_MMC_GCTL) & A10_MMC_RESET) == 0) break; DELAY(100); } @@ -457,18 +426,20 @@ a10_mmc_reset(struct a10_mmc_softc *sc) return (ETIMEDOUT); /* Set the timeout. */ - A10_MMC_WRITE_4(sc, A10_MMC_TIMEOUT, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_TMOR, + A10_MMC_TMOR_DTO_LMT_SHIFT(A10_MMC_TMOR_DTO_LMT_MASK) | + A10_MMC_TMOR_RTO_LMT_SHIFT(A10_MMC_TMOR_RTO_LMT_MASK)); /* Clear pending interrupts. */ - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); A10_MMC_WRITE_4(sc, A10_MMC_IDST, 0xffffffff); /* Unmask interrupts. */ - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, - A10_MMC_CMD_DONE | A10_MMC_INT_ERR_BIT | - A10_MMC_DATA_OVER | A10_MMC_AUTOCMD_DONE); + A10_MMC_WRITE_4(sc, A10_MMC_IMKR, + A10_MMC_INT_CMD_DONE | A10_MMC_INT_ERR_BIT | + A10_MMC_INT_DATA_OVER | A10_MMC_INT_AUTO_STOP_DONE); /* Enable interrupts and AHB access. */ - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_INT_ENABLE); + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, + A10_MMC_READ_4(sc, A10_MMC_GCTL) | A10_MMC_CTRL_INT_ENB); return (0); } @@ -483,12 +454,6 @@ a10_mmc_req_done(struct a10_mmc_softc *s if (cmd->error != MMC_ERR_NONE) { /* Reset the controller. */ a10_mmc_reset(sc); - a10_mmc_update_clock(sc); - } - if (sc->a10_dma_inuse == 0) { - /* Reset the FIFO. */ - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_FIFO_RESET); } req = sc->a10_req; @@ -496,7 +461,6 @@ a10_mmc_req_done(struct a10_mmc_softc *s sc->a10_req = NULL; sc->a10_intr = 0; sc->a10_resid = 0; - sc->a10_dma_inuse = 0; sc->a10_dma_map_err = 0; sc->a10_intr_wait = 0; req->done(req); @@ -511,8 +475,8 @@ a10_mmc_req_ok(struct a10_mmc_softc *sc) timeout = 1000; while (--timeout > 0) { - status = A10_MMC_READ_4(sc, A10_MMC_STAS); - if ((status & A10_MMC_CARD_DATA_BUSY) == 0) + status = A10_MMC_READ_4(sc, A10_MMC_STAR); + if ((status & A10_MMC_STAR_CARD_BUSY) == 0) break; DELAY(1000); } @@ -552,28 +516,6 @@ a10_mmc_timeout(void *arg) "Spurious timeout - no active request\n"); } -static int -a10_mmc_pio_transfer(struct a10_mmc_softc *sc, struct mmc_data *data) -{ - int i, write; - uint32_t bit, *buf; - - buf = (uint32_t *)data->data; - write = (data->flags & MMC_DATA_WRITE) ? 1 : 0; - bit = write ? A10_MMC_FIFO_FULL : A10_MMC_FIFO_EMPTY; - for (i = sc->a10_resid; i < (data->len >> 2); i++) { - if ((A10_MMC_READ_4(sc, A10_MMC_STAS) & bit)) - return (1); - if (write) - A10_MMC_WRITE_4(sc, sc->a10_fifo_reg, buf[i]); - else - buf[i] = A10_MMC_READ_4(sc, sc->a10_fifo_reg); - sc->a10_resid = i + 1; - } - - return (0); -} - static void a10_mmc_intr(void *arg) { @@ -584,9 +526,9 @@ a10_mmc_intr(void *arg) sc = (struct a10_mmc_softc *)arg; A10_MMC_LOCK(sc); - rint = A10_MMC_READ_4(sc, A10_MMC_RINTR); + rint = A10_MMC_READ_4(sc, A10_MMC_RISR); idst = A10_MMC_READ_4(sc, A10_MMC_IDST); - imask = A10_MMC_READ_4(sc, A10_MMC_IMASK); + imask = A10_MMC_READ_4(sc, A10_MMC_IMKR); if (idst == 0 && imask == 0 && rint == 0) { A10_MMC_UNLOCK(sc); return; @@ -603,14 +545,14 @@ a10_mmc_intr(void *arg) } if (rint & A10_MMC_INT_ERR_BIT) { device_printf(sc->a10_dev, "error rint: 0x%08X\n", rint); - if (rint & A10_MMC_RESP_TIMEOUT) + if (rint & A10_MMC_INT_RESP_TIMEOUT) sc->a10_req->cmd->error = MMC_ERR_TIMEOUT; else sc->a10_req->cmd->error = MMC_ERR_FAILED; a10_mmc_req_done(sc); goto end; } - if (idst & A10_MMC_IDMAC_ERROR) { + if (idst & A10_MMC_IDST_ERROR) { device_printf(sc->a10_dev, "error idst: 0x%08x\n", idst); sc->a10_req->cmd->error = MMC_ERR_FAILED; a10_mmc_req_done(sc); @@ -619,8 +561,7 @@ a10_mmc_intr(void *arg) sc->a10_intr |= rint; data = sc->a10_req->cmd->data; - if (data != NULL && sc->a10_dma_inuse == 1 && - (idst & A10_MMC_IDMAC_COMPLETE)) { + if (data != NULL && (idst & A10_MMC_IDST_COMPLETE) != 0) { if (data->flags & MMC_DATA_WRITE) sync_op = BUS_DMASYNC_POSTWRITE; else @@ -631,16 +572,13 @@ a10_mmc_intr(void *arg) BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->a10_dma_buf_tag, sc->a10_dma_buf_map); sc->a10_resid = data->len >> 2; - } else if (data != NULL && sc->a10_dma_inuse == 0 && - (rint & (A10_MMC_DATA_OVER | A10_MMC_RX_DATA_REQ | - A10_MMC_TX_DATA_REQ)) != 0) - a10_mmc_pio_transfer(sc, data); + } if ((sc->a10_intr & sc->a10_intr_wait) == sc->a10_intr_wait) a10_mmc_req_ok(sc); end: A10_MMC_WRITE_4(sc, A10_MMC_IDST, idst); - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, rint); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, rint); A10_MMC_UNLOCK(sc); } @@ -650,7 +588,8 @@ a10_mmc_request(device_t bus, device_t c int blksz; struct a10_mmc_softc *sc; struct mmc_command *cmd; - uint32_t cmdreg, val; + uint32_t cmdreg; + int err; sc = device_get_softc(bus); A10_MMC_LOCK(sc); @@ -660,48 +599,39 @@ a10_mmc_request(device_t bus, device_t c } sc->a10_req = req; cmd = req->cmd; - cmdreg = A10_MMC_START; + cmdreg = A10_MMC_CMDR_LOAD; if (cmd->opcode == MMC_GO_IDLE_STATE) - cmdreg |= A10_MMC_SEND_INIT_SEQ; + cmdreg |= A10_MMC_CMDR_SEND_INIT_SEQ; if (cmd->flags & MMC_RSP_PRESENT) - cmdreg |= A10_MMC_RESP_EXP; + cmdreg |= A10_MMC_CMDR_RESP_RCV; if (cmd->flags & MMC_RSP_136) - cmdreg |= A10_MMC_LONG_RESP; + cmdreg |= A10_MMC_CMDR_LONG_RESP; if (cmd->flags & MMC_RSP_CRC) - cmdreg |= A10_MMC_CHECK_RESP_CRC; + cmdreg |= A10_MMC_CMDR_CHK_RESP_CRC; sc->a10_intr = 0; sc->a10_resid = 0; - sc->a10_intr_wait = A10_MMC_CMD_DONE; + sc->a10_intr_wait = A10_MMC_INT_CMD_DONE; cmd->error = MMC_ERR_NONE; if (cmd->data != NULL) { - sc->a10_intr_wait |= A10_MMC_DATA_OVER; - cmdreg |= A10_MMC_DATA_EXP | A10_MMC_WAIT_PREOVER; + sc->a10_intr_wait |= A10_MMC_INT_DATA_OVER; + cmdreg |= A10_MMC_CMDR_DATA_TRANS | A10_MMC_CMDR_WAIT_PRE_OVER; if (cmd->data->flags & MMC_DATA_MULTI) { - cmdreg |= A10_MMC_SEND_AUTOSTOP; - sc->a10_intr_wait |= A10_MMC_AUTOCMD_DONE; + cmdreg |= A10_MMC_CMDR_STOP_CMD_FLAG; + sc->a10_intr_wait |= A10_MMC_INT_AUTO_STOP_DONE; } if (cmd->data->flags & MMC_DATA_WRITE) - cmdreg |= A10_MMC_WRITE; + cmdreg |= A10_MMC_CMDR_DIR_WRITE; blksz = min(cmd->data->len, MMC_SECTOR_SIZE); - A10_MMC_WRITE_4(sc, A10_MMC_BLKSZ, blksz); - A10_MMC_WRITE_4(sc, A10_MMC_BCNTR, cmd->data->len); + A10_MMC_WRITE_4(sc, A10_MMC_BKSR, blksz); + A10_MMC_WRITE_4(sc, A10_MMC_BYCR, cmd->data->len); - if (a10_mmc_pio_mode == 0) - a10_mmc_prepare_dma(sc); - /* Enable PIO access if sc->a10_dma_inuse is not set. */ - if (sc->a10_dma_inuse == 0) { - val = A10_MMC_READ_4(sc, A10_MMC_GCTRL); - val &= ~A10_MMC_DMA_ENABLE; - val |= A10_MMC_ACCESS_BY_AHB; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - val = A10_MMC_READ_4(sc, A10_MMC_IMASK); - val |= A10_MMC_RX_DATA_REQ | A10_MMC_TX_DATA_REQ; - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, val); - } + err = a10_mmc_prepare_dma(sc); + if (err != 0) + device_printf(sc->a10_dev, "prepare_dma failed: %d\n", err); } - A10_MMC_WRITE_4(sc, A10_MMC_CARG, cmd->arg); + A10_MMC_WRITE_4(sc, A10_MMC_CAGR, cmd->arg); A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg | cmd->opcode); callout_reset(&sc->a10_timeoutc, sc->a10_timeout * hz, a10_mmc_timeout, sc); @@ -811,23 +741,32 @@ a10_mmc_write_ivar(device_t bus, device_ } static int -a10_mmc_update_clock(struct a10_mmc_softc *sc) +a10_mmc_update_clock(struct a10_mmc_softc *sc, uint32_t clkon) { uint32_t cmdreg; int retry; + uint32_t ckcr; - cmdreg = A10_MMC_START | A10_MMC_UPCLK_ONLY | - A10_MMC_WAIT_PREOVER; + ckcr = A10_MMC_READ_4(sc, A10_MMC_CKCR); + ckcr &= ~(A10_MMC_CKCR_CCLK_ENB | A10_MMC_CKCR_CCLK_CTRL); + + if (clkon) + ckcr |= A10_MMC_CKCR_CCLK_ENB; + + A10_MMC_WRITE_4(sc, A10_MMC_CKCR, ckcr); + + cmdreg = A10_MMC_CMDR_LOAD | A10_MMC_CMDR_PRG_CLK | + A10_MMC_CMDR_WAIT_PRE_OVER; A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg); retry = 0xfffff; while (--retry > 0) { - if ((A10_MMC_READ_4(sc, A10_MMC_CMDR) & A10_MMC_START) == 0) { - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + if ((A10_MMC_READ_4(sc, A10_MMC_CMDR) & A10_MMC_CMDR_LOAD) == 0) { + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); return (0); } DELAY(10); } - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); device_printf(sc->a10_dev, "timeout updating clock\n"); return (ETIMEDOUT); @@ -839,28 +778,37 @@ a10_mmc_update_ios(device_t bus, device_ int error; struct a10_mmc_softc *sc; struct mmc_ios *ios; - uint32_t clkcr; + uint32_t ckcr; sc = device_get_softc(bus); - clkcr = A10_MMC_READ_4(sc, A10_MMC_CLKCR); - if (clkcr & A10_MMC_CARD_CLK_ON) { - /* Disable clock. */ - clkcr &= ~A10_MMC_CARD_CLK_ON; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); - if (error != 0) - return (error); - } ios = &sc->a10_host.ios; + + /* Set the bus width. */ + switch (ios->bus_width) { + case bus_width_1: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR1); + break; + case bus_width_4: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR4); + break; + case bus_width_8: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR8); + break; + } + if (ios->clock) { - /* Reset the divider. */ - clkcr &= ~A10_MMC_CLKCR_DIV; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); + + /* Disable clock */ + error = a10_mmc_update_clock(sc, 0); if (error != 0) return (error); + /* Reset the divider. */ + ckcr = A10_MMC_READ_4(sc, A10_MMC_CKCR); + ckcr &= ~A10_MMC_CKCR_CCLK_DIV; + A10_MMC_WRITE_4(sc, A10_MMC_CKCR, ckcr); + /* Set the MMC clock. */ error = clk_set_freq(sc->a10_clk_mmc, ios->clock, CLK_SET_ROUND_DOWN); @@ -872,25 +820,11 @@ a10_mmc_update_ios(device_t bus, device_ } /* Enable clock. */ - clkcr |= A10_MMC_CARD_CLK_ON; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); + error = a10_mmc_update_clock(sc, 1); if (error != 0) return (error); } - /* Set the bus width. */ - switch (ios->bus_width) { - case bus_width_1: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH1); - break; - case bus_width_4: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH4); - break; - case bus_width_8: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH8); - break; - } return (0); } Modified: head/sys/arm/allwinner/a10_mmc.h ============================================================================== --- head/sys/arm/allwinner/a10_mmc.h Sat Sep 10 17:14:57 2016 (r305688) +++ head/sys/arm/allwinner/a10_mmc.h Sat Sep 10 17:45:35 2016 (r305689) @@ -29,117 +29,120 @@ #ifndef _A10_MMC_H_ #define _A10_MMC_H_ -#define A10_MMC_GCTRL 0x00 /* Global Control Register */ -#define A10_MMC_CLKCR 0x04 /* Clock Control Register */ -#define A10_MMC_TIMEOUT 0x08 /* Timeout Register */ -#define A10_MMC_WIDTH 0x0C /* Bus Width Register */ -#define A10_MMC_BLKSZ 0x10 /* Block Size Register */ -#define A10_MMC_BCNTR 0x14 /* Byte Count Register */ +#define A10_MMC_GCTL 0x00 /* Control Register */ +#define A10_MMC_CKCR 0x04 /* Clock Control Register */ +#define A10_MMC_TMOR 0x08 /* Timeout Register */ +#define A10_MMC_BWDR 0x0C /* Bus Width Register */ +#define A10_MMC_BKSR 0x10 /* Block Size Register */ +#define A10_MMC_BYCR 0x14 /* Byte Count Register */ #define A10_MMC_CMDR 0x18 /* Command Register */ -#define A10_MMC_CARG 0x1C /* Argument Register */ +#define A10_MMC_CAGR 0x1C /* Argument Register */ #define A10_MMC_RESP0 0x20 /* Response Register 0 */ #define A10_MMC_RESP1 0x24 /* Response Register 1 */ #define A10_MMC_RESP2 0x28 /* Response Register 2 */ #define A10_MMC_RESP3 0x2C /* Response Register 3 */ -#define A10_MMC_IMASK 0x30 /* Interrupt Mask Register */ -#define A10_MMC_MISTA 0x34 /* Masked Interrupt Status Register */ -#define A10_MMC_RINTR 0x38 /* Raw Interrupt Status Register */ -#define A10_MMC_STAS 0x3C /* Status Register */ -#define A10_MMC_FTRGL 0x40 /* FIFO Threshold Watermark Register */ +#define A10_MMC_IMKR 0x30 /* Interrupt Mask Register */ +#define A10_MMC_MISR 0x34 /* Masked Interrupt Status Register */ +#define A10_MMC_RISR 0x38 /* Raw Interrupt Status Register */ +#define A10_MMC_STAR 0x3C /* Status Register */ +#define A10_MMC_FWLR 0x40 /* FIFO Threshold Watermark Register */ #define A10_MMC_FUNS 0x44 /* Function Select Register */ -#define A10_MMC_CBCR 0x48 /* CIU Byte Count Register */ -#define A10_MMC_BBCR 0x4C /* BIU Byte Count Register */ -#define A10_MMC_DBGC 0x50 /* Debug Enable Register */ +#define A10_MMC_HWRST 0x78 /* Hardware reset (not documented) */ #define A10_MMC_DMAC 0x80 /* IDMAC Control Register */ #define A10_MMC_DLBA 0x84 /* IDMAC Desc List Base Address Reg */ #define A10_MMC_IDST 0x88 /* IDMAC Status Register */ #define A10_MMC_IDIE 0x8C /* IDMAC Interrupt Enable Register */ -#define A10_MMC_CHDA 0x90 -#define A10_MMC_CBDA 0x94 -#define A10_MMC_FIFO 0x100 /* FIFO Access Address (A10/A20) */ -#define A31_MMC_FIFO 0x200 /* FIFO Access Address (A31) */ - -/* A10_MMC_GCTRL */ -#define A10_MMC_SOFT_RESET (1U << 0) -#define A10_MMC_FIFO_RESET (1U << 1) -#define A10_MMC_DMA_RESET (1U << 2) -#define A10_MMC_INT_ENABLE (1U << 4) -#define A10_MMC_DMA_ENABLE (1U << 5) -#define A10_MMC_DEBOUNCE_ENABLE (1U << 8) -#define A10_MMC_DDR_MODE (1U << 10) -#define A10_MMC_ACCESS_BY_AHB (1U << 31) +#define A10_MMC_FIFO 0x100 /* FIFO Access Address (A10/A20) */ +#define A31_MMC_FIFO 0x200 /* FIFO Access Address (A31) */ + +/* A10_MMC_GCTL */ +#define A10_MMC_CTRL_SOFT_RST (1U << 0) +#define A10_MMC_CTRL_FIFO_RST (1U << 1) +#define A10_MMC_CTRL_DMA_RST (1U << 2) +#define A10_MMC_CTRL_INT_ENB (1U << 4) +#define A10_MMC_CTRL_DMA_ENB (1U << 5) +#define A10_MMC_CTRL_CD_DBC_ENB (1U << 8) +#define A10_MMC_CTRL_DDR_MOD_SEL (1U << 10) +#define A10_MMC_CTRL_FIFO_AC_MOD (1U << 31) #define A10_MMC_RESET \ - (A10_MMC_SOFT_RESET | A10_MMC_FIFO_RESET | A10_MMC_DMA_RESET) + (A10_MMC_CTRL_SOFT_RST | A10_MMC_CTRL_FIFO_RST | A10_MMC_CTRL_DMA_RST) -/* A10_MMC_CLKCR */ -#define A10_MMC_CARD_CLK_ON (1U << 16) -#define A10_MMC_LOW_POWER_ON (1U << 17) -#define A10_MMC_CLKCR_DIV 0xff - -/* A10_MMC_WIDTH */ -#define A10_MMC_WIDTH1 0 -#define A10_MMC_WIDTH4 1 -#define A10_MMC_WIDTH8 2 +/* A10_MMC_CKCR */ +#define A10_MMC_CKCR_CCLK_ENB (1U << 16) +#define A10_MMC_CKCR_CCLK_CTRL (1U << 17) +#define A10_MMC_CKCR_CCLK_DIV 0xff + +/* A10_MMC_TMOR */ +#define A10_MMC_TMOR_RTO_LMT_SHIFT(x) x /* Response timeout limit */ +#define A10_MMC_TMOR_RTO_LMT_MASK 0xff +#define A10_MMC_TMOR_DTO_LMT_SHIFT(x) (x << 8) /* Data timeout limit */ +#define A10_MMC_TMOR_DTO_LMT_MASK 0xffffff + +/* A10_MMC_BWDR */ +#define A10_MMC_BWDR1 0 +#define A10_MMC_BWDR4 1 +#define A10_MMC_BWDR8 2 /* A10_MMC_CMDR */ -#define A10_MMC_RESP_EXP (1U << 6) -#define A10_MMC_LONG_RESP (1U << 7) -#define A10_MMC_CHECK_RESP_CRC (1U << 8) -#define A10_MMC_DATA_EXP (1U << 9) -#define A10_MMC_WRITE (1U << 10) -#define A10_MMC_SEQ_MODE (1U << 11) -#define A10_MMC_SEND_AUTOSTOP (1U << 12) -#define A10_MMC_WAIT_PREOVER (1U << 13) -#define A10_MMC_STOP_ABORT_CMD (1U << 14) -#define A10_MMC_SEND_INIT_SEQ (1U << 15) -#define A10_MMC_UPCLK_ONLY (1U << 21) -#define A10_MMC_RDCEATADEV (1U << 22) -#define A10_MMC_CCS_EXP (1U << 23) -#define A10_MMC_ENB_BOOT (1U << 24) -#define A10_MMC_ALT_BOOT_OPT (1U << 25) -#define A10_MMC_BOOT_ACK_EXP (1U << 26) -#define A10_MMC_DISABLE_BOOT (1U << 27) -#define A10_MMC_VOL_SWITCH (1U << 28) -#define A10_MMC_START (1U << 31) - -/* A10_MMC_IMASK and A10_MMC_RINTR */ -#define A10_MMC_RESP_ERR (1U << 1) -#define A10_MMC_CMD_DONE (1U << 2) -#define A10_MMC_DATA_OVER (1U << 3) -#define A10_MMC_TX_DATA_REQ (1U << 4) -#define A10_MMC_RX_DATA_REQ (1U << 5) -#define A10_MMC_RESP_CRC_ERR (1U << 6) -#define A10_MMC_DATA_CRC_ERR (1U << 7) -#define A10_MMC_RESP_TIMEOUT (1U << 8) -#define A10_MMC_ACK_RECV (1U << 8) -#define A10_MMC_DATA_TIMEOUT (1U << 9) -#define A10_MMC_BOOT_START (1U << 9) -#define A10_MMC_DATA_STARVE (1U << 10) -#define A10_MMC_VOL_CHG_DONE (1U << 10) -#define A10_MMC_FIFO_RUN_ERR (1U << 11) -#define A10_MMC_HARDW_LOCKED (1U << 12) -#define A10_MMC_START_BIT_ERR (1U << 13) -#define A10_MMC_AUTOCMD_DONE (1U << 14) -#define A10_MMC_END_BIT_ERR (1U << 15) -#define A10_MMC_SDIO_INT (1U << 16) -#define A10_MMC_CARD_INSERT (1U << 30) -#define A10_MMC_CARD_REMOVE (1U << 31) +#define A10_MMC_CMDR_RESP_RCV (1U << 6) +#define A10_MMC_CMDR_LONG_RESP (1U << 7) +#define A10_MMC_CMDR_CHK_RESP_CRC (1U << 8) +#define A10_MMC_CMDR_DATA_TRANS (1U << 9) +#define A10_MMC_CMDR_DIR_WRITE (1U << 10) +#define A10_MMC_CMDR_TRANS_MODE_STREAM (1U << 11) +#define A10_MMC_CMDR_STOP_CMD_FLAG (1U << 12) +#define A10_MMC_CMDR_WAIT_PRE_OVER (1U << 13) +#define A10_MMC_CMDR_STOP_ABT_CMD (1U << 14) +#define A10_MMC_CMDR_SEND_INIT_SEQ (1U << 15) +#define A10_MMC_CMDR_PRG_CLK (1U << 21) +#define A10_MMC_CMDR_RD_CEDATA_DEV (1U << 22) +#define A10_MMC_CMDR_CCS_EXP (1U << 23) +#define A10_MMC_CMDR_BOOT_MOD_SHIFT 24 +#define A10_MMC_CMDR_BOOT_MOD_NORMAL 0 +#define A10_MMC_CMDR_BOOT_MOD_MANDATORY 1 +#define A10_MMC_CMDR_BOOT_MOD_ALT 2 +#define A10_MMC_CMDR_EXP_BOOT_ACK (1U << 26) +#define A10_MMC_CMDR_BOOT_ABT (1U << 27) +#define A10_MMC_CMDR_VOL_SW (1U << 28) +#define A10_MMC_CMDR_LOAD (1U << 31) + +/* A10_MMC_IMKR and A10_MMC_RISR */ +#define A10_MMC_INT_RESP_ERR (1U << 1) +#define A10_MMC_INT_CMD_DONE (1U << 2) +#define A10_MMC_INT_DATA_OVER (1U << 3) +#define A10_MMC_INT_TX_DATA_REQ (1U << 4) +#define A10_MMC_INT_RX_DATA_REQ (1U << 5) +#define A10_MMC_INT_RESP_CRC_ERR (1U << 6) +#define A10_MMC_INT_DATA_CRC_ERR (1U << 7) +#define A10_MMC_INT_RESP_TIMEOUT (1U << 8) +#define A10_MMC_INT_BOOT_ACK_RECV (1U << 8) +#define A10_MMC_INT_DATA_TIMEOUT (1U << 9) +#define A10_MMC_INT_BOOT_START (1U << 9) +#define A10_MMC_INT_DATA_STARVE (1U << 10) +#define A10_MMC_INT_VOL_CHG_DONE (1U << 10) +#define A10_MMC_INT_FIFO_RUN_ERR (1U << 11) +#define A10_MMC_INT_CMD_BUSY (1U << 12) +#define A10_MMC_INT_DATA_START_ERR (1U << 13) +#define A10_MMC_INT_AUTO_STOP_DONE (1U << 14) +#define A10_MMC_INT_DATA_END_BIT_ERR (1U << 15) +#define A10_MMC_INT_SDIO (1U << 16) +#define A10_MMC_INT_CARD_INSERT (1U << 30) +#define A10_MMC_INT_CARD_REMOVE (1U << 31) #define A10_MMC_INT_ERR_BIT \ - (A10_MMC_RESP_ERR | A10_MMC_RESP_CRC_ERR | \ - A10_MMC_DATA_CRC_ERR | A10_MMC_RESP_TIMEOUT | \ - A10_MMC_FIFO_RUN_ERR | A10_MMC_HARDW_LOCKED | \ - A10_MMC_START_BIT_ERR | A10_MMC_END_BIT_ERR) - -/* A10_MMC_STAS */ -#define A10_MMC_RX_WLFLAG (1U << 0) -#define A10_MMC_TX_WLFLAG (1U << 1) -#define A10_MMC_FIFO_EMPTY (1U << 2) -#define A10_MMC_FIFO_FULL (1U << 3) -#define A10_MMC_CARD_PRESENT (1U << 8) -#define A10_MMC_CARD_DATA_BUSY (1U << 9) -#define A10_MMC_DATA_FSM_BUSY (1U << 10) -#define A10_MMC_DMA_REQ (1U << 31) -#define A10_MMC_FIFO_SIZE 16 + (A10_MMC_INT_RESP_ERR | A10_MMC_INT_RESP_CRC_ERR | \ + A10_MMC_INT_DATA_CRC_ERR | A10_MMC_INT_RESP_TIMEOUT | \ + A10_MMC_INT_FIFO_RUN_ERR | A10_MMC_INT_CMD_BUSY | \ + A10_MMC_INT_DATA_START_ERR | A10_MMC_INT_DATA_END_BIT_ERR) + +/* A10_MMC_STAR */ +#define A10_MMC_STAR_FIFO_RX_LEVEL (1U << 0) +#define A10_MMC_STAR_FIFO_TX_LEVEL (1U << 1) +#define A10_MMC_STAR_FIFO_EMPTY (1U << 2) +#define A10_MMC_STAR_FIFO_FULL (1U << 3) +#define A10_MMC_STAR_CARD_PRESENT (1U << 8) +#define A10_MMC_STAR_CARD_BUSY (1U << 9) +#define A10_MMC_STAR_FSM_BUSY (1U << 10) +#define A10_MMC_STAR_DMA_REQ (1U << 31) /* A10_MMC_FUNS */ #define A10_MMC_CE_ATA_ON (0xceaaU << 16) @@ -151,52 +154,51 @@ #define A10_MMC_CE_ATA_DEV_INT_ENB (1U << 10) /* IDMA CONTROLLER BUS MOD BIT FIELD */ -#define A10_MMC_IDMAC_SOFT_RST (1U << 0) -#define A10_MMC_IDMAC_FIX_BURST (1U << 1) -#define A10_MMC_IDMAC_IDMA_ON (1U << 7) -#define A10_MMC_IDMAC_REFETCH_DES (1U << 31) +#define A10_MMC_DMAC_IDMAC_SOFT_RST (1U << 0) +#define A10_MMC_DMAC_IDMAC_FIX_BURST (1U << 1) +#define A10_MMC_DMAC_IDMAC_IDMA_ON (1U << 7) +#define A10_MMC_DMAC_IDMAC_REFETCH_DES (1U << 31) /* A10_MMC_IDST */ -#define A10_MMC_IDMAC_TRANSMIT_INT (1U << 0) -#define A10_MMC_IDMAC_RECEIVE_INT (1U << 1) -#define A10_MMC_IDMAC_FATAL_BUS_ERR (1U << 2) -#define A10_MMC_IDMAC_DES_INVALID (1U << 4) -#define A10_MMC_IDMAC_CARD_ERR_SUM (1U << 5) -#define A10_MMC_IDMAC_NORMAL_INT_SUM (1U << 8) -#define A10_MMC_IDMAC_ABNORMAL_INT_SUM (1U << 9) -#define A10_MMC_IDMAC_HOST_ABT_INTX (1U << 10) -#define A10_MMC_IDMAC_HOST_ABT_INRX (1U << 10) -#define A10_MMC_IDMAC_IDLE (0U << 13) -#define A10_MMC_IDMAC_SUSPEND (1U << 13) -#define A10_MMC_IDMAC_DESC_RD (2U << 13) -#define A10_MMC_IDMAC_DESC_CHECK (3U << 13) -#define A10_MMC_IDMAC_RD_REQ_WAIT (4U << 13) -#define A10_MMC_IDMAC_WR_REQ_WAIT (5U << 13) -#define A10_MMC_IDMAC_RD (6U << 13) -#define A10_MMC_IDMAC_WR (7U << 13) -#define A10_MMC_IDMAC_DESC_CLOSE (8U << 13) -#define A10_MMC_IDMAC_ERROR \ - (A10_MMC_IDMAC_FATAL_BUS_ERR | A10_MMC_IDMAC_CARD_ERR_SUM | \ - A10_MMC_IDMAC_DES_INVALID | A10_MMC_IDMAC_ABNORMAL_INT_SUM) -#define A10_MMC_IDMAC_COMPLETE \ - (A10_MMC_IDMAC_TRANSMIT_INT | A10_MMC_IDMAC_RECEIVE_INT) +#define A10_MMC_IDST_TX_INT (1U << 0) +#define A10_MMC_IDST_RX_INT (1U << 1) +#define A10_MMC_IDST_FATAL_BERR_INT (1U << 2) +#define A10_MMC_IDST_DES_UNAVL_INT (1U << 4) +#define A10_MMC_IDST_ERR_FLAG_SUM (1U << 5) +#define A10_MMC_IDST_NOR_INT_SUM (1U << 8) +#define A10_MMC_IDST_ABN_INT_SUM (1U << 9) +#define A10_MMC_IDST_HOST_ABT_INTX (1U << 10) +#define A10_MMC_IDST_HOST_ABT_INRX (1U << 10) +#define A10_MMC_IDST_IDLE (0U << 13) +#define A10_MMC_IDST_SUSPEND (1U << 13) +#define A10_MMC_IDST_DESC_RD (2U << 13) +#define A10_MMC_IDST_DESC_CHECK (3U << 13) +#define A10_MMC_IDST_RD_REQ_WAIT (4U << 13) +#define A10_MMC_IDST_WR_REQ_WAIT (5U << 13) +#define A10_MMC_IDST_RD (6U << 13) +#define A10_MMC_IDST_WR (7U << 13) +#define A10_MMC_IDST_DESC_CLOSE (8U << 13) +#define A10_MMC_IDST_ERROR \ + (A10_MMC_IDST_FATAL_BERR_INT | A10_MMC_IDST_ERR_FLAG_SUM | \ + A10_MMC_IDST_DES_UNAVL_INT | A10_MMC_IDST_ABN_INT_SUM) +#define A10_MMC_IDST_COMPLETE \ + (A10_MMC_IDST_TX_INT | A10_MMC_IDST_RX_INT) /* The DMA descriptor table. */ struct a10_mmc_dma_desc { uint32_t config; -#define A10_MMC_DMA_CONFIG_DIC (1U << 1) -#define A10_MMC_DMA_CONFIG_LD (1U << 2) -#define A10_MMC_DMA_CONFIG_FD (1U << 3) -#define A10_MMC_DMA_CONFIG_CH (1U << 4) -#define A10_MMC_DMA_CONFIG_ER (1U << 5) -#define A10_MMC_DMA_CONFIG_CES (1U << 30) -#define A10_MMC_DMA_CONFIG_OWN (1U << 31) +#define A10_MMC_DMA_CONFIG_DIC (1U << 1) /* Disable Interrupt Completion */ +#define A10_MMC_DMA_CONFIG_LD (1U << 2) /* Last DES */ +#define A10_MMC_DMA_CONFIG_FD (1U << 3) /* First DES */ +#define A10_MMC_DMA_CONFIG_CH (1U << 4) /* CHAIN MOD */ +#define A10_MMC_DMA_CONFIG_ER (1U << 5) /* End of Ring (undocumented register) */ +#define A10_MMC_DMA_CONFIG_CES (1U << 30) /* Card Error Summary */ +#define A10_MMC_DMA_CONFIG_OWN (1U << 31) /* DES Own Flag */ uint32_t buf_size; uint32_t buf_addr; uint32_t next; }; -/* DMA descriptors and data buffers must be aligned to 32-bits */ -#define A10_MMC_DMA_ALIGN 4 +#define A10_MMC_DMA_ALIGN 4 #endif /* _A10_MMC_H_ */ From owner-svn-src-head@freebsd.org Sat Sep 10 20:04:59 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 68E60BD5AD6; Sat, 10 Sep 2016 20:04:59 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on071e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::71e]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D89EFFC2; Sat, 10 Sep 2016 20:04:58 +0000 (UTC) (envelope-from sjg@juniper.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=junipernetworks.onmicrosoft.com; s=selector1-juniper-net; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jgPWMidWAWK7AMF3nV67/HyZZcN1Iql0Zm9mfhWOmYg=; b=Hqwg+zIe9HtKC1qAPIXQnbrbaIozRabhuDC4II9epe81N/GShlU+KK0QZ0gGBBHjeztmC6t//XcYvdqOBjzvnhpYBeN02+f/VSOErfY5I+TTXTpShKyH9Lz/obec2A+HJWliDOSofS1ipI5UzCjKiRq6PzNfdy58AbVnIu/Qlvk= Received: from SN1PR05CA0035.namprd05.prod.outlook.com (10.163.68.173) by DM5PR05MB3145.namprd05.prod.outlook.com (10.173.219.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.2; Sat, 10 Sep 2016 00:27:53 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::175) by SN1PR05CA0035.outlook.office365.com (2a01:111:e400:5197::45) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.3 via Frontend Transport; Sat, 10 Sep 2016 00:27:53 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.18) smtp.mailfrom=juniper.net; FreeBSD.org; dkim=none (message not signed) header.d=none;FreeBSD.org; dmarc=none action=none header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.18 as permitted sender) Received: from p-emfe01a-sac.jnpr.net (66.129.239.18) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.6 via Frontend Transport; Sat, 10 Sep 2016 00:27:53 +0000 Received: from p-mailhub01.juniper.net (10.160.2.17) by p-emfe01a-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 9 Sep 2016 17:27:40 -0700 Received: from kaos.jnpr.net (kaos.jnpr.net [172.21.30.60]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id u8A0Rdov011566; Fri, 9 Sep 2016 17:27:39 -0700 (envelope-from sjg@juniper.net) Received: from kaos.jnpr.net (localhost [127.0.0.1]) by kaos.jnpr.net (Postfix) with ESMTP id 92EF738551E; Fri, 9 Sep 2016 17:27:39 -0700 (PDT) To: Bryan Drewery CC: , , , Subject: Re: svn commit: r305634 - head/share/mk In-Reply-To: References: <201609090121.u891LZOO023156@repo.freebsd.org> Comments: In-reply-to: Bryan Drewery message dated "Fri, 09 Sep 2016 11:24:27 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 24.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <76390.1473467259.1@kaos.jnpr.net> Date: Fri, 9 Sep 2016 17:27:39 -0700 Message-ID: <76391.1473467259@kaos.jnpr.net> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.18; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(199003)(189002)(24454002)(69596002)(7126002)(356003)(50986999)(19580395003)(81156014)(50466002)(86362001)(76176999)(8676002)(117636001)(626004)(53416004)(68736007)(46406003)(7696004)(2906002)(9686002)(7846002)(50226002)(23726003)(92566002)(97756001)(586003)(4001430100002)(77096005)(97736004)(8936002)(11100500001)(87936001)(305945005)(4326007)(189998001)(2950100001)(450100001)(5660300001)(2810700001)(107886002)(106466001)(19580405001)(47776003)(81166006)(110136002)(105596002)(76506005)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR05MB3145; H:p-emfe01a-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:utWk/f2q1atuNHOcjvd7ljJLqFKJw3yQX9SFdbAdT7h48qUwHa+6/qSoMX7+eR3b4uuDVVSWYPxIdEPEnZFTb2AjnVRSp2Ns76n1wlliq1i7CsR/tzpwks9KSNlE8oIDQRL3kVig3RQ9JwqRlRyTyx9kk0bSlkO5JAwO24uEdsbKGmtekHCkZ8WJYl6B06y2SK111jdae5zgdIo943CBPkI5IM2LtkY8WuGyiEY6RyW4Z8NHTCK4RcBTMg7Ft7yKd8uAiwnD5uBfxkrW1Mq17bIHi9NRF7GyNn9ZXLnn9NAbfo1ZWfE+Xo7Wj9sueqvdbwBYw2EZVJ9q6g7BAsXduy0VcFVvycUGMOXkoYE+9ORUr8+rbITXXAv3MlRpwt2TcqDR7tRoWKkKYpwyPaXsNhkif9bwDJLjdrFEwiBCP50+Rr7vRtsEHhZh91u3AhPqZPTSN9TUMM3Bpq2zTVSAL3Hnh4/sNhNL4JfPo4Ej9evrSIIb0OLTS0oh/3cNTSD7U7+eM0/qQVbACDYyZOAm96nsvWBdDFXs9Gk86Jw82jU= X-MS-Office365-Filtering-Correlation-Id: a7abf8e9-a08b-4c5e-9537-08d3d9114de3 X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3145; 2:NpJo9oKaWIulp5HCxGCLOqMNV2DmL3fQgM2uTGTvPHiSvyX9SNkSgtqfBEXzIlLW+UG/p3BAciuPh7NTnyIPUpsfABU0/QwQPubZtDXSPnf/YxxiQ+NPyBNh8bPsuXMdbXjpnwte4BEN2yVYb+Zph3kZXGI7WsG14cjW/8Hg6wIcoiRhxTMiGXhxEqs6mWLm; 3:31/wysTkjc/Q+1tYlLdhD7YgUMBQ3sdw1CkdeAtGboPxA9A4pTUCWW6cE4VMoXS/xBhPtF1AizWqQJfh3w7YWcFcAChL1ICXz0MnwnAlHV6ov2HivwxTnrwM0rzBMoacQpGIKN8xo8NJmwPe9SnnPIj+HiMphi+iNMRNkW7AW4gXo28r9n6Sw2Fzq08gc+tmwlXhp5D1eqEWbQcSNcBaAitcgS22zYHCCxS8nIKc1/Y=; 25:gSMs3JmaDZFGG4N8BW0mFUUstXzrMNEAje4hLsc5LL3SaGmsq1n3nQP0kyLgorMurXTvog6CV/8IcqPm+OSGhTkDv/ra1MWd/B47xsxnhkasAeSc8JwXcV4QvMTbqHVHENo6aUBO3i/kD7L4s/cKF0rklzLvfk09bxNQmogc/ow9lXikrviR/WdFOfne5P9Ax4xLCeEOAEWKQlBK/GFSdLa7bTiDjgnqY03RliTKNlkGcniCRudXO2Op9GLr6MgMvoyuyKind0KsIIVvo5OuhpcrUlzjQNefbmf5HXSChqsk644MNf8v9quEHrq4glx2ghBwlm6w9jnXG7bwR6ATM2dAXyuA+2WTF1uZOFM8C2ReausDQ/h9qdf8KkDN9d4/axmmZQ8M588U847ySPWuyInqpKXTtX/1t28iUBcsUQ0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR05MB3145; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3145; 31:tGd8wB5OHCwbrYkmmAA10r5cwZEFBSCBQu1p6L5XpqOC1h/kB5PaCiLsUFDiFcE3EbGBZ58uksnvRzJhyWGC41zGTat8tXQNLgWqZtnjdVR9sCpUbCHeUgV3HZ04TsX/jreROeLWFckkpo8k+/UD7uUvnXYM4QR9kMrXTyjfQIYOf+lxuuX0TlyZnJI2pCgoqj4IzIaxmIXhg+Uv230lVR2IK4q411zYHJJrMzyp7jE=; 20:CnAmmlad34bnh9aTsOPb4+XU/7bPHwtA4xPuoGaEpAU0HvQy1uqxGHe7t3DVcpxQc2kPbpKzslpOU+BG/+jtsi+ehVIPZ7UyiI7KikhP3ofWX0DZJTU7QNvSLW5S/Np6IQ4PO0Yk8zt6G9KKh3vBPnVOq1AmzEiHwjpXUUEiXzo5vkFcdl3fn8zvIv84+a1Qk8a/1C5PmkE+o09nJBtDd0EbjtzpG9lSatQYKtkEpA1Zb6BZtWMXDQAX4I6efyb3GxRYy1YW9hRtHqDnBj7qH5Hri3uDv5t+KJZdPOjHKFHsQtiz2qkxsTCCPs+FodqAdMDUmsQV7N2q2NQNyHie8MBTHrQoaSD8QYgnqW3NR+P5Hr3QPfjZL2Lbn1UpwB7LtMTOUJPFCqs5WsN6FibKVVXC06y0kWeU21DF49JqnfE23VnedfPoh6Xh4elL7byowGgi3NgQHb++CI1bI253m2CR2vJlot2mNrL2BnnOG2sDZFBS2XLsLkI6EVIuXGiX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:DM5PR05MB3145; BCL:0; PCL:0; RULEID:; SRVR:DM5PR05MB3145; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3145; 4:hBen3htlQznMibhunFC3BWxjIJlNga7XC/6wFg2RBiiUxRNrbJ3NAQzQ0EJl02c4sNB8ZSH8VCROooc5oGOPxAchJ4Kfxd3bhwyv5ekpRpWVDQ5ewyR1vExs5XYPvhW/ocK22/bGS7B2/WI1EiSY+O5hcZMb1yCUuG0Fy1w1eiUeZg201yo+AuPjaLqcqvrNOyq7bnIo2VZhqzSMvluQc5hUSo2zGrD9PPt74zddLchQAvktv2ON4op+qll7/EJb2iSd8h4bgUkhrBUg2Uj7wB2fjV0X4adliFbbMx/GnskM3UoGBerGa5MV9re+06AV7Tsadxee68fzyptHp0ifToIP1xtQ/km/y+YNVruI47a2XTWbul7FBaZAc2b1l3yzyNrXFsu1AYUW2r4O0YZJRpVySfdE2hJ4744ME1rWpD4BgKIqMLilMV8sNF19cNz/PNXZYl80312tjczEdbgwshjvonr5i8UnMrgvx+Ogc7x5tTKQs3sNiGM+h7rm/emQ X-Forefront-PRVS: 0061C35778 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR05MB3145; 23:mSreuyjjEPtU24r2ID2O5OrLOfYfvq6XScJEaHCR0?= =?us-ascii?Q?DRUNugEfKCMX94hSPljrYTCPkCZlMDdoDvWqcXHoGmy6s9yYK2RrW30/Y49u?= =?us-ascii?Q?KN1NC9iNKJI71HXU+I5ttb6R13CdbSrLXukvItQ5Xd0+XT4dOeFNWBwSxjP/?= =?us-ascii?Q?g65/mdiQKzmIzdkSDsTdJVXlqSqCBfW6rb+Xu1AsAKAtdBeUGdTwsuMhy4X6?= =?us-ascii?Q?w/JSeI4qMkRxXL2WM1rwiA4IJTVGykVCu6FojmMZGtKM/8LvII4Y8Ha0YYZQ?= =?us-ascii?Q?Q+EhtbmoGDhkft3p1KM41zMynjZgvh/sfvROil5LZmIlsBCMqTPVTVPS4ix4?= =?us-ascii?Q?cgpI8ihFeJCsfIqnFGcKEC2YBwrK7fTIrj+l0D8j7SJnWMjz9czl43S6YYzQ?= =?us-ascii?Q?LcSJLbUqO+Vwe4lim/VlSlnB2016eOUdHN5Zw7lmLSu2yG91gjTyaHRCUAdk?= =?us-ascii?Q?gG4u2z313UZdLwsGQvv4kPXAjrzGZaBYs9Ptmj/9ZVNHUSt+WT/ij12IBBWW?= =?us-ascii?Q?M+YrhIT5PG2v/EprmC2v2o70nUBRJOVsy3U1nNVLSR02ZnVa6y9aMbOubZHQ?= =?us-ascii?Q?Sfz88Ezgym1rPps7HdpEcgBvWaVFK5hP851I4neC32S7A2q+snc6MBKkF5B+?= =?us-ascii?Q?JtRwLtPpiV8xoRp81OO4UCdsICui4wC8mdVQCS5sgETja63+U89T/fw1PorE?= =?us-ascii?Q?lHLV1H6bdvn0cPSoScWdQYKNIN6bPjnLuyeFe2I20JlYrawF5wtmg5b93taY?= =?us-ascii?Q?gtjNahrHwhuHRpuQXfATgB8n1/DoBM25GfNFTVqSR1FFrZXk/9qnhmPb7NAy?= =?us-ascii?Q?NzAu/sfG51L0RNccxbYKiLIidWQNxvZ8M68akS5KNYKRa2TKhaSs0oSl3GTQ?= =?us-ascii?Q?HHQjLe4TDWXwGN0nc3Zs8X5jeyeNQFL9dtQyeF7Ag7ROU1LMWbYSWW3loOOJ?= =?us-ascii?Q?i/24YmAzU5UgwsZz0Tb38tunmY4UX2zqWQHGG6K5A7vejIKqbKhIjZnzrAdf?= =?us-ascii?Q?F7gwaCY7TJqEBvgdhJtmQzY+8w4DDqC6od5YH3aaWWX91IW+zem9Q41pDeY+?= =?us-ascii?Q?E5VNJb1RRgZWo1qQu0tlmwi2WqyXyh1OiS+KSrd8ALsHShl/0iiTWh/k2uzu?= =?us-ascii?Q?IbpNl2pfyOZ6zHePV6ZR40cHknQZmRmD9vGjgeW2ZsB0aAVrd1vUAIT+bzKT?= =?us-ascii?Q?zBH6Cfs+WV3E6r03cNVH0nfDQzY+oeeHb6mIQZL3EQJlfPapbyK3Jzj8oeKQ?= =?us-ascii?Q?q9d+M66iZSXHxkhqNc=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3145; 6:zauOS0+ZiSZ3KSv5vg2zfMtr69QAzL+S49GHyGak9qGaHMB1/kH+vGQMTb2m4PQJSW4H1xdeGKZ3v1bgJ45haUrBIwnIQroafY5qljD1tZG0meF5piBdVN7pxc9iAzjD9e5MY07DjJHiJ5Rc7mCVZ24DgS6KB+gL2WxgMm/JNNcGj6P0NHysJkJOUGIQOWeBIlbpaJlwBVIzt1WiiA1dvT/RfCXYc0uv5MR59LMtUvgD5cFnwZdJxjEOlsxYWkUOTUvRFextQc6oEt63b65HYYgjSEXciZJc7Qr6kM44jgPReS1Hsbl1gQGFLf4WWUz6IiKpO91j8J2UrleFsDKhsA==; 5:tyy6L4jTf2pMahMRpIexiejj0NulOm8LX4Ru7Vug3Yi7FHPWYli30Vv6A2i+x4P+ZaJ9RFhOyO6gAzH0h5HlyyGMd+FTUXA6RSWiVAkFRVZIJfhHda0Qa6qkJfl9nFCNCqPonzf6xI0Kj30rZnQ2yA==; 24:xhOgCHcsCr6xav07K5dHY+QUM3PtlUZdWAwMYOUFdMKW7O2ZeCGtcvVcukiPVJtvBpzrAYWI+j5HaeNRobVAwqSVqXhcL9AsZxgcD8SkNWc=; 7:xaGtM3hLhz1JvrIojNYaRgGiKlO5Hjwt2RUc/4MO8qecow4+IeVKZEg87+RKPBGrMac0JaeGGmRb2dh2dimm6qffzbjsQEkHRceiQysWqUFd2cQ7UtMGKS4e2UoR7wrv+monq+c2TFqSiyr6B55ARyDdyNd9zxQWz7kRJVS2oFr2zpVv8XgJbEWKuLs+u54ttRYxw8u0Z15S3LJFw/ZOM96jSjPXcPDLc1fGr7NTJtRppqJzWC2AOUA0Fsr7Ain2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2016 00:27:53.0059 (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.18]; Helo=[p-emfe01a-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB3145 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 10 Sep 2016 20:04:59 -0000 Bryan Drewery wrote: > > +# we can afford to use cookies to prevent some targets > > +# re-running needlessly > > +META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}} > > Could you use ?= here please? I have a META_COOKIE_TOUCH in local.sys.mk Sure. > Also note that you need to remove this cookie immediately in any target > that uses it. I covered this a bit in my BSDCan presentation. The > problem is if meta mode determines that a target is outdated, then > partially rebuilds the target, then fails before touching the cookie. > The next build may not consider the target out-of-date anymore and fail > to retry. > > Consider something like: > foo: foo.c > target_install: > cp foo ${DESTDIR}/usr/bin/ > touch target_install > > It may consider this target out-of-date due to foo rebuilding (and > detected in target_install.meta), but the cp may fail. The next build, > target_install.meta was overwritten with the failed attempt, and is now > newer than foo and still has its target_install cookie. Nothing will The mtime of the .meta file is not relevent as it is not the target If foo is still newer than target_install and referenced by the the .meta file the target will still be out-of-date Sill, one could do things like: .ERROR: ${.ERROR_TARGET:Drm -f ${.ERROR_TARGET}} or if multiple things to be done on .ERROR .ERROR: rm-failed rm-failed: .NOMETA ${.ERROR_TARGET:Drm -f ${.ERROR_TARGET}} to ensure that any failed target is removed. > cause it to retry copying, and it proceeds on with the build without > properly failing again. I hit this case in at least include/ (which > went through a lot of further changes, finally of which was the removal > of cookies in r300346) and some other cases which I don't recall the > specifics for.