From owner-svn-src-all@freebsd.org Sun Jul 23 05:54:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41B29C7D40E; Sun, 23 Jul 2017 05:54:57 +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 0F3E874FDD; Sun, 23 Jul 2017 05:54:56 +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 v6N5su9P032379; Sun, 23 Jul 2017 05:54:56 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6N5su45032378; Sun, 23 Jul 2017 05:54:56 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707230554.v6N5su45032378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 23 Jul 2017 05:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321377 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 321377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 05:54:57 -0000 Author: alc Date: Sun Jul 23 05:54:56 2017 New Revision: 321377 URL: https://svnweb.freebsd.org/changeset/base/321377 Log: In vm_page_ps_test(), always check that the base pages within the specified superpage all belong to the same object. To date, that check has not been needed, but upcoming changes require it. (See the Differential Revision.) Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11556 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Jul 22 21:29:44 2017 (r321376) +++ head/sys/vm/vm_page.c Sun Jul 23 05:54:56 2017 (r321377) @@ -3478,9 +3478,11 @@ vm_page_is_valid(vm_page_t m, int base, int size) bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m) { + vm_object_t object; int i, npages; - VM_OBJECT_ASSERT_LOCKED(m->object); + object = m->object; + VM_OBJECT_ASSERT_LOCKED(object); npages = atop(pagesizes[m->psind]); /* @@ -3489,6 +3491,9 @@ vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip * occupy adjacent entries in vm_page_array[]. */ for (i = 0; i < npages; i++) { + /* Always test object consistency, including "skip_m". */ + if (m[i].object != object) + return (false); if (&m[i] == skip_m) continue; if ((flags & PS_NONE_BUSY) != 0 && vm_page_busied(&m[i])) From owner-svn-src-all@freebsd.org Sun Jul 23 06:34:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A227C7DBCF; Sun, 23 Jul 2017 06:34:00 +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 16AD475D4D; Sun, 23 Jul 2017 06:34:00 +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 v6N6XxD4048783; Sun, 23 Jul 2017 06:33:59 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6N6XxDN048780; Sun, 23 Jul 2017 06:33:59 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707230633.v6N6XxDN048780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 23 Jul 2017 06:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321378 - in head/sys: amd64/amd64 amd64/include vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include vm X-SVN-Commit-Revision: 321378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 06:34:00 -0000 Author: alc Date: Sun Jul 23 06:33:58 2017 New Revision: 321378 URL: https://svnweb.freebsd.org/changeset/base/321378 Log: Add support for pmap_enter(..., psind=1) to the amd64 pmap. In other words, add support for explicitly requesting that pmap_enter() create a 2MB page mapping. (Essentially, this feature allows the machine-independent layer to create superpage mappings preemptively, and not wait for automatic promotion to occur.) Export pmap_ps_enabled() to the machine-independent layer. Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or reclaim a PV entry when one is not available. Refactor pmap_enter_pde() into two functions, one by the same name, that is a general-purpose function for creating PDE PG_PS mappings, and another, pmap_enter_2mpage(), that is used to prefault 2MB read- and/or execute-only mappings for execve(2), mmap(2), and shmat(2). Submitted by: Yufeng Zhou (an earlier version) Reviewed by: kib, markj Tested by: pho MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D11556 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/vm/pmap.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Jul 23 05:54:56 2017 (r321377) +++ head/sys/amd64/amd64/pmap.c Sun Jul 23 06:33:58 2017 (r321378) @@ -582,6 +582,12 @@ pmap_delayed_invl_page(vm_page_t m) */ static caddr_t crashdumpmap; +/* + * Internal flags for pmap_enter()'s helper functions. + */ +#define PMAP_ENTER_NORECLAIM 0x1000000 /* Don't reclaim PV entries. */ +#define PMAP_ENTER_NOREPLACE 0x2000000 /* Don't replace mappings. */ + static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp); @@ -591,8 +597,8 @@ static void reserve_pv_entries(pmap_t pmap, int needed struct rwlock **lockp); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, struct rwlock **lockp); -static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, - struct rwlock **lockp); +static bool pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde, + u_int flags, struct rwlock **lockp); static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, struct rwlock **lockp); static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); @@ -605,8 +611,10 @@ static boolean_t pmap_demote_pde_locked(pmap_t pmap, p vm_offset_t va, struct rwlock **lockp); static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va); -static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot, struct rwlock **lockp); +static bool pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot, struct rwlock **lockp); +static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, + u_int flags, vm_page_t m, struct rwlock **lockp); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp); static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); @@ -1389,7 +1397,7 @@ pmap_cache_mask(pmap_t pmap, boolean_t is_pde) return (mask); } -static __inline boolean_t +bool pmap_ps_enabled(pmap_t pmap) { @@ -3393,27 +3401,30 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, } /* - * Conditionally create the PV entry for a 2MB page mapping if the required - * memory can be allocated without resorting to reclamation. + * Create the PV entry for a 2MB page mapping. Always returns true unless the + * flag PMAP_ENTER_NORECLAIM is specified. If that flag is specified, returns + * false if the PV entry cannot be allocated without resorting to reclamation. */ -static boolean_t -pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, +static bool +pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde, u_int flags, struct rwlock **lockp) { struct md_page *pvh; pv_entry_t pv; + vm_paddr_t pa; PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* Pass NULL instead of the lock pointer to disable reclamation. */ - if ((pv = get_pv_entry(pmap, NULL)) != NULL) { - pv->pv_va = va; - CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); - pvh = pa_to_pvh(pa); - TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); - pvh->pv_gen++; - return (TRUE); - } else - return (FALSE); + if ((pv = get_pv_entry(pmap, (flags & PMAP_ENTER_NORECLAIM) != 0 ? + NULL : lockp)) == NULL) + return (false); + pv->pv_va = va; + pa = pde & PG_PS_FRAME; + CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); + pvh = pa_to_pvh(pa); + TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); + pvh->pv_gen++; + return (true); } /* @@ -4323,7 +4334,7 @@ setpte: */ int pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, - u_int flags, int8_t psind __unused) + u_int flags, int8_t psind) { struct rwlock *lock; pd_entry_t *pde; @@ -4351,6 +4362,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) VM_OBJECT_ASSERT_LOCKED(m->object); + KASSERT((flags & PMAP_ENTER_RESERVED) == 0, + ("pmap_enter: flags %u has reserved bits set", flags)); pa = VM_PAGE_TO_PHYS(m); newpte = (pt_entry_t)(pa | PG_A | PG_V); if ((flags & VM_PROT_WRITE) != 0) @@ -4367,7 +4380,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v newpte |= PG_U; if (pmap == kernel_pmap) newpte |= PG_G; - newpte |= pmap_cache_bits(pmap, m->md.pat_mode, 0); + newpte |= pmap_cache_bits(pmap, m->md.pat_mode, psind > 0); /* * Set modified bit gratuitously for writeable mappings if @@ -4380,10 +4393,16 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } else newpte |= PG_MANAGED; - mpte = NULL; - lock = NULL; PMAP_LOCK(pmap); + if (psind == 1) { + /* Assert the required virtual and physical alignment. */ + KASSERT((va & PDRMASK) == 0, ("pmap_enter: va unaligned")); + KASSERT(m->psind > 0, ("pmap_enter: m->psind < psind")); + rv = pmap_enter_pde(pmap, va, newpte | PG_PS, flags, m, &lock); + goto out; + } + mpte = NULL; /* * In the case that a page table page is not @@ -4543,48 +4562,118 @@ out: } /* - * Tries to create a 2MB page mapping. Returns TRUE if successful and FALSE - * otherwise. Fails if (1) a page table page cannot be allocated without - * blocking, (2) a mapping already exists at the specified virtual address, or - * (3) a pv entry cannot be allocated without reclaiming another pv entry. + * Tries to create a read- and/or execute-only 2MB page mapping. Returns true + * if successful. Returns false if (1) a page table page cannot be allocated + * without sleeping, (2) a mapping already exists at the specified virtual + * address, or (3) a PV entry cannot be allocated without reclaiming another + * PV entry. */ -static boolean_t -pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, +static bool +pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, struct rwlock **lockp) { - pd_entry_t *pde, newpde; + pd_entry_t newpde; pt_entry_t PG_V; - vm_page_t pdpg; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + PG_V = pmap_valid_bit(pmap); + newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(pmap, m->md.pat_mode, 1) | + PG_PS | PG_V; + if ((m->oflags & VPO_UNMANAGED) == 0) + newpde |= PG_MANAGED; + if ((prot & VM_PROT_EXECUTE) == 0) + newpde |= pg_nx; + if (va < VM_MAXUSER_ADDRESS) + newpde |= PG_U; + return (pmap_enter_pde(pmap, va, newpde, PMAP_ENTER_NOSLEEP | + PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) == + KERN_SUCCESS); +} + +/* + * Tries to create the specified 2MB page mapping. Returns KERN_SUCCESS if + * the mapping was created, and either KERN_FAILURE or KERN_RESOURCE_SHORTAGE + * otherwise. Returns KERN_FAILURE if PMAP_ENTER_NOREPLACE was specified and + * a mapping already exists at the specified virtual address. Returns + * KERN_RESOURCE_SHORTAGE if PMAP_ENTER_NOSLEEP was specified and a page table + * page allocation failed. Returns KERN_RESOURCE_SHORTAGE if + * PMAP_ENTER_NORECLAIM was specified and a PV entry allocation failed. + * + * The parameter "m" is only used when creating a managed, writeable mapping. + */ +static int +pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, + vm_page_t m, struct rwlock **lockp) +{ struct spglist free; + pd_entry_t oldpde, *pde; + pt_entry_t PG_G, PG_RW, PG_V; + vm_page_t mt, pdpg; + PG_G = pmap_global_bit(pmap); + PG_RW = pmap_rw_bit(pmap); + KASSERT((newpde & (pmap_modified_bit(pmap) | PG_RW)) != PG_RW, + ("pmap_enter_pde: newpde is missing PG_M")); PG_V = pmap_valid_bit(pmap); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((pdpg = pmap_allocpde(pmap, va, NULL)) == NULL) { + if ((pdpg = pmap_allocpde(pmap, va, (flags & PMAP_ENTER_NOSLEEP) != 0 ? + NULL : lockp)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); - return (FALSE); + return (KERN_RESOURCE_SHORTAGE); } pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); pde = &pde[pmap_pde_index(va)]; - if ((*pde & PG_V) != 0) { + oldpde = *pde; + if ((oldpde & PG_V) != 0) { KASSERT(pdpg->wire_count > 1, ("pmap_enter_pde: pdpg's wire count is too low")); - pdpg->wire_count--; - CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" - " in pmap %p", va, pmap); - return (FALSE); + if ((flags & PMAP_ENTER_NOREPLACE) != 0) { + pdpg->wire_count--; + CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" + " in pmap %p", va, pmap); + return (KERN_FAILURE); + } + /* Break the existing mapping(s). */ + SLIST_INIT(&free); + if ((oldpde & PG_PS) != 0) { + /* + * The reference to the PD page that was acquired by + * pmap_allocpde() ensures that it won't be freed. + * However, if the PDE resulted from a promotion, then + * a reserved PT page could be freed. + */ + (void)pmap_remove_pde(pmap, pde, va, &free, lockp); + if ((oldpde & PG_G) == 0) + pmap_invalidate_pde_page(pmap, va, oldpde); + } else { + pmap_delayed_invl_started(); + if (pmap_remove_ptes(pmap, va, va + NBPDR, pde, &free, + lockp)) + pmap_invalidate_all(pmap); + pmap_delayed_invl_finished(); + } + pmap_free_zero_pages(&free); + if (va >= VM_MAXUSER_ADDRESS) { + mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); + if (pmap_insert_pt_page(pmap, mt)) { + /* + * XXX Currently, this can't happen because + * we do not perform pmap_enter(psind == 1) + * on the kernel pmap. + */ + panic("pmap_enter_pde: trie insert failed"); + } + } else + KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", + pde)); } - newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(pmap, m->md.pat_mode, 1) | - PG_PS | PG_V; - if ((m->oflags & VPO_UNMANAGED) == 0) { - newpde |= PG_MANAGED; - + if ((newpde & PG_MANAGED) != 0) { /* * Abort this mapping if its PV entry could not be created. */ - if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m), - lockp)) { + if (!pmap_pv_insert_pde(pmap, va, newpde, flags, lockp)) { SLIST_INIT(&free); if (pmap_unwire_ptp(pmap, va, pdpg, &free)) { /* @@ -4598,17 +4687,19 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t } CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); - return (FALSE); + return (KERN_RESOURCE_SHORTAGE); } + if ((newpde & PG_RW) != 0) { + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_aflag_set(mt, PGA_WRITEABLE); + } } - if ((prot & VM_PROT_EXECUTE) == 0) - newpde |= pg_nx; - if (va < VM_MAXUSER_ADDRESS) - newpde |= PG_U; /* * Increment counters. */ + if ((newpde & PG_W) != 0) + pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); /* @@ -4620,7 +4711,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t atomic_add_long(&pmap_pde_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" " in pmap %p", va, pmap); - return (TRUE); + return (KERN_SUCCESS); } /* @@ -4655,7 +4746,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_o va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && m->psind == 1 && pmap_ps_enabled(pmap) && - pmap_enter_pde(pmap, va, m, prot, &lock)) + pmap_enter_2mpage(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else mpte = pmap_enter_quick_locked(pmap, va, m, prot, @@ -5088,8 +5179,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dst_pdpg)); pde = &pde[pmap_pde_index(addr)]; if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || - pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & - PG_PS_FRAME, &lock))) { + pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, + PMAP_ENTER_NORECLAIM, &lock))) { *pde = srcptepaddr & ~PG_W; pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); atomic_add_long(&pmap_pde_mappings, 1); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sun Jul 23 05:54:56 2017 (r321377) +++ head/sys/amd64/include/pmap.h Sun Jul 23 06:33:58 2017 (r321378) @@ -408,6 +408,7 @@ void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); void pmap_pinit_pml4(vm_page_t); +bool pmap_ps_enabled(pmap_t pmap); void pmap_unmapdev(vm_offset_t, vm_size_t); void pmap_invalidate_page(pmap_t, vm_offset_t); void pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t); Modified: head/sys/vm/pmap.h ============================================================================== --- head/sys/vm/pmap.h Sun Jul 23 05:54:56 2017 (r321377) +++ head/sys/vm/pmap.h Sun Jul 23 06:33:58 2017 (r321378) @@ -100,9 +100,11 @@ extern vm_offset_t kernel_vm_end; /* * Flags for pmap_enter(). The bits in the low-order byte are reserved * for the protection code (vm_prot_t) that describes the fault type. + * Bits 24 through 31 are reserved for the pmap's internal use. */ -#define PMAP_ENTER_NOSLEEP 0x0100 -#define PMAP_ENTER_WIRED 0x0200 +#define PMAP_ENTER_NOSLEEP 0x00000100 +#define PMAP_ENTER_WIRED 0x00000200 +#define PMAP_ENTER_RESERVED 0xFF000000 /* * Define the maximum number of machine-dependent reference bits that are From owner-svn-src-all@freebsd.org Sun Jul 23 07:02:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F663C7E45F; Sun, 23 Jul 2017 07:02:11 +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 3C5BC76924; Sun, 23 Jul 2017 07:02:11 +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 v6N72A7a060762; Sun, 23 Jul 2017 07:02:10 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6N72Asg060761; Sun, 23 Jul 2017 07:02:10 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707230702.v6N72Asg060761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Jul 2017 07:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321379 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 321379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 07:02:11 -0000 Author: adrian Date: Sun Jul 23 07:02:10 2017 New Revision: 321379 URL: https://svnweb.freebsd.org/changeset/base/321379 Log: [ar933x] re-add the ar71xx_apb device for AR933x. This prevents the console from working! Tested: * carambola2, AR933x Modified: head/sys/mips/conf/std.AR933X Modified: head/sys/mips/conf/std.AR933X ============================================================================== --- head/sys/mips/conf/std.AR933X Sun Jul 23 06:33:58 2017 (r321378) +++ head/sys/mips/conf/std.AR933X Sun Jul 23 07:02:10 2017 (r321379) @@ -33,6 +33,11 @@ options TCP_HHOOK # hhook(9) framework for TCP options PSEUDOFS #Pseudo-filesystem framework options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +# Enable boot time calibration hints +options AR71XX_ATH_EEPROM +device ar71xx_caldata +device firmware + # PMC options HWPMC_HOOKS @@ -61,5 +66,6 @@ device scbus device umass device da -device uart_ar933x +device ar71xx_apb +device uart_ar933x From owner-svn-src-all@freebsd.org Sun Jul 23 07:10:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69519C7E4F7; Sun, 23 Jul 2017 07:10: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 2C69476B00; Sun, 23 Jul 2017 07:10: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 v6N7AfT5061077; Sun, 23 Jul 2017 07:10:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6N7Af4T061075; Sun, 23 Jul 2017 07:10:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707230710.v6N7Af4T061075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Jul 2017 07:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321380 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 321380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 07:10:42 -0000 Author: adrian Date: Sun Jul 23 07:10:41 2017 New Revision: 321380 URL: https://svnweb.freebsd.org/changeset/base/321380 Log: [ar933x] make carambola2 work again! * Add in the hints needed for AR933x ath(4) support - this is the nicer way that allows ath to be a module; * ATH_EEPROM_FIRMWARE is also required for all AR933x chipsets. Tested: * Carambola2, AR933x Modified: head/sys/mips/conf/CARAMBOLA2.hints head/sys/mips/conf/std.AR933X Modified: head/sys/mips/conf/CARAMBOLA2.hints ============================================================================== --- head/sys/mips/conf/CARAMBOLA2.hints Sun Jul 23 07:02:10 2017 (r321379) +++ head/sys/mips/conf/CARAMBOLA2.hints Sun Jul 23 07:10:41 2017 (r321380) @@ -31,10 +31,16 @@ hint.arge.1.media=1000 hint.arge.1.fduplex=1 hint.arge.1.eeprommac=0x1fff0006 -# Where the ART is - last 64k in the flash -# 0x9fff1000 ? -hint.ath.0.eepromaddr=0x1fff0000 -hint.ath.0.eepromsize=16384 + +# ART calibration data mapping +hint.ar71xx_caldata.0.at="nexus0" +hint.ar71xx_caldata.0.order=0 +# Where the ART is - last 64k in the first 8MB of flash +hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # The AP121 16MB flash layout: # Modified: head/sys/mips/conf/std.AR933X ============================================================================== --- head/sys/mips/conf/std.AR933X Sun Jul 23 07:02:10 2017 (r321379) +++ head/sys/mips/conf/std.AR933X Sun Jul 23 07:10:41 2017 (r321380) @@ -57,7 +57,10 @@ include "std.AR_MIPS_BASE" makeoptions MODULES_OVERRIDE+="hwpmc_mips24k" +# AR9330 support - everything shipping uses EEPROM for calibration data, +# so always include this. option AH_SUPPORT_AR9330 # Chipset support +option ATH_EEPROM_FIRMWARE # Use EEPROM from flash device usb device ehci From owner-svn-src-all@freebsd.org Sun Jul 23 14:04:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50C98D7EF76; Sun, 23 Jul 2017 14:04:48 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C8152F1B; Sun, 23 Jul 2017 14:04:48 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NE4lXv033202; Sun, 23 Jul 2017 14:04:47 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NE4kBv033188; Sun, 23 Jul 2017 14:04:46 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201707231404.v6NE4kBv033188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 23 Jul 2017 14:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321381 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 321381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 14:04:48 -0000 Author: pstef Date: Sun Jul 23 14:04:45 2017 New Revision: 321381 URL: https://svnweb.freebsd.org/changeset/base/321381 Log: indent(1): don't produce unneeded space character in function declarators. Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_codes.h head/usr.bin/indent/indent_globs.h head/usr.bin/indent/lexi.c head/usr.bin/indent/tests/binary.0.stdout head/usr.bin/indent/tests/comments.0.stdout head/usr.bin/indent/tests/declarations.0 head/usr.bin/indent/tests/declarations.0.stdout head/usr.bin/indent/tests/elsecomment.0.stdout head/usr.bin/indent/tests/float.0.stdout head/usr.bin/indent/tests/label.0.stdout head/usr.bin/indent/tests/nsac.0.stdout head/usr.bin/indent/tests/offsetof.0.stdout head/usr.bin/indent/tests/sac.0.stdout Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/indent.c Sun Jul 23 14:04:45 2017 (r321381) @@ -535,11 +535,12 @@ check_type: ps.p_l_follow--; } if (ps.want_blank && *token != '[' && - (ps.last_token != ident || proc_calls_space || + ((ps.last_token != ident && ps.last_token != funcname) || + proc_calls_space || /* offsetof (1) is never allowed a space; sizeof (2) gets * one iff -bs; all other keywords (>2) always get a space * before lparen */ - (ps.keyword + Bill_Shannon > 2))) + ps.keyword + Bill_Shannon > 2)) *e_code++ = ' '; ps.want_blank = false; if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && @@ -576,7 +577,6 @@ check_type: break; case rparen: /* got a ')' or ']' */ - rparen_count--; if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) { ps.last_u_d = true; ps.cast_mask &= (1 << ps.p_l_follow) - 1; @@ -738,7 +738,7 @@ check_type: * structure declaration */ scase = false; /* these will only need resetting in an error */ squest = 0; - if (ps.last_token == rparen && rparen_count == 0) + if (ps.last_token == rparen) ps.in_parameter_declaration = 0; ps.cast_mask = 0; ps.not_cast_mask = 0; @@ -838,6 +838,7 @@ check_type: && ps.in_parameter_declaration) postfix_blankline_requested = 1; ps.in_parameter_declaration = 0; + ps.in_decl = false; } dec_ind = 0; parse(lbrace); /* let parser know about this */ @@ -935,7 +936,6 @@ check_type: case decl: /* we have a declaration type (int, etc.) */ parse(decl); /* let parser worry about indentation */ if (ps.last_token == rparen && ps.tos <= 1) { - ps.in_parameter_declaration = 1; if (s_code != e_code) { dump_line(); ps.want_blank = 0; @@ -964,10 +964,11 @@ check_type: } goto copy_id; + case funcname: case ident: /* got an identifier or constant */ if (ps.in_decl) { /* if we are in a declaration, we must indent * identifier */ - if (is_procname == 0 || !procnames_start_line) { + if (type_code != funcname || !procnames_start_line) { if (!ps.block_init && !ps.dumped_decl_indent) { if (troff) { if (ps.want_blank) @@ -980,7 +981,8 @@ check_type: ps.want_blank = false; } } else { - if (ps.want_blank) + if (ps.want_blank && !(procnames_start_line && + type_code == funcname)) *e_code++ = ' '; ps.want_blank = false; if (dec_ind && s_code != e_code) { @@ -1014,7 +1016,8 @@ check_type: CHECK_SIZE_CODE; *e_code++ = *t_ptr; } - ps.want_blank = true; + if (type_code != funcname) + ps.want_blank = true; break; case strpfx: Modified: head/usr.bin/indent/indent_codes.h ============================================================================== --- head/usr.bin/indent/indent_codes.h Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/indent_codes.h Sun Jul 23 14:04:45 2017 (r321381) @@ -70,3 +70,4 @@ #define period 32 #define strpfx 33 #define storage 34 +#define funcname 35 Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/indent_globs.h Sun Jul 23 14:04:45 2017 (r321381) @@ -330,6 +330,5 @@ struct parser_state { } ps; int ifdef_level; -int rparen_count; struct parser_state state_stack[5]; struct parser_state match_state[5]; Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/lexi.c Sun Jul 23 14:04:45 2017 (r321381) @@ -353,7 +353,8 @@ lexi(void) return (ident); } /* end of switch */ } /* end of if (found_it) */ - if (*buf_ptr == '(' && ps.tos <= 1 && ps.ind_level == 0) { + if (*buf_ptr == '(' && ps.tos <= 1 && ps.ind_level == 0 && + ps.in_parameter_declaration == 0 && ps.block_init == 0) { char *tp = buf_ptr; while (tp < buf_end) if (*tp++ == ')' && (*tp == ';' || *tp == ',')) @@ -361,7 +362,7 @@ lexi(void) strncpy(ps.procname, token, sizeof ps.procname - 1); if (ps.in_decl) ps.in_parameter_declaration = 1; - rparen_count = 1; + return (last_code = funcname); not_proc:; } /* Modified: head/usr.bin/indent/tests/binary.0.stdout ============================================================================== --- head/usr.bin/indent/tests/binary.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/binary.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ #define b00101010 -1 -void +void t(void) { unsigned a[] = {0b00101010, 0x00005678, 02, 17U}; Modified: head/usr.bin/indent/tests/comments.0.stdout ============================================================================== --- head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* See r303597, r303598, r309219, and r309343 */ -void +void t(void) { /* Modified: head/usr.bin/indent/tests/declarations.0 ============================================================================== --- head/usr.bin/indent/tests/declarations.0 Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/declarations.0 Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,32 @@ /* $FreeBSD$ */ /* See r303570 */ -void t(void) { + +static const struct +{ + double x; + double y, z; +} n[m + 1] = +{ + { + .0, + .9, + 5 + } +}; + +typedef struct Complex +{ + double x; + double y; +} Complex; + +void +t1 (char *a, int b, + void (*fn)(void)) +{} + +void t2 (char *x, int y) +{ int a, b, c; @@ -18,4 +44,33 @@ void t(void) { ,n ,o ; +} + +const int int_minimum_size = +MAXALIGN(offsetof(int, test)) + MAXIMUM_ALIGNOF; + +int *int_create(void) +{ + +} + +static +_attribute_printf(1, 2) +void +print_error(const char *fmt,...) +{ + +} + +static LIST_HEAD(, alq) ald_active; +static int ald_shutingdown = 0; +struct thread *ald_thread; + +static int +do_execve(td, args, mac_p) + struct thread *td; + struct image_args *args; + struct mac *mac_p; +{ + } Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/declarations.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,8 +1,32 @@ /* $FreeBSD$ */ /* See r303570 */ -void -t(void) + +static const struct { + double x; + double y, z; +} n[m + 1] = { + { + .0, + .9, + 5 + } +}; + +typedef struct Complex { + double x; + double y; +} Complex; + +void +t1(char *a, int b, + void (*fn) (void)) +{ +} + +void +t2(char *x, int y) +{ int a, b, c; int *d, *e, *f; @@ -12,4 +36,34 @@ t(void) ,n ,o ; +} + +const int int_minimum_size = +MAXALIGN(offsetof(int, test)) + MAXIMUM_ALIGNOF; + +int * +int_create(void) +{ + +} + +static +_attribute_printf(1, 2) +void +print_error(const char *fmt,...) +{ + +} + +static LIST_HEAD(, alq) ald_active; +static int ald_shutingdown = 0; +struct thread *ald_thread; + +static int +do_execve(td, args, mac_p) + struct thread *td; + struct image_args *args; + struct mac *mac_p; +{ + } Modified: head/usr.bin/indent/tests/elsecomment.0.stdout ============================================================================== --- head/usr.bin/indent/tests/elsecomment.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/elsecomment.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* See r303484 and r309342 */ -void +void t(void) { if (0) Modified: head/usr.bin/indent/tests/float.0.stdout ============================================================================== --- head/usr.bin/indent/tests/float.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/float.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* See r303499 */ -void +void t(void) { unsigned long x = 314UL; Modified: head/usr.bin/indent/tests/label.0.stdout ============================================================================== --- head/usr.bin/indent/tests/label.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/label.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* See r303489 */ -void +void t(void) { switch (1) { Modified: head/usr.bin/indent/tests/nsac.0.stdout ============================================================================== --- head/usr.bin/indent/tests/nsac.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/nsac.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -void +void t(void) { int a = (double)8; Modified: head/usr.bin/indent/tests/offsetof.0.stdout ============================================================================== --- head/usr.bin/indent/tests/offsetof.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/offsetof.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* See r303718 */ -void +void t(void) { int n = malloc(offsetof(struct s, f) + 1); Modified: head/usr.bin/indent/tests/sac.0.stdout ============================================================================== --- head/usr.bin/indent/tests/sac.0.stdout Sun Jul 23 07:10:41 2017 (r321380) +++ head/usr.bin/indent/tests/sac.0.stdout Sun Jul 23 14:04:45 2017 (r321381) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -void +void t(void) { int a = (double) 8; From owner-svn-src-all@freebsd.org Sun Jul 23 14:33:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB379D7F73B; Sun, 23 Jul 2017 14:33:05 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A1BA3F05; Sun, 23 Jul 2017 14:33:05 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NEX4XJ045806; Sun, 23 Jul 2017 14:33:04 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NEX4E2045804; Sun, 23 Jul 2017 14:33:04 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201707231433.v6NEX4E2045804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 23 Jul 2017 14:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321382 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 321382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 14:33:05 -0000 Author: pstef Date: Sun Jul 23 14:33:04 2017 New Revision: 321382 URL: https://svnweb.freebsd.org/changeset/base/321382 Log: indent(1): don't produce unnecessary blank lines. Don't force a blank line between an opening brace and a block comment -- not even if -bbb (blank lines before block comments) is on. Added: head/usr.bin/indent/tests/comments.pro (contents, props changed) Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 23 14:04:45 2017 (r321381) +++ head/usr.bin/indent/pr_comment.c Sun Jul 23 14:33:04 2017 (r321382) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "indent_globs.h" +#include "indent_codes.h" #include "indent.h" /* * NAME: @@ -187,7 +188,7 @@ pr_comment(void) char *t = e_com; e_com = s_com + 2; *e_com = 0; - if (blanklines_before_blockcomments) + if (blanklines_before_blockcomments && ps.last_token != lbrace) prefix_blankline_requested = 1; dump_line(); e_com = s_com = t; Added: head/usr.bin/indent/tests/comments.pro ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/comments.pro Sun Jul 23 14:33:04 2017 (r321382) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +-bbb From owner-svn-src-all@freebsd.org Sun Jul 23 15:07:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C5AED9A34A; Sun, 23 Jul 2017 15:07:53 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5996664312; Sun, 23 Jul 2017 15:07:53 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NF7q7L058981; Sun, 23 Jul 2017 15:07:52 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NF7q21058980; Sun, 23 Jul 2017 15:07:52 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201707231507.v6NF7q21058980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 23 Jul 2017 15:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321383 - head/usr.bin/indent/tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/usr.bin/indent/tests X-SVN-Commit-Revision: 321383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 15:07:53 -0000 Author: pstef Date: Sun Jul 23 15:07:52 2017 New Revision: 321383 URL: https://svnweb.freebsd.org/changeset/base/321383 Log: indent(1): rename the profile file. Currently, indent's testing mechanism will attempt to apply options from a file named ${test}.pro - and this test's filename is comments.0. Added: head/usr.bin/indent/tests/comments.0.pro - copied unchanged from r321382, head/usr.bin/indent/tests/comments.pro Deleted: head/usr.bin/indent/tests/comments.pro Copied: head/usr.bin/indent/tests/comments.0.pro (from r321382, head/usr.bin/indent/tests/comments.pro) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/comments.0.pro Sun Jul 23 15:07:52 2017 (r321383, copy of r321382, head/usr.bin/indent/tests/comments.pro) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +-bbb From owner-svn-src-all@freebsd.org Sun Jul 23 16:03:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C80FDA4704; Sun, 23 Jul 2017 16:03:52 +0000 (UTC) (envelope-from srs0=g7wu=62=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3764D65C8E; Sun, 23 Jul 2017 16:03:51 +0000 (UTC) (envelope-from srs0=g7wu=62=freebsd.org=kp@codepro.be) Received: from [169.254.11.67] (ptr-8ripyyhttb1guvlwhwm.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:e18d:18af:2910:13a6]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 529C1B2C9; Sun, 23 Jul 2017 18:03:49 +0200 (CEST) From: "Kristof Provost" To: "Ngie Cooper" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321370 - head/lib/libsysdecode Date: Sun, 23 Jul 2017 18:03:48 +0200 Message-ID: <8FA5355F-E374-49BE-B2B2-25351ED827A9@FreeBSD.org> In-Reply-To: References: <201707221251.v6MCpKn4014224@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Mailer: MailMate (2.0BETAr6088) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 16:03:52 -0000 On 22 Jul 2017, at 17:42, Ngie Cooper (yaneurabeya) wrote: > > On Jul 22, 2017, at 5:51 AM, Kristof Provost wrote: >> >> Author: kp >> Date: Sat Jul 22 12:51:19 2017 >> New Revision: 321370 >> URL: https://svnweb.freebsd.org/changeset/base/321370 >> >> Log: >> Handle WITH/WITHOUT_PF in libsysdecode >> >> Only filter out the PF ioctls if we're building without pf support. >> Until now those were always filtered out, so truss did not show = >> symbolic >> names for pf ioctls. > > > Hi Kristof! > 'MFC after: 1 week=E2=80=9D should have probably be added to this comm= it. > This change should be MFCed to ^/stable/11 and probably ^/stable/10 = > (in usr.sbin/kdump on 10: = > https://svnweb.freebsd.org/base/stable/10/usr.bin/kdump/mkioctls?revisi= on=3D291815&view=3Dmarkup#l25 = > ). To be honest I wasn=E2=80=99t planning on MFCing this, because it=E2=80=99= s not a = terribly important issue. That said, if it=E2=80=99d be useful to you (or anyone else) I=E2=80=99m = certainly = willing to do so. I=E2=80=99m not sure how much the code changed between 10 and 11, but MFC= to = 11 should be easy, and if the changes are not too extensive I can do the = merge to 10 as well. Regards, Kristof From owner-svn-src-all@freebsd.org Sun Jul 23 16:11:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5921ADA4AC6; Sun, 23 Jul 2017 16:11:49 +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 F00C16656E; Sun, 23 Jul 2017 16:11:48 +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 v6NGBmK2087627; Sun, 23 Jul 2017 16:11:48 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NGBm1o087624; Sun, 23 Jul 2017 16:11:48 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707231611.v6NGBm1o087624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 23 Jul 2017 16:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321385 - in head/sys/dev: mmc sdhci X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in head/sys/dev: mmc sdhci X-SVN-Commit-Revision: 321385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 16:11:49 -0000 Author: marius Date: Sun Jul 23 16:11:47 2017 New Revision: 321385 URL: https://svnweb.freebsd.org/changeset/base/321385 Log: o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to sdhci(4), mmc(4) and mmcsd(4). For the most part, this consists of: - Correcting and extending the infrastructure for negotiating and enabling post-DDR52 modes already added as part of r315598. In fact, HS400ES now should work as well but hasn't been activated due to lack of corresponding hardware. - Adding support executing standard SDHCI initial tuning as well as re-tuning as required for eMMC HS200/HS400 and the fast UHS-I SD card modes. Currently, corresponding methods are only hooked up to the ACPI and PCI front-ends of sdhci(4), though. Moreover, sdhci(4) won't offer any modes requiring (re-)tuning to the MMC/SD layer in order to not break operations with other sdhci(4) front- ends. Likewise, sdhci(4) now no longer offers modes requiring the set_uhs_timing method introduced in r315598 to be implemented/ hooked up (previously, this method was used with DDR52 only, which in turn is only available with Intel controllers so far, i. e. no such limitation was necessary before). Similarly for 1.2/1.8 V VCCQ support and the switch_vccq method. - Addition of locking to the IOCTL half of mmcsd(4) to prevent races with detachment and suspension, especially since it's required to immediately switch away from RPMB partitions again after an access to these (so re-tuning can take place anew, given that the current eMMC specification v5.1 doesn't allow tuning commands to be issued with a RPMB partition selected). Therefore, the existing part_mtx lock in the mmcsd(4) softc is additionally renamed to disk_mtx in order to denote that it only refers to the disk(9) half, likewise for corresponding macros. On the system where the addition of DDR52 support increased the read throughput to ~80 MB/s (from ~45 MB/s at high speed), HS200 yields ~154 MB/s and HS400 ~187 MB/s, i. e. performance now has more than quadrupled compared to pre-r315598. Also, with the advent of (re-)tuning support, most infrastructure necessary for SD card UHS-I modes up to SDR104 now is also in place. Note, though, that the standard SDHCI way of (re-)tuning is special in several ways, which also is why sending the actual tuning requests to the device is part of sdhci(4). SDHCI implementations not following the specification, MMC and non-SDHCI SD card controllers likely will use a generic implementation in the MMC/SD layer for executing tuning, which hasn't been written so far, though. However, in fact this isn't a feature-only change; there are boards based on Intel Bay Trail where DDR52 is problematic and the suggested workaround is to use HS200 mode instead. So far exact details are unknown, however, i. e. whether that's due to a defect in these SoCs or on the boards. Moreover, due to the above changes requiring to be aware of possible MMC siblings in the fast path of mmc(4), corresponding information now is cached in mmc_softc. As a side-effect, mmc_calculate_clock(), mmc_delete_cards(), mmc_discover_cards() and mmc_rescan_cards() now all are guaranteed to operate on the same set of devices as there no longer is any use of device_get_children(9), which can fail in low memory situations. Likewise, mmc_calculate_clock() now longer will trigger a panic due to the latter. o Fix a bug in the failure reporting of mmcsd_delete(); in case of an error when the starting block of a previously stored erase request is used (in order to be able to erase a full erase sector worth of data), the starting block of the newly supplied bio_pblkno has to be returned for indicating no progress. Otherwise, upper layers might be told that a negative number of BIOs have been completed, leading to a panic. o Fix 2 bugs on resume: - Things done in fork1(9) like the acquisition of an SX lock or the sleepable memory allocation are incompatible with a MTX_DEF taken. Thus, mmcsd_resume() must not call kproc_create(9), which in turn uses fork1(9), with the disk_mtx (formerly part_mtx) held. - In mmc_suspend(), the bus is powered down, which in the typical case of a device being selected at the time of suspension, causes the device deselection as part of the bus acquisition by mmc(4) in mmc_scan() to fail as the bus isn't powered up again before later in mmc_go_discovery(). Thus, power down with the bus acquired in mmc_suspend(), which will trigger the deselection up-front. o Fix a memory leak in mmcsd_ioctl() in case copyin(9) fails. [1] o Fix missing variable initialization in mmc_switch_status(). [2] o Fix R1_SWITCH_ERROR detection in mmc_switch_status(). [3] o Handle the case of device_add_child(9) failing, for example due to a memory shortage, gracefully in mmc(4) and sdhci(4), including not leaking memory for the instance variables in case of mmc(4) (which might or might not fix [4] as the latter problem has been discovered independently). o Handle the case of an unknown SD CSD version in mmc_decode_csd_sd() gracefully instead of calling panic(9). o Again, check and handle the return values of some additional function calls in mmc(4) instead of assuming that everything went right or mark non-fatal errors by casting the return value to void. o Correct a typo in the Linux IOCTL compatibility; it should have been MMC_IOC_MULTI_CMD rather than MMC_IOC_CMD_MULTI. o Now that we are reaching ever faster speeds (more improvement in this regard is to be expected when adding ADMA support to sdhci(4)), apply a few micro-optimizations like predicting mmc(4) and sdhci(4) debugging to be off or caching erase sector and maximum data sizes as well support of block addressing in mmsd(4) (instead of doing 2 indirections on every read/write request for determining the maximum data size for example). Reported by: Coverity CID: 1372612 [1], 1372624 [2], 1372594 [3], 1007069 [4] Modified: head/sys/dev/mmc/bridge.h head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmc_ioctl.h head/sys/dev/mmc/mmc_private.h head/sys/dev/mmc/mmc_subr.c head/sys/dev/mmc/mmcbr_if.m head/sys/dev/mmc/mmcbrvar.h head/sys/dev/mmc/mmcbus_if.m head/sys/dev/mmc/mmcreg.h head/sys/dev/mmc/mmcsd.c head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_acpi.c head/sys/dev/sdhci/sdhci_if.m head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/dev/mmc/bridge.h ============================================================================== --- head/sys/dev/mmc/bridge.h Sun Jul 23 15:22:06 2017 (r321384) +++ head/sys/dev/mmc/bridge.h Sun Jul 23 16:11:47 2017 (r321385) @@ -137,6 +137,10 @@ enum mmc_card_mode { mode_mmc, mode_sd }; +enum mmc_retune_req { + retune_req_none = 0, retune_req_normal, retune_req_reset +}; + struct mmc_host { int f_min; int f_max; @@ -178,7 +182,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 3 +#define MMC_VERSION 4 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Sun Jul 23 15:22:06 2017 (r321384) +++ head/sys/dev/mmc/mmc.c Sun Jul 23 16:11:47 2017 (r321385) @@ -88,14 +88,14 @@ struct mmc_ivars { uint8_t raw_ext_csd[MMC_EXTCSD_SIZE]; /* Raw bits of the EXT_CSD */ uint32_t raw_sd_status[16]; /* Raw bits of the SD_STATUS */ uint16_t rca; + u_char read_only; /* True when the device is read-only */ + u_char high_cap; /* High Capacity device (block addressed) */ enum mmc_card_mode mode; + enum mmc_bus_width bus_width; /* Bus width to use */ struct mmc_cid cid; /* cid decoded */ struct mmc_csd csd; /* csd decoded */ struct mmc_scr scr; /* scr decoded */ struct mmc_sd_status sd_status; /* SD_STATUS decoded */ - u_char read_only; /* True when the device is read-only */ - u_char bus_width; /* Bus width to use */ - u_char high_cap; /* High Capacity card (block addressed) */ uint32_t sec_count; /* Card capacity in 512byte blocks */ uint32_t timings; /* Mask of bus timings supported */ uint32_t vccq_120; /* Mask of bus timings at VCCQ of 1.2 V */ @@ -127,8 +127,10 @@ static int mmc_read_ivar(device_t bus, device_t child, uintptr_t *result); static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static void mmc_retune_pause(device_t busdev, device_t dev, bool retune); +static void mmc_retune_unpause(device_t busdev, device_t dev); static int mmc_suspend(device_t dev); -static int mmc_wait_for_request(device_t brdev, device_t reqdev, +static int mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req); static int mmc_write_ivar(device_t bus, device_t child, int which, uintptr_t value); @@ -155,21 +157,23 @@ static void mmc_decode_cid_mmc(uint32_t *raw_cid, stru bool is_4_41p); static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); -static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); static void mmc_delayed_attach(void *xsc); -static int mmc_delete_cards(struct mmc_softc *sc); +static int mmc_delete_cards(struct mmc_softc *sc, bool final); static void mmc_discover_cards(struct mmc_softc *sc); static void mmc_format_card_id_string(struct mmc_ivars *ivar); static void mmc_go_discovery(struct mmc_softc *sc); static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, int size); static int mmc_highest_voltage(uint32_t ocr); +static bool mmc_host_timing(device_t dev, enum mmc_bus_timing timing); static void mmc_idle_cards(struct mmc_softc *sc); static void mmc_ms_delay(int ms); static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); static void mmc_power_up(struct mmc_softc *sc); static void mmc_rescan_cards(struct mmc_softc *sc); +static int mmc_retune(device_t busdev, device_t dev, bool reset); static void mmc_scan(struct mmc_softc *sc); static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, uint8_t value, uint8_t *res); @@ -183,15 +187,23 @@ static int mmc_send_op_cond(struct mmc_softc *sc, uint uint32_t *rocr); static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); -static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar); +static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); static int mmc_set_power_class(struct mmc_softc *sc, struct mmc_ivars *ivar); static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); static int mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars *ivar, enum mmc_bus_timing timing); +static int mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); +static int mmc_switch_to_hs200(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t clock); +static int mmc_switch_to_hs400(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t max_dtr, enum mmc_bus_timing max_timing); static int mmc_test_bus_width(struct mmc_softc *sc); static uint32_t mmc_timing_to_dtr(struct mmc_ivars *ivar, enum mmc_bus_timing timing); static const char *mmc_timing_to_string(enum mmc_bus_timing timing); +static void mmc_update_child_list(struct mmc_softc *sc); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req); @@ -235,7 +247,8 @@ mmc_detach(device_t dev) struct mmc_softc *sc = device_get_softc(dev); int err; - if ((err = mmc_delete_cards(sc)) != 0) + err = mmc_delete_cards(sc, true); + if (err != 0) return (err); mmc_power_down(sc); MMC_LOCK_DESTROY(sc); @@ -250,10 +263,21 @@ mmc_suspend(device_t dev) int err; err = bus_generic_suspend(dev); - if (err) + if (err != 0) return (err); + /* + * We power down with the bus acquired here, mainly so that no device + * is selected any longer and sc->last_rca gets set to 0. Otherwise, + * the deselect as part of the bus acquisition in mmc_scan() may fail + * during resume, as the bus isn't powered up again before later in + * mmc_go_discovery(). + */ + err = mmc_acquire_bus(dev, dev); + if (err != 0) + return (err); mmc_power_down(sc); - return (0); + err = mmc_release_bus(dev, dev); + return (err); } static int @@ -270,7 +294,8 @@ mmc_acquire_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; struct mmc_ivars *ivar; - int err, rca; + int err; + uint16_t rca; enum mmc_bus_timing timing; err = MMCBR_ACQUIRE_HOST(device_get_parent(busdev), busdev); @@ -294,12 +319,27 @@ mmc_acquire_bus(device_t busdev, device_t dev) rca = ivar->rca; if (sc->last_rca != rca) { if (mmc_select_card(sc, rca) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to select.\n", rca); + device_printf(busdev, "Card at relative " + "address %d failed to select\n", rca); return (ENXIO); } sc->last_rca = rca; timing = mmcbr_get_timing(busdev); + /* + * For eMMC modes, setting/updating bus width and VCCQ + * only really is necessary if there actually is more + * than one device on the bus as generally that already + * had to be done by mmc_calculate_clock() or one of + * its calees. Moreover, setting the bus width anew + * can trigger re-tuning (via a CRC error on the next + * CMD), even if not switching between devices an the + * previously selected one is still tuned. Obviously, + * we need to re-tune the host controller if devices + * are actually switched, though. + */ + if (timing >= bus_timing_mmc_ddr52 && + sc->child_count == 1) + return (0); /* Prepare bus width for the new card. */ if (bootverbose || mmc_debug) { device_printf(busdev, @@ -308,38 +348,34 @@ mmc_acquire_bus(device_t busdev, device_t dev) (ivar->bus_width == bus_width_8) ? 8 : 1, mmc_timing_to_string(timing)); } - if (mmc_set_card_bus_width(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set bus width.\n", + if (mmc_set_card_bus_width(sc, ivar, timing) != + MMC_ERR_NONE) { + device_printf(busdev, "Card at relative " + "address %d failed to set bus width\n", rca); return (ENXIO); } - if (isset(&ivar->vccq_120, timing)) - mmcbr_set_vccq(busdev, vccq_120); - else if (isset(&ivar->vccq_180, timing)) - mmcbr_set_vccq(busdev, vccq_180); - else - mmcbr_set_vccq(busdev, vccq_330); - if (mmcbr_switch_vccq(busdev) != 0) { - device_printf(sc->dev, "Failed to set VCCQ " - "for card at relative address %d.\n", rca); + mmcbr_set_bus_width(busdev, ivar->bus_width); + mmcbr_update_ios(busdev); + if (mmc_set_vccq(sc, ivar, timing) != MMC_ERR_NONE) { + device_printf(busdev, "Failed to set VCCQ " + "for card at relative address %d\n", rca); return (ENXIO); } - if (mmc_set_power_class(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set power class.\n", - rca); + if (timing >= bus_timing_mmc_hs200 && + mmc_retune(busdev, dev, true) != 0) { + device_printf(busdev, "Card at relative " + "address %d failed to re-tune\n", rca); return (ENXIO); } - mmcbr_set_bus_width(busdev, ivar->bus_width); - mmcbr_update_ios(busdev); } } else { /* * If there's a card selected, stand down. */ if (sc->last_rca != 0) { - mmc_select_card(sc, 0); + if (mmc_select_card(sc, 0) != MMC_ERR_NONE) + return (ENXIO); sc->last_rca = 0; } } @@ -407,7 +443,7 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ req->done = mmc_wakeup; req->done_data = sc; - if (mmc_debug > 1) { + if (__predict_false(mmc_debug > 1)) { device_printf(sc->dev, "REQUEST: CMD%d arg %#x flags %#x", req->cmd->opcode, req->cmd->arg, req->cmd->flags); if (req->cmd->data) { @@ -420,18 +456,66 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ while ((req->flags & MMC_REQ_DONE) == 0) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); - if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE)) + if (__predict_false(mmc_debug > 2 || (mmc_debug > 0 && + req->cmd->error != MMC_ERR_NONE))) device_printf(sc->dev, "CMD%d RESULT: %d\n", req->cmd->opcode, req->cmd->error); return (0); } static int -mmc_wait_for_request(device_t brdev, device_t reqdev __unused, - struct mmc_request *req) +mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req) { - struct mmc_softc *sc = device_get_softc(brdev); + struct mmc_softc *sc; + struct mmc_ivars *ivar; + int err, i; + enum mmc_retune_req retune_req; + sc = device_get_softc(busdev); + KASSERT(sc->owner != NULL, + ("%s: Request from %s without bus being acquired.", __func__, + device_get_nameunit(dev))); + + /* + * Unless no device is selected or re-tuning is already ongoing, + * execute re-tuning if a) the bridge is requesting to do so and + * re-tuning hasn't been otherwise paused, or b) if a child asked + * to be re-tuned prior to pausing (see also mmc_retune_pause()). + */ + if (__predict_false(sc->last_rca != 0 && sc->retune_ongoing == 0 && + (((retune_req = mmcbr_get_retune_req(busdev)) != retune_req_none && + sc->retune_paused == 0) || sc->retune_needed == 1))) { + if (__predict_false(mmc_debug > 1)) { + device_printf(busdev, + "Re-tuning with%s circuit reset required\n", + retune_req == retune_req_reset ? "" : "out"); + } + if (device_get_parent(dev) == busdev) + ivar = device_get_ivars(dev); + else { + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (ivar->rca == sc->last_rca) + break; + } + if (ivar->rca != sc->last_rca) + return (EINVAL); + } + sc->retune_ongoing = 1; + err = mmc_retune(busdev, dev, retune_req == retune_req_reset); + sc->retune_ongoing = 0; + switch (err) { + case MMC_ERR_NONE: + case MMC_ERR_FAILED: /* Re-tune error but still might work */ + break; + case MMC_ERR_BADCRC: /* Switch failure on HS400 recovery */ + return (ENXIO); + case MMC_ERR_INVALID: /* Driver implementation b0rken */ + default: /* Unknown error, should not happen */ + return (EINVAL); + } + sc->retune_needed = 0; + } return (mmc_wait_for_req(sc, req)); } @@ -599,11 +683,14 @@ mmc_power_down(struct mmc_softc *sc) static int mmc_select_card(struct mmc_softc *sc, uint16_t rca) { - int flags; + int err, flags; flags = (rca ? MMC_RSP_R1B : MMC_RSP_NONE) | MMC_CMD_AC; - return (mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, - flags, NULL, CMD_RETRIES)); + sc->retune_paused++; + err = mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, + flags, NULL, CMD_RETRIES); + sc->retune_paused--; + return (err); } static int @@ -635,7 +722,8 @@ mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint } static int -mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar) +mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) { struct mmc_command cmd; int err; @@ -668,28 +756,33 @@ mmc_set_card_bus_width(struct mmc_softc *sc, struct mm } else { switch (ivar->bus_width) { case bus_width_1: + if (timing == bus_timing_mmc_hs400 || + timing == bus_timing_mmc_hs400es) + return (MMC_ERR_INVALID); value = EXT_CSD_BUS_WIDTH_1; break; case bus_width_4: - switch (mmcbr_get_timing(sc->dev)) { + switch (timing) { case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: - case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: value = EXT_CSD_BUS_WIDTH_4_DDR; break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + return (MMC_ERR_INVALID); default: value = EXT_CSD_BUS_WIDTH_4; break; } break; case bus_width_8: - switch (mmcbr_get_timing(sc->dev)) { + value = 0; + switch (timing) { + case bus_timing_mmc_hs400es: + value = EXT_CSD_BUS_WIDTH_ES; + /* FALLTHROUGH */ case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: - value = EXT_CSD_BUS_WIDTH_8_DDR; + value |= EXT_CSD_BUS_WIDTH_8_DDR; break; default: value = EXT_CSD_BUS_WIDTH_8; @@ -814,6 +907,13 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars case bus_timing_mmc_ddr52: value = EXT_CSD_HS_TIMING_HS; break; + case bus_timing_mmc_hs200: + value = EXT_CSD_HS_TIMING_HS200; + break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + value = EXT_CSD_HS_TIMING_HS400; + break; default: return (MMC_ERR_INVALID); } @@ -830,6 +930,23 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars return (err); } +static int +mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) +{ + + if (isset(&ivar->vccq_120, timing)) + mmcbr_set_vccq(sc->dev, vccq_120); + else if (isset(&ivar->vccq_180, timing)) + mmcbr_set_vccq(sc->dev, vccq_180); + else + mmcbr_set_vccq(sc->dev, vccq_330); + if (mmcbr_switch_vccq(sc->dev) != 0) + return (MMC_ERR_INVALID); + else + return (MMC_ERR_NONE); +} + static const uint8_t p8[8] = { 0x55, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1037,7 +1154,7 @@ static const int cur_max[8] = { 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 }; -static void +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) { int v; @@ -1078,6 +1195,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); + return (MMC_ERR_NONE); } else if (v == 1) { m = mmc_get_bits(raw_csd, 128, 115, 4); e = mmc_get_bits(raw_csd, 128, 112, 3); @@ -1101,8 +1219,9 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); - } else - panic("unknown SD CSD version"); + return (MMC_ERR_NONE); + } + return (MMC_ERR_INVALID); } static void @@ -1366,6 +1485,53 @@ mmc_timing_to_string(enum mmc_bus_timing timing) return (""); } +static bool +mmc_host_timing(device_t dev, enum mmc_bus_timing timing) +{ + int host_caps; + + host_caps = mmcbr_get_caps(dev); + +#define HOST_TIMING_CAP(host_caps, cap) ({ \ + bool retval; \ + if (((host_caps) & (cap)) == (cap)) \ + retval = true; \ + else \ + retval = false; \ + retval; \ +}) + + switch (timing) { + case bus_timing_normal: + return (true); + case bus_timing_hs: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_HSPEED)); + case bus_timing_uhs_sdr12: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR12)); + case bus_timing_uhs_sdr25: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR25)); + case bus_timing_uhs_ddr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_DDR50)); + case bus_timing_uhs_sdr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR50)); + case bus_timing_uhs_sdr104: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR104)); + case bus_timing_mmc_ddr52: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_DDR52)); + case bus_timing_mmc_hs200: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200)); + case bus_timing_mmc_hs400: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400)); + case bus_timing_mmc_hs400es: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400 | + MMC_CAP_MMC_ENH_STROBE)); + } + +#undef HOST_TIMING_CAP + + return (false); +} + static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard) { @@ -1397,9 +1563,8 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; - device_t *devlist; device_t child; - int devcount, err, host_caps, i, newcard; + int err, host_caps, i, newcard; uint32_t resp, sec_count, status; uint16_t rca = 2; @@ -1407,6 +1572,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (bootverbose || mmc_debug) device_printf(sc->dev, "Probing cards\n"); while (1) { + child = NULL; sc->squelched++; /* Errors are expected, squelch reporting. */ err = mmc_all_send_cid(sc, raw_cid); sc->squelched--; @@ -1417,18 +1583,14 @@ mmc_discover_cards(struct mmc_softc *sc) break; } newcard = 1; - if ((err = device_get_children(sc->dev, &devlist, - &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == 0) { newcard = 0; break; } } - free(devlist, M_TEMP); if (bootverbose || mmc_debug) { device_printf(sc->dev, "%sard detected (CID %08x%08x%08x%08x)\n", @@ -1451,7 +1613,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting RCA %d\n", err); - break; + goto free_ivar; } ivar->rca = resp >> 16; /* Get card CSD. */ @@ -1459,7 +1621,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1467,7 +1629,11 @@ mmc_discover_cards(struct mmc_softc *sc) newcard ? "New c" : "C", ivar->raw_csd[0], ivar->raw_csd[1], ivar->raw_csd[2], ivar->raw_csd[3]); - mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + err = mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + if (err != MMC_ERR_NONE) { + device_printf(sc->dev, "Error decoding CSD\n"); + goto free_ivar; + } ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE; if (ivar->csd.csd_structure > 0) ivar->high_cap = 1; @@ -1480,12 +1646,12 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } /* Get card SCR. Card must be selected to fetch it. */ @@ -1493,13 +1659,13 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } err = mmc_app_send_scr(sc, ivar->rca, ivar->raw_scr); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading SCR %d\n", err); - break; + goto free_ivar; } mmc_app_decode_scr(ivar->raw_scr, &ivar->scr); /* Get card switch capabilities (command class 10). */ @@ -1527,7 +1693,7 @@ mmc_discover_cards(struct mmc_softc *sc) * use from the sd_status is the erase sector size, but * it is still nice to get that right. */ - mmc_select_card(sc, 0); + (void)mmc_select_card(sc, 0); (void)mmc_select_card(sc, ivar->rca); (void)mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); @@ -1537,47 +1703,24 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->erase_sector = 16 << ivar->sd_status.au_size; } - /* Find max supported bus width. */ + /* Find maximum supported bus width. */ if ((host_caps & MMC_CAP_4_BIT_DATA) && (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) ivar->bus_width = bus_width_4; - /* - * Some cards that report maximum I/O block sizes - * greater than 512 require the block length to be - * set to 512, even though that is supposed to be - * the default. Example: - * - * Transcend 2GB SDSC card, CID: - * mid=0x1b oid=0x534d pnm="00000" prv=1.0 mdt=00.2000 - */ - if (ivar->csd.read_bl_len != MMC_SECTOR_SIZE || - ivar->csd.write_bl_len != MMC_SECTOR_SIZE) - mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - - mmc_format_card_id_string(ivar); - - if (bootverbose || mmc_debug) - mmc_log_card(sc->dev, ivar, newcard); - if (newcard) { - /* Add device. */ - child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); - } - mmc_select_card(sc, 0); - return; + goto child_common; } ivar->rca = rca++; err = mmc_set_relative_addr(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error setting RCA %d\n", err); - break; + goto free_ivar; } /* Get card CSD. */ err = mmc_send_csd(sc, ivar->rca, ivar->raw_csd); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1596,19 +1739,19 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } err = mmc_select_card(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } /* Only MMC >= 4.x devices support EXT_CSD. */ @@ -1618,7 +1761,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading EXT_CSD %d\n", err); - break; + goto free_ivar; } /* Handle extended capacity from EXT_CSD */ sec_count = ivar->raw_ext_csd[EXT_CSD_SEC_CNT] + @@ -1629,6 +1772,8 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->sec_count = sec_count; ivar->high_cap = 1; } + /* Find maximum supported bus width. */ + ivar->bus_width = mmc_test_bus_width(sc); /* Get device speeds beyond normal mode. */ if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_HS_52) != 0) { @@ -1651,6 +1796,50 @@ mmc_discover_cards(struct mmc_softc *sc) setbit(&ivar->timings, bus_timing_mmc_ddr52); setbit(&ivar->vccq_180, bus_timing_mmc_ddr52); } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_120, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_180, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400es); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400es); + } /* * Determine generic switch timeout (provided in * units of 10 ms), defaulting to 500 ms. @@ -1659,8 +1848,6 @@ mmc_discover_cards(struct mmc_softc *sc) if (ivar->csd.spec_vers >= 6) ivar->cmd6_time = 10 * ivar->raw_ext_csd[EXT_CSD_GEN_CMD6_TIME]; - /* Find max supported bus width. */ - ivar->bus_width = mmc_test_bus_width(sc); /* Handle HC erase sector size. */ if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) { ivar->erase_sector = 1024 * @@ -1674,11 +1861,15 @@ mmc_discover_cards(struct mmc_softc *sc) device_printf(sc->dev, "Error setting erase group %d\n", err); - break; + goto free_ivar; } } } + mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, + ivar->raw_ext_csd[EXT_CSD_REV] >= 5); + +child_common: /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -1691,8 +1882,6 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->csd.write_bl_len != MMC_SECTOR_SIZE) mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, - ivar->raw_ext_csd[EXT_CSD_REV] >= 5); mmc_format_card_id_string(ivar); if (bootverbose || mmc_debug) @@ -1700,56 +1889,111 @@ mmc_discover_cards(struct mmc_softc *sc) if (newcard) { /* Add device. */ child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); + if (child != NULL) { + device_set_ivars(child, ivar); + sc->child_list = realloc(sc->child_list, + sizeof(device_t *) * sc->child_count + 1, + M_DEVBUF, M_WAITOK); + sc->child_list[sc->child_count++] = child; + } else + device_printf(sc->dev, "Error adding child\n"); } - mmc_select_card(sc, 0); + +free_ivar: + if (newcard && child == NULL) + free(ivar, M_DEVBUF); + (void)mmc_select_card(sc, 0); + /* + * Not returning here when one MMC device could no be added + * potentially would mean looping forever when that device + * is broken (in which case it also may impact the remainder + * of the bus anyway, though). + */ + if ((newcard && child == NULL) || + mmcbr_get_mode(sc->dev) == mode_sd) + return; } } static void +mmc_update_child_list(struct mmc_softc *sc) +{ + device_t child; + int i, j; + + if (sc->child_count == 0) { + free(sc->child_list, M_DEVBUF); + return; + } + for (i = j = 0; i < sc->child_count; i++) { + for (;;) { + child = sc->child_list[j++]; + if (child != NULL) + break; + } + if (i != j) + sc->child_list[i] = child; + } + sc->child_list = realloc(sc->child_list, sizeof(device_t *) * + sc->child_count, M_DEVBUF, M_WAITOK); +} + +static void mmc_rescan_cards(struct mmc_softc *sc) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (mmc_select_card(sc, ivar->rca) != MMC_ERR_NONE) { if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d lost.\n", + "Card at relative address %d lost\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + continue; + } free(ivar, M_DEVBUF); - } + } else + j++; } - free(devlist, M_TEMP); - mmc_select_card(sc, 0); + if (sc->child_count == j) + goto out; + sc->child_count = j; + mmc_update_child_list(sc); +out: + (void)mmc_select_card(sc, 0); } static int -mmc_delete_cards(struct mmc_softc *sc) +mmc_delete_cards(struct mmc_softc *sc, bool final) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return (err); - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + err = 0; + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d deleted.\n", + "Card at relative address %d deleted\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + if (final == false) + continue; + else + break; + } free(ivar, M_DEVBUF); } - free(devlist, M_TEMP); - return (0); + sc->child_count = j; + mmc_update_child_list(sc); + return (err); } static void @@ -1813,7 +2057,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_get_ocr(dev)); if (mmcbr_get_ocr(dev) == 0) { device_printf(sc->dev, "No compatible cards found on bus\n"); - mmc_delete_cards(sc); + (void)mmc_delete_cards(sc, false); mmc_power_down(sc); return; } @@ -1837,31 +2081,27 @@ mmc_go_discovery(struct mmc_softc *sc) static int mmc_calculate_clock(struct mmc_softc *sc) { - device_t *kids; + device_t dev; struct mmc_ivars *ivar; - int host_caps, i, nkid; + int i; uint32_t dtr, max_dtr; + uint16_t rca; enum mmc_bus_timing max_timing, timing; - bool changed; + bool changed, hs400; - max_dtr = mmcbr_get_f_max(sc->dev); - host_caps = mmcbr_get_caps(sc->dev); - if ((host_caps & MMC_CAP_MMC_DDR52) != 0) - max_timing = bus_timing_mmc_ddr52; - else if ((host_caps & MMC_CAP_HSPEED) != 0) - max_timing = bus_timing_hs; - else - max_timing = bus_timing_normal; - if (device_get_children(sc->dev, &kids, &nkid) != 0) - panic("can't get children"); + dev = sc->dev; + max_dtr = mmcbr_get_f_max(dev); + max_timing = bus_timing_max; do { changed = false; - for (i = 0; i < nkid; i++) { - ivar = device_get_ivars(kids[i]); - if (isclr(&ivar->timings, max_timing)) { - for (timing = max_timing; timing >= + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (isclr(&ivar->timings, max_timing) || + !mmc_host_timing(dev, max_timing)) { + for (timing = max_timing - 1; timing >= bus_timing_normal; timing--) { - if (isset(&ivar->timings, timing)) { + if (isset(&ivar->timings, timing) && + mmc_host_timing(dev, timing)) { max_timing = timing; break; } @@ -1875,38 +2115,316 @@ mmc_calculate_clock(struct mmc_softc *sc) } } } while (changed == true); + if (bootverbose || mmc_debug) { - device_printf(sc->dev, + device_printf(dev, "setting transfer rate to %d.%03dMHz (%s timing)\n", max_dtr / 1000000, (max_dtr / 1000) % 1000, mmc_timing_to_string(max_timing)); } - for (i = 0; i < nkid; i++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Jul 23 16:28:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 075F8DA4EED; Sun, 23 Jul 2017 16:28:15 +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 C7B2466A66; Sun, 23 Jul 2017 16:28:14 +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 v6NGSDdH092421; Sun, 23 Jul 2017 16:28:13 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NGSDoa092418; Sun, 23 Jul 2017 16:28:13 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707231628.v6NGSDoa092418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 23 Jul 2017 16:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321386 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 321386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 16:28:15 -0000 Author: alc Date: Sun Jul 23 16:28:13 2017 New Revision: 321386 URL: https://svnweb.freebsd.org/changeset/base/321386 Log: Utilize pmap_enter(..., psind=1) in vm_fault_soft_fast() on amd64. (The Differential Revision discusses the benefits of this change.) Add a function, vm_reserv_to_superpage(), that returns the superpage containing the specified base page. Reviewed by: kib, markj Tested by: pho MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D11556 Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Jul 23 16:11:47 2017 (r321385) +++ head/sys/vm/vm_fault.c Sun Jul 23 16:28:13 2017 (r321386) @@ -266,8 +266,11 @@ static int vm_fault_soft_fast(struct faultstate *fs, vm_offset_t vaddr, vm_prot_t prot, int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold) { - vm_page_t m; - int rv; + vm_page_t m, m_map; +#if defined(__amd64__) && VM_NRESERVLEVEL > 0 + vm_page_t m_super; +#endif + int flags, psind, rv; MPASS(fs->vp == NULL); m = vm_page_lookup(fs->first_object, fs->first_pindex); @@ -275,14 +278,46 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) return (KERN_FAILURE); - rv = pmap_enter(fs->map->pmap, vaddr, m, prot, fault_type | - PMAP_ENTER_NOSLEEP | (wired ? PMAP_ENTER_WIRED : 0), 0); + m_map = m; + psind = 0; +#if defined(__amd64__) && VM_NRESERVLEVEL > 0 + if ((m->flags & PG_FICTITIOUS) == 0 && + (m_super = vm_reserv_to_superpage(m)) != NULL && + rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start && + roundup2(vaddr + 1, pagesizes[m_super->psind]) <= fs->entry->end && + (vaddr & (pagesizes[m_super->psind] - 1)) == (VM_PAGE_TO_PHYS(m) & + (pagesizes[m_super->psind] - 1)) && + pmap_ps_enabled(fs->map->pmap)) { + flags = PS_ALL_VALID; + if ((prot & VM_PROT_WRITE) != 0) { + /* + * Create a superpage mapping allowing write access + * only if none of the constituent pages are busy and + * all of them are already dirty (except possibly for + * the page that was faulted on). + */ + flags |= PS_NONE_BUSY; + if ((fs->first_object->flags & OBJ_UNMANAGED) == 0) + flags |= PS_ALL_DIRTY; + } + if (vm_page_ps_test(m_super, flags, m)) { + m_map = m_super; + psind = m_super->psind; + vaddr = rounddown2(vaddr, pagesizes[psind]); + /* Preset the modified bit for dirty superpages. */ + if ((flags & PS_ALL_DIRTY) != 0) + fault_type |= VM_PROT_WRITE; + } + } +#endif + rv = pmap_enter(fs->map->pmap, vaddr, m_map, prot, fault_type | + PMAP_ENTER_NOSLEEP | (wired ? PMAP_ENTER_WIRED : 0), psind); if (rv != KERN_SUCCESS) return (rv); vm_fault_fill_hold(m_hold, m); vm_fault_dirty(fs->entry, m, prot, fault_type, fault_flags, false); VM_OBJECT_RUNLOCK(fs->first_object); - if (!wired) + if (psind == 0 && !wired) vm_fault_prefault(fs, vaddr, PFBAK, PFFOR); vm_map_lookup_done(fs->map, fs->entry); curthread->td_ru.ru_minflt++; Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sun Jul 23 16:11:47 2017 (r321385) +++ head/sys/vm/vm_reserv.c Sun Jul 23 16:28:13 2017 (r321386) @@ -1121,4 +1121,18 @@ vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, return (new_end); } +/* + * Returns the superpage containing the given page. + */ +vm_page_t +vm_reserv_to_superpage(vm_page_t m) +{ + vm_reserv_t rv; + + VM_OBJECT_ASSERT_LOCKED(m->object); + rv = vm_reserv_from_page(m); + return (rv->object == m->object && rv->popcnt == VM_LEVEL_0_NPAGES ? + rv->pages : NULL); +} + #endif /* VM_NRESERVLEVEL > 0 */ Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Sun Jul 23 16:11:47 2017 (r321385) +++ head/sys/vm/vm_reserv.h Sun Jul 23 16:28:13 2017 (r321386) @@ -64,6 +64,7 @@ void vm_reserv_rename(vm_page_t m, vm_object_t new_ob int vm_reserv_size(int level); vm_paddr_t vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, vm_paddr_t high_water); +vm_page_t vm_reserv_to_superpage(vm_page_t m); #endif /* VM_NRESERVLEVEL > 0 */ #endif /* _KERNEL */ From owner-svn-src-all@freebsd.org Sun Jul 23 17:57:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34165DA984C; Sun, 23 Jul 2017 17:57:02 +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 EBDA369359; Sun, 23 Jul 2017 17:57:01 +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 v6NHv06f030493; Sun, 23 Jul 2017 17:57:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NHv08W030492; Sun, 23 Jul 2017 17:57:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707231757.v6NHv08W030492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Jul 2017 17:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321387 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Commit-Revision: 321387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 17:57:02 -0000 Author: ngie Date: Sun Jul 23 17:57:00 2017 New Revision: 321387 URL: https://svnweb.freebsd.org/changeset/base/321387 Log: Don't use incorrect hardcoded path to ksh -- use /usr/bin/env to find ksh instead MFC after: 1 month Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Sun Jul 23 16:28:13 2017 (r321386) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Sun Jul 23 17:57:00 2017 (r321387) @@ -1,4 +1,4 @@ -#!/bin/ksh -p +#!/usr/bin/env ksh -p /* * CDDL HEADER START From owner-svn-src-all@freebsd.org Sun Jul 23 18:00:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2928EDA998C; Sun, 23 Jul 2017 18:00:05 +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 E33E069638; Sun, 23 Jul 2017 18:00:04 +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 v6NI03ou030714; Sun, 23 Jul 2017 18:00:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NI03OD030713; Sun, 23 Jul 2017 18:00:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707231800.v6NI03OD030713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Jul 2017 18:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321388 - stable/11/usr.sbin/cron/cron X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/usr.sbin/cron/cron X-SVN-Commit-Revision: 321388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 18:00:05 -0000 Author: ngie Date: Sun Jul 23 18:00:03 2017 New Revision: 321388 URL: https://svnweb.freebsd.org/changeset/base/321388 Log: MFC r321240: cron(8) manpage updates - Document /etc/cron.d and /usr/local/etc/cron.d under FILES. - Reword documentation for -n: add appropriate soft-stop and remove contraction to appease igor. Modified: stable/11/usr.sbin/cron/cron/cron.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/cron/cron/cron.8 ============================================================================== --- stable/11/usr.sbin/cron/cron/cron.8 Sun Jul 23 17:57:00 2017 (r321387) +++ stable/11/usr.sbin/cron/cron/cron.8 Sun Jul 23 18:00:03 2017 (r321388) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2016 +.Dd July 19, 2017 .Dt CRON 8 .Os .Sh NAME @@ -138,7 +138,7 @@ set to a null string, usually specified in a shell as or .Li \*q\*q . .It Fl n -Don't daemonize, run in foreground instead. +Do not daemonize; run in foreground instead. .It Fl s Enable special handling of situations when the GMT offset of the local timezone changes, such as the switches between the standard time and @@ -209,13 +209,17 @@ trace through the execution, but do not perform any ac .El .El .Sh FILES -.Bl -tag -width /etc/pam.d/cron -compact +.Bl -tag -width /usr/local/etc/cron.d -compact .It Pa /etc/crontab System crontab file +.It Pa /etc/cron.d +Directory for optional/modularized system crontab files. .It Pa /etc/pam.d/cron .Xr pam.conf 5 configuration file for .Nm +.It Pa /usr/local/etc/cron.d +Directory for third-party package provided crontab files. .It Pa /var/cron/tabs Directory for personal crontab files .El From owner-svn-src-all@freebsd.org Sun Jul 23 18:00:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D48FFDA99CE; Sun, 23 Jul 2017 18:00:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9496969D; Sun, 23 Jul 2017 18:00: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 v6NI0BEN030765; Sun, 23 Jul 2017 18:00:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NI0BEd030764; Sun, 23 Jul 2017 18:00:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707231800.v6NI0BEd030764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Jul 2017 18:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321389 - stable/10/usr.sbin/cron/cron X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/usr.sbin/cron/cron X-SVN-Commit-Revision: 321389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 18:00:13 -0000 Author: ngie Date: Sun Jul 23 18:00:11 2017 New Revision: 321389 URL: https://svnweb.freebsd.org/changeset/base/321389 Log: MFC r321240: cron(8) manpage updates - Document /etc/cron.d and /usr/local/etc/cron.d under FILES. - Reword documentation for -n: add appropriate soft-stop and remove contraction to appease igor. Modified: stable/10/usr.sbin/cron/cron/cron.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/cron/cron/cron.8 ============================================================================== --- stable/10/usr.sbin/cron/cron/cron.8 Sun Jul 23 18:00:03 2017 (r321388) +++ stable/10/usr.sbin/cron/cron/cron.8 Sun Jul 23 18:00:11 2017 (r321389) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2016 +.Dd July 19, 2017 .Dt CRON 8 .Os .Sh NAME @@ -138,7 +138,7 @@ set to a null string, usually specified in a shell as or .Li \*q\*q . .It Fl n -Don't daemonize, run in foreground instead. +Do not daemonize; run in foreground instead. .It Fl s Enable special handling of situations when the GMT offset of the local timezone changes, such as the switches between the standard time and @@ -209,13 +209,17 @@ trace through the execution, but do not perform any ac .El .El .Sh FILES -.Bl -tag -width /etc/pam.d/cron -compact +.Bl -tag -width /usr/local/etc/cron.d -compact .It Pa /etc/crontab System crontab file +.It Pa /etc/cron.d +Directory for optional/modularized system crontab files. .It Pa /etc/pam.d/cron .Xr pam.conf 5 configuration file for .Nm +.It Pa /usr/local/etc/cron.d +Directory for third-party package provided crontab files. .It Pa /var/cron/tabs Directory for personal crontab files .El From owner-svn-src-all@freebsd.org Sun Jul 23 18:10:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96714DA9E2A; Sun, 23 Jul 2017 18:10: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 70C0169D65; Sun, 23 Jul 2017 18:10: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 v6NIAlX4034990; Sun, 23 Jul 2017 18:10:47 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NIAljj034987; Sun, 23 Jul 2017 18:10:47 GMT (envelope-from np@FreeBSD.org) Message-Id: <201707231810.v6NIAljj034987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 23 Jul 2017 18:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321390 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 321390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 18:10:48 -0000 Author: np Date: Sun Jul 23 18:10:47 2017 New Revision: 321390 URL: https://svnweb.freebsd.org/changeset/base/321390 Log: cxgbe(4): Install the firmware bundled with the driver to the card if it doesn't seem to have one. This lets the driver recover automatically from incomplete firmware upgrades (panic, reboot, power loss, etc. in the middle of an upgrade). MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Sun Jul 23 18:00:11 2017 (r321389) +++ head/sys/dev/cxgbe/common/common.h Sun Jul 23 18:10:47 2017 (r321390) @@ -693,6 +693,8 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, const u8 *fw_data, unsigned int size, int force); +int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data, + unsigned int size); int t4_fw_initialize(struct adapter *adap, unsigned int mbox); int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sun Jul 23 18:00:11 2017 (r321389) +++ head/sys/dev/cxgbe/common/t4_hw.c Sun Jul 23 18:10:47 2017 (r321390) @@ -6745,6 +6745,31 @@ int t4_fw_upgrade(struct adapter *adap, unsigned int m return t4_fw_restart(adap, mbox, reset); } +/* + * Card doesn't have a firmware, install one. + */ +int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data, + unsigned int size) +{ + const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; + unsigned int bootstrap = + be32_to_cpu(fw_hdr->magic) == FW_HDR_MAGIC_BOOTSTRAP; + int ret; + + if (!t4_fw_matches_chip(adap, fw_hdr) || bootstrap) + return -EINVAL; + + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, F_UPCRST); + t4_write_reg(adap, A_PCIE_FW, 0); /* Clobber internal state */ + ret = t4_load_fw(adap, fw_data, size); + if (ret < 0) + return ret; + t4_write_reg(adap, A_PL_RST, F_PIORST | F_PIORSTMODE); + msleep(1000); + + return (0); +} + /** * t4_fw_initialize - ask FW to initialize the device * @adap: the adapter Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sun Jul 23 18:00:11 2017 (r321389) +++ head/sys/dev/cxgbe/t4_main.c Sun Jul 23 18:10:47 2017 (r321390) @@ -2968,6 +2968,7 @@ install: return (1); } + /* * Establish contact with the firmware and determine if we are the master driver * or not, and whether we are responsible for chip initialization. @@ -2984,28 +2985,6 @@ prep_firmware(struct adapter *sc) const struct fw_hdr *drv_fw; /* fw header the driver was compiled against */ - /* Contact firmware. */ - rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state); - if (rc < 0 || state == DEV_STATE_ERR) { - rc = -rc; - device_printf(sc->dev, - "failed to connect to the firmware: %d, %d.\n", rc, state); - return (rc); - } - pf = rc; - if (pf == sc->mbox) - sc->flags |= MASTER_PF; - else if (state == DEV_STATE_UNINIT) { - /* - * We didn't get to be the master so we definitely won't be - * configuring the chip. It's a bug if someone else hasn't - * configured it already. - */ - device_printf(sc->dev, "couldn't be master(%d), " - "device not already initialized either(%d).\n", rc, state); - return (EDOOFUS); - } - /* This is the firmware whose headers the driver was compiled against */ fw_info = find_fw_info(chip_id(sc)); if (fw_info == NULL) { @@ -3022,26 +3001,82 @@ prep_firmware(struct adapter *sc) */ default_cfg = firmware_get(fw_info->kld_name); + /* This is the firmware in the KLD */ + fw = firmware_get(fw_info->fw_mod_name); + if (fw != NULL) { + kld_fw = (const void *)fw->data; + kld_fw_usable = fw_compatible(drv_fw, kld_fw); + } else { + kld_fw = NULL; + kld_fw_usable = 0; + } + /* Read the header of the firmware on the card */ card_fw = malloc(sizeof(*card_fw), M_CXGBE, M_ZERO | M_WAITOK); rc = -t4_read_flash(sc, FLASH_FW_START, sizeof (*card_fw) / sizeof (uint32_t), (uint32_t *)card_fw, 1); - if (rc == 0) + if (rc == 0) { card_fw_usable = fw_compatible(drv_fw, (const void*)card_fw); - else { + if (card_fw->fw_ver == be32toh(0xffffffff)) { + uint32_t d = be32toh(kld_fw->fw_ver); + + if (!kld_fw_usable) { + device_printf(sc->dev, + "no firmware on the card and no usable " + "firmware bundled with the driver.\n"); + rc = EIO; + goto done; + } else if (t4_fw_install == 0) { + device_printf(sc->dev, + "no firmware on the card and the driver " + "is prohibited from installing new " + "firmware.\n"); + rc = EIO; + goto done; + } + + device_printf(sc->dev, "no firmware on the card, " + "installing firmware %d.%d.%d.%d\n", + G_FW_HDR_FW_VER_MAJOR(d), G_FW_HDR_FW_VER_MINOR(d), + G_FW_HDR_FW_VER_MICRO(d), G_FW_HDR_FW_VER_BUILD(d)); + rc = t4_fw_forceinstall(sc, fw->data, fw->datasize); + if (rc < 0) { + rc = -rc; + device_printf(sc->dev, + "firmware install failed: %d.\n", rc); + goto done; + } + memcpy(card_fw, kld_fw, sizeof(*card_fw)); + card_fw_usable = 1; + need_fw_reset = 0; + } + } else { device_printf(sc->dev, "Unable to read card's firmware header: %d\n", rc); card_fw_usable = 0; } - /* This is the firmware in the KLD */ - fw = firmware_get(fw_info->fw_mod_name); - if (fw != NULL) { - kld_fw = (const void *)fw->data; - kld_fw_usable = fw_compatible(drv_fw, kld_fw); - } else { - kld_fw = NULL; - kld_fw_usable = 0; + /* Contact firmware. */ + rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state); + if (rc < 0 || state == DEV_STATE_ERR) { + rc = -rc; + device_printf(sc->dev, + "failed to connect to the firmware: %d, %d.\n", rc, state); + goto done; + } + pf = rc; + if (pf == sc->mbox) + sc->flags |= MASTER_PF; + else if (state == DEV_STATE_UNINIT) { + /* + * We didn't get to be the master so we definitely won't be + * configuring the chip. It's a bug if someone else hasn't + * configured it already. + */ + device_printf(sc->dev, "couldn't be master(%d), " + "device not already initialized either(%d).\n", rc, state); + rc = EPROTO; + goto done; } if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver && From owner-svn-src-all@freebsd.org Sun Jul 23 18:13:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94CD8DAA06E; Sun, 23 Jul 2017 18:13:20 +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 6DE046A164; Sun, 23 Jul 2017 18:13:20 +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 v6NIDJj0038638; Sun, 23 Jul 2017 18:13:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NIDJjC038637; Sun, 23 Jul 2017 18:13:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707231813.v6NIDJjC038637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Jul 2017 18:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321391 - stable/11/targets/pseudo/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/targets/pseudo/tests X-SVN-Commit-Revision: 321391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 18:13:20 -0000 Author: ngie Date: Sun Jul 23 18:13:19 2017 New Revision: 321391 URL: https://svnweb.freebsd.org/changeset/base/321391 Log: MFC r316603,r321214: r316603: META_MODE: add additional reachover relative paths to DIRDEPS_BUILD These additional entries are being added, after their addition to the source tree. r321214: Update targets/pseudo/tests/Makefile.depend after recent additions/subtractions from the FreeBSD test suite. MFC with: r316603 Modified: stable/11/targets/pseudo/tests/Makefile.depend Directory Properties: stable/11/ (props changed) Modified: stable/11/targets/pseudo/tests/Makefile.depend ============================================================================== --- stable/11/targets/pseudo/tests/Makefile.depend Sun Jul 23 18:10:47 2017 (r321390) +++ stable/11/targets/pseudo/tests/Makefile.depend Sun Jul 23 18:13:19 2017 (r321391) @@ -7,13 +7,17 @@ # find . -name Makefile -exec grep -l '^\.include.*\.test.mk' {} + | grep -v '^\./contrib' | sed -e 's,/Makefile,,' -e 's,^\./,,' -e 's,^, ,' -e 's,$, \\,' | sort DIRDEPS= \ bin/cat/tests \ + bin/chmod/tests \ bin/date/tests \ bin/dd/tests \ + bin/echo/tests \ bin/expr/tests \ + bin/ln/tests \ bin/ls/tests \ bin/mv/tests \ bin/pax/tests \ bin/pkill/tests \ + bin/pwait/tests \ bin/sh/tests \ bin/sh/tests/builtins \ bin/sh/tests/errors \ @@ -113,6 +117,7 @@ DIRDEPS= \ cddl/usr.sbin/dtrace/tests/common/vars \ cddl/usr.sbin/dtrace/tests/common/version \ cddl/usr.sbin/tests \ + cddl/usr.sbin/zfsd/tests \ gnu/lib/tests \ gnu/tests \ gnu/usr.bin/diff/tests \ @@ -131,6 +136,7 @@ DIRDEPS= \ lib/libc/tests/gen/execve \ lib/libc/tests/gen/posix_spawn \ lib/libc/tests/hash \ + lib/libc/tests/iconv \ lib/libc/tests/inet \ lib/libc/tests/locale \ lib/libc/tests/net \ @@ -149,12 +155,16 @@ DIRDEPS= \ lib/libc/tests/time \ lib/libc/tests/tls \ lib/libc/tests/ttyio \ + lib/libcam/tests \ lib/libcrypt/tests \ + lib/libdevdctl/tests \ + lib/libkvm/tests \ lib/libmp/tests \ lib/libnv/tests \ lib/libpam/libpam/tests \ lib/libproc/tests \ lib/librt/tests \ + lib/libsbuf/tests \ lib/libthr/tests \ lib/libthr/tests/dlopen \ lib/libthr/tests/dlopen/dso \ @@ -166,8 +176,6 @@ DIRDEPS= \ libexec/atf/atf-sh/tests \ libexec/atf/tests \ libexec/rtld-elf/tests \ - libexec/rtld-elf/tests/libpythagoras \ - libexec/rtld-elf/tests/target \ libexec/tests \ sbin/devd/tests \ sbin/dhclient/tests \ @@ -193,6 +201,8 @@ DIRDEPS= \ tests/sys/aio \ tests/sys/fifo \ tests/sys/file \ + tests/sys/fs \ + tests/sys/fs/tmpfs \ tests/sys/geom \ tests/sys/geom/class \ tests/sys/geom/class/concat \ @@ -209,13 +219,13 @@ DIRDEPS= \ tests/sys/kern/execve \ tests/sys/kern/pipe \ tests/sys/kqueue \ + tests/sys/kqueue/libkqueue \ tests/sys/mac \ tests/sys/mac/bsdextended \ tests/sys/mac/portacl \ tests/sys/mqueue \ tests/sys/netinet \ tests/sys/opencrypto \ - tests/sys/pjdfstest/pjdfstest \ tests/sys/pjdfstest/tests \ tests/sys/pjdfstest/tests/chflags \ tests/sys/pjdfstest/tests/chmod \ @@ -292,10 +302,13 @@ DIRDEPS= \ usr.bin/cmp/tests \ usr.bin/col/tests \ usr.bin/comm/tests \ + usr.bin/compress/tests \ usr.bin/cpio/tests \ usr.bin/cut/tests \ usr.bin/dirname/tests \ + usr.bin/du/tests \ usr.bin/file2c/tests \ + usr.bin/getconf/tests \ usr.bin/grep/tests \ usr.bin/gzip/tests \ usr.bin/ident/tests \ @@ -306,17 +319,21 @@ DIRDEPS= \ usr.bin/m4/tests \ usr.bin/mkimg/tests \ usr.bin/ncal/tests \ + usr.bin/pr/tests \ usr.bin/printf/tests \ - usr.bin/pwait/tests \ + usr.bin/procstat/tests \ usr.bin/sdiff/tests \ usr.bin/sed/tests \ usr.bin/sed/tests/regress.multitest.out \ usr.bin/soelim/tests \ + usr.bin/stat/tests \ + usr.bin/tail/tests \ usr.bin/tar/tests \ usr.bin/tests \ usr.bin/timeout/tests \ usr.bin/tr/tests \ usr.bin/truncate/tests \ + usr.bin/uniq/tests \ usr.bin/units/tests \ usr.bin/uudecode/tests \ usr.bin/uuencode/tests \ @@ -341,6 +358,7 @@ DIRDEPS= \ DIRDEPS:= ${DIRDEPS:Ncddl/usr.sbin/dtrace/tests/common/nfs} DIRDEPS:= ${DIRDEPS:Ncddl/usr.sbin/dtrace/tests/common/sysevent} DIRDEPS:= ${DIRDEPS:Ncddl/usr.sbin/dtrace/tests/common/docsExamples} +DIRDEPS:= ${DIRDEPS:Ncddl/usr.sbin/zfsd/tests} DIRDEPS:= ${DIRDEPS:Nlib/libc/tests/net/getaddrinfo} .include From owner-svn-src-all@freebsd.org Sun Jul 23 18:14:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C207DDAA0ED; Sun, 23 Jul 2017 18:14:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (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 8E3BB6A290; Sun, 23 Jul 2017 18:14:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x241.google.com with SMTP id y25so1403808pfk.4; Sun, 23 Jul 2017 11:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=L7P7bmD5yDkrDFbJEfaOTnwIc8ZGwo1xJrJ04znXZ18=; b=qFf1pZbIiFfF4A5QOyzNv1/39Nc3Fr1GdkYWYlMheTGey6u7A2eze5h8pRw/o7hBnt fDDXhJxlI9egzWxD+pF1/cYrc46fXVNFJNXISvS8FpPkFJ1e0HchnAsEAYqgXnBvO3e4 XKVphsJvfuCalTD+H+eejuvyEYUxFheH/y74RUei62SxlbRXlr5u+Ryni4lcgVRA99zs tO11snQEmtd2IdLUjDPazDBELsiMKrNTe2adShp1vU/SN2QylTSvTEwWImomGNeFT15X ZniIO3BewmNjYEddHpSkUN/4d2SjNSJqMz8nBPJox0PiDnHHZicvCU6jdcPF9H7eyFSY zxKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=L7P7bmD5yDkrDFbJEfaOTnwIc8ZGwo1xJrJ04znXZ18=; b=nKl8HpgM7YIgp9gcNOI4qUJoyksX4CXhC1AE5pdfBqTdNsC4dEjrlvADei1IbwBz6Y IIL3eK0ffmRiiIpkHxBAI6T29ABtmKZzvFdV6b3PwY8I4Lr70E4vqURKf4cDajjAYaUQ lIm7sbuyamLUYW4dsjN10SCsFMpOjakvxiNZ1YqQUhrs9zcYJoUzEeJvk0sAT9+4GJqm BSgQjXewxxII070gQcZbIgNwKV3q+zO57k67o1JBNgdRuSpftLewIfFY9sZcjxgVu1No oWGJsXIYJjubhc5RaAsRiFCr7/z0r0/EaEnLg29dKyZjYEdY+7BeXR++olW/J8dMftyz tojQ== X-Gm-Message-State: AIVw112vtYYbXiKq+hm5/V7Z5mkRIX2T34YYxSa0RynrDLLPFEPdZvTi 5107MBG6B8PJ3SGEcDc= X-Received: by 10.99.119.139 with SMTP id s133mr13371215pgc.256.1500833697518; Sun, 23 Jul 2017 11:14:57 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id p8sm1487089pfj.101.2017.07.23.11.14.55 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Jul 2017 11:14:56 -0700 (PDT) Subject: Re: svn commit: r321331 - head/share/mk Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_54C233BD-B295-481F-9FD1-882D1305D4AF"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201707211450.v6LEoWCO064640@repo.freebsd.org> Date: Sun, 23 Jul 2017 11:14:54 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <12D1C1EF-EC00-459F-844E-E5EA342EEDF2@gmail.com> References: <201707211450.v6LEoWCO064640@repo.freebsd.org> To: Ruslan Bukin X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 18:14:58 -0000 --Apple-Mail=_54C233BD-B295-481F-9FD1-882D1305D4AF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 21, 2017, at 07:50, Ruslan Bukin wrote: >=20 > Author: br > Date: Fri Jul 21 14:50:32 2017 > New Revision: 321331 > URL: https://svnweb.freebsd.org/changeset/base/321331 >=20 > Log: > Add warning flags for GCC 7.1.0 compiler. >=20 > Sponsored by: DARPA, AFRL >=20 > Modified: > head/share/mk/bsd.sys.mk >=20 > Modified: head/share/mk/bsd.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/bsd.sys.mk Fri Jul 21 14:14:47 2017 = (r321330) > +++ head/share/mk/bsd.sys.mk Fri Jul 21 14:50:32 2017 = (r321331) > @@ -145,6 +145,23 @@ CWARNFLAGS+=3D = -Wno-error=3Dmisleading-indentation \ > -Wno-error=3Dunused-const-variable > .endif >=20 > +# GCC 7.1.0 > +.if ${COMPILER_TYPE} =3D=3D "gcc" && ${COMPILER_VERSION} >=3D 70100 > +CWARNFLAGS+=3D -Wno-error=3Ddeprecated \ > + -Wno-error=3Dpointer-compare \ > + -Wno-error=3Dformat-truncation \ > + -Wno-error=3Dimplicit-fallthrough \ > + -Wno-error=3Dexpansion-to-defined \ > + -Wno-error=3Dint-in-bool-context \ > + -Wno-error=3Dbool-operation \ > + -Wno-error=3Dformat-overflow \ > + -Wno-error=3Dstringop-overflow \ > + -Wno-error=3Dmemset-elt-size \ > + -Wno-error=3Dint-in-bool-context \ > + -Wno-error=3Dunused-const-variable \ > + -Wno-error=3Dnonnull > +.endif Hi Ruslan, 1. Fixing some of these warnings make sense =E2=80=94 why are we = ignoring them? 2. Why isn=E2=80=99t this being MFCed? gcc 7.1.0 is available on = ^/stable/11 as well. Thanks, -Ngie --Apple-Mail=_54C233BD-B295-481F-9FD1-882D1305D4AF 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZdOefAAoJEPWDqSZpMIYVWCIP/iNveEEqws2D7gMNrwPMBA27 jZ1Jn2wQUmyAWao47fPnODX20qGBuJJZWhc6D0pwGp7nVeNOyFFs+v8DzwLNvhRO wucODiaAOUyZs229aAiDz8/K5CfYQ7aEYln+E654K0jFBS8cxTXGQEPSheiwtQg8 2KmjpCrwk7wVOGFPABPfutQS23ABXFYrhetmv367/GKxexnavg+3NZvf7RsdhWPr CCB6DFjcjaBQ8XEKtchpPVb2XclrtEe7kfjxc1BrnXoVyaep4CLbY07Z/pbyBb74 P0iwkmPZOmUR9lqaN1QRdaIv0xNm9rrRx3cj6PWwKwd1RT9IgEf0STB/bY+cCV1H 6bv/VQ2vso0xTAWAXldFuSHCg+BQH1F4DJi+o56IQK/kEgrlGRnIedX5zL53SxgR DBVruMTX9otcomAd/VP7w0TyZvpSxzog++YhispdxMcC5Kl/BsaC4tlOxUkQBx0m 80Yq05uRMXpCIhtOm7OprR5031UOm/iGJ2JHksILs2tTCJBx4NJ2feCFRc1ogeKP 7Mip1AMpZkJ5h/D3zmO5KyvNFrEdrlTyDwZohLOL80+fYq7PUPto7/lQxGGoOSfs i6+5xcLvfivTGd4ynSzZ004sbYbYN6PsgFBofPoX7zUM9h5PWSDn48O7oQJcRh3I 6u3g374TqCqxFHlIqDvc =Orh7 -----END PGP SIGNATURE----- --Apple-Mail=_54C233BD-B295-481F-9FD1-882D1305D4AF-- From owner-svn-src-all@freebsd.org Sun Jul 23 19:00:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BF46DAAA79; Sun, 23 Jul 2017 19:00:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED9F86B100; Sun, 23 Jul 2017 19:00:29 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NJ0TSK055241; Sun, 23 Jul 2017 19:00:29 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NJ0TQj055240; Sun, 23 Jul 2017 19:00:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201707231900.v6NJ0TQj055240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Sun, 23 Jul 2017 19:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321392 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 321392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 19:00:30 -0000 Author: mw Date: Sun Jul 23 19:00:28 2017 New Revision: 321392 URL: https://svnweb.freebsd.org/changeset/base/321392 Log: Add myself (mw) as a src committer and cognet as my mentor. Reviewed by: cognet (mentor) Approved by: cognet (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sun Jul 23 18:13:19 2017 (r321391) +++ head/share/misc/committers-src.dot Sun Jul 23 19:00:28 2017 (r321392) @@ -250,6 +250,7 @@ mmel [label="Michal Meloun\nmmel@FreeBSD.org\n2015/11/ monthadar [label="Monthadar Al Jaberi\nmonthadar@FreeBSD.org\n2012/04/02"] mp [label="Mark Peek\nmp@FreeBSD.org\n2001/07/27"] mr [label="Michael Reifenberger\nmr@FreeBSD.org\n2001/09/30"] +mw [label="Marcin Wojtas\nmw@FreeBSD.org\n2017/07/18"] neel [label="Neel Natu\nneel@FreeBSD.org\n2009/09/20"] netchild [label="Alexander Leidinger\nnetchild@FreeBSD.org\n2005/03/31"] ngie [label="Ngie Cooper\nngie@FreeBSD.org\n2014/07/27"] @@ -420,6 +421,7 @@ cognet -> jceel cognet -> kevlo cognet -> ian cognet -> manu +cognet -> mw cognet -> wkoszek cognet -> wma cognet -> zbb From owner-svn-src-all@freebsd.org Sun Jul 23 19:09:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E829DAACE5 for ; Sun, 23 Jul 2017 19:09:53 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 657FE6B52C for ; Sun, 23 Jul 2017 19:09:52 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 8489506a-6fda-11e7-bfd0-afd4446ba3af X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 8489506a-6fda-11e7-bfd0-afd4446ba3af; Sun, 23 Jul 2017 19:09:58 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v6NJ9iPf006426; Sun, 23 Jul 2017 13:09:44 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1500836984.24226.316.camel@freebsd.org> Subject: Re: svn commit: r321386 - head/sys/vm From: Ian Lepore To: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 23 Jul 2017 13:09:44 -0600 In-Reply-To: <201707231628.v6NGSDoa092418@repo.freebsd.org> References: <201707231628.v6NGSDoa092418@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 19:09:53 -0000 On Sun, 2017-07-23 at 16:28 +0000, Alan Cox wrote: > Author: alc > Date: Sun Jul 23 16:28:13 2017 > New Revision: 321386 > URL: https://svnweb.freebsd.org/changeset/base/321386 > > Log: >   Utilize pmap_enter(..., psind=1) in vm_fault_soft_fast() on > amd64.  (The >   Differential Revision discusses the benefits of this change.) >    >   Add a function, vm_reserv_to_superpage(), that returns the > superpage >   containing the specified base page. >    >   Reviewed by: kib, markj >   Tested by: pho >   MFC after: 10 days >   Differential Revision: https://reviews.freebsd.org/D11556 > > Modified: >   head/sys/vm/vm_fault.c >   head/sys/vm/vm_reserv.c >   head/sys/vm/vm_reserv.h > Arches that build with old gcc 4.2.1 are complaining: /b/staging/freebsd/head/src/sys/vm/vm_fault.c:273:6: error: unused variable 'flags' [-Werror,-Wunused-variable] -- Ian From owner-svn-src-all@freebsd.org Sun Jul 23 19:21:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3021EDAB2C1; Sun, 23 Jul 2017 19:21:58 +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 0084F6BD14; Sun, 23 Jul 2017 19:21:57 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.16.0.17/8.16.0.17) with SMTP id v6NIpHNG022929; Sun, 23 Jul 2017 14:21:49 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 2bv1rj88bv-1; Sun, 23 Jul 2017 14:21:49 -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-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (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 B4E0F4003F; Sun, 23 Jul 2017 14:21:48 -0500 (CDT) Subject: Re: svn commit: r321386 - head/sys/vm To: Ian Lepore , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201707231628.v6NGSDoa092418@repo.freebsd.org> <1500836984.24226.316.camel@freebsd.org> From: Alan Cox Message-ID: Date: Sun, 23 Jul 2017 14:21:47 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1500836984.24226.316.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US 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-1609300000 definitions=main-1611190142 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 19:21:58 -0000 On 07/23/2017 14:09, Ian Lepore wrote: > On Sun, 2017-07-23 at 16:28 +0000, Alan Cox wrote: >> Author: alc >> Date: Sun Jul 23 16:28:13 2017 >> New Revision: 321386 >> URL: https://svnweb.freebsd.org/changeset/base/321386 >> >> Log: >> Utilize pmap_enter(..., psind=1) in vm_fault_soft_fast() on >> amd64. (The >> Differential Revision discusses the benefits of this change.) >> >> Add a function, vm_reserv_to_superpage(), that returns the >> superpage >> containing the specified base page. >> >> Reviewed by: kib, markj >> Tested by: pho >> MFC after: 10 days >> Differential Revision: https://reviews.freebsd.org/D11556 >> >> Modified: >> head/sys/vm/vm_fault.c >> head/sys/vm/vm_reserv.c >> head/sys/vm/vm_reserv.h >> > Arches that build with old gcc 4.2.1 are complaining: > > /b/staging/freebsd/head/src/sys/vm/vm_fault.c:273:6: error: unused > variable 'flags' [-Werror,-Wunused-variable] I see. I'll commit a fix in a few minutes. Thanks. From owner-svn-src-all@freebsd.org Sun Jul 23 19:35:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD6A9DAB75C; Sun, 23 Jul 2017 19:35:15 +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 9CB0A6C354; Sun, 23 Jul 2017 19:35:15 +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 v6NJZEPD071106; Sun, 23 Jul 2017 19:35:14 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NJZEZt071105; Sun, 23 Jul 2017 19:35:14 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707231935.v6NJZEZt071105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 23 Jul 2017 19:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321393 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 321393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 19:35:15 -0000 Author: alc Date: Sun Jul 23 19:35:14 2017 New Revision: 321393 URL: https://svnweb.freebsd.org/changeset/base/321393 Log: Address a compilation warning on some architectures that was introduced by the previous change, r321386. Reported by: ian MFC after: 10 days X-MFC after: r321386 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Jul 23 19:00:28 2017 (r321392) +++ head/sys/vm/vm_fault.c Sun Jul 23 19:35:14 2017 (r321393) @@ -269,8 +269,9 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t vm_page_t m, m_map; #if defined(__amd64__) && VM_NRESERVLEVEL > 0 vm_page_t m_super; + int flags; #endif - int flags, psind, rv; + int psind, rv; MPASS(fs->vp == NULL); m = vm_page_lookup(fs->first_object, fs->first_pindex); From owner-svn-src-all@freebsd.org Sun Jul 23 20:25:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAB34DAC7A9; Sun, 23 Jul 2017 20:25:54 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99DFA6E275; Sun, 23 Jul 2017 20:25:54 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NKPrDP091559; Sun, 23 Jul 2017 20:25:53 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NKPrOe091556; Sun, 23 Jul 2017 20:25:53 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201707232025.v6NKPrOe091556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 23 Jul 2017 20:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321396 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 321396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 20:25:54 -0000 Author: pstef Date: Sun Jul 23 20:25:53 2017 New Revision: 321396 URL: https://svnweb.freebsd.org/changeset/base/321396 Log: indent(1): better alignment of comments on code. If aligning the beginning of a comment to -cn would mean no space between code and the comment, align it to the next tab stop. Modified: head/usr.bin/indent/pr_comment.c head/usr.bin/indent/tests/comments.0 head/usr.bin/indent/tests/comments.0.stdout Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 23 19:54:54 2017 (r321395) +++ head/usr.bin/indent/pr_comment.c Sun Jul 23 20:25:53 2017 (r321396) @@ -141,7 +141,7 @@ pr_comment(void) target_col = count_spaces(compute_label_target(), s_lab); } ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind; - if (ps.com_col < target_col) + if (ps.com_col <= target_col) ps.com_col = ((target_col + 7) & ~7) + 1; if (ps.com_col + 24 > adj_max_col) adj_max_col = ps.com_col + 24; Modified: head/usr.bin/indent/tests/comments.0 ============================================================================== --- head/usr.bin/indent/tests/comments.0 Sun Jul 23 19:54:54 2017 (r321395) +++ head/usr.bin/indent/tests/comments.0 Sun Jul 23 20:25:53 2017 (r321396) @@ -1,4 +1,11 @@ /* $FreeBSD$ */ +typedef enum x { + aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */ + bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */ + cccccccccccccc = 1 << 1, /* test c */ + dddddddddddddddddddddddddddddd = 1 << 2 /* test d */ +} x; + /* See r303597, r303598, r309219, and r309343 */ void t(void) { /* Modified: head/usr.bin/indent/tests/comments.0.stdout ============================================================================== --- head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 19:54:54 2017 (r321395) +++ head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 20:25:53 2017 (r321396) @@ -1,4 +1,11 @@ /* $FreeBSD$ */ +typedef enum x { + aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */ + bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */ + cccccccccccccc = 1 << 1, /* test c */ + dddddddddddddddddddddddddddddd = 1 << 2 /* test d */ +} x; + /* See r303597, r303598, r309219, and r309343 */ void t(void) From owner-svn-src-all@freebsd.org Sun Jul 23 20:32:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82837DACB7B; Sun, 23 Jul 2017 20:32:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54CA06E6C5; Sun, 23 Jul 2017 20:32:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NKWtGY095663; Sun, 23 Jul 2017 20:32:55 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NKWsMv095656; Sun, 23 Jul 2017 20:32:54 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201707232032.v6NKWsMv095656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 23 Jul 2017 20:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321397 - head/sys/dev/evdev X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/evdev X-SVN-Commit-Revision: 321397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 20:32:56 -0000 Author: wulf Date: Sun Jul 23 20:32:54 2017 New Revision: 321397 URL: https://svnweb.freebsd.org/changeset/base/321397 Log: evdev: style(9), sort headers alphabetically Pointed out by: bde Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Modified: head/sys/dev/evdev/cdev.c head/sys/dev/evdev/evdev.c head/sys/dev/evdev/evdev_mt.c head/sys/dev/evdev/evdev_private.h head/sys/dev/evdev/evdev_utils.c head/sys/dev/evdev/input.h head/sys/dev/evdev/uinput.c Modified: head/sys/dev/evdev/cdev.c ============================================================================== --- head/sys/dev/evdev/cdev.c Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/cdev.c Sun Jul 23 20:32:54 2017 (r321397) @@ -29,24 +29,23 @@ #include "opt_evdev.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 #ifdef EVDEV_DEBUG #define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args) Modified: head/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/evdev.c Sun Jul 23 20:32:54 2017 (r321397) @@ -29,19 +29,18 @@ #include "opt_evdev.h" -#include -#include #include -#include -#include +#include #include +#include #include -#include +#include #include +#include -#include #include #include +#include #ifdef EVDEV_DEBUG #define debugf(evdev, fmt, args...) printf("evdev: " fmt "\n", ##args) Modified: head/sys/dev/evdev/evdev_mt.c ============================================================================== --- head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:32:54 2017 (r321397) @@ -27,14 +27,14 @@ */ #include -#include #include +#include #include #include -#include #include #include +#include #ifdef DEBUG #define debugf(fmt, args...) printf("evdev: " fmt "\n", ##args) Modified: head/sys/dev/evdev/evdev_private.h ============================================================================== --- head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:32:54 2017 (r321397) @@ -31,10 +31,11 @@ #define _DEV_EVDEV_EVDEV_PRIVATE_H #include -#include -#include #include +#include +#include #include + #include #include #include Modified: head/sys/dev/evdev/evdev_utils.c ============================================================================== --- head/sys/dev/evdev/evdev_utils.c Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/evdev_utils.c Sun Jul 23 20:32:54 2017 (r321397) @@ -27,17 +27,16 @@ * $FreeBSD$ */ -#include -#include #include #include -#include #include -#include #include +#include +#include +#include -#include #include +#include #include Modified: head/sys/dev/evdev/input.h ============================================================================== --- head/sys/dev/evdev/input.h Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/input.h Sun Jul 23 20:32:54 2017 (r321397) @@ -31,8 +31,8 @@ #define _EVDEV_INPUT_H #ifndef __KERNEL__ -#include #include +#include #include #endif Modified: head/sys/dev/evdev/uinput.c ============================================================================== --- head/sys/dev/evdev/uinput.c Sun Jul 23 20:25:53 2017 (r321396) +++ head/sys/dev/evdev/uinput.c Sun Jul 23 20:32:54 2017 (r321397) @@ -29,25 +29,24 @@ #include "opt_evdev.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 #ifdef UINPUT_DEBUG #define debugf(state, fmt, args...) printf("uinput: " fmt "\n", ##args) From owner-svn-src-all@freebsd.org Sun Jul 23 20:35:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EEC1DACC7A; Sun, 23 Jul 2017 20:35:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35E6E6E85B; Sun, 23 Jul 2017 20:35:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NKZRVP095816; Sun, 23 Jul 2017 20:35:27 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NKZRm8095812; Sun, 23 Jul 2017 20:35:27 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201707232035.v6NKZRm8095812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 23 Jul 2017 20:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321398 - head/sys/dev/evdev X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/evdev X-SVN-Commit-Revision: 321398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 20:35:28 -0000 Author: wulf Date: Sun Jul 23 20:35:26 2017 New Revision: 321398 URL: https://svnweb.freebsd.org/changeset/base/321398 Log: evdev: Macroize common locking sequences Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Modified: head/sys/dev/evdev/evdev.c head/sys/dev/evdev/evdev_mt.c head/sys/dev/evdev/evdev_private.h Modified: head/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sun Jul 23 20:32:54 2017 (r321397) +++ head/sys/dev/evdev/evdev.c Sun Jul 23 20:35:26 2017 (r321398) @@ -757,14 +757,11 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t typ int32_t value) { - if (evdev->ev_lock_type != EV_LOCK_INTERNAL) - EVDEV_LOCK_ASSERT(evdev); - if (evdev_check_event(evdev, type, code, value) != 0) return (EINVAL); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); + EVDEV_ENTER(evdev); + evdev_modify_event(evdev, type, code, &value); if (type == EV_SYN && code == SYN_REPORT && bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) @@ -773,8 +770,8 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t typ bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_send_mt_compat(evdev); evdev_send_event(evdev, type, code, value); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + + EVDEV_EXIT(evdev); return (0); } Modified: head/sys/dev/evdev/evdev_mt.c ============================================================================== --- head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:32:54 2017 (r321397) +++ head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:35:26 2017 (r321398) @@ -224,13 +224,9 @@ void evdev_push_nfingers(struct evdev_dev *evdev, int32_t nfingers) { - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); - else - EVDEV_LOCK_ASSERT(evdev); + EVDEV_ENTER(evdev); evdev_send_nfingers(evdev, nfingers); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + EVDEV_EXIT(evdev); } void @@ -264,13 +260,9 @@ void evdev_push_mt_compat(struct evdev_dev *evdev) { - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); - else - EVDEV_LOCK_ASSERT(evdev); + EVDEV_ENTER(evdev); evdev_send_mt_compat(evdev); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + EVDEV_EXIT(evdev); } void Modified: head/sys/dev/evdev/evdev_private.h ============================================================================== --- head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:32:54 2017 (r321397) +++ head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:35:26 2017 (r321398) @@ -135,6 +135,16 @@ struct evdev_dev #define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock) #define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock) #define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED) +#define EVDEV_ENTER(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + EVDEV_LOCK(evdev); \ + else \ + EVDEV_LOCK_ASSERT(evdev); \ +} while (0) +#define EVDEV_EXIT(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + EVDEV_UNLOCK(evdev); \ +} while (0) struct evdev_client { From owner-svn-src-all@freebsd.org Sun Jul 23 20:42:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F90DDACFD5; Sun, 23 Jul 2017 20:42:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A4526EDA3; Sun, 23 Jul 2017 20:42:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NKfxGP096890; Sun, 23 Jul 2017 20:41:59 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NKfw9Q096880; Sun, 23 Jul 2017 20:41:58 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201707232041.v6NKfw9Q096880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 23 Jul 2017 20:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321399 - head/sys/dev/evdev X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/evdev X-SVN-Commit-Revision: 321399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 20:42:00 -0000 Author: wulf Date: Sun Jul 23 20:41:58 2017 New Revision: 321399 URL: https://svnweb.freebsd.org/changeset/base/321399 Log: Change my email address to wulf@FreeBSD.org in copyright headers. Approved by: gonzo (mentor) MFC after: 2 weeks Modified: head/sys/dev/evdev/cdev.c head/sys/dev/evdev/evdev.c head/sys/dev/evdev/evdev_mt.c head/sys/dev/evdev/evdev_private.h head/sys/dev/evdev/evdev_utils.c head/sys/dev/evdev/input-event-codes.h head/sys/dev/evdev/input.h head/sys/dev/evdev/uinput.c head/sys/dev/evdev/uinput.h Modified: head/sys/dev/evdev/cdev.c ============================================================================== --- head/sys/dev/evdev/cdev.c Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/cdev.c Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/evdev.c Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/evdev_mt.c ============================================================================== --- head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/evdev_mt.c Sun Jul 23 20:41:58 2017 (r321399) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Vladimir Kondratyev + * Copyright (c) 2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/evdev_private.h ============================================================================== --- head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/evdev_private.h Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/evdev_utils.c ============================================================================== --- head/sys/dev/evdev/evdev_utils.c Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/evdev_utils.c Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/input-event-codes.h ============================================================================== --- head/sys/dev/evdev/input-event-codes.h Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/input-event-codes.h Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/input.h ============================================================================== --- head/sys/dev/evdev/input.h Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/input.h Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/uinput.c ============================================================================== --- head/sys/dev/evdev/uinput.c Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/uinput.c Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/evdev/uinput.h ============================================================================== --- head/sys/dev/evdev/uinput.h Sun Jul 23 20:35:26 2017 (r321398) +++ head/sys/dev/evdev/uinput.h Sun Jul 23 20:41:58 2017 (r321399) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Sun Jul 23 21:28:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07C09DAE0FA; Sun, 23 Jul 2017 21:28:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9A9C705D8; Sun, 23 Jul 2017 21:28:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6NLS0tJ016214; Sun, 23 Jul 2017 21:28:00 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NLS0Gs016213; Sun, 23 Jul 2017 21:28:00 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707232128.v6NLS0Gs016213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jul 2017 21:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321400 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 21:28:02 -0000 Author: ian Date: Sun Jul 23 21:28:00 2017 New Revision: 321400 URL: https://svnweb.freebsd.org/changeset/base/321400 Log: Add common code to support realtime clocks that store year without century. Most realtime clocks store the year as 2 BCD digits. Some add a century bit to extend the range another hundred years. Every clock driver has its own code to determine the century and pass a full year value to clock_ct_to_ts(). Now clock drivers can just convert BCD to bin and store the result in the clocktime struct and let the common code figure out the century. Clocks with a century bit can just add 100 to year if the century bit is on. Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Sun Jul 23 20:41:58 2017 (r321399) +++ head/sys/kern/subr_clock.c Sun Jul 23 21:28:00 2017 (r321400) @@ -142,18 +142,27 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * { int i, year, days; - year = ct->year; - if (ct_debug) { printf("ct_to_ts("); print_ct(ct); printf(")"); } + /* + * Many realtime clocks store the year as 2-digit BCD; pivot on 70 to + * determine century. Some clocks have a "century bit" and drivers do + * year += 100, so interpret values between 70-199 as relative to 1900. + */ + year = ct->year; + if (year < 70) + year += 2000; + else if (year < 200) + year += 1900; + /* Sanity checks. */ if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 || ct->day > days_in_month(year, ct->mon) || - ct->hour > 23 || ct->min > 59 || ct->sec > 59 || + ct->hour > 23 || ct->min > 59 || ct->sec > 59 || year < 1970 || (sizeof(time_t) == 4 && year > 2037)) { /* time_t overflow */ if (ct_debug) printf(" = EINVAL\n"); From owner-svn-src-all@freebsd.org Sun Jul 23 22:10:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7D35DAEB69; Sun, 23 Jul 2017 22:10:50 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 859AC71638; Sun, 23 Jul 2017 22:10:50 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:15823) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1dZP5L-000rLX-dC (Exim 4.89) (return-path ); Sun, 23 Jul 2017 23:10:47 +0100 Date: Sun, 23 Jul 2017 22:05:57 +0000 From: Ruslan Bukin To: "Ngie Cooper (yaneurabeya)" Cc: Ruslan Bukin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321331 - head/share/mk Message-ID: <20170723220557.GA79777@bsdpad.com> References: <201707211450.v6LEoWCO064640@repo.freebsd.org> <12D1C1EF-EC00-459F-844E-E5EA342EEDF2@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <12D1C1EF-EC00-459F-844E-E5EA342EEDF2@gmail.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 22:10:50 -0000 On Sun, Jul 23, 2017 at 11:14:54AM -0700, Ngie Cooper (yaneurabeya) wrote: > > > On Jul 21, 2017, at 07:50, Ruslan Bukin wrote: > > > > Author: br > > Date: Fri Jul 21 14:50:32 2017 > > New Revision: 321331 > > URL: https://svnweb.freebsd.org/changeset/base/321331 > > > > Log: > > Add warning flags for GCC 7.1.0 compiler. > > > > Sponsored by: DARPA, AFRL > > > > Modified: > > head/share/mk/bsd.sys.mk > > > > Modified: head/share/mk/bsd.sys.mk > > ============================================================================== > > --- head/share/mk/bsd.sys.mk Fri Jul 21 14:14:47 2017 (r321330) > > +++ head/share/mk/bsd.sys.mk Fri Jul 21 14:50:32 2017 (r321331) > > @@ -145,6 +145,23 @@ CWARNFLAGS+= -Wno-error=misleading-indentation \ > > -Wno-error=unused-const-variable > > .endif > > > > +# GCC 7.1.0 > > +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 70100 > > +CWARNFLAGS+= -Wno-error=deprecated \ > > + -Wno-error=pointer-compare \ > > + -Wno-error=format-truncation \ > > + -Wno-error=implicit-fallthrough \ > > + -Wno-error=expansion-to-defined \ > > + -Wno-error=int-in-bool-context \ > > + -Wno-error=bool-operation \ > > + -Wno-error=format-overflow \ > > + -Wno-error=stringop-overflow \ > > + -Wno-error=memset-elt-size \ > > + -Wno-error=int-in-bool-context \ > > + -Wno-error=unused-const-variable \ > > + -Wno-error=nonnull > > +.endif > > Hi Ruslan, > 1. Fixing some of these warnings make sense — why are we ignoring them? > 2. Why isn’t this being MFCed? gcc 7.1.0 is available on ^/stable/11 as well. This is mostly for upcoming RISC-V update to support new privilege specification. I did not try this on other architectures as my current goal is to support latest RISC-V. Ruslan From owner-svn-src-all@freebsd.org Sun Jul 23 22:38:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90F85DAF1D7; Sun, 23 Jul 2017 22:38:01 +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 600CF71F94; Sun, 23 Jul 2017 22:38:01 +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 v6NMc0lG044200; Sun, 23 Jul 2017 22:38:00 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6NMc0jD044198; Sun, 23 Jul 2017 22:38:00 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201707232238.v6NMc0jD044198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 23 Jul 2017 22:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321401 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 321401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jul 2017 22:38:01 -0000 Author: avos Date: Sun Jul 23 22:38:00 2017 New Revision: 321401 URL: https://svnweb.freebsd.org/changeset/base/321401 Log: net80211: do not allow to unload rate control module if it is still in use. Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active wlan(4) interface will not lead to kernel panic. MFC after: 5 days Modified: head/sys/net80211/ieee80211_amrr.c head/sys/net80211/ieee80211_rssadapt.c Modified: head/sys/net80211/ieee80211_amrr.c ============================================================================== --- head/sys/net80211/ieee80211_amrr.c Sun Jul 23 21:28:00 2017 (r321400) +++ head/sys/net80211/ieee80211_amrr.c Sun Jul 23 22:38:00 2017 (r321401) @@ -117,6 +117,7 @@ amrr_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__)); + nrefs++; /* XXX locking */ amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (amrr == NULL) { @@ -133,6 +134,8 @@ static void amrr_deinit(struct ieee80211vap *vap) { IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } /* Modified: head/sys/net80211/ieee80211_rssadapt.c ============================================================================== --- head/sys/net80211/ieee80211_rssadapt.c Sun Jul 23 21:28:00 2017 (r321400) +++ head/sys/net80211/ieee80211_rssadapt.c Sun Jul 23 22:38:00 2017 (r321401) @@ -130,7 +130,8 @@ rssadapt_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized", __func__)); - + + nrefs++; /* XXX locking */ vap->iv_rs = rs = IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (rs == NULL) { @@ -146,6 +147,8 @@ static void rssadapt_deinit(struct ieee80211vap *vap) { IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } static void From owner-svn-src-all@freebsd.org Mon Jul 24 00:52:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEBA6DB2393; Mon, 24 Jul 2017 00:52:54 +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 AFF2775215; Mon, 24 Jul 2017 00:52:54 +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 v6O0qrMJ001006; Mon, 24 Jul 2017 00:52:53 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O0qrnl001000; Mon, 24 Jul 2017 00:52:53 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201707240052.v6O0qrnl001000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 24 Jul 2017 00:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321402 - vendor/NetBSD/bmake/dist X-SVN-Group: vendor X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: vendor/NetBSD/bmake/dist X-SVN-Commit-Revision: 321402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 00:52:55 -0000 Author: sjg Date: Mon Jul 24 00:52:52 2017 New Revision: 321402 URL: https://svnweb.freebsd.org/changeset/base/321402 Log: Import bmake-20170720 compat.c: pass SIGINT etc onto child and wait for it to exit before we self-terminate. Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/Makefile vendor/NetBSD/bmake/dist/compat.c vendor/NetBSD/bmake/dist/job.c vendor/NetBSD/bmake/dist/make.h vendor/NetBSD/bmake/dist/nonints.h Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/ChangeLog Mon Jul 24 00:52:52 2017 (r321402) @@ -1,3 +1,10 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + 2017-07-11 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170711 Modified: vendor/NetBSD/bmake/dist/Makefile ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/Makefile Mon Jul 24 00:52:52 2017 (r321402) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170711 +_MAKE_VERSION= 20170720 PROG= bmake Modified: vendor/NetBSD/bmake/dist/compat.c ============================================================================== --- vendor/NetBSD/bmake/dist/compat.c Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/compat.c Mon Jul 24 00:52:52 2017 (r321402) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); +__RCSID("$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -118,6 +118,8 @@ __RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +static pid_t compatChild; +static int compatSigno; /* * CompatDeleteTarget -- delete a failed, interrupted, or otherwise @@ -176,8 +178,17 @@ CompatInterrupt(int signo) } if (signo == SIGQUIT) _exit(signo); - bmake_signal(signo, SIG_DFL); - kill(myPid, signo); + /* + * If there is a child running, pass the signal on + * we will exist after it has exited. + */ + compatSigno = signo; + if (compatChild > 0) { + KILLPG(compatChild, signo); + } else { + bmake_signal(signo, SIG_DFL); + kill(myPid, signo); + } } /*- @@ -370,7 +381,7 @@ again: /* * Fork and execute the single command. If the fork fails, we abort. */ - cpid = vFork(); + compatChild = cpid = vFork(); if (cpid < 0) { Fatal("Could not fork"); } @@ -483,7 +494,12 @@ again: } } free(cmdStart); - + compatChild = 0; + if (compatSigno) { + bmake_signal(compatSigno, SIG_DFL); + kill(myPid, compatSigno); + } + return (status); } Modified: vendor/NetBSD/bmake/dist/job.c ============================================================================== --- vendor/NetBSD/bmake/dist/job.c Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/job.c Mon Jul 24 00:52:52 2017 (r321402) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */ +/* $NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"); +__RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -348,11 +348,6 @@ static Job childExitJob; /* child exit pseudo-job */ (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) static sigset_t caught_signals; /* Set of signals we handle */ -#if defined(SYSV) -#define KILLPG(pid, sig) kill(-(pid), (sig)) -#else -#define KILLPG(pid, sig) killpg((pid), (sig)) -#endif static void JobChildSig(int); static void JobContinueSig(int); Modified: vendor/NetBSD/bmake/dist/make.h ============================================================================== --- vendor/NetBSD/bmake/dist/make.h Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/make.h Mon Jul 24 00:52:52 2017 (r321402) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ +/* $NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -541,6 +541,12 @@ int cached_stat(const char *, void *); #endif #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN +#endif + +#if defined(SYSV) +#define KILLPG(pid, sig) kill(-(pid), (sig)) +#else +#define KILLPG(pid, sig) killpg((pid), (sig)) #endif #endif /* _MAKE_H_ */ Modified: vendor/NetBSD/bmake/dist/nonints.h ============================================================================== --- vendor/NetBSD/bmake/dist/nonints.h Sun Jul 23 22:38:00 2017 (r321401) +++ vendor/NetBSD/bmake/dist/nonints.h Mon Jul 24 00:52:52 2017 (r321402) @@ -143,6 +143,11 @@ int Str_Match(const char *, const char *); char *Str_SYSVMatch(const char *, const char *, int *len); void Str_SYSVSubst(Buffer *, char *, char *, int); +#ifndef HAVE_STRLCPY +/* strlcpy.c */ +size_t strlcpy(char *, const char *, size_t); +#endif + /* suff.c */ void Suff_ClearSuffixes(void); Boolean Suff_IsTransform(char *); From owner-svn-src-all@freebsd.org Mon Jul 24 00:53:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8510DDB23F0; Mon, 24 Jul 2017 00:53:44 +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 3A4EA754BD; Mon, 24 Jul 2017 00:53:44 +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 v6O0rheO001082; Mon, 24 Jul 2017 00:53:43 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O0rha7001081; Mon, 24 Jul 2017 00:53:43 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201707240053.v6O0rha7001081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 24 Jul 2017 00:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321403 - vendor/NetBSD/bmake/20170720 X-SVN-Group: vendor X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: vendor/NetBSD/bmake/20170720 X-SVN-Commit-Revision: 321403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 00:53:44 -0000 Author: sjg Date: Mon Jul 24 00:53:43 2017 New Revision: 321403 URL: https://svnweb.freebsd.org/changeset/base/321403 Log: tag bmake-20170720 Added: vendor/NetBSD/bmake/20170720/ - copied from r321402, vendor/NetBSD/bmake/dist/ From owner-svn-src-all@freebsd.org Mon Jul 24 01:39:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F0D7DB317F; Mon, 24 Jul 2017 01:39: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 37BDE76677; Mon, 24 Jul 2017 01:39: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 v6O1dwMp017761; Mon, 24 Jul 2017 01:39:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O1dwEJ017760; Mon, 24 Jul 2017 01:39:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240139.v6O1dwEJ017760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 01:39:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321404 - stable/11/sys/dev/hyperv/storvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 321404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 01:39:59 -0000 Author: sephe Date: Mon Jul 24 01:39:58 2017 New Revision: 321404 URL: https://svnweb.freebsd.org/changeset/base/321404 Log: MFC 321286 hyperv/storvsc: Force SPC3 for CDROM attached. This unbreaks the CDROM attaching on GEN2 VMs. On GEN1 VMs, CDROM is attached to emulated ATA controller. PR: 220790 Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11634 Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 24 00:53:43 2017 (r321403) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 24 01:39:58 2017 (r321404) @@ -2211,6 +2211,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp) resp_buf[3], resp_buf[4]); } /* + * XXX: Hyper-V (since win2012r2) responses inquiry with + * unknown version (0) for GEN-2 DVD device. + * Manually set the version number to SPC3 in order to + * ask CAM to continue probing with "PROBE_REPORT_LUNS". + * see probedone() in scsi_xpt.c + */ + if (SID_TYPE(inq_data) == T_CDROM && + inq_data->version == 0 && + (vmstor_proto_version >= VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + xpt_print(ccb->ccb_h.path, + "set version from 0 to %d\n", + inq_data->version); + } + } + /* * XXX: Manually fix the wrong response returned from WS2012 */ if (!is_scsi_valid(inq_data) && @@ -2219,7 +2236,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) { if (data_len >= 4 && (resp_buf[2] == 0 || resp_buf[3] == 0)) { - resp_buf[2] = 5; // verion=5 means SPC-3 + resp_buf[2] = SCSI_REV_SPC3; resp_buf[3] = 2; // resp fmt must be 2 if (bootverbose) xpt_print(ccb->ccb_h.path, From owner-svn-src-all@freebsd.org Mon Jul 24 02:13:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B317DB3BAB; Mon, 24 Jul 2017 02:13:48 +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 0768B775FE; Mon, 24 Jul 2017 02:13:47 +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 v6O2DlUK033892; Mon, 24 Jul 2017 02:13:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O2DleJ033891; Mon, 24 Jul 2017 02:13:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240213.v6O2DleJ033891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 02:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321405 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 321405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 02:13:48 -0000 Author: sephe Date: Mon Jul 24 02:13:46 2017 New Revision: 321405 URL: https://svnweb.freebsd.org/changeset/base/321405 Log: MFC 321286 hyperv/storvsc: Force SPC3 for CDROM attached. This unbreaks the CDROM attaching on GEN2 VMs. On GEN1 VMs, CDROM is attached to emulated ATA controller. PR: 220790 Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11634 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 24 01:39:58 2017 (r321404) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 24 02:13:46 2017 (r321405) @@ -2211,6 +2211,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp) resp_buf[3], resp_buf[4]); } /* + * XXX: Hyper-V (since win2012r2) responses inquiry with + * unknown version (0) for GEN-2 DVD device. + * Manually set the version number to SPC3 in order to + * ask CAM to continue probing with "PROBE_REPORT_LUNS". + * see probedone() in scsi_xpt.c + */ + if (SID_TYPE(inq_data) == T_CDROM && + inq_data->version == 0 && + (vmstor_proto_version >= VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + xpt_print(ccb->ccb_h.path, + "set version from 0 to %d\n", + inq_data->version); + } + } + /* * XXX: Manually fix the wrong response returned from WS2012 */ if (!is_scsi_valid(inq_data) && @@ -2219,7 +2236,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) { if (data_len >= 4 && (resp_buf[2] == 0 || resp_buf[3] == 0)) { - resp_buf[2] = 5; // verion=5 means SPC-3 + resp_buf[2] = SCSI_REV_SPC3; resp_buf[3] = 2; // resp fmt must be 2 if (bootverbose) xpt_print(ccb->ccb_h.path, From owner-svn-src-all@freebsd.org Mon Jul 24 03:32:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A39EDB582F; Mon, 24 Jul 2017 03:32:12 +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 BF9F77E125; Mon, 24 Jul 2017 03:32:11 +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 v6O3WAxo064359; Mon, 24 Jul 2017 03:32:10 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O3WAbh064357; Mon, 24 Jul 2017 03:32:10 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240332.v6O3WAbh064357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 03:32:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321406 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 321406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 03:32:12 -0000 Author: sephe Date: Mon Jul 24 03:32:10 2017 New Revision: 321406 URL: https://svnweb.freebsd.org/changeset/base/321406 Log: ethernet: Add ethernet interface attached event and devctl notification. ifnet_arrival_event may not be adequate under certain situation; e.g. when the LLADDR is needed. So the ethernet ifattach event is announced after all necessary bits are setup. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11617 Modified: head/sys/net/ethernet.h head/sys/net/if_ethersubr.c Modified: head/sys/net/ethernet.h ============================================================================== --- head/sys/net/ethernet.h Mon Jul 24 02:13:46 2017 (r321405) +++ head/sys/net/ethernet.h Mon Jul 24 03:32:10 2017 (r321406) @@ -406,6 +406,12 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *, void *, u_int); struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); +#ifdef _SYS_EVENTHANDLER_H_ +/* new ethernet interface attached event */ +typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); +#endif + #else /* _KERNEL */ #include Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Mon Jul 24 02:13:46 2017 (r321405) +++ head/sys/net/if_ethersubr.c Mon Jul 24 03:32:10 2017 (r321406) @@ -38,6 +38,8 @@ #include #include +#include +#include #include #include #include @@ -931,6 +933,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) if_printf(ifp, "Ethernet address: %6D\n", lla, ":"); uuid_ether_add(LLADDR(sdl)); + + /* Add necessary bits are setup; announce it now. */ + EVENTHANDLER_INVOKE(ether_ifattach_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL); } /* From owner-svn-src-all@freebsd.org Mon Jul 24 03:52:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C24ECDB5FB6; Mon, 24 Jul 2017 03:52:33 +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 8F5817EB95; Mon, 24 Jul 2017 03:52:33 +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 v6O3qW1M074723; Mon, 24 Jul 2017 03:52:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O3qWEN074721; Mon, 24 Jul 2017 03:52:32 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240352.v6O3qWEN074721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 03:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321407 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 03:52:33 -0000 Author: sephe Date: Mon Jul 24 03:52:32 2017 New Revision: 321407 URL: https://svnweb.freebsd.org/changeset/base/321407 Log: hyperv/hn: Export VF list and VF-HN mapping The VF-HN map will be used later on to implement "transparent VF". MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11618 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:32:10 2017 (r321406) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:52:32 2017 (r321407) @@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -119,6 +121,8 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 +#define HN_VFMAP_SIZE_DEF 8 + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -255,6 +259,11 @@ static int hn_ifmedia_upd(struct ifnet *); static void hn_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void hn_ifnet_event(void *, struct ifnet *, int); +static void hn_ifaddr_event(void *, struct ifnet *); +static void hn_ifnet_attevent(void *, struct ifnet *); +static void hn_ifnet_detevent(void *, struct ifnet *); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static void hn_rndis_rx_data(struct hn_rx_ring *, @@ -303,6 +312,9 @@ static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARG static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -502,9 +514,21 @@ static int hn_tx_agg_pkts = -1; SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts, CTLFLAG_RDTUN, &hn_tx_agg_pkts, 0, "Packet transmission aggregation packet limit"); +/* VF list */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vflist_sysctl, "A", "VF list"); + +/* VF mapping */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ +static struct rmlock hn_vfmap_lock; +static int hn_vfmap_size; +static struct ifnet **hn_vfmap; + #ifndef RSS static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { @@ -971,7 +995,7 @@ hn_update_vf_task(void *arg, int pending __unused) { struct hn_update_vf *uv = arg; - uv->rxr->hn_vf = uv->vf; + uv->rxr->hn_rxvf_ifp = uv->vf; } static void @@ -994,37 +1018,50 @@ hn_update_vf(struct hn_softc *sc, struct ifnet *vf) uv.vf = vf; vmbus_chan_run_task(rxr->hn_chan, &task); } else { - rxr->hn_vf = vf; + rxr->hn_rxvf_ifp = vf; } } } -static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +static __inline bool +hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { - struct ifnet *hn_ifp; + const struct ifnet *hn_ifp; - HN_LOCK(sc); - - if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) - goto out; - hn_ifp = sc->hn_ifp; if (ifp == hn_ifp) - goto out; + return (false); if (ifp->if_alloctype != IFT_ETHER) - goto out; + return (false); /* Ignore lagg/vlan interfaces */ if (strcmp(ifp->if_dname, "lagg") == 0 || strcmp(ifp->if_dname, "vlan") == 0) - goto out; + return (false); if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0) + return (false); + + return (true); +} + +static void +hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +{ + struct ifnet *hn_ifp; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) goto out; + if (!hn_ismyvf(sc, ifp)) + goto out; + + hn_ifp = sc->hn_ifp; + /* Now we're sure 'ifp' is a real VF device. */ if (vf) { if (sc->hn_flags & HN_FLAG_VF) @@ -1037,7 +1074,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool goto out; sc->hn_flags &= ~HN_FLAG_VF; - if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); @@ -1052,7 +1089,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); - if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + if_link_state_change(hn_ifp, LINK_STATE_DOWN); } else { hn_resume_mgmt(sc); } @@ -1082,6 +1119,85 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); } +static void +hn_ifnet_attevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + if (sc->hn_vf_ifp != NULL) { + if_printf(sc->hn_ifp, "%s was attached as VF\n", + sc->hn_vf_ifp->if_xname); + goto done; + } + + rm_wlock(&hn_vfmap_lock); + + if (ifp->if_index >= hn_vfmap_size) { + struct ifnet **newmap; + int newsize; + + newsize = ifp->if_index + HN_VFMAP_SIZE_DEF; + newmap = malloc(sizeof(struct ifnet *) * newsize, M_DEVBUF, + M_WAITOK | M_ZERO); + + memcpy(newmap, hn_vfmap, + sizeof(struct ifnet *) * hn_vfmap_size); + free(hn_vfmap, M_DEVBUF); + hn_vfmap = newmap; + hn_vfmap_size = newsize; + } + KASSERT(hn_vfmap[ifp->if_index] == NULL, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = sc->hn_ifp; + + rm_wunlock(&hn_vfmap_lock); + + sc->hn_vf_ifp = ifp; +done: + HN_UNLOCK(sc); +} + +static void +hn_ifnet_detevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (sc->hn_vf_ifp == NULL) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + sc->hn_vf_ifp = NULL; + + rm_wlock(&hn_vfmap_lock); + + KASSERT(ifp->if_index < hn_vfmap_size, + ("ifindex %d, vfmapsize %d", ifp->if_index, hn_vfmap_size)); + if (hn_vfmap[ifp->if_index] != NULL) { + KASSERT(hn_vfmap[ifp->if_index] == sc->hn_ifp, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, + hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = NULL; + } + + rm_wunlock(&hn_vfmap_lock); +done: + HN_UNLOCK(sc); +} + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const struct hyperv_guid g_net_vsc_device_type = { .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -1322,6 +1438,9 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -1412,10 +1531,14 @@ hn_attach(device_t dev) sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, + hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, + hn_ifnet_detevent, sc, EVENTHANDLER_PRI_ANY); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -1428,13 +1551,26 @@ static int hn_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->hn_ifp; + struct ifnet *ifp = sc->hn_ifp, *vf_ifp; if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) EVENTHANDLER_DEREGISTER(ifnet_event, sc->hn_ifnet_evthand); + if (sc->hn_ifnet_atthand != NULL) { + EVENTHANDLER_DEREGISTER(ether_ifattach_event, + sc->hn_ifnet_atthand); + } + if (sc->hn_ifnet_dethand != NULL) { + EVENTHANDLER_DEREGISTER(ifnet_departure_event, + sc->hn_ifnet_dethand); + } + vf_ifp = sc->hn_vf_ifp; + __compiler_membar(); + if (vf_ifp != NULL) + hn_ifnet_detevent(sc, vf_ifp); + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { /* * In case that the vmbus missed the orphan handler @@ -2326,7 +2462,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int int hash_type; /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_vf ? rxr->hn_vf : rxr->hn_ifp; + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -3301,12 +3437,12 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; - char vf_name[128]; + char vf_name[IFNAMSIZ + 1]; struct ifnet *vf; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_rx_ring[0].hn_vf; + vf = sc->hn_vf_ifp; if (vf != NULL) snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); HN_UNLOCK(sc); @@ -3314,6 +3450,110 @@ hn_vf_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[IFNAMSIZ + 1]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_rxvf_ifp; + if (vf != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + HN_UNLOCK(sc); + return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); +} + +static int +hn_vflist_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp; + + if (hn_vfmap[i] == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) + sbuf_printf(sb, "%s", ifp->if_xname); + else + sbuf_printf(sb, " %s", ifp->if_xname); + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int +hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp, *hn_ifp; + + hn_ifp = hn_vfmap[i]; + if (hn_ifp == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) { + sbuf_printf(sb, "%s:%s", ifp->if_xname, + hn_ifp->if_xname); + } else { + sbuf_printf(sb, " %s:%s", ifp->if_xname, + hn_ifp->if_xname); + } + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -5829,11 +6069,19 @@ hn_chan_callback(struct vmbus_channel *chan, void *xrx } static void -hn_tx_taskq_create(void *arg __unused) +hn_sysinit(void *arg __unused) { int i; /* + * Initialize VF map. + */ + rm_init_flags(&hn_vfmap_lock, "hn_vfmap", RM_SLEEPABLE); + hn_vfmap_size = HN_VFMAP_SIZE_DEF; + hn_vfmap = malloc(sizeof(struct ifnet *) * hn_vfmap_size, M_DEVBUF, + M_WAITOK | M_ZERO); + + /* * Fix the # of TX taskqueues. */ if (hn_tx_taskq_cnt <= 0) @@ -5869,11 +6117,10 @@ hn_tx_taskq_create(void *arg __unused) "hn tx%d", i); } } -SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_create, NULL); +SYSINIT(hn_sysinit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysinit, NULL); static void -hn_tx_taskq_destroy(void *arg __unused) +hn_sysuninit(void *arg __unused) { if (hn_tx_taskque != NULL) { @@ -5883,6 +6130,9 @@ hn_tx_taskq_destroy(void *arg __unused) taskqueue_free(hn_tx_taskque[i]); free(hn_tx_taskque, M_DEVBUF); } + + if (hn_vfmap != NULL) + free(hn_vfmap, M_DEVBUF); + rm_destroy(&hn_vfmap_lock); } -SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_destroy, NULL); +SYSUNINIT(hn_sysuninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysuninit, NULL); Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 24 03:32:10 2017 (r321406) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 24 03:52:32 2017 (r321407) @@ -59,7 +59,7 @@ struct hn_tx_ring; struct hn_rx_ring { struct ifnet *hn_ifp; - struct ifnet *hn_vf; /* SR-IOV VF */ + struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ struct hn_tx_ring *hn_txr; void *hn_pktbuf; int hn_pktbuf_len; @@ -174,6 +174,7 @@ struct hn_tx_ring { */ struct hn_softc { struct ifnet *hn_ifp; + struct ifnet *hn_vf_ifp; /* SR-IOV VF */ struct ifmedia hn_media; device_t hn_dev; int hn_if_flags; @@ -238,6 +239,8 @@ struct hn_softc { eventhandler_tag hn_ifaddr_evthand; eventhandler_tag hn_ifnet_evthand; + eventhandler_tag hn_ifnet_atthand; + eventhandler_tag hn_ifnet_dethand; }; #define HN_FLAG_RXBUF_CONNECTED 0x0001 From owner-svn-src-all@freebsd.org Mon Jul 24 03:59:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F2F7DB611C; Mon, 24 Jul 2017 03:59:52 +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 A507B7EDEB; Mon, 24 Jul 2017 03:59:51 +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 v6O3xoFb075019; Mon, 24 Jul 2017 03:59:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O3xoAL075018; Mon, 24 Jul 2017 03:59:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240359.v6O3xoAL075018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 03:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321408 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 321408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 03:59:52 -0000 Author: sephe Date: Mon Jul 24 03:59:50 2017 New Revision: 321408 URL: https://svnweb.freebsd.org/changeset/base/321408 Log: rndis: Add LINK_SPEED_CHANGE status Reviewed by: hselasky MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11650 Modified: head/sys/net/rndis.h Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Mon Jul 24 03:52:32 2017 (r321407) +++ head/sys/net/rndis.h Mon Jul 24 03:59:50 2017 (r321408) @@ -31,6 +31,7 @@ #define RNDIS_STATUS_PENDING 0x00000103L #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L #define RNDIS_STATUS_NETWORK_CHANGE 0x40010018L #define RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG 0x40020006L #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L From owner-svn-src-all@freebsd.org Mon Jul 24 04:00:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7838DB619B; Mon, 24 Jul 2017 04:00: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 755C27EF94; Mon, 24 Jul 2017 04:00: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 v6O40hON075865; Mon, 24 Jul 2017 04:00:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O40htX075864; Mon, 24 Jul 2017 04:00:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707240400.v6O40htX075864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Jul 2017 04:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321409 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 04:00:44 -0000 Author: sephe Date: Mon Jul 24 04:00:43 2017 New Revision: 321409 URL: https://svnweb.freebsd.org/changeset/base/321409 Log: hyperv/hn: Ignore LINK_SPEED_CHANGE status. This status will be reported if the backend NIC is wireless; it's not useful. Due to the high frequency of the reporting, this could be pretty annoying; ignore it. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11651 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:59:50 2017 (r321408) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 04:00:43 2017 (r321409) @@ -5574,6 +5574,7 @@ hn_rndis_rx_status(struct hn_softc *sc, const void *da break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + case RNDIS_STATUS_LINK_SPEED_CHANGE: /* Not really useful; ignore. */ break; From owner-svn-src-all@freebsd.org Mon Jul 24 04:38:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3992DDB67E8; Mon, 24 Jul 2017 04:38:07 +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 0675B7FB79; Mon, 24 Jul 2017 04:38:06 +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 v6O4c6d6090969; Mon, 24 Jul 2017 04:38:06 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O4c5fR090961; Mon, 24 Jul 2017 04:38:05 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201707240438.v6O4c5fR090961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 24 Jul 2017 04:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321410 - in head: contrib/bmake usr.bin/bmake X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: contrib/bmake usr.bin/bmake X-SVN-Commit-Revision: 321410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 04:38:07 -0000 Author: sjg Date: Mon Jul 24 04:38:05 2017 New Revision: 321410 URL: https://svnweb.freebsd.org/changeset/base/321410 Log: Import bmake-20170720 Includes fix for compat handling of interrupts. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/compat.c head/contrib/bmake/job.c head/contrib/bmake/make.h head/contrib/bmake/nonints.h head/usr.bin/bmake/Makefile head/usr.bin/bmake/Makefile.inc Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/ChangeLog Mon Jul 24 04:38:05 2017 (r321410) @@ -1,3 +1,10 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + 2017-07-11 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170711 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/Makefile Mon Jul 24 04:38:05 2017 (r321410) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170711 +_MAKE_VERSION= 20170720 PROG= bmake Modified: head/contrib/bmake/compat.c ============================================================================== --- head/contrib/bmake/compat.c Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/compat.c Mon Jul 24 04:38:05 2017 (r321410) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); +__RCSID("$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -118,6 +118,8 @@ __RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +static pid_t compatChild; +static int compatSigno; /* * CompatDeleteTarget -- delete a failed, interrupted, or otherwise @@ -176,8 +178,17 @@ CompatInterrupt(int signo) } if (signo == SIGQUIT) _exit(signo); - bmake_signal(signo, SIG_DFL); - kill(myPid, signo); + /* + * If there is a child running, pass the signal on + * we will exist after it has exited. + */ + compatSigno = signo; + if (compatChild > 0) { + KILLPG(compatChild, signo); + } else { + bmake_signal(signo, SIG_DFL); + kill(myPid, signo); + } } /*- @@ -370,7 +381,7 @@ again: /* * Fork and execute the single command. If the fork fails, we abort. */ - cpid = vFork(); + compatChild = cpid = vFork(); if (cpid < 0) { Fatal("Could not fork"); } @@ -483,7 +494,12 @@ again: } } free(cmdStart); - + compatChild = 0; + if (compatSigno) { + bmake_signal(compatSigno, SIG_DFL); + kill(myPid, compatSigno); + } + return (status); } Modified: head/contrib/bmake/job.c ============================================================================== --- head/contrib/bmake/job.c Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/job.c Mon Jul 24 04:38:05 2017 (r321410) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */ +/* $NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"); +__RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -364,11 +364,6 @@ static Job childExitJob; /* child exit pseudo-job */ (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) static sigset_t caught_signals; /* Set of signals we handle */ -#if defined(SYSV) -#define KILLPG(pid, sig) kill(-(pid), (sig)) -#else -#define KILLPG(pid, sig) killpg((pid), (sig)) -#endif static void JobChildSig(int); static void JobContinueSig(int); Modified: head/contrib/bmake/make.h ============================================================================== --- head/contrib/bmake/make.h Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/make.h Mon Jul 24 04:38:05 2017 (r321410) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ +/* $NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -541,6 +541,12 @@ int cached_stat(const char *, void *); #endif #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN +#endif + +#if defined(SYSV) +#define KILLPG(pid, sig) kill(-(pid), (sig)) +#else +#define KILLPG(pid, sig) killpg((pid), (sig)) #endif #endif /* _MAKE_H_ */ Modified: head/contrib/bmake/nonints.h ============================================================================== --- head/contrib/bmake/nonints.h Mon Jul 24 04:00:43 2017 (r321409) +++ head/contrib/bmake/nonints.h Mon Jul 24 04:38:05 2017 (r321410) @@ -143,6 +143,11 @@ int Str_Match(const char *, const char *); char *Str_SYSVMatch(const char *, const char *, int *len); void Str_SYSVSubst(Buffer *, char *, char *, int); +#ifndef HAVE_STRLCPY +/* strlcpy.c */ +size_t strlcpy(char *, const char *, size_t); +#endif + /* suff.c */ void Suff_ClearSuffixes(void); Boolean Suff_IsTransform(char *); Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Mon Jul 24 04:00:43 2017 (r321409) +++ head/usr.bin/bmake/Makefile Mon Jul 24 04:38:05 2017 (r321410) @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170711 +_MAKE_VERSION= 20170720 PROG?= ${.CURDIR:T} Modified: head/usr.bin/bmake/Makefile.inc ============================================================================== --- head/usr.bin/bmake/Makefile.inc Mon Jul 24 04:00:43 2017 (r321409) +++ head/usr.bin/bmake/Makefile.inc Mon Jul 24 04:38:05 2017 (r321410) @@ -24,3 +24,9 @@ SUBDIR+= tests WARNS=3 CFLAGS+= -DNO_PWD_OVERRIDE + +.if make(after-import) +# use our preferred value +DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk +.export DEFAULT_SYS_PATH +.endif From owner-svn-src-all@freebsd.org Mon Jul 24 05:52:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6C9DDB7786; Mon, 24 Jul 2017 05:52:12 +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 802528165D; Mon, 24 Jul 2017 05:52:12 +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 v6O5qBhF022791; Mon, 24 Jul 2017 05:52:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O5qAdA022781; Mon, 24 Jul 2017 05:52:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707240552.v6O5qAdA022781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Jul 2017 05:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321411 - in stable/11: sys/fs/nfsclient sys/fs/smbfs sys/vm usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sys/fs/nfsclient sys/fs/smbfs sys/vm usr.sbin/bhyve X-SVN-Commit-Revision: 321411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 05:52:12 -0000 Author: mav Date: Mon Jul 24 05:52:10 2017 New Revision: 321411 URL: https://svnweb.freebsd.org/changeset/base/321411 Log: MFC r302850: Make PCI interupts allocation static when using bootrom (UEFI). This makes factual interrupt routing match one shipped with UEFI firmware. With old firmware this make legacy interrupts work reliable for functions 0 of PCI slots 3-6. Updated UEFI image fixes problem completely. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/smbfs/smbfs_io.c stable/11/sys/vm/vnode_pager.c stable/11/sys/vm/vnode_pager.h stable/11/usr.sbin/bhyve/ioapic.c stable/11/usr.sbin/bhyve/ioapic.h stable/11/usr.sbin/bhyve/pci_emul.c stable/11/usr.sbin/bhyve/pci_irq.c stable/11/usr.sbin/bhyve/pci_irq.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Mon Jul 24 05:52:10 2017 (r321411) @@ -337,8 +337,10 @@ ncl_putpages(struct vop_putpages_args *ap) cred); crfree(cred); - if (error == 0 || !nfs_keep_dirty_on_error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + if (error == 0 || !nfs_keep_dirty_on_error) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + np->n_size - offset, npages * PAGE_SIZE); + } return (rtvals[0]); } Modified: stable/11/sys/fs/smbfs/smbfs_io.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_io.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/sys/fs/smbfs/smbfs_io.c Mon Jul 24 05:52:10 2017 (r321411) @@ -621,9 +621,11 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (!error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); - return rtvals[0]; + if (error == 0) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + npages * PAGE_SIZE, npages * PAGE_SIZE); + } + return (rtvals[0]); #endif /* SMBFS_RWGENERIC */ } Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/sys/vm/vnode_pager.c Mon Jul 24 05:52:10 2017 (r321411) @@ -1277,12 +1277,13 @@ vnode_pager_putpages_ioflags(int pager_flags) } void -vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, int eof, + int lpos) { vm_object_t obj; - int i, pos; + int i, pos, pos_devb; - if (written == 0) + if (written == 0 && eof >= lpos) return; obj = ma[0]->object; VM_OBJECT_WLOCK(obj); @@ -1294,6 +1295,20 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, /* Partially written page. */ rtvals[i] = VM_PAGER_AGAIN; vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); + } + } + for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { + if (pos != trunc_page(pos)) { + pos_devb = roundup2(pos, DEV_BSIZE) & PAGE_MASK; + vm_page_clear_dirty(ma[i], pos_devb, PAGE_SIZE - + pos_devb); + if (ma[i]->dirty == VM_PAGE_BITS_ALL) + rtvals[i] = VM_PAGER_OK; + pos = round_page(pos); + } else { + /* vm_pageout_flush() clears dirty */ + rtvals[i] = VM_PAGER_BAD; + pos += PAGE_SIZE; } } VM_OBJECT_WUNLOCK(obj); Modified: stable/11/sys/vm/vnode_pager.h ============================================================================== --- stable/11/sys/vm/vnode_pager.h Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/sys/vm/vnode_pager.h Mon Jul 24 05:52:10 2017 (r321411) @@ -50,7 +50,8 @@ int vnode_pager_local_getpages_async(struct vop_getpag int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, + int eof, int lpos); void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); Modified: stable/11/usr.sbin/bhyve/ioapic.c ============================================================================== --- stable/11/usr.sbin/bhyve/ioapic.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/usr.sbin/bhyve/ioapic.c Mon Jul 24 05:52:10 2017 (r321411) @@ -29,11 +29,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include "ioapic.h" +#include "pci_emul.h" +#include "pci_lpc.h" /* * Assign PCI INTx interrupts to I/O APIC pins in a round-robin @@ -64,11 +67,15 @@ ioapic_init(struct vmctx *ctx) } int -ioapic_pci_alloc_irq(void) +ioapic_pci_alloc_irq(struct pci_devinst *pi) { static int last_pin; if (pci_pins == 0) return (-1); + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + return (16 + (4 + pi->pi_slot + pi->pi_lintr.pin) % 8); + } return (16 + (last_pin++ % pci_pins)); } Modified: stable/11/usr.sbin/bhyve/ioapic.h ============================================================================== --- stable/11/usr.sbin/bhyve/ioapic.h Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/usr.sbin/bhyve/ioapic.h Mon Jul 24 05:52:10 2017 (r321411) @@ -30,10 +30,12 @@ #ifndef _IOAPIC_H_ #define _IOAPIC_H_ +struct pci_devinst; + /* * Allocate a PCI IRQ from the I/O APIC. */ void ioapic_init(struct vmctx *ctx); -int ioapic_pci_alloc_irq(void); +int ioapic_pci_alloc_irq(struct pci_devinst *pi); #endif Modified: stable/11/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_emul.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/usr.sbin/bhyve/pci_emul.c Mon Jul 24 05:52:10 2017 (r321411) @@ -1504,7 +1504,7 @@ pci_lintr_route(struct pci_devinst *pi) * is not yet assigned. */ if (ii->ii_ioapic_irq == 0) - ii->ii_ioapic_irq = ioapic_pci_alloc_irq(); + ii->ii_ioapic_irq = ioapic_pci_alloc_irq(pi); assert(ii->ii_ioapic_irq > 0); /* @@ -1512,7 +1512,7 @@ pci_lintr_route(struct pci_devinst *pi) * not yet assigned. */ if (ii->ii_pirq_pin == 0) - ii->ii_pirq_pin = pirq_alloc_pin(pi->pi_vmctx); + ii->ii_pirq_pin = pirq_alloc_pin(pi); assert(ii->ii_pirq_pin > 0); pi->pi_lintr.ioapic_irq = ii->ii_ioapic_irq; Modified: stable/11/usr.sbin/bhyve/pci_irq.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_irq.c Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/usr.sbin/bhyve/pci_irq.c Mon Jul 24 05:52:10 2017 (r321411) @@ -193,19 +193,25 @@ pci_irq_deassert(struct pci_devinst *pi) } int -pirq_alloc_pin(struct vmctx *ctx) +pirq_alloc_pin(struct pci_devinst *pi) { + struct vmctx *ctx = pi->pi_vmctx; int best_count, best_irq, best_pin, irq, pin; pirq_cold = 0; - /* First, find the least-used PIRQ pin. */ - best_pin = 0; - best_count = pirqs[0].use_count; - for (pin = 1; pin < nitems(pirqs); pin++) { - if (pirqs[pin].use_count < best_count) { - best_pin = pin; - best_count = pirqs[pin].use_count; + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + best_pin = (4 + pi->pi_slot + pi->pi_lintr.pin) % 8; + } else { + /* Find the least-used PIRQ pin. */ + best_pin = 0; + best_count = pirqs[0].use_count; + for (pin = 1; pin < nitems(pirqs); pin++) { + if (pirqs[pin].use_count < best_count) { + best_pin = pin; + best_count = pirqs[pin].use_count; + } } } pirqs[best_pin].use_count++; Modified: stable/11/usr.sbin/bhyve/pci_irq.h ============================================================================== --- stable/11/usr.sbin/bhyve/pci_irq.h Mon Jul 24 04:38:05 2017 (r321410) +++ stable/11/usr.sbin/bhyve/pci_irq.h Mon Jul 24 05:52:10 2017 (r321411) @@ -37,7 +37,7 @@ void pci_irq_deassert(struct pci_devinst *pi); void pci_irq_init(struct vmctx *ctx); void pci_irq_reserve(int irq); void pci_irq_use(int irq); -int pirq_alloc_pin(struct vmctx *ctx); +int pirq_alloc_pin(struct pci_devinst *pi); int pirq_irq(int pin); uint8_t pirq_read(int pin); void pirq_write(struct vmctx *ctx, int pin, uint8_t val); From owner-svn-src-all@freebsd.org Mon Jul 24 06:07:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD890DB7A0A; Mon, 24 Jul 2017 06:07:45 +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 AEEB081B18; Mon, 24 Jul 2017 06:07:45 +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 v6O67ik3027388; Mon, 24 Jul 2017 06:07:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O67ic9027384; Mon, 24 Jul 2017 06:07:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707240607.v6O67ic9027384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Jul 2017 06:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321412 - in stable/11/sys: fs/nfsclient fs/smbfs vm X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: fs/nfsclient fs/smbfs vm X-SVN-Commit-Revision: 321412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 06:07:46 -0000 Author: mav Date: Mon Jul 24 06:07:44 2017 New Revision: 321412 URL: https://svnweb.freebsd.org/changeset/base/321412 Log: Revert unexpected changes leaked into r321411. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/smbfs/smbfs_io.c stable/11/sys/vm/vnode_pager.c stable/11/sys/vm/vnode_pager.h Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Mon Jul 24 05:52:10 2017 (r321411) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Mon Jul 24 06:07:44 2017 (r321412) @@ -337,10 +337,8 @@ ncl_putpages(struct vop_putpages_args *ap) cred); crfree(cred); - if (error == 0 || !nfs_keep_dirty_on_error) { - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, - np->n_size - offset, npages * PAGE_SIZE); - } + if (error == 0 || !nfs_keep_dirty_on_error) + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); return (rtvals[0]); } Modified: stable/11/sys/fs/smbfs/smbfs_io.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_io.c Mon Jul 24 05:52:10 2017 (r321411) +++ stable/11/sys/fs/smbfs/smbfs_io.c Mon Jul 24 06:07:44 2017 (r321412) @@ -621,11 +621,9 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (error == 0) { - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, - npages * PAGE_SIZE, npages * PAGE_SIZE); - } - return (rtvals[0]); + if (!error) + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + return rtvals[0]; #endif /* SMBFS_RWGENERIC */ } Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Mon Jul 24 05:52:10 2017 (r321411) +++ stable/11/sys/vm/vnode_pager.c Mon Jul 24 06:07:44 2017 (r321412) @@ -1277,13 +1277,12 @@ vnode_pager_putpages_ioflags(int pager_flags) } void -vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, int eof, - int lpos) +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) { vm_object_t obj; - int i, pos, pos_devb; + int i, pos; - if (written == 0 && eof >= lpos) + if (written == 0) return; obj = ma[0]->object; VM_OBJECT_WLOCK(obj); @@ -1295,20 +1294,6 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, /* Partially written page. */ rtvals[i] = VM_PAGER_AGAIN; vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); - } - } - for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { - if (pos != trunc_page(pos)) { - pos_devb = roundup2(pos, DEV_BSIZE) & PAGE_MASK; - vm_page_clear_dirty(ma[i], pos_devb, PAGE_SIZE - - pos_devb); - if (ma[i]->dirty == VM_PAGE_BITS_ALL) - rtvals[i] = VM_PAGER_OK; - pos = round_page(pos); - } else { - /* vm_pageout_flush() clears dirty */ - rtvals[i] = VM_PAGER_BAD; - pos += PAGE_SIZE; } } VM_OBJECT_WUNLOCK(obj); Modified: stable/11/sys/vm/vnode_pager.h ============================================================================== --- stable/11/sys/vm/vnode_pager.h Mon Jul 24 05:52:10 2017 (r321411) +++ stable/11/sys/vm/vnode_pager.h Mon Jul 24 06:07:44 2017 (r321412) @@ -50,8 +50,7 @@ int vnode_pager_local_getpages_async(struct vop_getpag int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, - int eof, int lpos); +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); From owner-svn-src-all@freebsd.org Mon Jul 24 06:19:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88DB5DB7C3C; Mon, 24 Jul 2017 06:19:06 +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 CA83481F24; Mon, 24 Jul 2017 06:19:05 +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 v6O6J5tG031350; Mon, 24 Jul 2017 06:19:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O6J4ZV031347; Mon, 24 Jul 2017 06:19:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707240619.v6O6J4ZV031347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Jul 2017 06:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321413 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 321413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 06:19:06 -0000 Author: mav Date: Mon Jul 24 06:19:04 2017 New Revision: 321413 URL: https://svnweb.freebsd.org/changeset/base/321413 Log: MFC r305898, r309120, r309121 (by jceel): Add virtio-console support to bhyve. Adds virtio-console device support to bhyve, allowing to create bidirectional character streams between host and guest. Syntax: -s ,virtio-console,port1=/path/to/port1.sock,anotherport=... Maximum of 16 ports per device can be created. Every port is named and corresponds to an Unix domain socket created by bhyve. bhyve accepts at most one connection per port at a time. Limitations: - due to lack of destructors of in bhyve, sockets on the filesystem must be cleaned up manually after bhyve exits - there's no way to use "console port" feature, nor the console port resize as of now - emergency write is advertised, but no-op as of now Added: stable/11/usr.sbin/bhyve/pci_virtio_console.c - copied, changed from r305898, head/usr.sbin/bhyve/pci_virtio_console.c Modified: stable/11/usr.sbin/bhyve/Makefile stable/11/usr.sbin/bhyve/virtio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/Makefile ============================================================================== --- stable/11/usr.sbin/bhyve/Makefile Mon Jul 24 06:07:44 2017 (r321412) +++ stable/11/usr.sbin/bhyve/Makefile Mon Jul 24 06:19:04 2017 (r321413) @@ -38,6 +38,7 @@ SRCS= \ pci_lpc.c \ pci_passthru.c \ pci_virtio_block.c \ + pci_virtio_console.c \ pci_virtio_net.c \ pci_virtio_rnd.c \ pci_uart.c \ Copied and modified: stable/11/usr.sbin/bhyve/pci_virtio_console.c (from r305898, head/usr.sbin/bhyve/pci_virtio_console.c) ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Sat Sep 17 13:48:01 2016 (r305898, copy source) +++ stable/11/usr.sbin/bhyve/pci_virtio_console.c Mon Jul 24 06:19:04 2017 (r321413) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include "pci_emul.h" #include "virtio.h" #include "mevent.h" +#include "sockstream.h" #define VTCON_RINGSZ 64 #define VTCON_MAXPORTS 16 @@ -90,6 +91,7 @@ struct pci_vtcon_port { bool vsp_enabled; bool vsp_console; bool vsp_rx_ready; + bool vsp_open; int vsp_rxq; int vsp_txq; void * vsp_arg; @@ -116,6 +118,7 @@ struct pci_vtcon_softc { char * vsc_rootdir; int vsc_kq; int vsc_nports; + bool vsc_ready; struct pci_vtcon_port vsc_control_port; struct pci_vtcon_port vsc_ports[VTCON_MAXPORTS]; struct pci_vtcon_config *vsc_config; @@ -349,6 +352,7 @@ pci_vtcon_sock_accept(int fd __unused, enum ev_type t sock->vss_open = true; sock->vss_conn_fd = s; sock->vss_conn_evp = mevent_add(s, EVF_READ, pci_vtcon_sock_rx, sock); + pci_vtcon_open_port(sock->vss_port, true); } @@ -412,16 +416,21 @@ pci_vtcon_sock_tx(struct pci_vtcon_port *port, void *a int niov) { struct pci_vtcon_sock *sock; - int ret; + int i, ret; sock = (struct pci_vtcon_sock *)arg; if (sock->vss_conn_fd == -1) return; - ret = writev(sock->vss_conn_fd, iov, niov); + for (i = 0; i < niov; i++) { + ret = stream_write(sock->vss_conn_fd, iov[i].iov_base, + iov[i].iov_len); + if (ret <= 0) + break; + } - if (ret < 0 && errno != EWOULDBLOCK) { + if (ret <= 0) { mevent_delete_close(sock->vss_conn_evp); sock->vss_conn_fd = -1; sock->vss_open = false; @@ -444,11 +453,15 @@ pci_vtcon_control_tx(struct pci_vtcon_port *port, void switch (ctrl->event) { case VTCON_DEVICE_READY: + sc->vsc_ready = true; /* set port ready events for registered ports */ for (i = 0; i < VTCON_MAXPORTS; i++) { tmp = &sc->vsc_ports[i]; if (tmp->vsp_enabled) pci_vtcon_announce_port(tmp); + + if (tmp->vsp_open) + pci_vtcon_open_port(tmp, true); } break; @@ -489,6 +502,11 @@ static void pci_vtcon_open_port(struct pci_vtcon_port *port, bool open) { struct pci_vtcon_control event; + + if (!port->vsp_sc->vsc_ready) { + port->vsp_open = true; + return; + } event.id = port->vsp_id; event.event = VTCON_PORT_OPEN; Modified: stable/11/usr.sbin/bhyve/virtio.h ============================================================================== --- stable/11/usr.sbin/bhyve/virtio.h Mon Jul 24 06:07:44 2017 (r321412) +++ stable/11/usr.sbin/bhyve/virtio.h Mon Jul 24 06:19:04 2017 (r321413) @@ -210,6 +210,7 @@ struct vring_used { #define VIRTIO_DEV_NET 0x1000 #define VIRTIO_DEV_BLOCK 0x1001 #define VIRTIO_DEV_RANDOM 0x1005 +#define VIRTIO_DEV_CONSOLE 0x1003 /* * PCI config space constants. From owner-svn-src-all@freebsd.org Mon Jul 24 06:49:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DA12DBC272; Mon, 24 Jul 2017 06:49:59 +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 0CA9982A67; Mon, 24 Jul 2017 06:49:58 +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 v6O6nwm8043974; Mon, 24 Jul 2017 06:49:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6O6nwef043972; Mon, 24 Jul 2017 06:49:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707240649.v6O6nwef043972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Jul 2017 06:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321414 - stable/11/sys/amd64/vmm/io X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/amd64/vmm/io X-SVN-Commit-Revision: 321414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 06:49:59 -0000 Author: mav Date: Mon Jul 24 06:49:57 2017 New Revision: 321414 URL: https://svnweb.freebsd.org/changeset/base/321414 Log: MFC r302843: Increase number of I/O APIC pins from 24 to 32 to give PCI up to 16 IRQs. Move HPET to the top of the supported 0-31 range. Modified: stable/11/sys/amd64/vmm/io/vhpet.c stable/11/sys/amd64/vmm/io/vioapic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/io/vhpet.c ============================================================================== --- stable/11/sys/amd64/vmm/io/vhpet.c Mon Jul 24 06:19:04 2017 (r321413) +++ stable/11/sys/amd64/vmm/io/vhpet.c Mon Jul 24 06:49:57 2017 (r321414) @@ -715,8 +715,10 @@ vhpet_init(struct vm *vm) vhpet->freq_sbt = bttosbt(bt); pincount = vioapic_pincount(vm); - if (pincount >= 24) - allowed_irqs = 0x00f00000; /* irqs 20, 21, 22 and 23 */ + if (pincount >= 32) + allowed_irqs = 0xff000000; /* irqs 24-31 */ + else if (pincount >= 20) + allowed_irqs = 0xf << (pincount - 4); /* 4 upper irqs */ else allowed_irqs = 0; Modified: stable/11/sys/amd64/vmm/io/vioapic.c ============================================================================== --- stable/11/sys/amd64/vmm/io/vioapic.c Mon Jul 24 06:19:04 2017 (r321413) +++ stable/11/sys/amd64/vmm/io/vioapic.c Mon Jul 24 06:49:57 2017 (r321414) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #define IOREGSEL 0x00 #define IOWIN 0x10 -#define REDIR_ENTRIES 24 +#define REDIR_ENTRIES 32 #define RTBL_RO_BITS ((uint64_t)(IOART_REM_IRR | IOART_DELIVS)) struct vioapic { From owner-svn-src-all@freebsd.org Mon Jul 24 14:42:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 139F8C7F966; Mon, 24 Jul 2017 14:42:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE2936A7EB; Mon, 24 Jul 2017 14:42:44 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6OEghJ2038535; Mon, 24 Jul 2017 14:42:43 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OEghb1038532; Mon, 24 Jul 2017 14:42:43 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707241442.v6OEghb1038532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 24 Jul 2017 14:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321415 - in stable/11/sys/dev: mpr mps X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11/sys/dev: mpr mps X-SVN-Commit-Revision: 321415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 14:42:45 -0000 Author: ken Date: Mon Jul 24 14:42:43 2017 New Revision: 321415 URL: https://svnweb.freebsd.org/changeset/base/321415 Log: MFC r321207: ------------------------------------------------------------------------ r321207 | ken | 2017-07-19 09:39:01 -0600 (Wed, 19 Jul 2017) | 14 lines Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers. mps_wait_command() and mpr_wait_command() were using getmicrotime() to determine elapsed time when checking for a timeout in polled mode. getmicrotime() isn't guaranteed to monotonically increase, and that caused spurious timeouts occasionally. Switch to using getmicrouptime(), which does increase monotonically. This fixes the spurious timeouts in my test case. ------------------------------------------------------------------------ Reviewed by: slm, scottl Sponsored by: Spectra Logic Modified: stable/11/sys/dev/mpr/mpr.c stable/11/sys/dev/mps/mps.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpr.c ============================================================================== --- stable/11/sys/dev/mpr/mpr.c Mon Jul 24 06:49:57 2017 (r321414) +++ stable/11/sys/dev/mpr/mpr.c Mon Jul 24 14:42:43 2017 (r321415) @@ -3286,9 +3286,17 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm if (curthread->td_pflags & TDP_NOSLEEPING) #endif //__FreeBSD_version >= 1000029 sleep_flag = NO_SLEEP; - getmicrotime(&start_time); + getmicrouptime(&start_time); if (mtx_owned(&sc->mpr_mtx) && sleep_flag == CAN_SLEEP) { error = msleep(cm, &sc->mpr_mtx, 0, "mprwait", timeout*hz); + if (error == EWOULDBLOCK) { + /* + * Record the actual elapsed time in the case of a + * timeout for the message below. + */ + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + } } else { while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3297,8 +3305,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm else DELAY(50000); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > timeout) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > timeout) { error = EWOULDBLOCK; break; } @@ -3306,7 +3315,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm } if (error == EWOULDBLOCK) { - mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__); + mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s, timeout=%d," + " elapsed=%jd\n", __func__, timeout, + (intmax_t)cur_time.tv_sec); rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); Modified: stable/11/sys/dev/mps/mps.c ============================================================================== --- stable/11/sys/dev/mps/mps.c Mon Jul 24 06:49:57 2017 (r321414) +++ stable/11/sys/dev/mps/mps.c Mon Jul 24 14:42:43 2017 (r321415) @@ -2551,10 +2551,18 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm */ if (curthread->td_no_sleeping != 0) sleep_flag = NO_SLEEP; - getmicrotime(&start_time); + getmicrouptime(&start_time); if (mtx_owned(&sc->mps_mtx) && sleep_flag == CAN_SLEEP) { cm->cm_flags |= MPS_CM_FLAGS_WAKEUP; error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz); + if (error == EWOULDBLOCK) { + /* + * Record the actual elapsed time in the case of a + * timeout for the message below. + */ + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + } } else { while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) { mps_intr_locked(sc); @@ -2563,8 +2571,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm else DELAY(50000); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > timeout) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > timeout) { error = EWOULDBLOCK; break; } @@ -2572,7 +2581,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm } if (error == EWOULDBLOCK) { - mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s\n", __func__); + mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s, timeout=%d," + " elapsed=%jd\n", __func__, timeout, + (intmax_t)cur_time.tv_sec); rc = mps_reinit(sc); mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); From owner-svn-src-all@freebsd.org Mon Jul 24 14:42:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A924C7F96F; Mon, 24 Jul 2017 14:42:47 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 254936A7EC; Mon, 24 Jul 2017 14:42:47 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6OEgjUg038582; Mon, 24 Jul 2017 14:42:45 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OEgjpW038580; Mon, 24 Jul 2017 14:42:45 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707241442.v6OEgjpW038580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 24 Jul 2017 14:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321416 - in stable/10/sys/dev: mpr mps X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/10/sys/dev: mpr mps X-SVN-Commit-Revision: 321416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 14:42:47 -0000 Author: ken Date: Mon Jul 24 14:42:45 2017 New Revision: 321416 URL: https://svnweb.freebsd.org/changeset/base/321416 Log: MFC r321207: ------------------------------------------------------------------------ r321207 | ken | 2017-07-19 09:39:01 -0600 (Wed, 19 Jul 2017) | 14 lines Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers. mps_wait_command() and mpr_wait_command() were using getmicrotime() to determine elapsed time when checking for a timeout in polled mode. getmicrotime() isn't guaranteed to monotonically increase, and that caused spurious timeouts occasionally. Switch to using getmicrouptime(), which does increase monotonically. This fixes the spurious timeouts in my test case. ------------------------------------------------------------------------ Reviewed by: slm, scottl Sponsored by: Spectra Logic Modified: stable/10/sys/dev/mpr/mpr.c stable/10/sys/dev/mps/mps.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr.c ============================================================================== --- stable/10/sys/dev/mpr/mpr.c Mon Jul 24 14:42:43 2017 (r321415) +++ stable/10/sys/dev/mpr/mpr.c Mon Jul 24 14:42:45 2017 (r321416) @@ -3286,9 +3286,17 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm if (curthread->td_pflags & TDP_NOSLEEPING) #endif //__FreeBSD_version >= 1000029 sleep_flag = NO_SLEEP; - getmicrotime(&start_time); + getmicrouptime(&start_time); if (mtx_owned(&sc->mpr_mtx) && sleep_flag == CAN_SLEEP) { error = msleep(cm, &sc->mpr_mtx, 0, "mprwait", timeout*hz); + if (error == EWOULDBLOCK) { + /* + * Record the actual elapsed time in the case of a + * timeout for the message below. + */ + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + } } else { while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3297,8 +3305,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm else DELAY(50000); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > timeout) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > timeout) { error = EWOULDBLOCK; break; } @@ -3306,7 +3315,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm } if (error == EWOULDBLOCK) { - mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__); + mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s, timeout=%d," + " elapsed=%jd\n", __func__, timeout, + (intmax_t)cur_time.tv_sec); rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); Modified: stable/10/sys/dev/mps/mps.c ============================================================================== --- stable/10/sys/dev/mps/mps.c Mon Jul 24 14:42:43 2017 (r321415) +++ stable/10/sys/dev/mps/mps.c Mon Jul 24 14:42:45 2017 (r321416) @@ -2551,10 +2551,18 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm */ if (curthread->td_no_sleeping != 0) sleep_flag = NO_SLEEP; - getmicrotime(&start_time); + getmicrouptime(&start_time); if (mtx_owned(&sc->mps_mtx) && sleep_flag == CAN_SLEEP) { cm->cm_flags |= MPS_CM_FLAGS_WAKEUP; error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz); + if (error == EWOULDBLOCK) { + /* + * Record the actual elapsed time in the case of a + * timeout for the message below. + */ + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + } } else { while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) { mps_intr_locked(sc); @@ -2563,8 +2571,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm else DELAY(50000); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > timeout) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > timeout) { error = EWOULDBLOCK; break; } @@ -2572,7 +2581,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm } if (error == EWOULDBLOCK) { - mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s\n", __func__); + mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s, timeout=%d," + " elapsed=%jd\n", __func__, timeout, + (intmax_t)cur_time.tv_sec); rc = mps_reinit(sc); mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); From owner-svn-src-all@freebsd.org Mon Jul 24 15:39:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB3F1CFCB12; Mon, 24 Jul 2017 15:39:10 +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 9A1556C0CC; Mon, 24 Jul 2017 15:39:10 +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 v6OFd9Nm059018; Mon, 24 Jul 2017 15:39:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OFd9Ze059017; Mon, 24 Jul 2017 15:39:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707241539.v6OFd9Ze059017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Jul 2017 15:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321417 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 15:39:10 -0000 Author: emaste Date: Mon Jul 24 15:39:09 2017 New Revision: 321417 URL: https://svnweb.freebsd.org/changeset/base/321417 Log: lld 5.0 supports filter libraries, so enable linker feature flag Also switch the logic to enable this for any non-lld linker, since filter library support is fairly simple and is very likely supported by any other linker capable of linking the FreeBSD base system. MFC after: 2 months MFC with: r321369 Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Mon Jul 24 14:42:45 2017 (r321416) +++ head/share/mk/bsd.linker.mk Mon Jul 24 15:39:09 2017 (r321417) @@ -70,7 +70,7 @@ ${X_}LINKER_FEATURES= .if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750 ${X_}LINKER_FEATURES+= build-id .endif -.if ${${X_}LINKER_TYPE} == "bfd" +.if ${${X_}LINKER_TYPE} != "lld" || ${${X_}LINKER_VERSION} >= 50000 ${X_}LINKER_FEATURES+= filter .endif .endif From owner-svn-src-all@freebsd.org Mon Jul 24 16:23:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACBBACFDA33; Mon, 24 Jul 2017 16:23:29 +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 7B5996DECC; Mon, 24 Jul 2017 16:23:29 +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 v6OGNSxx079925; Mon, 24 Jul 2017 16:23:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OGNSGc079924; Mon, 24 Jul 2017 16:23:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707241623.v6OGNSGc079924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Jul 2017 16:23:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321418 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 321418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:23:29 -0000 Author: markj Date: Mon Jul 24 16:23:28 2017 New Revision: 321418 URL: https://svnweb.freebsd.org/changeset/base/321418 Log: MFC r320918, r321035: Have mkdumpheader() handle version string truncation. Modified: stable/11/sys/kern/kern_shutdown.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_shutdown.c ============================================================================== --- stable/11/sys/kern/kern_shutdown.c Mon Jul 24 15:39:09 2017 (r321417) +++ stable/11/sys/kern/kern_shutdown.c Mon Jul 24 16:23:28 2017 (r321418) @@ -914,6 +914,7 @@ void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, uint64_t dumplen, uint32_t blksz) { + size_t dstsize; bzero(kdh, sizeof(*kdh)); strlcpy(kdh->magic, magic, sizeof(kdh->magic)); @@ -924,7 +925,9 @@ mkdumpheader(struct kerneldumpheader *kdh, char *magic kdh->dumptime = htod64(time_second); kdh->blocksize = htod32(blksz); strlcpy(kdh->hostname, prison0.pr_hostname, sizeof(kdh->hostname)); - strlcpy(kdh->versionstring, version, sizeof(kdh->versionstring)); + dstsize = sizeof(kdh->versionstring); + if (strlcpy(kdh->versionstring, version, dstsize) >= dstsize) + kdh->versionstring[dstsize - 2] = '\n'; if (panicstr != NULL) strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); kdh->parity = kerneldump_parity(kdh); From owner-svn-src-all@freebsd.org Mon Jul 24 16:24:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89CE7CFDABC; Mon, 24 Jul 2017 16:24:23 +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 589576E095; Mon, 24 Jul 2017 16:24:23 +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 v6OGOM6e080013; Mon, 24 Jul 2017 16:24:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OGOM1P080012; Mon, 24 Jul 2017 16:24:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707241624.v6OGOM1P080012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Jul 2017 16:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321419 - stable/11/usr.bin/top X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.bin/top X-SVN-Commit-Revision: 321419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:24:23 -0000 Author: markj Date: Mon Jul 24 16:24:22 2017 New Revision: 321419 URL: https://svnweb.freebsd.org/changeset/base/321419 Log: MFC r321356: Fix top(1) output when zfs.ko is loaded but ZFS is not in use. Modified: stable/11/usr.bin/top/machine.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Mon Jul 24 16:23:28 2017 (r321418) +++ stable/11/usr.bin/top/machine.c Mon Jul 24 16:24:22 2017 (r321419) @@ -328,14 +328,15 @@ machine_init(struct statics *statics, char do_unames) size != sizeof(smpmode)) smpmode = 0; - size = sizeof(carc_en); - if (sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size, - NULL, 0) == 0 && carc_en == 1) - carc_enabled = 1; size = sizeof(arc_size); if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size, NULL, 0) == 0 && arc_size != 0) arc_enabled = 1; + size = sizeof(carc_en); + if (arc_enabled && + sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size, + NULL, 0) == 0 && carc_en == 1) + carc_enabled = 1; if (do_unames) { while ((pw = getpwent()) != NULL) { From owner-svn-src-all@freebsd.org Mon Jul 24 16:33:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4159CFE0C1; Mon, 24 Jul 2017 16:33:07 +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 719266E72B; Mon, 24 Jul 2017 16:33:07 +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 v6OGX6l3084074; Mon, 24 Jul 2017 16:33:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OGX6Qu084073; Mon, 24 Jul 2017 16:33:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707241633.v6OGX6Qu084073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 24 Jul 2017 16:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321420 - head/lib/clang/liblldb X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/clang/liblldb X-SVN-Commit-Revision: 321420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:33:07 -0000 Author: dim Date: Mon Jul 24 16:33:06 2017 New Revision: 321420 URL: https://svnweb.freebsd.org/changeset/base/321420 Log: Add a few more object files to liblldb, which should solve errors when linking the lldb executable in some cases. In particular, when the -ffunction-sections -fdata-sections options are turned off, or ineffective. Reported by: Shawn Webb, Mark Millard MFC after: 2 months X-MFC-With: r308421 Modified: head/lib/clang/liblldb/Makefile Modified: head/lib/clang/liblldb/Makefile ============================================================================== --- head/lib/clang/liblldb/Makefile Mon Jul 24 16:24:22 2017 (r321419) +++ head/lib/clang/liblldb/Makefile Mon Jul 24 16:33:06 2017 (r321420) @@ -61,6 +61,7 @@ SRCS+= API/SBTarget.cpp SRCS+= API/SBThread.cpp SRCS+= API/SBThreadCollection.cpp SRCS+= API/SBThreadPlan.cpp +SRCS+= API/SBTrace.cpp SRCS+= API/SBType.cpp SRCS+= API/SBTypeCategory.cpp SRCS+= API/SBTypeEnumMember.cpp @@ -348,6 +349,9 @@ SRCS+= Plugins/Language/ObjC/NSSet.cpp SRCS+= Plugins/Language/ObjC/NSString.cpp SRCS+= Plugins/Language/ObjC/ObjCLanguage.cpp SRCS+= Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +SRCS+= Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +SRCS+= Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +SRCS+= Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp SRCS+= Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp SRCS+= Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp SRCS+= Plugins/ObjectFile/ELF/ELFHeader.cpp From owner-svn-src-all@freebsd.org Mon Jul 24 16:37:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B9CFCFE1D6 for ; Mon, 24 Jul 2017 16:37:28 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x235.google.com (mail-qk0-x235.google.com [IPv6:2607:f8b0:400d:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF71B6E93E for ; Mon, 24 Jul 2017 16:37:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x235.google.com with SMTP id d136so58534697qkg.3 for ; Mon, 24 Jul 2017 09:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WfKDLYKQQoFjLE490iwo6WHRUsbW2JmNUuRuKVrLAE0=; b=l6d0JTV7gvJezvyhl66JoBJeOmXSrEmA+OYN+1lHZyTzw6gWiUeH1bCtgOYodCPmKx +a3J60gKgHlze7wACgUgOdQaVDQ921yVxqp/o3B0+FvQHe7tTv0cTE/jZVJb2NB4zHly 3ZTZ5BmyGjftvQqEhrwNqZpmwuw7rwvesMQWPqFn5ZnnszZR71oB1c14l3jdfBLheTv3 FBSiJWrUyHehqrdYbIfbF129tRWjRh7DtvTlq6RRYJHlk7meYIDTXiwD60j0l62tUJgU DR2JLeur5XnPHb2naMNVh6MFzRoLp1AzU1V9fTKoP5mJ6f/o++i/hX5+NzNbTWvn6SWl Ivyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WfKDLYKQQoFjLE490iwo6WHRUsbW2JmNUuRuKVrLAE0=; b=tKmEvcO8lVrQVw5CY1s0xBWtyRI+uvkH5t6PaJcJD4lmAB0OrEmW0en0EaiA6G7okV rzBxTuOiOt1pV1bQbgyZGLWzdIEnYIytjlQIOHZh6yg1CoWJrg9Dna6bi3HYRViTjnLu 5HU3dURravT6SIR97Bkq0Zd8HgbTnp+LjWB8i+MG/qikmpmxk7uHEXWxalCBu+MK6uQJ QlyBg/7KXnW6kgGcsBD+FtfP6qmC2NSsrWyyyYChQxi1mF+i2bVkaagIaAqWHjLgbwVf /HWfRM7j0cPR3Ad8lbOWoqQrDTFYu7sHoQQprIIW6MhJvYg+u63TOQ+D/aHPrPbgus4T JEnQ== X-Gm-Message-State: AIVw113L3WbMeyO6feQIdwtVEW5XU1uIuUC04I38RrPbNWRx5HY1LTQz ki2PUCuUhgcTdz7V X-Received: by 10.55.94.69 with SMTP id s66mr5671161qkb.99.1500914246924; Mon, 24 Jul 2017 09:37:26 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id e3sm8170996qkd.90.2017.07.24.09.37.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 09:37:26 -0700 (PDT) Date: Mon, 24 Jul 2017 12:37:25 -0400 From: Shawn Webb To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321420 - head/lib/clang/liblldb Message-ID: <20170724163725.xw74daf5i2mlnveq@mutt-hbsd> References: <201707241633.v6OGX6Qu084073@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z2ggjx3hzxmqrytn" Content-Disposition: inline In-Reply-To: <201707241633.v6OGX6Qu084073@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-CURRENT FreeBSD 12.0-CURRENT X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20170609 (1.8.3) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:37:28 -0000 --z2ggjx3hzxmqrytn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 24, 2017 at 04:33:06PM +0000, Dimitry Andric wrote: > Author: dim > Date: Mon Jul 24 16:33:06 2017 > New Revision: 321420 > URL: https://svnweb.freebsd.org/changeset/base/321420 >=20 > Log: > Add a few more object files to liblldb, which should solve errors when > linking the lldb executable in some cases. In particular, when the > -ffunction-sections -fdata-sections options are turned off, or > ineffective. > =20 > Reported by: Shawn Webb, Mark Millard > MFC after: 2 months > X-MFC-With: r308421 >=20 > Modified: > head/lib/clang/liblldb/Makefile Thanks for the quick turnaround! --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --z2ggjx3hzxmqrytn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAll2IkMACgkQaoRlj1JF bu4y8BAApDvNjaTKssUqDW929F5nYfzvP+OroHZyQEw3aLX3iH84Y5Dj7TnWJ8M4 qvAb7/33jzKrw5yCfDFagLdvzwYqWGbnzSRI9wGbxwd02ld62OUBFs/+5oTGEHL0 R8RLZJc4Cy+MWscmtdUhYv9SWPCucJptN6XFUm7+Kj1kZxK1jGA297cwOlXAU4eR S+L7X8sqrp1k3sEIjT1H1QVVbZ66X4s4BRrY8LZxAsYALKzYg68u7NIC2/jCr25/ kllsQNCUUpzIyEqEsAlLnddmtqJVfD7lZO3mKSg1ifdEg7skXEJBBSclWN1CeiHJ tZsXgoi9tNdDUyDrcDRdefkA8rTU4irnuPmDR4wIkOtmed8gONFVdrp+l5cWoIRh BNfqtNcvmkibyM3TB4Gox3wOfy19LWlmSTZFfotnCQIfQE3t7xmI0WvaH3jIed8f q7/ZqWBIfUMuBBoppuji5fbHa0kmIAORmcTS5kWgCzZUXbkArADPgqxMz0n54UEW b5TBQYq90wfml8XwRSa80H7zR9/moIio6Gttqs/l79unTXmfoaRrhS8DV+IZZfzF x+ZCOdHZTVGU80ek+Kj/lxa1K+Fu75fMDeOpIc6VJ+8SsZHbB2iwKCVzcGkwiA9j WFp/r/4VOImdXKDZXZe1pDbJ2PK1lm6vWLHboFUw6OU1I0A0SMY= =ewfK -----END PGP SIGNATURE----- --z2ggjx3hzxmqrytn-- From owner-svn-src-all@freebsd.org Mon Jul 24 16:45:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7C27CFE48A; Mon, 24 Jul 2017 16:45:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A03F36EE6E; Mon, 24 Jul 2017 16:45:39 +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 v6OGjcOL088266; Mon, 24 Jul 2017 16:45:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OGjcV6088264; Mon, 24 Jul 2017 16:45:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707241645.v6OGjcV6088264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 24 Jul 2017 16:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321421 - in stable/10/lib/msun: . man X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/10/lib/msun: . man X-SVN-Commit-Revision: 321421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:45:40 -0000 Author: ngie Date: Mon Jul 24 16:45:38 2017 New Revision: 321421 URL: https://svnweb.freebsd.org/changeset/base/321421 Log: MFC r290605,r290606: r290605: Document powl(3) PR: 191751 r290606: Bump .Dd Modified: stable/10/lib/msun/Makefile stable/10/lib/msun/man/exp.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/msun/Makefile ============================================================================== --- stable/10/lib/msun/Makefile Mon Jul 24 16:33:06 2017 (r321420) +++ stable/10/lib/msun/Makefile Mon Jul 24 16:45:38 2017 (r321421) @@ -169,7 +169,8 @@ MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 erf.3 erfl.3 erf.3 erfcl.3 MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 expm1l.3 exp.3 pow.3 exp.3 powf.3 \ - exp.3 exp2.3 exp.3 exp2f.3 exp.3 exp2l.3 exp.3 expf.3 exp.3 expl.3 + exp.3 powl.3 exp.3 exp2.3 exp.3 exp2f.3 exp.3 exp2l.3 exp.3 expf.3 \ + exp.3 expl.3 MLINKS+=fabs.3 fabsf.3 fabs.3 fabsl.3 MLINKS+=fdim.3 fdimf.3 fdim.3 fdiml.3 MLINKS+=feclearexcept.3 fegetexceptflag.3 feclearexcept.3 feraiseexcept.3 \ Modified: stable/10/lib/msun/man/exp.3 ============================================================================== --- stable/10/lib/msun/man/exp.3 Mon Jul 24 16:33:06 2017 (r321420) +++ stable/10/lib/msun/man/exp.3 Mon Jul 24 16:45:38 2017 (r321421) @@ -28,7 +28,7 @@ .\" from: @(#)exp.3 6.12 (Berkeley) 7/31/91 .\" $FreeBSD$ .\" -.Dd June 3, 2013 +.Dd November 9, 2015 .Dt EXP 3 .Os .Sh NAME @@ -43,7 +43,8 @@ .Nm expm1f , .Nm expm1l , .Nm pow , -.Nm powf +.Nm powf , +.Nm powl .Nd exponential and power functions .Sh LIBRARY .Lb libm @@ -71,6 +72,8 @@ .Fn pow "double x" "double y" .Ft float .Fn powf "float x" "float y" +.Ft long double +.Fn powl "long double x" "long double y" .Sh DESCRIPTION The .Fn exp , @@ -99,9 +102,10 @@ functions compute the value exp(x)\-1 accurately even .Fa x . .Pp The -.Fn pow +.Fn pow , +.Fn powf , and the -.Fn powf +.Fn powl functions compute the value of .Ar x @@ -122,9 +126,10 @@ Otherwise the error in these functions is generally be These functions will return the appropriate computation unless an error occurs or an argument is out of range. The functions -.Fn pow x y +.Fn pow x y , +.Fn powf x y , and -.Fn powf x y +.Fn powl x y raise an invalid exception and return an \*(Na if .Fa x < 0 and From owner-svn-src-all@freebsd.org Mon Jul 24 16:58:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF44CFE77E; Mon, 24 Jul 2017 16:58:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F3D66F3B0; Mon, 24 Jul 2017 16:58:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6OGwst3092290; Mon, 24 Jul 2017 16:58:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OGwsc2092289; Mon, 24 Jul 2017 16:58:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201707241658.v6OGwsc2092289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Jul 2017 16:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321422 - head/usr.bin/ktrace X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/ktrace X-SVN-Commit-Revision: 321422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 16:58:55 -0000 Author: trasz Date: Mon Jul 24 16:58:54 2017 New Revision: 321422 URL: https://svnweb.freebsd.org/changeset/base/321422 Log: Improve the ktrace(1) man page to make it slightly more obvious that there are _two_ options that control its behaviour wrt child processes; slightly improve the example[1], and add Xrefs. Discussed with: wblock [1] MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/usr.bin/ktrace/ktrace.1 Modified: head/usr.bin/ktrace/ktrace.1 ============================================================================== --- head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:45:38 2017 (r321421) +++ head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:58:54 2017 (r321422) @@ -85,6 +85,9 @@ Clear the specified trace points associated with the g .It Fl d Descendants; perform the operation for all current children of the designated processes. +See also the +.Fl i +option. .It Fl f Ar trfile Log trace records to .Ar trfile @@ -97,6 +100,9 @@ flag is permitted). .It Fl i Inherit; pass the trace flags to all future children of the designated processes. +See also the +.Fl d +option. .It Fl p Ar pid Enable (disable) tracing on the indicated process id (only one .Fl p @@ -148,6 +154,9 @@ and .Ar command options are mutually exclusive. .Sh EXAMPLES +Run "make", then trace it and any child processes: +.Dl $ ktrace -i make +.Pp Trace all kernel operations of process id 34: .Dl $ ktrace -p 34 .Pp @@ -166,16 +175,15 @@ Enable tracing of on process 67: .Dl $ ktrace -ti -p 67 .Pp -Run the command "w", tracing only system calls: -.Dl $ ktrace -tc w -.Pp Disable all tracing to the file "tracedata": .Dl $ ktrace -c -f tracedata .Pp Disable tracing of all user-owned processes: .Dl $ ktrace -C .Sh SEE ALSO +.Xr dtrace 1 , .Xr kdump 1 , +.Xr truss 1 , .Xr ktrace 2 .Sh HISTORY The From owner-svn-src-all@freebsd.org Mon Jul 24 17:17:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A00C4CFEDDC; Mon, 24 Jul 2017 17:17:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (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 6B8386FF1F; Mon, 24 Jul 2017 17:17:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::c995:48cf:5934:883a] (unknown [IPv6:2001:470:7a58:0:c995:48cf:5934:883a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 6FF2E262B7; Mon, 24 Jul 2017 19:17:34 +0200 (CEST) From: Dimitry Andric Content-Type: multipart/signed; boundary="Apple-Mail=_56DF5048-EF6A-4ABB-9643-4AF02F81D909"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r321420 - head/lib/clang/liblldb Date: Mon, 24 Jul 2017 19:17:24 +0200 References: <201707241633.v6OGX6Qu084073@repo.freebsd.org> To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201707241633.v6OGX6Qu084073@repo.freebsd.org> Message-Id: <35EFA134-0D52-4DCF-996E-ED4800F375CD@FreeBSD.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:17:35 -0000 --Apple-Mail=_56DF5048-EF6A-4ABB-9643-4AF02F81D909 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 24 Jul 2017, at 18:33, Dimitry Andric wrote: > > Author: dim > Date: Mon Jul 24 16:33:06 2017 > New Revision: 321420 > URL: https://svnweb.freebsd.org/changeset/base/321420 > > Log: > Add a few more object files to liblldb, which should solve errors when > linking the lldb executable in some cases. In particular, when the > -ffunction-sections -fdata-sections options are turned off, or > ineffective. > > Reported by: Shawn Webb, Mark Millard > MFC after: 2 months > X-MFC-With: r308421 Ugh, that should have been our r321369 of course. :) r308321 is the llvm upstream revision. Now if only there was a version control system which used unique hashes... ;) -Dimitry --Apple-Mail=_56DF5048-EF6A-4ABB-9643-4AF02F81D909 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.1 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWXYrpAAKCRCwXqMKLiCW o37AAKDdW/PWoDFKFktCjvEASCNQLEU5vwCePY65gCIixAB0HTZgPLGt0iyOUuM= =hN8u -----END PGP SIGNATURE----- --Apple-Mail=_56DF5048-EF6A-4ABB-9643-4AF02F81D909-- From owner-svn-src-all@freebsd.org Mon Jul 24 17:23:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99495CFF0EA; Mon, 24 Jul 2017 17:23:54 +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 750A370476; Mon, 24 Jul 2017 17:23:54 +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 v6OHNrkJ004594; Mon, 24 Jul 2017 17:23:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OHNrS0004593; Mon, 24 Jul 2017 17:23:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707241723.v6OHNrS0004593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 24 Jul 2017 17:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321423 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:23:54 -0000 Author: alc Date: Mon Jul 24 17:23:53 2017 New Revision: 321423 URL: https://svnweb.freebsd.org/changeset/base/321423 Log: Change the interactions of the interface functions with the "meta" and "leaf" functions for alloc, free, and fill. After the change, the interface functions call "meta" unconditionally, and the "meta" functions recur unconditionally in looping over their descendants. The "meta" functions start with a validity test, and then a test for the "leaf" case, before falling into the general recursive case. This simplifies and shrinks the code, and, for "free" and "fill" moves panic tests that check the same meta node repeatedly in a loop to a place that will have each node tested once. Remove irrelevant null checks from blist_free and blist_fill. Make the code that initializes a meta node the same in blist_meta_alloc and blist_meta_fill. Parenthesize return expressions in blst_meta_fill. Submitted by: Doug Moore MFC after: 1 week Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Mon Jul 24 16:58:54 2017 (r321422) +++ head/sys/kern/subr_blist.c Mon Jul 24 17:23:53 2017 (r321423) @@ -224,12 +224,8 @@ blist_alloc(blist_t bl, daddr_t count) * reduce the hint, stopping further iterations. */ while (count <= bl->bl_root->bm_bighint) { - if (bl->bl_radix == BLIST_BMAP_RADIX) - blk = blst_leaf_alloc(bl->bl_root, 0, count, - bl->bl_cursor); - else - blk = blst_meta_alloc(bl->bl_root, 0, count, - bl->bl_radix, bl->bl_skip, bl->bl_cursor); + blk = blst_meta_alloc(bl->bl_root, 0, count, bl->bl_radix, + bl->bl_skip, bl->bl_cursor); if (blk != SWAPBLK_NONE) { bl->bl_cursor = blk + count; return (blk); @@ -260,13 +256,8 @@ blist_avail(blist_t bl) void blist_free(blist_t bl, daddr_t blkno, daddr_t count) { - if (bl) { - if (bl->bl_radix == BLIST_BMAP_RADIX) - blst_leaf_free(bl->bl_root, blkno, count); - else - blst_meta_free(bl->bl_root, blkno, count, - bl->bl_radix, bl->bl_skip, 0); - } + + blst_meta_free(bl->bl_root, blkno, count, bl->bl_radix, bl->bl_skip, 0); } /* @@ -278,17 +269,9 @@ blist_free(blist_t bl, daddr_t blkno, daddr_t count) daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t count) { - daddr_t filled; - if (bl) { - if (bl->bl_radix == BLIST_BMAP_RADIX) - filled = blst_leaf_fill(bl->bl_root, blkno, count); - else - filled = blst_meta_fill(bl->bl_root, blkno, count, - bl->bl_radix, bl->bl_skip, 0); - return (filled); - } - return (0); + return (blst_meta_fill(bl->bl_root, blkno, count, bl->bl_radix, + bl->bl_skip, 0)); } /* @@ -449,6 +432,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t c int child; bool scan_from_start; + if (radix == BLIST_BMAP_RADIX) + return (blst_leaf_alloc(scan, blk, count, cursor)); if (scan->u.bmu_avail < count) { /* * The meta node's hint must be too large if the allocation @@ -497,14 +482,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t c /* * The allocation might fit in the i'th subtree. */ - if (next_skip == 1) { - r = blst_leaf_alloc(&scan[i], blk, count, - cursor > blk ? cursor : blk); - } else { - r = blst_meta_alloc(&scan[i], blk, count, - radix, next_skip - 1, cursor > blk ? - cursor : blk); - } + r = blst_meta_alloc(&scan[i], blk, count, radix, + next_skip - 1, cursor > blk ? cursor : blk); if (r != SWAPBLK_NONE) { scan->u.bmu_avail -= count; return (r); @@ -578,6 +557,10 @@ blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_ daddr_t i, next_skip, v; int child; + if (scan->bm_bighint == (daddr_t)-1) + panic("freeing invalid range"); + if (radix == BLIST_BMAP_RADIX) + return (blst_leaf_free(scan, freeBlk, count)); next_skip = skip / BLIST_META_RADIX; if (scan->u.bmu_avail == 0) { @@ -630,17 +613,9 @@ blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_ v = blk + radix - freeBlk; if (v > count) v = count; - - if (scan->bm_bighint == (daddr_t)-1) - panic("blst_meta_free: freeing unexpected range"); - - if (next_skip == 1) { - blst_leaf_free(&scan[i], freeBlk, v); - } else { - blst_meta_free(&scan[i], freeBlk, v, radix, next_skip - 1, blk); - } + blst_meta_free(&scan[i], freeBlk, v, radix, next_skip - 1, blk); if (scan->bm_bighint < scan[i].bm_bighint) - scan->bm_bighint = scan[i].bm_bighint; + scan->bm_bighint = scan[i].bm_bighint; count -= v; freeBlk += v; blk += radix; @@ -763,13 +738,17 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr daddr_t i, nblks, next_skip, v; int child; + if (scan->bm_bighint == (daddr_t)-1) + panic("filling invalid range"); if (count > radix) { /* * The allocation exceeds the number of blocks that are - * managed by this meta node. + * managed by this node. */ - panic("allocation too large"); + panic("fill too large"); } + if (radix == BLIST_BMAP_RADIX) + return (blst_leaf_fill(scan, allocBlk, count)); if (count == radix || scan->u.bmu_avail == 0) { /* * ALL-ALLOCATED special case @@ -777,7 +756,7 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr nblks = scan->u.bmu_avail; scan->u.bmu_avail = 0; scan->bm_bighint = 0; - return nblks; + return (nblks); } next_skip = skip / BLIST_META_RADIX; @@ -793,13 +772,11 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr * meta node cannot have a terminator in any subtree. */ for (i = 1; i <= skip; i += next_skip) { - if (next_skip == 1) { + if (next_skip == 1) scan[i].u.bmu_bitmap = (u_daddr_t)-1; - scan[i].bm_bighint = BLIST_BMAP_RADIX; - } else { - scan[i].bm_bighint = radix; + else scan[i].u.bmu_avail = radix; - } + scan[i].bm_bighint = radix; } } else { radix /= BLIST_META_RADIX; @@ -813,23 +790,15 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr v = blk + radix - allocBlk; if (v > count) v = count; - - if (scan->bm_bighint == (daddr_t)-1) - panic("blst_meta_fill: filling unexpected range"); - - if (next_skip == 1) { - nblks += blst_leaf_fill(&scan[i], allocBlk, v); - } else { - nblks += blst_meta_fill(&scan[i], allocBlk, v, - radix, next_skip - 1, blk); - } + nblks += blst_meta_fill(&scan[i], allocBlk, v, radix, + next_skip - 1, blk); count -= v; allocBlk += v; blk += radix; i += next_skip; } scan->u.bmu_avail -= nblks; - return nblks; + return (nblks); } /* From owner-svn-src-all@freebsd.org Mon Jul 24 17:27:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7BD7CFF28C; Mon, 24 Jul 2017 17:27: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 74BDF70746; Mon, 24 Jul 2017 17:27: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 v6OHRLqx004754; Mon, 24 Jul 2017 17:27:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OHRLrt004753; Mon, 24 Jul 2017 17:27:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707241727.v6OHRLrt004753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 24 Jul 2017 17:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321424 - head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts X-SVN-Commit-Revision: 321424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:27:22 -0000 Author: ngie Date: Mon Jul 24 17:27:21 2017 New Revision: 321424 URL: https://svnweb.freebsd.org/changeset/base/321424 Log: Style cleanup: delete spurious trailing whitespace MFC after: 1 month Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Jul 24 17:23:53 2017 (r321423) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Jul 24 17:27:21 2017 (r321424) @@ -250,7 +250,7 @@ sub run_tests { $name = $1; $base = $2; $ext = $3; - + $dir = dirname($file); $isksh = 0; $tag = 0; @@ -372,7 +372,7 @@ sub run_tests { "modunload -i 0"); if (!system("modinfo | grep dtrace")) { warn "ERROR: couldn't unload dtrace\n"; - system("svcadm enable " . + system("svcadm enable " . "-s svc:/network/nfs/mapid:default"); exit(124); } @@ -387,7 +387,7 @@ sub run_tests { "modunload -i 0"); if (!system("modinfo | grep dtrace")) { warn "ERROR: couldn't unload dtrace\n"; - system("svcadm enable " . + system("svcadm enable " . "-s svc:/network/nfs/mapid:default"); exit(124); } @@ -679,7 +679,7 @@ if ($opt_b) { # # Run all the tests specified on the command-line (the entire test suite # by default) once for each dtrace command tested, skipping any tests -# not valid for that command. +# not valid for that command. # foreach $dtrace_cmd (@dtrace_cmds) { run_tests($dtrace_cmd, $exception_lists{$dtrace_cmd}); From owner-svn-src-all@freebsd.org Mon Jul 24 17:29:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6259CFF34B; Mon, 24 Jul 2017 17:29:57 +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 93179708EC; Mon, 24 Jul 2017 17:29:57 +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 v6OHTukI004884; Mon, 24 Jul 2017 17:29:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OHTu2Q004883; Mon, 24 Jul 2017 17:29:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707241729.v6OHTu2Q004883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 24 Jul 2017 17:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321425 - head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts X-SVN-Commit-Revision: 321425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:29:57 -0000 Author: ngie Date: Mon Jul 24 17:29:56 2017 New Revision: 321425 URL: https://svnweb.freebsd.org/changeset/base/321425 Log: Fix whitespace on a line in fix(..) accidentally missed in r321424 MFC after: 1 month MFC with: r321424 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Jul 24 17:27:21 2017 (r321424) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Jul 24 17:29:56 2017 (r321425) @@ -116,7 +116,7 @@ sub fail open(README, ">$opt_d/failure.$n/README"); print README "ERROR: " . $file . " " . $msg; - + if (scalar @parms > 1) { print README "; see $errfile\n"; } else { From owner-svn-src-all@freebsd.org Mon Jul 24 17:53:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61195CFFE4E; Mon, 24 Jul 2017 17:53: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 3042771C94; Mon, 24 Jul 2017 17:53: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 v6OHrj1p016914; Mon, 24 Jul 2017 17:53:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OHrjuV016913; Mon, 24 Jul 2017 17:53:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707241753.v6OHrjuV016913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 17:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321426 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:53:46 -0000 Author: bdrewery Date: Mon Jul 24 17:53:45 2017 New Revision: 321426 URL: https://svnweb.freebsd.org/changeset/base/321426 Log: cleanobj: Unhide removal of directory. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.obj.mk Modified: head/share/mk/bsd.obj.mk ============================================================================== --- head/share/mk/bsd.obj.mk Mon Jul 24 17:29:56 2017 (r321425) +++ head/share/mk/bsd.obj.mk Mon Jul 24 17:53:45 2017 (r321426) @@ -159,7 +159,7 @@ whereobj: .if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) cleanobj: - @-rm -rf ${CANONICALOBJDIR} + -rm -rf ${CANONICALOBJDIR} .else cleanobj: clean cleandepend .endif From owner-svn-src-all@freebsd.org Mon Jul 24 17:54:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC366CFFE9C; Mon, 24 Jul 2017 17:54:04 +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 88C3F71DC2; Mon, 24 Jul 2017 17:54:04 +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 v6OHs3Ru016973; Mon, 24 Jul 2017 17:54:03 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OHs3L5016971; Mon, 24 Jul 2017 17:54:03 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707241754.v6OHs3L5016971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 17:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321427 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:54:04 -0000 Author: bdrewery Date: Mon Jul 24 17:54:03 2017 New Revision: 321427 URL: https://svnweb.freebsd.org/changeset/base/321427 Log: PROGS: Fix ESTALE errors on NFS while cleaning in directories with PROGS. - Only recurse on cleanobj/cleandir if there is no .OBJDIR being used. If we don't recurse then bsd.obj.mk will just rm -rf the OBJDIR dir. - When recursing on cleanobj/cleandir don't remove dependfiles/dirs redundantly from the child and main processes. Meaning '.depend', and 'tags', and '.depend.*' will now only be removed from the main process. - Stop recursing on 'cleandepend' since the main process can handle removing all files via the default glob patterns in CLEANDEPENDFILES. - This reverts r288201, by readding recursion on 'cleanobj', due to r291635 changing how bsd.subdir.mk handles recursion. This is primarily targeting ESTALE NFS errors from rm(1) during a buildworld but is also a performance optimization as both issues fixed were redundant anyway. Reported by: cperciva, scottl MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.obj.mk head/share/mk/bsd.progs.mk Modified: head/share/mk/bsd.obj.mk ============================================================================== --- head/share/mk/bsd.obj.mk Mon Jul 24 17:53:45 2017 (r321426) +++ head/share/mk/bsd.obj.mk Mon Jul 24 17:54:03 2017 (r321427) @@ -157,6 +157,7 @@ whereobj: @echo ${.OBJDIR} .endif +# Same check in bsd.progs.mk .if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) cleanobj: -rm -rf ${CANONICALOBJDIR} Modified: head/share/mk/bsd.progs.mk ============================================================================== --- head/share/mk/bsd.progs.mk Mon Jul 24 17:53:45 2017 (r321426) +++ head/share/mk/bsd.progs.mk Mon Jul 24 17:54:03 2017 (r321427) @@ -116,7 +116,16 @@ ${_PROGS_COMMON_OBJS}: .NOMETA .if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG) # tell progs.mk we might want to install things -PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install +PROGS_TARGETS+= checkdpadd clean depend install +# Only handle removing depend files from the main process. +_PROG_MK.cleandir= CLEANDEPENDFILES= CLEANDEPENDDIRS= +_PROG_MK.cleanobj= CLEANDEPENDFILES= CLEANDEPENDDIRS= +# Only recurse on these if there is no objdir, meaning a normal +# 'clean' gets ran via the target defined in bsd.obj.mk. +# Same check from cleanobj: in bsd.obj.mk +.if ${CANONICALOBJDIR} == ${.CURDIR} || !exists(${CANONICALOBJDIR}/) +PROGS_TARGETS+= cleandir cleanobj +.endif # Ensure common objects are built before recursing. .if !empty(_PROGS_COMMON_OBJS) @@ -142,7 +151,7 @@ $p.$t: .PHONY .MAKE (cd ${.CURDIR} && \ DEPENDFILE=.depend.$p \ NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \ - PROG=$p ${x.$p} ${@:E}) + ${_PROG_MK.${t}} PROG=$p ${x.$p} ${@:E}) .endfor .endfor From owner-svn-src-all@freebsd.org Mon Jul 24 17:55:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04B55CFFF7B; Mon, 24 Jul 2017 17:55:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com [IPv6:2607:f8b0:400e: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 C4ADE71F5D; Mon, 24 Jul 2017 17:55:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x229.google.com with SMTP id 125so60172587pgi.3; Mon, 24 Jul 2017 10:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=Jyk/cezc12dTj18k9YIvJ0s4G0+G4mW637cuONyNOPU=; b=VRYD8AVLnTBzZP3s3tr2VvQ/c3b1RjEsiiXdoiIGHQmKAlCjbQupP3YjlU4BXHdBTx +Kn3XKegkSyPnm6WTAUkngfMZYGR7u58qsTl/O3GvY+y2+rQyW7Jy4wHnSpxKJbVsmMz 2TOlcnFsczuep/hYlHs73Dk4c5fug67UhogxrDsEKTZlW8lb6PqcaId0a3duUcIw2cIJ ONwTovB6SwmOn2jQeOztGCL8894uYMxLuEzV4BXQSohnWwA3jrFOPI+9LBo3m8Vly/Vc fFDcv8zuIXlDidZlkW8hUVD/O6w1AGf9EcBNYf7cyIW4N0jnfnZRbEn2ho9vgqeJHRpp MNOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=Jyk/cezc12dTj18k9YIvJ0s4G0+G4mW637cuONyNOPU=; b=JphPTVIv5IAiNLIIE9sLhAlv/0YpwXUDMH+A04I8nwMUx1fIWYKWkIeQaEjgUlC5iE MWUJQ1RlzH1uHWi4n/7Q7HG/phQ+RHxmSw8jfuTQPiLbl3/fiKpS+taoF4UB3pLxIklm JZdiH4WurWPA+NTuGfp39lXEfscRLthpEFb65Rpwr/Y8MJEzm4wJ2LjmPK/8K4AcKErn tB7FnJlQE7EAl0F2RIABPRP1Gr3IjuCNg7ZwYHFNFs3qhINlwHLLA4C4e2c9+yhytX5D 2GTugFJIBXrGCbjDnzrgR+NU8KTKfvvsR/kvxAtTeI8gGJ8oEiQKuwVn9BiB0OUecRk5 wjEg== X-Gm-Message-State: AIVw112pcN1SEoE1OTILjxRT/YrDOZMrEyLMiuvi9pjGpZh91pPJHddG nPl4UGTxwh8z4P17XZg= X-Received: by 10.98.202.12 with SMTP id n12mr17110022pfg.187.1500918956191; Mon, 24 Jul 2017 10:55:56 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c62sm23531493pfb.93.2017.07.24.10.55.54 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Jul 2017 10:55:55 -0700 (PDT) Subject: Re: svn commit: r321426 - head/share/mk Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_66A1CFDB-FFD4-4871-9DF0-E7F4D290CADC"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201707241753.v6OHrjuV016913@repo.freebsd.org> Date: Mon, 24 Jul 2017 10:55:54 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <44CBBFE1-7C38-41AA-AABD-0FE7027AE938@gmail.com> References: <201707241753.v6OHrjuV016913@repo.freebsd.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:55:57 -0000 --Apple-Mail=_66A1CFDB-FFD4-4871-9DF0-E7F4D290CADC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 24, 2017, at 10:53, Bryan Drewery wrote: >=20 > Author: bdrewery > Date: Mon Jul 24 17:53:45 2017 > New Revision: 321426 > URL: https://svnweb.freebsd.org/changeset/base/321426 >=20 > Log: > cleanobj: Unhide removal of directory. >=20 > MFC after: 2 weeks > Sponsored by: Dell EMC Isilon >=20 > Modified: > head/share/mk/bsd.obj.mk Why? Dumping output of things like this is why =E2=80=9Cmake -d l=E2=80=9D= is helpful. -Ngie --Apple-Mail=_66A1CFDB-FFD4-4871-9DF0-E7F4D290CADC 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZdjSqAAoJEPWDqSZpMIYV+3kP/jqZ3w1GwrbWbF9OBq2Fp4fT pnMpII+5RSQymP18rnmBN3VQ9NnTgZMpCTPk9VbRqOajAKrjI9wgJoCESJySNJEI MIPxmmBU7M/2Uxh7ljG73ZO0OklgXS23EiEdvi3lVs4K2EtY0RdCioSHQtfCNJQP 5IX++NUqcHbrM+wnwMpEWHX+xk3CFRkynkX8aVccx6JhQpSvO//x47INu+9oyh9f mrZBdjUU3kDjxT2vbvtLnsQc7WGk5y5Mdbs2nSXqJ9aN/0Imr42FpzcGSWghJ/4X RHlF1J+BMB6lKKst/SpI1WLbiTj6+YvwS27ginQq44p+B+74zOu38KHawOxeweiS 9uuivNi+feMNk7mqU/yn/wDQI/tvrEqioGC3LCS120zcJe9xG9GVV4et+x2YBkYp nQwmIPIwb4pR+MZQCRDF00+oOYS5VveEgc7lxdD5k1A1G2sAGuYBVVhrmXZd+fKQ 9aX922+51ziLhhyFxU/j1XAfpFqfac1gGRDKNNJyF1TW2ht4nUlinfOOVE6vwfpz Opsu14o/BRuivhjRH8Isf6sbV0YsH5arstazPwwHfXT9SvEDgkspOhfNpTkjBzuw uKt5O22JW8d7B/oT7v87HboYIZTiI87DSQQmw8T5YpxqvQiwjZsVMZKqjfFpHj5V JWLD/FHNkqzEDG96MMfB =8Aa+ -----END PGP SIGNATURE----- --Apple-Mail=_66A1CFDB-FFD4-4871-9DF0-E7F4D290CADC-- From owner-svn-src-all@freebsd.org Mon Jul 24 17:57:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B428D7C009; Mon, 24 Jul 2017 17:57:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17116720B1; Mon, 24 Jul 2017 17:57:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 4544FA273; Mon, 24 Jul 2017 17:57:41 +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 2CEB88DF6; Mon, 24 Jul 2017 17:57:40 +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 Kzt4q2713EYh; Mon, 24 Jul 2017 17:57:37 +0000 (UTC) Subject: Re: svn commit: r321426 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 7AB598DF1 To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201707241753.v6OHrjuV016913@repo.freebsd.org> <44CBBFE1-7C38-41AA-AABD-0FE7027AE938@gmail.com> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <7fad1f9c-b0d0-79c4-24a8-2b40dbf5b0de@FreeBSD.org> Date: Mon, 24 Jul 2017 10:57:11 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <44CBBFE1-7C38-41AA-AABD-0FE7027AE938@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bFvNwR09qDC3xAIR0fftDMTRKnLe6r3Gj" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 17:57:42 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bFvNwR09qDC3xAIR0fftDMTRKnLe6r3Gj Content-Type: multipart/mixed; boundary="Iu6bderJPpOaPiGQsGtMV6uRrDknfm8vj"; protected-headers="v1" From: Bryan Drewery To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <7fad1f9c-b0d0-79c4-24a8-2b40dbf5b0de@FreeBSD.org> Subject: Re: svn commit: r321426 - head/share/mk References: <201707241753.v6OHrjuV016913@repo.freebsd.org> <44CBBFE1-7C38-41AA-AABD-0FE7027AE938@gmail.com> In-Reply-To: <44CBBFE1-7C38-41AA-AABD-0FE7027AE938@gmail.com> --Iu6bderJPpOaPiGQsGtMV6uRrDknfm8vj Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/24/2017 10:55 AM, Ngie Cooper (yaneurabeya) wrote: >=20 >> On Jul 24, 2017, at 10:53, Bryan Drewery wrote:= >> >> Author: bdrewery >> Date: Mon Jul 24 17:53:45 2017 >> New Revision: 321426 >> URL: https://svnweb.freebsd.org/changeset/base/321426 >> >> Log: >> cleanobj: Unhide removal of directory. >> >> MFC after: 2 weeks >> Sponsored by: Dell EMC Isilon >> >> Modified: >> head/share/mk/bsd.obj.mk >=20 > Why? Dumping output of things like this is why =E2=80=9Cmake -d l=E2=80= =9D is helpful. > -Ngie >=20 There's no output for this one clean operation, while all other clean operations have output. The opposite, 'make obj', has output as well. This was doing something with no affirmation that anything was actually being done. --=20 Regards, Bryan Drewery --Iu6bderJPpOaPiGQsGtMV6uRrDknfm8vj-- --bFvNwR09qDC3xAIR0fftDMTRKnLe6r3Gj 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 iQEcBAEBAgAGBQJZdjUAAAoJEDXXcbtuRpfP15wIAI5AqBZENvUffUlg9oOLen9v mRapKenXI4Fzog+t9NePcARJkolSI2OSvuWnqpkpGHVJQ3EgseB61N2+sbHNNh8X KIuHDEgxi0fnBLKn2Ay4yBtKDetde6ViAxX0wSEUwx3XzMBqt3Xu4oi/8W8uJm68 q0CN1NLmdm6+3o0prSKIuCjXYd6fTDn2QgS+z2GMTNl4PZAV67LqBym4F3k8rHA0 7Nv8YJ5S3IoctyEfoiVSmPMPshBXm1YeI23+gjHj5AS2wh0IkpanLg1Zii/gnDSO Hqsa1/3xesABcZrZ5Psaf6R9onUyxM2X6t6FlYCf5L9SqmFcF/uLw8sZEdDMR80= =6MeT -----END PGP SIGNATURE----- --bFvNwR09qDC3xAIR0fftDMTRKnLe6r3Gj-- From owner-svn-src-all@freebsd.org Mon Jul 24 18:10:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3C20D7C475; Mon, 24 Jul 2017 18:10:43 +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 8331472805; Mon, 24 Jul 2017 18:10:43 +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 v6OIAgqW022553; Mon, 24 Jul 2017 18:10:42 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OIAg13022552; Mon, 24 Jul 2017 18:10:42 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707241810.v6OIAg13022552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jul 2017 18:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321429 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 321429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 18:10:43 -0000 Author: imp Date: Mon Jul 24 18:10:42 2017 New Revision: 321429 URL: https://svnweb.freebsd.org/changeset/base/321429 Log: fix typo Modified: head/lib/libefivar/uefi-dputil.c Modified: head/lib/libefivar/uefi-dputil.c ============================================================================== --- head/lib/libefivar/uefi-dputil.c Mon Jul 24 18:02:13 2017 (r321428) +++ head/lib/libefivar/uefi-dputil.c Mon Jul 24 18:10:42 2017 (r321429) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "uefi-dplib.h" -/* XXX maybe I sould include the entire DevicePathUtiltiies.c and ifdef out what we don't use */ +/* XXX maybe I should include the entire DevicePathUtiltiies.c and ifdef out what we don't use */ /* * Taken from MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c From owner-svn-src-all@freebsd.org Mon Jul 24 18:21:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DF62D7C854; Mon, 24 Jul 2017 18:21:02 +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 6C0E673101; Mon, 24 Jul 2017 18:21:02 +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 v6OIL116025412; Mon, 24 Jul 2017 18:21:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OIL1uE025411; Mon, 24 Jul 2017 18:21:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707241821.v6OIL1uE025411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 24 Jul 2017 18:21:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321431 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 18:21:02 -0000 Author: ngie Date: Mon Jul 24 18:21:01 2017 New Revision: 321431 URL: https://svnweb.freebsd.org/changeset/base/321431 Log: Use __DEFAULT_DEPENDENT_OPTIONS for articulating dependency relationship between MK_STALE_STAGED and MK_STAGING instead of using equivalent ad hoc logic. MFC after: 1 month Modified: head/share/mk/bsd.opts.mk Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Mon Jul 24 18:16:54 2017 (r321430) +++ head/share/mk/bsd.opts.mk Mon Jul 24 18:21:01 2017 (r321431) @@ -76,6 +76,7 @@ __DEFAULT_NO_OPTIONS = \ __DEFAULT_DEPENDENT_OPTIONS = \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ + STALE_STAGED/STAGING \ .include @@ -98,10 +99,6 @@ __DEFAULT_DEPENDENT_OPTIONS = \ MK_${var}:=no .endif .endfor - -.if ${MK_STAGING} == "no" -MK_STALE_STAGED= no -.endif .include From owner-svn-src-all@freebsd.org Mon Jul 24 18:52:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EC10D7D680; Mon, 24 Jul 2017 18:52:42 +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 F0557743FA; Mon, 24 Jul 2017 18:52:41 +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 v6OIqepo041499; Mon, 24 Jul 2017 18:52:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OIqe3F041498; Mon, 24 Jul 2017 18:52:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707241852.v6OIqe3F041498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 24 Jul 2017 18:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321433 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 18:52:42 -0000 Author: dim Date: Mon Jul 24 18:52:40 2017 New Revision: 321433 URL: https://svnweb.freebsd.org/changeset/base/321433 Log: Cleanup stale Options.inc files from the previous libllvm build for clang 4.0.0. Otherwise, these can get included before the two newly generated ones (which are different) for clang 5.0.0. Reported by: Mark Millard MFC after: 2 months X-MFC-With: r321369 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 24 18:25:08 2017 (r321432) +++ head/Makefile.inc1 Mon Jul 24 18:52:40 2017 (r321433) @@ -813,6 +813,16 @@ _worldtmp: .PHONY ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.* .endif .endfor +# 20170724 remove stale lib/clang/libllvm/Options.inc file, of which there are +# two different versions after r308421, one for llvm-lib, one for llvm-dlltool +.for d in ${OBJTREE} ${WORLDTMP} +.for f in ${d}${.CURDIR}/lib/clang/libllvm/Options.inc +.if exists(${f}) || exists(${f}.d) + @echo Removing stale generated ${f} files + @rm -f ${f} ${f}.d +.endif +.endfor +.endfor .for _dir in \ lib lib/casper usr legacy/bin legacy/usr mkdir -p ${WORLDTMP}/${_dir} From owner-svn-src-all@freebsd.org Mon Jul 24 18:54:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 024BED7D76E; Mon, 24 Jul 2017 18:54:58 +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 C3DF974655; Mon, 24 Jul 2017 18:54:57 +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 v6OIsuIb041711; Mon, 24 Jul 2017 18:54:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OIsumD041710; Mon, 24 Jul 2017 18:54:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707241854.v6OIsumD041710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 18:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321434 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 18:54:58 -0000 Author: bdrewery Date: Mon Jul 24 18:54:56 2017 New Revision: 321434 URL: https://svnweb.freebsd.org/changeset/base/321434 Log: Add some .ORDER for distrib-dirs, distribute, distribution and distributeworld. Reported by: Mark Millard MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Mon Jul 24 18:52:40 2017 (r321433) +++ head/Makefile Mon Jul 24 18:54:56 2017 (r321434) @@ -158,8 +158,18 @@ META_TGT_WHITELIST+= \ toolchains universe world worlds xdev xdev-build .ORDER: buildworld installworld +.ORDER: buildworld distrib-dirs +.ORDER: buildworld distribution +.ORDER: buildworld distribute .ORDER: buildworld distributeworld .ORDER: buildworld buildkernel +.ORDER: distrib-dirs distribute +.ORDER: distrib-dirs distributeworld +.ORDER: distrib-dirs installworld +.ORDER: distribution distribute +.ORDER: distributeworld distribute +.ORDER: distributeworld distribution +.ORDER: installworld distribute .ORDER: installworld distribution .ORDER: installworld installkernel .ORDER: buildkernel installkernel From owner-svn-src-all@freebsd.org Mon Jul 24 19:04:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46DAAD7DBC2; Mon, 24 Jul 2017 19:04:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07EBC74E26; Mon, 24 Jul 2017 19:04:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 33B0DB9C0; Mon, 24 Jul 2017 19:04:44 +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 4A6A38FBB; Mon, 24 Jul 2017 19:04:43 +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 ayhwpjbNbTSy; Mon, 24 Jul 2017 19:04:40 +0000 (UTC) Subject: Re: svn commit: r321433 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 18C6A8FB6 To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201707241852.v6OIqe3F041498@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <2fba04e9-520b-d36d-b038-25fe694724fb@FreeBSD.org> Date: Mon, 24 Jul 2017 12:04:38 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201707241852.v6OIqe3F041498@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K5Mcgt46Eb5BnIkprugWUaucDngeJI1Rb" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 19:04:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --K5Mcgt46Eb5BnIkprugWUaucDngeJI1Rb Content-Type: multipart/mixed; boundary="j4GKjoH4WxG1P8UmEVb1DaHSp0MuId5lG"; protected-headers="v1" From: Bryan Drewery To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <2fba04e9-520b-d36d-b038-25fe694724fb@FreeBSD.org> Subject: Re: svn commit: r321433 - head References: <201707241852.v6OIqe3F041498@repo.freebsd.org> In-Reply-To: <201707241852.v6OIqe3F041498@repo.freebsd.org> --j4GKjoH4WxG1P8UmEVb1DaHSp0MuId5lG Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/24/2017 11:52 AM, Dimitry Andric wrote: > Author: dim > Date: Mon Jul 24 18:52:40 2017 > New Revision: 321433 > URL: https://svnweb.freebsd.org/changeset/base/321433 >=20 > Log: > Cleanup stale Options.inc files from the previous libllvm build for > clang 4.0.0. Otherwise, these can get included before the two newly > generated ones (which are different) for clang 5.0.0. > =20 > Reported by: Mark Millard > MFC after: 2 months > X-MFC-With: r321369 >=20 > Modified: > head/Makefile.inc1 >=20 > Modified: head/Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/Makefile.inc1 Mon Jul 24 18:25:08 2017 (r321432) > +++ head/Makefile.inc1 Mon Jul 24 18:52:40 2017 (r321433) > @@ -813,6 +813,16 @@ _worldtmp: .PHONY > ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.* > .endif > .endfor > +# 20170724 remove stale lib/clang/libllvm/Options.inc file, of which t= here are > +# two different versions after r308421, one for llvm-lib, one for llvm= -dlltool > +.for d in ${OBJTREE} ${WORLDTMP} > +.for f in ${d}${.CURDIR}/lib/clang/libllvm/Options.inc The 2nd .for is not needed, there's only 1 item. It could probably be f=3D${d}${.CURDIR}/lib/clang/libllvm/Options.inc instead. > +.if exists(${f}) || exists(${f}.d) > + @echo Removing stale generated ${f} files > + @rm -f ${f} ${f}.d > +.endif > +.endfor > +.endfor > .for _dir in \ > lib lib/casper usr legacy/bin legacy/usr > mkdir -p ${WORLDTMP}/${_dir} >=20 --=20 Regards, Bryan Drewery --j4GKjoH4WxG1P8UmEVb1DaHSp0MuId5lG-- --K5Mcgt46Eb5BnIkprugWUaucDngeJI1Rb 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 iQEcBAEBAgAGBQJZdkTGAAoJEDXXcbtuRpfP7hYH/01qC73rpHHZGy7hazlNiIQM 3gs3k1Bn12wbMkD7cdXhy6n1iKP4iMW5dHrRgxlJ1S3r83Jj1RJtDpzVhNLP97hi xzq0RnZd1dzEIKPUF8oCKknX/zZsZCMKufBmxsQYA5Vh+wrIRxp3tZNKq7O/Ukr3 vB5GFimsy8G1Gy8JItdx1SS9A6fLpKk5kF5rGsZlCVw/ABlukGkNJrKdS+9dV1pB mjwOTfDE7bXLX6YvULYPSCb9x6/WBoQxdxVuoRsWADYsav0wwX0YKFWXvVRtYy9R nSjTHmJc+43MTLihBsKyT9AJmgPcZjOcqw0Pod0bv+RzGiLoGOqQnFzVxy+FYdI= =Mp9Q -----END PGP SIGNATURE----- --K5Mcgt46Eb5BnIkprugWUaucDngeJI1Rb-- From owner-svn-src-all@freebsd.org Mon Jul 24 19:14:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 509DDD7DEA0; Mon, 24 Jul 2017 19:14:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (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 097D37530F; Mon, 24 Jul 2017 19:14:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::c995:48cf:5934:883a] (unknown [IPv6:2001:470:7a58:0:c995:48cf:5934:883a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id BCF50262C4; Mon, 24 Jul 2017 21:14:17 +0200 (CEST) From: Dimitry Andric Message-Id: <2EB128F7-BBFB-4BCC-87FF-BE416D461994@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_D96225B1-FCD2-4DDD-9A7C-656326D615F3"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r321433 - head Date: Mon, 24 Jul 2017 21:14:12 +0200 In-Reply-To: <2fba04e9-520b-d36d-b038-25fe694724fb@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Bryan Drewery References: <201707241852.v6OIqe3F041498@repo.freebsd.org> <2fba04e9-520b-d36d-b038-25fe694724fb@FreeBSD.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 19:14:25 -0000 --Apple-Mail=_D96225B1-FCD2-4DDD-9A7C-656326D615F3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 24 Jul 2017, at 21:04, Bryan Drewery wrote: >=20 > On 7/24/2017 11:52 AM, Dimitry Andric wrote: >> Author: dim >> Date: Mon Jul 24 18:52:40 2017 >> New Revision: 321433 >> URL: https://svnweb.freebsd.org/changeset/base/321433 >>=20 >> Log: >> Cleanup stale Options.inc files from the previous libllvm build for >> clang 4.0.0. Otherwise, these can get included before the two newly >> generated ones (which are different) for clang 5.0.0. >>=20 >> Reported by: Mark Millard >> MFC after: 2 months >> X-MFC-With: r321369 >>=20 >> Modified: >> head/Makefile.inc1 >>=20 >> Modified: head/Makefile.inc1 >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/Makefile.inc1 Mon Jul 24 18:25:08 2017 = (r321432) >> +++ head/Makefile.inc1 Mon Jul 24 18:52:40 2017 = (r321433) >> @@ -813,6 +813,16 @@ _worldtmp: .PHONY >> = ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.* >> .endif >> .endfor >> +# 20170724 remove stale lib/clang/libllvm/Options.inc file, of which = there are >> +# two different versions after r308421, one for llvm-lib, one for = llvm-dlltool >> +.for d in ${OBJTREE} ${WORLDTMP} >> +.for f in ${d}${.CURDIR}/lib/clang/libllvm/Options.inc >=20 > The 2nd .for is not needed, there's only 1 item. It could probably be > f=3D${d}${.CURDIR}/lib/clang/libllvm/Options.inc instead. I never fully understand how assignments work in bmake, this always goes wrong for me in for loops. Feel free to correct it so that it works, I'm afraid to touch this. :) -Dimitry --Apple-Mail=_D96225B1-FCD2-4DDD-9A7C-656326D615F3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.1 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWXZHBAAKCRCwXqMKLiCW oxnkAKDUzuDIOjipWs4s7XPDfBNH5/dSxQCfdX8Us1N7h4Rpyru7qLdLURNDcsc= =DKVx -----END PGP SIGNATURE----- --Apple-Mail=_D96225B1-FCD2-4DDD-9A7C-656326D615F3-- From owner-svn-src-all@freebsd.org Mon Jul 24 19:17:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4392AD7DF53; Mon, 24 Jul 2017 19:17:15 +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 1ACB2754B6; Mon, 24 Jul 2017 19:17: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 v6OJHEJL050538; Mon, 24 Jul 2017 19:17:14 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OJHDRj050536; Mon, 24 Jul 2017 19:17:13 GMT (envelope-from np@FreeBSD.org) Message-Id: <201707241917.v6OJHDRj050536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 24 Jul 2017 19:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321435 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 321435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 19:17:15 -0000 Author: np Date: Mon Jul 24 19:17:13 2017 New Revision: 321435 URL: https://svnweb.freebsd.org/changeset/base/321435 Log: cxgbe(4): Display some more TOE parameters related to retransmission and keepalive in the sysctl MIB. Provide tunables to change some of these parameters. These are supposed to be setup by the firmware so these tunables are for experimentation only. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Mon Jul 24 18:54:56 2017 (r321434) +++ head/sys/dev/cxgbe/common/common.h Mon Jul 24 19:17:13 2017 (r321435) @@ -501,6 +501,15 @@ static inline unsigned int dack_ticks_to_usec(const st return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap); } +static inline u_int ms_to_tcp_ticks(const struct adapter *adap, u_int ms) +{ + u_long l; + + l = (u_long)ms * adap->params.vpd.cclk >> adap->params.tp.tre; + + return (l); +} + void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val); int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd, Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Jul 24 18:54:56 2017 (r321434) +++ head/sys/dev/cxgbe/t4_main.c Mon Jul 24 19:17:13 2017 (r321435) @@ -551,6 +551,8 @@ static int sysctl_tc_params(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS); static int sysctl_tp_timer(SYSCTL_HANDLER_ARGS); +static int sysctl_tp_shift_cnt(SYSCTL_HANDLER_ARGS); +static int sysctl_tp_backoff(SYSCTL_HANDLER_ARGS); #endif static uint32_t fconf_iconf_to_mode(uint32_t, uint32_t); static uint32_t mode_to_fconf(uint32_t); @@ -3607,12 +3609,62 @@ static int set_params__post_init(struct adapter *sc) { uint32_t param, val; + int i, v, shift; + char s[32]; /* ask for encapsulated CPLs */ param = FW_PARAM_PFVF(CPLFW4MSG_ENCAP); val = 1; (void)t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + /* + * Override the TOE timers with user provided tunables. This is not the + * recommended way to change the timers (the firmware config file is) so + * these tunables are not documented. + * + * All the timer tunables are in milliseconds. + */ + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_idle", &v)) { + t4_set_reg_field(sc, A_TP_KEEP_IDLE, + V_KEEPALIVEIDLE(M_KEEPALIVEIDLE), + V_KEEPALIVEIDLE(ms_to_tcp_ticks(sc, v))); + } + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_interval", &v)) { + t4_set_reg_field(sc, A_TP_KEEP_INTVL, + V_KEEPALIVEINTVL(M_KEEPALIVEINTVL), + V_KEEPALIVEINTVL(ms_to_tcp_ticks(sc, v))); + } + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_count", &v)) { + v &= M_KEEPALIVEMAXR1; + t4_set_reg_field(sc, A_TP_SHIFT_CNT, + V_KEEPALIVEMAXR1(M_KEEPALIVEMAXR1) | + V_KEEPALIVEMAXR2(M_KEEPALIVEMAXR2), + V_KEEPALIVEMAXR1(1) | V_KEEPALIVEMAXR2(v)); + } + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_min", &v)) { + t4_set_reg_field(sc, A_TP_RXT_MIN, + V_RXTMIN(M_RXTMIN), V_RXTMIN(ms_to_tcp_ticks(sc, v))); + } + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_max", &v)) { + t4_set_reg_field(sc, A_TP_RXT_MAX, + V_RXTMAX(M_RXTMAX), V_RXTMAX(ms_to_tcp_ticks(sc, v))); + } + if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_count", &v)) { + v &= M_RXTSHIFTMAXR1; + t4_set_reg_field(sc, A_TP_SHIFT_CNT, + V_RXTSHIFTMAXR1(M_RXTSHIFTMAXR1) | + V_RXTSHIFTMAXR2(M_RXTSHIFTMAXR2), + V_RXTSHIFTMAXR1(1) | V_RXTSHIFTMAXR2(v)); + } + for (i = 0; i < 16; i++) { + snprintf(s, sizeof(s), "hw.cxgbe.toe.rexmt_backoff.%d", i); + if (TUNABLE_INT_FETCH(s, &v)) { + v &= M_TIMERBACKOFFINDEX0; + shift = (i & 3) << 3; + t4_set_reg_field(sc, A_TP_TCP_BACKOFF_REG0 + (i & ~3), + M_TIMERBACKOFFINDEX0 << shift, v << shift); + } + } return (0); } @@ -5255,6 +5307,9 @@ t4_sysctls(struct adapter *sc) #ifdef TCP_OFFLOAD if (is_offload(sc)) { + int i; + char s[4]; + /* * dev.t4nex.X.toe. */ @@ -5301,11 +5356,11 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_min", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MIN, - sysctl_tp_timer, "LU", "Retransmit min (us)"); + sysctl_tp_timer, "LU", "Minimum retransmit interval (us)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_max", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MAX, - sysctl_tp_timer, "LU", "Retransmit max (us)"); + sysctl_tp_timer, "LU", "Maximum retransmit interval (us)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "persist_min", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_PERS_MIN, @@ -5317,11 +5372,11 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_idle", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_IDLE, - sysctl_tp_timer, "LU", "Keepidle idle timer (us)"); + sysctl_tp_timer, "LU", "Keepalive idle timer (us)"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_intvl", + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_interval", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_INTVL, - sysctl_tp_timer, "LU", "Keepidle interval (us)"); + sysctl_tp_timer, "LU", "Keepalive interval timer (us)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "initial_srtt", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_INIT_SRTT, @@ -5330,6 +5385,31 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "finwait2_timer", CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_FINWAIT2_TIMER, sysctl_tp_timer, "LU", "FINWAIT2 timer (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "syn_rexmt_count", + CTLTYPE_UINT | CTLFLAG_RD, sc, S_SYNSHIFTMAX, + sysctl_tp_shift_cnt, "IU", + "Number of SYN retransmissions before abort"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_count", + CTLTYPE_UINT | CTLFLAG_RD, sc, S_RXTSHIFTMAXR2, + sysctl_tp_shift_cnt, "IU", + "Number of retransmissions before abort"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_count", + CTLTYPE_UINT | CTLFLAG_RD, sc, S_KEEPALIVEMAXR2, + sysctl_tp_shift_cnt, "IU", + "Number of keepalive probes before abort"); + + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "rexmt_backoff", + CTLFLAG_RD, NULL, "TOE retransmit backoffs"); + children = SYSCTL_CHILDREN(oid); + for (i = 0; i < 16; i++) { + snprintf(s, sizeof(s), "%u", i); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, s, + CTLTYPE_UINT | CTLFLAG_RD, sc, i, sysctl_tp_backoff, + "IU", "TOE retransmit backoff"); + } } #endif } @@ -8148,6 +8228,40 @@ sysctl_tp_timer(SYSCTL_HANDLER_ARGS) v = tp_tick_us * t4_read_reg(sc, reg); return (sysctl_handle_long(oidp, &v, 0, req)); +} + +/* + * All fields in TP_SHIFT_CNT are 4b and the starting location of the field is + * passed to this function. + */ +static int +sysctl_tp_shift_cnt(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int idx = arg2; + u_int v; + + MPASS(idx >= 0 && idx <= 24); + + v = (t4_read_reg(sc, A_TP_SHIFT_CNT) >> idx) & 0xf; + + return (sysctl_handle_int(oidp, &v, 0, req)); +} + +static int +sysctl_tp_backoff(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int idx = arg2; + u_int shift, v, r; + + MPASS(idx >= 0 && idx < 16); + + r = A_TP_TCP_BACKOFF_REG0 + (idx & ~3); + shift = (idx & 3) << 3; + v = (t4_read_reg(sc, r) >> shift) & M_TIMERBACKOFFINDEX0; + + return (sysctl_handle_int(oidp, &v, 0, req)); } #endif From owner-svn-src-all@freebsd.org Mon Jul 24 19:21:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B7C5D7E140; Mon, 24 Jul 2017 19:21:11 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAB26757C9; Mon, 24 Jul 2017 19:21:10 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x236.google.com with SMTP id 123so61051266pgj.1; Mon, 24 Jul 2017 12:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=L8qjweKuRhgNUPIRyduoKoPIagU9oEB9tfLMsYBoUrA=; b=lfYup6rwtr0eXd8hfRDZrc+TQO5nCRptnwKhwMpriq/DZ3FrcFDYUyebCpfv+A8vIe O8g6Sn/3pwK+0GWj2qtSS8z+ZDo4Z8EoPAclYREfULd25TwvqBielB/4Dxgd20QkUXVp WFBt9qN1UrpO338zRvnZKihMGjNT6MtdDnyuDeKOVKuNwHcynL4M1wd3beN4cV7DaMyx buyr9NlbpAFLUwVYFzkP57RsnvI64mnIWaZV9LOJuz0r1047ekHYh6OdTEcIRW8NvKR+ iWBTa2+YoEBkvhptjKRxDI8RsVxNtrWyVFmTXTb/4jLQbOEV+VmE1lpdZ5etmT4VE7oE o/FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=L8qjweKuRhgNUPIRyduoKoPIagU9oEB9tfLMsYBoUrA=; b=rg2bESn7R7BYlWoS7VUjMcSwB4B/82eLrSmZvy+rGh8lkm5CMA5mmm2VOXcqhS/Nxr sxcWAm/ZS3yhTlw5YDe8NMsfIX96FCghHepp0WBMOwGVGdshXPzbxKPd5BBc+1j8vLA8 DLOX82+/gOF2r+srgMukw3AcoSESDIkqrgYRSOQVfS/RHG54jaOyNy9Pqs1xSi0zfHjT F2532HQwOsWuWC61V3+QdrK8FOY3NuiSKMNH5r5ZQE39IMWX+hceIDYMUkAmhfrAwmE8 XLKYcWzfQdLB1L/3PUntIZncoG9DkTDxxFakqxVmCBAY68t7NMHeNcPyq410+Erm9qYY i1tQ== X-Gm-Message-State: AIVw112W49cj2GIt9i4glhM3h78qIOLGQlvLAR8RwccAxGtaDPFjM7zW SgjPBWHiT4ICbx8/IQQ= X-Received: by 10.98.31.201 with SMTP id l70mr17366871pfj.128.1500924070174; Mon, 24 Jul 2017 12:21:10 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id j1sm21240688pgs.77.2017.07.24.12.21.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Jul 2017 12:21:09 -0700 (PDT) Subject: Re: svn commit: r321434 - head Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_9AC419B1-619E-43F6-B2F3-1B6100293EF6"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201707241854.v6OIsumD041710@repo.freebsd.org> Date: Mon, 24 Jul 2017 12:21:07 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <747A1C1C-43F4-4E91-B3B8-B23473BCE571@gmail.com> References: <201707241854.v6OIsumD041710@repo.freebsd.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 19:21:11 -0000 --Apple-Mail=_9AC419B1-619E-43F6-B2F3-1B6100293EF6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 24, 2017, at 11:54, Bryan Drewery wrote: >=20 > Author: bdrewery > Date: Mon Jul 24 18:54:56 2017 > New Revision: 321434 > URL: https://svnweb.freebsd.org/changeset/base/321434 >=20 > Log: > Add some .ORDER for distrib-dirs, distribute, distribution and = distribute world. The why could have helped explain this: 'This helps fix parallel =E2=80=9Cmake installworld=E2=80=9D with newly = created directories=E2=80=9D Thanks for fixing this ;)! -Ngie --Apple-Mail=_9AC419B1-619E-43F6-B2F3-1B6100293EF6 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZdkikAAoJEPWDqSZpMIYVR/IP/iNy1d1mMN7OqjxD6WlrYm0D jXHuXw9Kktv8UMYQ2Nfn9fVMzmPacu79dFHLQlXAYHa2B4GOZMpdMWfassz0x1Sn gVTMEoNp41nJ4WHnfuali+RDIy09yrPf+0r5ZgMSYPntPJnq123mfk+/P+4MQrcL 4QX+3NviGjUoTXmvjL8yhXIIBm5ES85tFRhg8Uv0GdM6028p1SfLjHTdKY7x9rum IZMtz9Y2ZXegredXhr+fuHrkpgVeJqEdKHn68Asx5Lbae9+zb5BgZHqB7QWb09sL gyQipDjdQ51LW83aifZ0/eBKm0yT3Zpm8UlH+FIm50Oao4FtO9aDwLKpzXnPou0e R1osnAjihxX/qx/S1STcDEvMBFtCwsC53Zd/Rm2veNbKDYnNJ9//WztCZPIPPPCS nzObQ1DWMN+SmGeohzarkVXJq2xw2vIUkkznhvIQqkTZMBXRicLY3nP2NEdJxS4Q Dj6ZiXItCV2/6FAfL0R/Yx4GGSNeABEPZrA0bkMZMY9m8JYLo2lXj6kZgPE8kp2D N5ton30s/A5Ran3nBrjVTwB1EqoPgAa7mk3Ngf7GKCGSR9EEmEOF25uAVhbV+VbR WnYzo0fosMA+Iqh2fr5byYSEC0wvIHYI3Ifyrya30Fl2HjTbatxc/aqPs2lc5ovz KbEE5o1MjY116Tf8AodJ =0ewn -----END PGP SIGNATURE----- --Apple-Mail=_9AC419B1-619E-43F6-B2F3-1B6100293EF6-- From owner-svn-src-all@freebsd.org Mon Jul 24 21:25:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F75FDA45CB; Mon, 24 Jul 2017 21:25:51 +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 D0F087D12A; Mon, 24 Jul 2017 21:25:50 +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 v6OLPngS002623; Mon, 24 Jul 2017 21:25:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OLPnNN002622; Mon, 24 Jul 2017 21:25:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707242125.v6OLPnNN002622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Jul 2017 21:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321436 - head/usr.bin/ar X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/ar X-SVN-Commit-Revision: 321436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 21:25:51 -0000 Author: emaste Date: Mon Jul 24 21:25:49 2017 New Revision: 321436 URL: https://svnweb.freebsd.org/changeset/base/321436 Log: ar: handle partial writes from archive_write_data libarchive may limit a single archive_write_data call to handling 0x7fffffff bytes. Add a loop to handle partial writes. Reviewed by: kib, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11715 Modified: head/usr.bin/ar/write.c Modified: head/usr.bin/ar/write.c ============================================================================== --- head/usr.bin/ar/write.c Mon Jul 24 19:17:13 2017 (r321435) +++ head/usr.bin/ar/write.c Mon Jul 24 21:25:49 2017 (r321436) @@ -586,10 +586,17 @@ prefault_buffer(const char *buf, size_t s) static void write_data(struct bsdar *bsdar, struct archive *a, const void *buf, size_t s) { + ssize_t written; + prefault_buffer(buf, s); - if (archive_write_data(a, buf, s) != (ssize_t)s) - bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", - archive_error_string(a)); + while (s > 0) { + written = archive_write_data(a, buf, s); + if (written < 0) + bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", + archive_error_string(a)); + buf = (const char *)buf + written; + s -= written; + } } /* From owner-svn-src-all@freebsd.org Mon Jul 24 21:51:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FF8DA94C6; Mon, 24 Jul 2017 21:51: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 5C9337E2CC; Mon, 24 Jul 2017 21:51:42 +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 v6OLpfv5013846; Mon, 24 Jul 2017 21:51:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OLpfkR013845; Mon, 24 Jul 2017 21:51:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707242151.v6OLpfkR013845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Jul 2017 21:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321437 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 321437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 21:51:42 -0000 Author: markj Date: Mon Jul 24 21:51:41 2017 New Revision: 321437 URL: https://svnweb.freebsd.org/changeset/base/321437 Log: Fix style and wrap lines to 80 columns in savecore.c. No functional change intended. MFC after: 3 days Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Mon Jul 24 21:25:49 2017 (r321436) +++ head/sbin/savecore/savecore.c Mon Jul 24 21:51:41 2017 (r321437) @@ -101,30 +101,39 @@ static sig_atomic_t got_siginfo; static void infohandler(int); static void -printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *device, - int bounds, const int status) +printheader(xo_handle_t *xo, const struct kerneldumpheader *h, + const char *device, int bounds, const int status) { uint64_t dumplen; time_t t; const char *stat_str; xo_flush_h(xo); - xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", device); - xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", h->architecture); - xo_emit_h(xo, "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", dtoh32(h->architectureversion)); + xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", + device); + xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", + h->architecture); + xo_emit_h(xo, + "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", + dtoh32(h->architectureversion)); dumplen = dtoh64(h->dumplength); - xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", (long long)dumplen); - xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize)); + xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", + (long long)dumplen); + xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", + dtoh32(h->blocksize)); + t = dtoh64(h->dumptime); xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname); xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic); - xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring); - xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring); + xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", + h->versionstring); + xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", + h->panicstring); xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity); xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds); - switch(status) { + switch (status) { case STATUS_BAD: stat_str = "bad"; break; @@ -133,13 +142,15 @@ printheader(xo_handle_t *xo, const struct kerneldumphe break; default: stat_str = "unknown"; + break; } xo_emit_h(xo, "{P: }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str); xo_flush_h(xo); } static int -getbounds(void) { +getbounds(void) +{ FILE *fp; char buf[6]; int ret; @@ -170,7 +181,8 @@ getbounds(void) { } static void -writebounds(int bounds) { +writebounds(int bounds) +{ FILE *fp; if ((fp = fopen("bounds", "w")) == NULL) { @@ -397,8 +409,8 @@ DoRegularFile(int fd, bool isencrypted, off_t dumpsize /* * At this point, we have a partial ordering: * nw <= hs <= he <= nr - * If hs > nw, buf[nw..hs] contains non-zero data. - * If he > hs, buf[hs..he] is all zeroes. + * If hs > nw, buf[nw..hs] contains non-zero + * data. If he > hs, buf[hs..he] is all zeroes. */ if (hs > nw) if (fwrite(buf + nw, hs - nw, 1, fp) @@ -705,7 +717,7 @@ DoFile(const char *savedir, const char *device) goto closefd; } - oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/ + oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file. */ isencrypted = (dumpkeysize > 0); if (compress) { snprintf(corename, sizeof(corename), "%s.%d.gz", @@ -960,7 +972,8 @@ main(int argc, char **argv) } else if (nsaved == 0) { if (nerr != 0) { if (verbose) - syslog(LOG_WARNING, "unsaved dumps found but not saved"); + syslog(LOG_WARNING, + "unsaved dumps found but not saved"); exit(1); } else if (verbose) syslog(LOG_WARNING, "no unsaved dumps found"); From owner-svn-src-all@freebsd.org Mon Jul 24 23:32:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D58F3DAB6C9; Mon, 24 Jul 2017 23:32:25 +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 A355381040; Mon, 24 Jul 2017 23:32:25 +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 v6ONWO1e055287; Mon, 24 Jul 2017 23:32:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONWOdo055285; Mon, 24 Jul 2017 23:32:24 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707242332.v6ONWOdo055285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 23:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321439 - in head: . lib/clang/libllvm X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: . lib/clang/libllvm X-SVN-Commit-Revision: 321439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:32:25 -0000 Author: bdrewery Date: Mon Jul 24 23:32:24 2017 New Revision: 321439 URL: https://svnweb.freebsd.org/changeset/base/321439 Log: Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm. The files are only ever generated to .OBJDIR, not to WORLDTMP (as a sysroot) and are only ever included from a compilation. So using a beforebuild target here removes the file before the compilation tries to include it. MFC after: 2 months X-MFC-With: r321369 Modified: head/Makefile.inc1 head/lib/clang/libllvm/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 24 22:26:48 2017 (r321438) +++ head/Makefile.inc1 Mon Jul 24 23:32:24 2017 (r321439) @@ -813,16 +813,6 @@ _worldtmp: .PHONY ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.* .endif .endfor -# 20170724 remove stale lib/clang/libllvm/Options.inc file, of which there are -# two different versions after r308421, one for llvm-lib, one for llvm-dlltool -.for d in ${OBJTREE} ${WORLDTMP} -.for f in ${d}${.CURDIR}/lib/clang/libllvm/Options.inc -.if exists(${f}) || exists(${f}.d) - @echo Removing stale generated ${f} files - @rm -f ${f} ${f}.d -.endif -.endfor -.endfor .for _dir in \ lib lib/casper usr legacy/bin legacy/usr mkdir -p ${WORLDTMP}/${_dir} Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Mon Jul 24 22:26:48 2017 (r321438) +++ head/lib/clang/libllvm/Makefile Mon Jul 24 23:32:24 2017 (r321439) @@ -1302,6 +1302,16 @@ llvm-dlltool/Options.inc: ${LLVM_SRCS}/lib/ToolDrivers TGHDRS+= llvm-dlltool/Options.inc CFLAGS.DlltoolDriver.cpp+= -I${.OBJDIR}/llvm-dlltool +beforebuild: +# 20170724 remove stale Options.inc file, of which there are two different +# versions after r308421, one for llvm-lib, one for llvm-dlltool +.for f in Options.inc +.if exists(${f}) || exists(${f}.d) + @echo Removing stale generated ${f} files + @rm -f ${f} ${f}.d +.endif +.endfor + # Note: some rules are superfluous, not every combination is valid. .for arch in \ AArch64/AArch64 ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86 From owner-svn-src-all@freebsd.org Mon Jul 24 23:32:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FDBBDAB6F5; Mon, 24 Jul 2017 23:32:38 +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 0D3D0810F8; Mon, 24 Jul 2017 23:32:37 +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 v6ONWbLF055338; Mon, 24 Jul 2017 23:32:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONWa1G055336; Mon, 24 Jul 2017 23:32:36 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707242332.v6ONWa1G055336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 23:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321440 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 321440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:32:38 -0000 Author: bdrewery Date: Mon Jul 24 23:32:36 2017 New Revision: 321440 URL: https://svnweb.freebsd.org/changeset/base/321440 Log: Slightly simplify logic for which depend file is expected. This is a NOP. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/sys/conf/kern.post.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Mon Jul 24 23:32:24 2017 (r321439) +++ head/share/mk/bsd.dep.mk Mon Jul 24 23:32:36 2017 (r321440) @@ -240,8 +240,12 @@ _meta_obj= ${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta _meta_obj= ${__obj}.meta .endif _dep_obj= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}} -.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${_meta_obj})) || \ - (!defined(_meta_filemon) && !exists(${.OBJDIR}/${_dep_obj})) +.if defined(_meta_filemon) +_depfile= ${.OBJDIR}/${_meta_obj} +.else +_depfile= ${.OBJDIR}/${_dep_obj} +.endif +.if !exists(${_depfile}) ${__obj}: ${OBJS_DEPEND_GUESS} ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} .elif defined(_meta_filemon) @@ -252,7 +256,7 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} # guesses do include headers though since they may not be in SRCS. ${__obj}: ${OBJS_DEPEND_GUESS:N*.h} ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} -.endif +.endif # !exists(${_depfile}) .endfor # Always run 'make depend' to generate dependencies early and to avoid the Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Mon Jul 24 23:32:24 2017 (r321439) +++ head/sys/conf/kern.post.mk Mon Jul 24 23:32:36 2017 (r321440) @@ -259,8 +259,12 @@ beforebuild: kernel-depend # For meta+filemon the .meta file is checked for since it is the dependency # file used. .for __obj in ${DEPENDOBJS:O:u} -.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \ - (!defined(_meta_filemon) && !exists(${.OBJDIR}/.depend.${__obj})) +.if defined(_meta_filemon) +_depfile= ${.OBJDIR}/${__obj}.meta +.else +_depfile= ${.OBJDIR}/.depend.${__obj} +.endif +.if !exists(${_depfile}) .if ${SYSTEM_OBJS:M${__obj}} ${__obj}: ${OBJS_DEPEND_GUESS} .endif @@ -275,7 +279,7 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} ${__obj}: ${OBJS_DEPEND_GUESS:N*.h} .endif ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} -.endif +.endif # !exists(${_depfile}) .endfor .NOPATH: .depend ${DEPENDFILES_OBJS} From owner-svn-src-all@freebsd.org Mon Jul 24 23:32:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5927DAB733; Mon, 24 Jul 2017 23:32:44 +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 A07C68119C; Mon, 24 Jul 2017 23:32:44 +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 v6ONWhFW055431; Mon, 24 Jul 2017 23:32:43 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONWhmA055430; Mon, 24 Jul 2017 23:32:43 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707242332.v6ONWhmA055430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 23:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321442 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:32:45 -0000 Author: bdrewery Date: Mon Jul 24 23:32:43 2017 New Revision: 321442 URL: https://svnweb.freebsd.org/changeset/base/321442 Log: The .depend.obj cleanup hacks are only needed with -DNO_CLEAN. Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 24 23:32:40 2017 (r321441) +++ head/Makefile.inc1 Mon Jul 24 23:32:43 2017 (r321442) @@ -770,7 +770,6 @@ _worldtmp: .PHONY fi .endfor .endif # ${USING_SYSTEM_COMPILER} == "yes" -.endif # !defined(NO_CLEAN) # Our current approach to dependency tracking cannot cope with certain source # tree changes, particularly with respect to removing source files and @@ -813,6 +812,9 @@ _worldtmp: .PHONY ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.* .endif .endfor + +.endif # !defined(NO_CLEAN) + .for _dir in \ lib lib/casper usr legacy/bin legacy/usr mkdir -p ${WORLDTMP}/${_dir} From owner-svn-src-all@freebsd.org Mon Jul 24 23:32:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD896DAB712; Mon, 24 Jul 2017 23:32:41 +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 7748A81138; Mon, 24 Jul 2017 23:32:41 +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 v6ONWe0o055385; Mon, 24 Jul 2017 23:32:40 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONWeJO055383; Mon, 24 Jul 2017 23:32:40 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707242332.v6ONWeJO055383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 23:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321441 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 321441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:32:41 -0000 Author: bdrewery Date: Mon Jul 24 23:32:40 2017 New Revision: 321441 URL: https://svnweb.freebsd.org/changeset/base/321441 Log: Allow disabling dependency tracking if DEPEND_CFLAGS is empty. This falls back on using the guesssed dependencies if so. Also remove a pre-bmake check while here. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/sys/conf/kern.post.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Mon Jul 24 23:32:36 2017 (r321440) +++ head/share/mk/bsd.dep.mk Mon Jul 24 23:32:40 2017 (r321441) @@ -195,13 +195,11 @@ ${DEPENDFILE}: .NOMETA DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}} DEPEND_CFLAGS+= -MT${.TARGET} .if !defined(_meta_filemon) -.if defined(.PARSEDIR) +.if !empty(DEPEND_CFLAGS) # Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS # as those are the only ones we will include. DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != "" CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:} -.else -CFLAGS+= ${DEPEND_CFLAGS} .endif .for __depend_obj in ${DEPENDFILES_OBJS} .if ${MAKE_VERSION} < 20160220 Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Mon Jul 24 23:32:36 2017 (r321440) +++ head/sys/conf/kern.post.mk Mon Jul 24 23:32:40 2017 (r321441) @@ -232,13 +232,11 @@ ${DEPENDOBJS}: .NOMETA DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF.depend.${.TARGET} DEPEND_CFLAGS+= -MT${.TARGET} .if !defined(_meta_filemon) -.if defined(.PARSEDIR) +.if !empty(DEPEND_CFLAGS) # Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS # as those are the only ones we will include. DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET}}" != "" CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:} -.else -CFLAGS+= ${DEPEND_CFLAGS} .endif .for __depend_obj in ${DEPENDFILES_OBJS} .if ${MAKE_VERSION} < 20160220 From owner-svn-src-all@freebsd.org Mon Jul 24 23:32:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0103BDAB758; Mon, 24 Jul 2017 23:32:48 +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 C2E94811FF; Mon, 24 Jul 2017 23:32:47 +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 v6ONWkZE055477; Mon, 24 Jul 2017 23:32:46 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONWkn7055476; Mon, 24 Jul 2017 23:32:46 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707242332.v6ONWkn7055476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 24 Jul 2017 23:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321443 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:32:48 -0000 Author: bdrewery Date: Mon Jul 24 23:32:46 2017 New Revision: 321443 URL: https://svnweb.freebsd.org/changeset/base/321443 Log: NO_CLEAN: Utilize delete-old to remove old orphaned libraries/headers in WORLDTMP. This prevents situations with -DNO_CLEAN from finding stale headers or libraries in places that no longer exist or have moved. It avoids the need to remove all of WORLDTMP by reusing what we already know is obsolete. MFC after: 1 month Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 24 23:32:43 2017 (r321442) +++ head/Makefile.inc1 Mon Jul 24 23:32:46 2017 (r321443) @@ -761,6 +761,13 @@ _worldtmp: .PHONY rm -rf ${LIBCOMPATTMP} .endif .else + ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ + delete-old delete-old-libs +.if defined(LIBCOMPAT) + ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ + DESTDIR=${LIBCOMPATTMP} \ + delete-old delete-old-libs +.endif rm -rf ${WORLDTMP}/legacy/usr/include .if ${USING_SYSTEM_COMPILER} == "yes" .for cc in cc c++ From owner-svn-src-all@freebsd.org Mon Jul 24 23:57:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAFADDABF4C; Mon, 24 Jul 2017 23:57:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B86E581E01; Mon, 24 Jul 2017 23:57:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ONvh3Z063825; Mon, 24 Jul 2017 23:57:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ONvhJA063824; Mon, 24 Jul 2017 23:57:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707242357.v6ONvhJA063824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 24 Jul 2017 23:57:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321444 - head/etc X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 321444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 23:57:45 -0000 Author: ngie Date: Mon Jul 24 23:57:43 2017 New Revision: 321444 URL: https://svnweb.freebsd.org/changeset/base/321444 Log: Remove ${MTREE} and leverage etc/mtree/Makefile instead with "make distribution". This also fixes the fact that BSD.debug.dist was being installed if/when ${MK_DEBUG_FILES} != "no" before this commit. MFC after: 2 months Modified: head/etc/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Mon Jul 24 23:32:46 2017 (r321443) +++ head/etc/Makefile Mon Jul 24 23:57:43 2017 (r321444) @@ -152,20 +152,6 @@ BIN1+= regdomain.xml # -rwxr-xr-x root:wheel, for the new cron root:wheel BIN2= netstart pccard_ether rc.suspend rc.resume -MTREE= BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist -.if ${MK_LIB32} != "no" -MTREE+= BSD.lib32.dist -.endif -.if ${MK_LIBSOFT} != "no" -MTREE+= BSD.libsoft.dist -.endif -.if ${MK_TESTS} != "no" -MTREE+= BSD.tests.dist -.endif -.if ${MK_SENDMAIL} != "no" -MTREE+= BSD.sendmail.dist -.endif - PPPCNF= ppp.conf .if ${MK_SENDMAIL} == "no" @@ -254,6 +240,7 @@ distribution: ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install ${_+_}cd ${.CURDIR}/devd; ${MAKE} install ${_+_}cd ${.CURDIR}/gss; ${MAKE} install + ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install .if ${MK_NTP} != "no" ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install @@ -308,8 +295,6 @@ distribution: rm -f ${DESTDIR}/.cshrc; \ ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc .endif - cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${MTREE} ${DESTDIR}/etc/mtree .if ${MK_MAIL} != "no" cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${ETCMAIL} ${DESTDIR}/etc/mail From owner-svn-src-all@freebsd.org Tue Jul 25 00:12:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C3E2DAC28B; Tue, 25 Jul 2017 00:12:49 +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 2909A82492; Tue, 25 Jul 2017 00:12:49 +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 v6P0CmXJ071728; Tue, 25 Jul 2017 00:12:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P0Cm9b071727; Tue, 25 Jul 2017 00:12:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707250012.v6P0Cm9b071727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Jul 2017 00:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321445 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:12:49 -0000 Author: bdrewery Date: Tue Jul 25 00:12:48 2017 New Revision: 321445 URL: https://svnweb.freebsd.org/changeset/base/321445 Log: cleandir: Fix ESTALE errors from parallel removals. This fixes 'make cleandir' to use the same ordering as 'make cleanobj'. Meaning that SUBDIR will be recursed before the current directory is handled. This avoids an 'rm -rf /usr/obj/usr/src/lib/libc' while a child 'rm -rf /usr/obj/usr/src/lib/libc/tests' is being ran next, or even removing the current directory and then recursing into a child and using the 'missing OBJDIR' logic to remove files rather than the directory. The most ideal ordering here would be for 'cleanobj' and 'cleandir' to simply remove the .OBJDIR and then not recurse at all. This is only safe if it is guaranteed that all children directories have no orphaned files in their source checkout and are only using obj directories. This is usually safe from the top-level build targets and when using WITH_AUTO_OBJ. Improving the build for those cases is coming. Reported by: cperciva, scottl X-MFC-With: r321427 MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.obj.mk Modified: head/share/mk/bsd.obj.mk ============================================================================== --- head/share/mk/bsd.obj.mk Mon Jul 24 23:57:43 2017 (r321444) +++ head/share/mk/bsd.obj.mk Tue Jul 25 00:12:48 2017 (r321445) @@ -183,9 +183,9 @@ clean: .endif .ORDER: clean all -cleandir: cleanobj - .include + +cleandir: .WAIT cleanobj .if make(destroy*) && defined(OBJROOT) # this (rm -rf objdir) is much faster and more reliable than cleaning. From owner-svn-src-all@freebsd.org Tue Jul 25 00:17:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21692DAC394; Tue, 25 Jul 2017 00:17:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7E9A82656; Tue, 25 Jul 2017 00:17:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 14A50F458; Tue, 25 Jul 2017 00:17:27 +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 E79EF951B; Tue, 25 Jul 2017 00:17:25 +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 wnl870F9KYEB; Tue, 25 Jul 2017 00:17:22 +0000 (UTC) Subject: Re: svn commit: r321444 - head/etc DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 68DEC9516 To: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201707242357.v6ONvhJA063824@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <5890e09f-8983-f458-34cf-3107f288edc1@FreeBSD.org> Date: Mon, 24 Jul 2017 17:17:02 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201707242357.v6ONvhJA063824@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="flwt2961UI6eu2NGGbsGPu309DjCNILcG" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:17:28 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --flwt2961UI6eu2NGGbsGPu309DjCNILcG Content-Type: multipart/mixed; boundary="BG3wdHEtclulSP5bGKhejlFhf1JbFMC21"; protected-headers="v1" From: Bryan Drewery To: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <5890e09f-8983-f458-34cf-3107f288edc1@FreeBSD.org> Subject: Re: svn commit: r321444 - head/etc References: <201707242357.v6ONvhJA063824@repo.freebsd.org> In-Reply-To: <201707242357.v6ONvhJA063824@repo.freebsd.org> --BG3wdHEtclulSP5bGKhejlFhf1JbFMC21 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/24/2017 4:57 PM, Ngie Cooper wrote: > Author: ngie > Date: Mon Jul 24 23:57:43 2017 > New Revision: 321444 > URL: https://svnweb.freebsd.org/changeset/base/321444 >=20 > Log: > Remove ${MTREE} and leverage etc/mtree/Makefile instead with > "make distribution". > =20 > This also fixes the fact that BSD.debug.dist was being installed if/w= hen > ${MK_DEBUG_FILES} !=3D "no" before this commit. This was intentional, see r279248. > =20 > MFC after: 2 months >=20 > Modified: > head/etc/Makefile >=20 > Modified: head/etc/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/etc/Makefile Mon Jul 24 23:32:46 2017 (r321443) > +++ head/etc/Makefile Mon Jul 24 23:57:43 2017 (r321444) > @@ -152,20 +152,6 @@ BIN1+=3D regdomain.xml > # -rwxr-xr-x root:wheel, for the new cron root:wheel > BIN2=3D netstart pccard_ether rc.suspend rc.resume > =20 > -MTREE=3D BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BS= D.var.dist > -.if ${MK_LIB32} !=3D "no" > -MTREE+=3D BSD.lib32.dist > -.endif > -.if ${MK_LIBSOFT} !=3D "no" > -MTREE+=3D BSD.libsoft.dist > -.endif > -.if ${MK_TESTS} !=3D "no" > -MTREE+=3D BSD.tests.dist > -.endif > -.if ${MK_SENDMAIL} !=3D "no" > -MTREE+=3D BSD.sendmail.dist > -.endif > - > PPPCNF=3D ppp.conf > =20 > .if ${MK_SENDMAIL} =3D=3D "no" > @@ -254,6 +240,7 @@ distribution: > ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install > ${_+_}cd ${.CURDIR}/devd; ${MAKE} install > ${_+_}cd ${.CURDIR}/gss; ${MAKE} install > + ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install > ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install > .if ${MK_NTP} !=3D "no" > ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install > @@ -308,8 +295,6 @@ distribution: > rm -f ${DESTDIR}/.cshrc; \ > ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc > .endif > - cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ > - ${MTREE} ${DESTDIR}/etc/mtree > .if ${MK_MAIL} !=3D "no" > cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ > ${ETCMAIL} ${DESTDIR}/etc/mail >=20 --=20 Regards, Bryan Drewery --BG3wdHEtclulSP5bGKhejlFhf1JbFMC21-- --flwt2961UI6eu2NGGbsGPu309DjCNILcG 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 iQEcBAEBAgAGBQJZdo3/AAoJEDXXcbtuRpfPUc0H/1mj7Eq6qOqCZ3qaTcgmrniq sIAusYtlG2H87MHEWqlkA/Uj2VZ1h8I7gPkkkUk3BDEicQ96+od6NTvbme3v/D+x 36aXmN0zb8bnliqqMqpXr/K+eU7gUuTY9Va6iv85zp60gSvVPkP40T9E6lS4tu3S 2tg4lNpujsnDv24sL+LqOmGo+Wmxou0CJYNifa21izD8W7ldWJHXyGK+c7alR/7a H6cHsOMcENYsqxDGJlMt8lunnw8Kh6yQa9hBnoIomnSuO+WKTBOB4w9psfkYwa7p SGMhG0piPEYxoOrya/TvwPfZBmUCu2k7tQmtpltkr7It+ycLHLP1l0Oq6f0BaMI= =32SH -----END PGP SIGNATURE----- --flwt2961UI6eu2NGGbsGPu309DjCNILcG-- From owner-svn-src-all@freebsd.org Tue Jul 25 00:20:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD005DAC42B; Tue, 25 Jul 2017 00:20:04 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (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 78792827A2; Tue, 25 Jul 2017 00:20:04 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x243.google.com with SMTP id y129so13032723pgy.3; Mon, 24 Jul 2017 17:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=o+EZU7J30xq6GwzbQ9EbxUPFiAWPTWeqNPG4aGQxVYU=; b=DYI9feirtkh5QUc8dy4gOlGhUIEDyOOrvYDYmok9WmBqc1oLlCW7IXuxxrX33+jkId Z2SisGb7P88bFmr5oyIAoIiMqMN/olxrTqC3w6Nva5SJIsxCL2rrPEXmmcKfvNwz3cgt qQHH+sAPJ9UGak4JgCenV+yP6j5ap+EejyAu65zw4ycJJq8Kktlkg0FomqrKbjCsmdJ1 curtoBkNa7DYOHXlZ4wlmWW401GeftlLGv3/5bNHurLt/pvL3AB3GYM6AFoynJ3R86Q2 zcnDkomI931qwMhmW8FLnxvexmjscaOnK3uMTp7lyQqKSaGhk1HN3U2GinCn1+V7Dyka 7Mrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=o+EZU7J30xq6GwzbQ9EbxUPFiAWPTWeqNPG4aGQxVYU=; b=g5ialeanTaMtnfUuIfq5Dj0xPSoNXfrpZn/1SnYLjAUt4EAgDP1d9JFaeAtYD6BeK1 qCGT8QXBZWP0MIUXnMPjiR4rsFrUrEC1M4glblA1MkWbrpMIw8oaieoyD8FDIbIHTpX0 3ad5xUKd2bqbkvLGcAa0asT2FgPLRZWp/ZrKz6nJL6R7DfgUfAk87U/IdPxjT95GWsUX dUzbg4CcTt/kk6L632qurXbjIB06IO0ZRJDcTiCxAK1tm1xCnbY2NHxABuf2CUFCq3sP 2YH8n19IAOE+dDnVlCGMq6C3Q6eb7qECrXPTcHbRAAo3r6mAx/GWnIzI4wwSO1OSlCnz 52lA== X-Gm-Message-State: AIVw113GdhmtcB3pt7s/VDdlA2tMWB2D9OqIMJm1vKljYsjO4TXXMnCG twvo+yT2WE0SffeZOdM= X-Received: by 10.98.129.3 with SMTP id t3mr17691370pfd.167.1500942003680; Mon, 24 Jul 2017 17:20:03 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id e24sm1071802pfk.180.2017.07.24.17.20.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Jul 2017 17:20:02 -0700 (PDT) Subject: Re: svn commit: r321444 - head/etc Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_12DCF526-51C1-4587-97BB-6BAD3F69993B"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <5890e09f-8983-f458-34cf-3107f288edc1@FreeBSD.org> Date: Mon, 24 Jul 2017 17:20:01 -0700 Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201707242357.v6ONvhJA063824@repo.freebsd.org> <5890e09f-8983-f458-34cf-3107f288edc1@FreeBSD.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:20:04 -0000 --Apple-Mail=_12DCF526-51C1-4587-97BB-6BAD3F69993B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 24, 2017, at 17:17, Bryan Drewery wrote: >=20 > On 7/24/2017 4:57 PM, Ngie Cooper wrote: >> Author: ngie >> Date: Mon Jul 24 23:57:43 2017 >> New Revision: 321444 >> URL: https://svnweb.freebsd.org/changeset/base/321444 >>=20 >> Log: >> Remove ${MTREE} and leverage etc/mtree/Makefile instead with >> "make distribution". >>=20 >> This also fixes the fact that BSD.debug.dist was being installed = if/when >> ${MK_DEBUG_FILES} !=3D "no" before this commit. >=20 > This was intentional, see r279248. Ok. It would have been nice if there had been a comment added noting = that it was being unconditionally installed for a reason. I=E2=80=99ll add a relevant comment to etc/mtree/Makefile and restore = the previous behavior (it was silly having duplicative logic in two = places, since etc/mtree/Makefile wasn=E2=80=99t actually being used). Thanks, -Ngie --Apple-Mail=_12DCF526-51C1-4587-97BB-6BAD3F69993B 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZdo6xAAoJEPWDqSZpMIYVJZgP/RQuVoCF6bw1DvbM5P799khr VsVov5H+T8NjTBOvMSyrV0GYQNSE+G1JNQXnY30Lo6AQWfKyxmIOiFbSpbiEqnN6 /kcRDTCUcwTr5pxd78XTztWWaPfYWf6S0ZuSmHJAqgUNQSq9Kqk9AdEcyFuW09GI uNu2+kaLBh77gtPvB86TuLmx6clD/dyXfxSK5kitcJfpALvEky4VTq29/Zs6gu6b wYmkGj6tOmxTEK2ghTaH4JTzcXcq6U/I/j1aYWXWwQAiw2ABfQmON7NreEaRdeDN yuYFdLm6O05yb6cgprDJT9jUc4Yw4cTBl/xnGwpxxZrWdsGI2ZKu5Hvik5qtoIyc gelnaT1KHqW05WEzMLK+6bNUYYrIFxpVYNtkeBOvTZiKZtIAn5b/h6KexittZs4x gDRAVMF7caQsVuhGAlUEHvLHSclQa591MBQa4SL2r6/1bYtkscWx4g4hlRYilHb/ wOwm5HSfL0WTXF467bzhdAdyVhWYRp34Zv4BG48b0X0KgVhYwltJH9HRpL3AAOc5 KqqJsxMGaBW1X/Fi5hp1D18bJYxLklD1LB6h/mJXTGO+BnMoy3lcS7BmnCkz+Qdc 49+kgZcsxDncTjKPlBuNkcSbFchPYRelCEmpocpMBDO8AmXM0DBl+2nXFkXXcFbg Fs1MItDHEKutU+czLaPx =X+6O -----END PGP SIGNATURE----- --Apple-Mail=_12DCF526-51C1-4587-97BB-6BAD3F69993B-- From owner-svn-src-all@freebsd.org Tue Jul 25 00:28:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6C1EDAC66A; Tue, 25 Jul 2017 00:28:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0A9E82B85; Tue, 25 Jul 2017 00:28:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6P0SNcA076027; Tue, 25 Jul 2017 00:28:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P0SNlW076026; Tue, 25 Jul 2017 00:28:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707250028.v6P0SNlW076026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 00:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321446 - head/etc/mtree X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/etc/mtree X-SVN-Commit-Revision: 321446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:28:25 -0000 Author: ngie Date: Tue Jul 25 00:28:23 2017 New Revision: 321446 URL: https://svnweb.freebsd.org/changeset/base/321446 Log: Unconditionally install etc/mtree/BSD.debug.dist again r279248 unconditionally installed BSD.debug.dist for ease-of-developer-use. Restore the previous behavior. While here, add a comment to note that this is intentional to avoid accidental future removal. MFC after: 2 months MFC with: r321444 Modified: head/etc/mtree/Makefile Modified: head/etc/mtree/Makefile ============================================================================== --- head/etc/mtree/Makefile Tue Jul 25 00:12:48 2017 (r321445) +++ head/etc/mtree/Makefile Tue Jul 25 00:28:23 2017 (r321446) @@ -2,7 +2,9 @@ .include -FILES= ${_BSD.debug.dist} \ +# NOTE: BSD.debug.dist is unconditionally installed for developer ease-of-use. +FILES= \ + BSD.debug.dist \ BSD.include.dist \ BSD.root.dist \ ${_BSD.lib32.dist} \ @@ -12,9 +14,6 @@ FILES= ${_BSD.debug.dist} \ BSD.usr.dist \ BSD.var.dist -.if ${MK_DEBUG_FILES} != "no" -_BSD.debug.dist= BSD.debug.dist -.endif .if ${MK_LIB32} != "no" _BSD.lib32.dist= BSD.lib32.dist .endif From owner-svn-src-all@freebsd.org Tue Jul 25 00:28:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6A28DAC68B; Tue, 25 Jul 2017 00:28:30 +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 7401C82B9B; Tue, 25 Jul 2017 00:28:30 +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 v6P0STwU076078; Tue, 25 Jul 2017 00:28:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P0STIp076077; Tue, 25 Jul 2017 00:28:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707250028.v6P0STIp076077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 25 Jul 2017 00:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321447 - stable/11/sbin/savecore X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sbin/savecore X-SVN-Commit-Revision: 321447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:28:30 -0000 Author: markj Date: Tue Jul 25 00:28:29 2017 New Revision: 321447 URL: https://svnweb.freebsd.org/changeset/base/321447 Log: MFC r320896: Add a subroutine for comparing kerneldump identifiers. Modified: stable/11/sbin/savecore/savecore.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/savecore/savecore.c ============================================================================== --- stable/11/sbin/savecore/savecore.c Tue Jul 25 00:28:23 2017 (r321446) +++ stable/11/sbin/savecore/savecore.c Tue Jul 25 00:28:29 2017 (r321447) @@ -308,6 +308,13 @@ check_space(const char *savedir, off_t dumpsize, int b return (1); } +static bool +compare_magic(const struct kerneldumpheader *kdh, const char *magic) +{ + + return (strncmp(kdh->magic, magic, sizeof(kdh->magic)) == 0); +} + #define BLOCKSIZE (1<<12) #define BLOCKMASK (~(BLOCKSIZE-1)) @@ -534,7 +541,7 @@ DoFile(const char *savedir, const char *device) } memcpy(&kdhl, temp, sizeof(kdhl)); istextdump = 0; - if (strncmp(kdhl.magic, TEXTDUMPMAGIC, sizeof kdhl) == 0) { + if (compare_magic(&kdhl, TEXTDUMPMAGIC)) { if (verbose) printf("textdump magic on last dump header on %s\n", device); @@ -548,8 +555,7 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; } - } else if (memcmp(kdhl.magic, KERNELDUMPMAGIC, sizeof kdhl.magic) == - 0) { + } else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) { if (dtoh32(kdhl.version) != KERNELDUMPVERSION) { syslog(LOG_ERR, "unknown version (%d) in last dump header on %s", @@ -568,8 +574,7 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; - if (memcmp(kdhl.magic, KERNELDUMPMAGIC_CLEARED, - sizeof kdhl.magic) == 0) { + if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) { if (verbose) printf("forcing magic on %s\n", device); memcpy(kdhl.magic, KERNELDUMPMAGIC, From owner-svn-src-all@freebsd.org Tue Jul 25 00:30:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0892FDAC761; Tue, 25 Jul 2017 00:30:27 +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 C5C8E82E07; Tue, 25 Jul 2017 00:30:26 +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 v6P0UPbl076203; Tue, 25 Jul 2017 00:30:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P0UPhY076202; Tue, 25 Jul 2017 00:30:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707250030.v6P0UPhY076202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 25 Jul 2017 00:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321448 - stable/11/sbin/savecore X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sbin/savecore X-SVN-Commit-Revision: 321448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:30:27 -0000 Author: markj Date: Tue Jul 25 00:30:25 2017 New Revision: 321448 URL: https://svnweb.freebsd.org/changeset/base/321448 Log: Include stdbool.h for r321447. This is a direct commit to stable/11. Modified: stable/11/sbin/savecore/savecore.c Modified: stable/11/sbin/savecore/savecore.c ============================================================================== --- stable/11/sbin/savecore/savecore.c Tue Jul 25 00:28:29 2017 (r321447) +++ stable/11/sbin/savecore/savecore.c Tue Jul 25 00:30:25 2017 (r321448) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Tue Jul 25 00:31:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5678DAC959; Tue, 25 Jul 2017 00:31:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (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 A170B83101; Tue, 25 Jul 2017 00:31:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id g14so8391474pgu.4; Mon, 24 Jul 2017 17:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=dWfgSyEJjFyjoF9eQeVvrBfVyN2l/HYHfZ/6//en280=; b=mTzJP7yTL2gwielauXLPBfVFIac4zLm++tjH1EYtR4oM5aJM/0feOZvzuTeSL8jW4z DoN4UkuQvbrvVIKkrciyn5UDo7JLKo/9wzo+14ClSCWm4MNHWroTHZ06x0q/3rDjJh5J kxCooYuGX5rleO1lZETH56VT4hDOciJQZfFTFaXPzx10p9jO6KPfn5/aHWrZOer+BbTg yXFcKWR9JfD4K8lyXw6OIaNnRahqpG/M14YiLNYRGYambZbksLtdy2hv0iMwuZhINL3S OYMB2Mpt3Gdo6RJycECvjJTF7dyzkZPUjRv6wVlnoM9Ov/9NnTIed4jTBG8fBvy4neNI 3vfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=dWfgSyEJjFyjoF9eQeVvrBfVyN2l/HYHfZ/6//en280=; b=fKgfN+LQcy+jGYVxV+cihGPCchJA/cq4OPiZ+rgU8OU0QXqin/YmZT7KT79lqMM3ko skAMsQ70gkyUOmkHCeDRAsXwdjQDzng1jjhlTncuaEQCp7veUR3kowObrMnt4kxmMrP9 e5x9XG5WJAhQrx5Irah/rd7O08dFqFKv8yq6NtG9fsr+Ts8qgoMEjQMVT9kg6Vm7WBt9 s3SpMmC/964iovJ/O1zR1UQKgh91Kq+mQzfTz04hbDyjHHw/AVxMJPNRETMgZWUVSa0r qH25klPNpbK6eIEvjNfR0NH1ZqIUhRXQV1ddRzXcY5uVYYWRrTEl/SvOkl6t+usoNmlX 6VGA== X-Gm-Message-State: AIVw110mDGY8XB8s2m1uQ+6AVG0A0KEsmcNFhSo343rJR3zTyS8OA5C2 3s6J6cft9DlikFYVupw= X-Received: by 10.84.191.164 with SMTP id a33mr19411263pld.119.1500942719070; Mon, 24 Jul 2017 17:31:59 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id y12sm21334475pgs.91.2017.07.24.17.31.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Jul 2017 17:31:58 -0700 (PDT) Subject: Re: svn commit: r321448 - stable/11/sbin/savecore Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_56CFB916-9546-4FDD-8072-257063ABC673"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201707250030.v6P0UPhY076202@repo.freebsd.org> Date: Mon, 24 Jul 2017 17:31:57 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Message-Id: <51FECB6B-0838-4A93-9584-50623946FB14@gmail.com> References: <201707250030.v6P0UPhY076202@repo.freebsd.org> To: Mark Johnston X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:31:59 -0000 --Apple-Mail=_56CFB916-9546-4FDD-8072-257063ABC673 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 24, 2017, at 17:30, Mark Johnston wrote: >=20 > Author: markj > Date: Tue Jul 25 00:30:25 2017 > New Revision: 321448 > URL: https://svnweb.freebsd.org/changeset/base/321448 >=20 > Log: > Include stdbool.h for r321447. >=20 > This is a direct commit to stable/11. Shouldn=E2=80=99t the pollution be committed to ^/head and backported = instead of doing a direct commit? Thanks, -Ngie --Apple-Mail=_56CFB916-9546-4FDD-8072-257063ABC673 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZdpF9AAoJEPWDqSZpMIYV+yEP/1i9e7Umzzjve/Lmu42gERkE dZ7i/EtKrh4N72EcR3oLg6O/zVKhYwA2Pv9PYJ0EIazYNPlBcseaqzupaNhw9yKx pwpgixxUugHSQwFw2VLs6Qy8P1CU/AczYI6s+jE3ePGsGdCkLASbiThUcSeQYORx 60pwpcJL9lVyU/x+gZmsQZcJhcodI3nuyHbOZ+GZ60f6p9RQ9i2JXyKHs/t5vuBm pdGt2elxTrW57NibGGfujRnGOOllfvZ2A4tABiN6BwyR7UB69M3AJ4VxQZepTmd1 b1MJ3bu3KS5D1q3nUW66zyl+aoOnUTrwXA0nX/LmOn7UxEuSMi4pwPBAKZgyF+UQ hq3Y7g3s7du9AdtHsV0Su92REYjQpRrgbbcDhILD/ai40xEkuDPuJRaKtvKlFWGn cpGbfAngSFrHkTCtmivL5iwfe5zGM5xMhxNcIMZATmv9vpFI+VqqHINiK5wVir6P X4kPMgo6dhChOjujiIJHcoW78er6QbsS7qjgOST8SQZaRh0Ma/MKBfgDy9Ah1tTY TOU953cFimf+5RGWSVs41P7TYWTk58nKMttN2wq2AUqa1HTXN7QlUb99V8e9bohw 5QuBjAzKTXuLVsGOhlj6kWnfL7uDtxU+Ddb7Td6oB79apykfCXWtqKUlRLCEy7xj Xdba94CWFYwfTD5B2Fjd =PmU0 -----END PGP SIGNATURE----- --Apple-Mail=_56CFB916-9546-4FDD-8072-257063ABC673-- From owner-svn-src-all@freebsd.org Tue Jul 25 00:37:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C6E7DACBE5; Tue, 25 Jul 2017 00:37:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d: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 E6DC183543; Tue, 25 Jul 2017 00:37:58 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id k2so22537376qkf.0; Mon, 24 Jul 2017 17:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=mPAptb4pngmO5t/41UGzm++nBu329vnCgx0GJ6Uqfak=; b=kO1msF8muSaw+tCCCiiuH9Od03N9WKDPoc9s41+J52i03ximET4RDorGb6fMGGs/Cu 68oDkqzYBinsXxBVs3Zcd0x0aAxk72r22NWOuaFxJX42iyK/DVX/uMYSvmgu0EhM6KTa TSxjNq8nERpMQDmej93SkAjg3skPl/m+q6cxXhaTsTCg3n5DS8c4dbD7yo2Mahxcgg2S lq6DszPeV2K3M1VTORDmWnfKSM4sybodp8pS0EpRzfx10n3Rhsx48RffdDF8lgttP9HW 8Th8M1A+kZ6UMjaYBZoGNIatEM+ir5LVzsNtDZid1XjtZ68fhOVFmDafgEOqFjmUhnje 4iug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=mPAptb4pngmO5t/41UGzm++nBu329vnCgx0GJ6Uqfak=; b=pe8xpmR4O48cf+z4KkUbGuGYQIdKz9vl4f92pyzYftKfoofdykNn0uTrQBdJ8Anra4 NUSuKP42Xlvdhiz85sC8x83TYNiS+eSXFvwBzIoso+60w6G79oehxF6pSK2yxpfVQY/9 owHLl43u4q8eZZyKYcZEeuPkfqMhDVNw3LxZA0NrJhZMu2h8QPHWld5Sq6ZLHrPo/5YS x9QA9rUkasqw8IhIXF/Ak/fDSUQgctZsFhMk8Z7kj1Hk74zX4lgP8I9P2HZkBtWOEVe2 xgj59vppiBVygfrsEFU5lWASm+MVNya6AinCvSjnKn7u7hxj+2dCABANudPFW4qkPtNS PVqw== X-Gm-Message-State: AIVw110d1HtVCr2+Owm3TF88htSOCE5j0F04rcpIE8wwPKjy898JkY8w jVfuHqE9PVjbWhKgQDE= X-Received: by 10.55.18.222 with SMTP id 91mr22904010qks.350.1500943077932; Mon, 24 Jul 2017 17:37:57 -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 64sm9944607qky.78.2017.07.24.17.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jul 2017 17:37:57 -0700 (PDT) Sender: Mark Johnston Date: Mon, 24 Jul 2017 17:38:37 -0700 From: Mark Johnston To: "Ngie Cooper (yaneurabeya)" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r321448 - stable/11/sbin/savecore Message-ID: <20170725003837.GA95607@wkstn-mjohnston.west.isilon.com> References: <201707250030.v6P0UPhY076202@repo.freebsd.org> <51FECB6B-0838-4A93-9584-50623946FB14@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <51FECB6B-0838-4A93-9584-50623946FB14@gmail.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 00:37:59 -0000 On Mon, Jul 24, 2017 at 05:31:57PM -0700, Ngie Cooper (yaneurabeya) wrote: > > > On Jul 24, 2017, at 17:30, Mark Johnston wrote: > > > > Author: markj > > Date: Tue Jul 25 00:30:25 2017 > > New Revision: 321448 > > URL: https://svnweb.freebsd.org/changeset/base/321448 > > > > Log: > > Include stdbool.h for r321447. > > > > This is a direct commit to stable/11. > > Shouldn’t the pollution be committed to ^/head and backported instead of doing a direct commit? > Thanks, > -Ngie The stdbool.h include is already present in head. From owner-svn-src-all@freebsd.org Tue Jul 25 01:50:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84D99DAF1AE; Tue, 25 Jul 2017 01:50:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53B5020C4; Tue, 25 Jul 2017 01:50:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6P1obH0008858; Tue, 25 Jul 2017 01:50:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P1obZg008856; Tue, 25 Jul 2017 01:50:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201707250150.v6P1obZg008856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 25 Jul 2017 01:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321450 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 321450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 01:50:38 -0000 Author: kevans Date: Tue Jul 25 01:50:37 2017 New Revision: 321450 URL: https://svnweb.freebsd.org/changeset/base/321450 Log: bsdgrep(1): Don't exit before processing every file Given an empty pattern (i.e. grep "" A B), bsdgrep(1) would previously exit() with the appropriate exit code upon encountering an empty file. Likely intended as an optimization, but this behavior is technically incorrect since an empty pattern should match every line. PR: 220924 Reviewed by: emaste, cem (earlier version), ngie Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11698 Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh head/usr.bin/grep/util.c Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Jul 25 00:33:53 2017 (r321449) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Jul 25 01:50:37 2017 (r321450) @@ -669,6 +669,24 @@ mmap_eof_not_eol_body() atf_check -s exit:0 -o not-empty \ env MALLOC_CONF="redzone:true" grep --mmap -e " " test2 } + +atf_test_case matchall +matchall_head() +{ + atf_set "descr" "Check proper behavior of matching all with an empty string" +} +matchall_body() +{ + printf "" > test1 + printf "A" > test2 + printf "A\nB" > test3 + + atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 test3 + atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 test2 + atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 test1 + + atf_check -s exit:1 grep "" test1 +} # End FreeBSD atf_init_test_cases() @@ -709,5 +727,6 @@ atf_init_test_cases() atf_add_test_case badcontext atf_add_test_case mmap atf_add_test_case mmap_eof_not_eol + atf_add_test_case matchall # End FreeBSD } Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Tue Jul 25 00:33:53 2017 (r321449) +++ head/usr.bin/grep/util.c Tue Jul 25 01:50:37 2017 (r321450) @@ -259,16 +259,8 @@ procfile(const char *fn) pc.ln.boff = 0; pc.ln.off += pc.ln.len + 1; if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || - pc.ln.len == 0) { - if (pc.ln.line_no == 0 && matchall) - /* - * An empty file with an empty pattern and the - * -w flag does not match - */ - exit(matchall && wflag ? 1 : 0); - else - break; - } + pc.ln.len == 0) + break; if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol) --pc.ln.len; From owner-svn-src-all@freebsd.org Tue Jul 25 03:43:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABD67DB4089; Tue, 25 Jul 2017 03:43:01 +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 79B7A657A1; Tue, 25 Jul 2017 03:43:01 +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 v6P3h0M1057869; Tue, 25 Jul 2017 03:43:00 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P3h0JF057867; Tue, 25 Jul 2017 03:43:00 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707250343.v6P3h0JF057867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 25 Jul 2017 03:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321453 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 321453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 03:43:01 -0000 Author: alc Date: Tue Jul 25 03:43:00 2017 New Revision: 321453 URL: https://svnweb.freebsd.org/changeset/base/321453 Log: MFC r320077 Change blist_alloc()'s allocation policy from first-fit to next-fit so that disk writes are more likely to be sequential. This change is beneficial on both the solid state and mechanical disks that I've tested. (A similar change in allocation policy was made by DragonFly BSD in 2013 to speed up Poudriere with "stressful memory parameters".) Increase the width of blst_meta_alloc()'s parameter "skip" and the local variables whose values are derived from it to 64 bits. (This matches the width of the field "skip" that is stored in the structure "blist" and passed to blst_meta_alloc().) Eliminate a pointless check for a NULL blist_t. Simplify blst_meta_alloc()'s handling of the ALL-FREE case. Address nearby style errors. MFC r320417 Address the remaining integer overflow issues with the "skip" parameters and "next_skip" variables. The "skip" value in struct blist has long been a 64-bit quantity but various functions have implicitly truncated this value to 32 bits. Now, all arithmetic involving the "skip" value is 64 bits wide. (This should allow us to relax the size limit on a swap device in the swap pager.) Maintain the ability to test this allocator as a user-space application by including . Remove an unused variable from blst_radix_print(). MFC r320527 Change blst_leaf_alloc() to handle a cursor argument, and to improve performance. To find in the leaf bitmap all ranges of sufficient length, use a doubling strategy with shift-and-and until each bit still set represents a bit sequence of length 'count', or until the bitmask is zero. In the latter case, update the hint based on the first bit sequence length not found to be available. For example, seeking an interval of length 12, the set bits of the bitmap would represent intervals of length 1, then 2, then 3, then 6, then 12. If no bits are set at the point when each bit represents an interval of length 6, then the hint can be updated to 5 and the search terminated. If long-enough intervals are found, discard those before the cursor. If any remain, use binary search to find the position of the first of them, and allocate that interval. Modified: stable/11/sys/kern/subr_blist.c stable/11/sys/sys/blist.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_blist.c ============================================================================== --- stable/11/sys/kern/subr_blist.c Tue Jul 25 03:41:05 2017 (r321452) +++ stable/11/sys/kern/subr_blist.c Tue Jul 25 03:43:00 2017 (r321453) @@ -105,6 +105,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define bitcount64(x) __bitcount64((uint64_t)(x)) #define malloc(a,b,c) calloc(a, 1) @@ -120,22 +121,23 @@ void panic(const char *ctl, ...); * static support functions */ -static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count); -static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, - daddr_t count, daddr_t radix, int skip); +static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, + daddr_t cursor); +static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, + daddr_t radix, daddr_t skip, daddr_t cursor); static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count); static void blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, - daddr_t radix, int skip, daddr_t blk); + daddr_t radix, daddr_t skip, daddr_t blk); static void blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, daddr_t skip, blist_t dest, daddr_t count); static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count); static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, - daddr_t radix, int skip, daddr_t blk); -static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, - int skip, daddr_t count); + daddr_t radix, daddr_t skip, daddr_t blk); +static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t skip, + daddr_t count); #ifndef _KERNEL -static void blst_radix_print(blmeta_t *scan, daddr_t blk, - daddr_t radix, int skip, int tab); +static void blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, + daddr_t skip, int tab); #endif #ifdef _KERNEL @@ -157,18 +159,18 @@ blist_t blist_create(daddr_t blocks, int flags) { blist_t bl; - daddr_t nodes, radix; - int skip = 0; + daddr_t nodes, radix, skip; /* * Calculate radix and skip field used for scanning. */ radix = BLIST_BMAP_RADIX; - + skip = 0; while (radix < blocks) { radix *= BLIST_META_RADIX; skip = (skip + 1) * BLIST_META_RADIX; } + nodes = 1 + blst_radix_init(NULL, radix, skip, blocks); bl = malloc(sizeof(struct blist), M_SWAP, flags); if (bl == NULL) @@ -177,13 +179,13 @@ blist_create(daddr_t blocks, int flags) bl->bl_blocks = blocks; bl->bl_radix = radix; bl->bl_skip = skip; - nodes = 1 + blst_radix_init(NULL, radix, bl->bl_skip, blocks); + bl->bl_cursor = 0; bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags); if (bl->bl_root == NULL) { free(bl, M_SWAP); return (NULL); } - blst_radix_init(bl->bl_root, radix, bl->bl_skip, blocks); + blst_radix_init(bl->bl_root, radix, skip, blocks); #if defined(BLIST_DEBUG) printf( @@ -218,13 +220,24 @@ blist_alloc(blist_t bl, daddr_t count) { daddr_t blk; - if (bl != NULL && count <= bl->bl_root->bm_bighint) { + /* + * This loop iterates at most twice. An allocation failure in the + * first iteration leads to a second iteration only if the cursor was + * non-zero. When the cursor is zero, an allocation failure will + * reduce the hint, stopping further iterations. + */ + while (count <= bl->bl_root->bm_bighint) { if (bl->bl_radix == BLIST_BMAP_RADIX) - blk = blst_leaf_alloc(bl->bl_root, 0, count); + blk = blst_leaf_alloc(bl->bl_root, 0, count, + bl->bl_cursor); else blk = blst_meta_alloc(bl->bl_root, 0, count, - bl->bl_radix, bl->bl_skip); - return (blk); + bl->bl_radix, bl->bl_skip, bl->bl_cursor); + if (blk != SWAPBLK_NONE) { + bl->bl_cursor = blk + count; + return (blk); + } else if (bl->bl_cursor != 0) + bl->bl_cursor = 0; } return (SWAPBLK_NONE); } @@ -341,77 +354,92 @@ blist_print(blist_t bl) /* * blist_leaf_alloc() - allocate at a leaf in the radix tree (a bitmap). * - * This is the core of the allocator and is optimized for the 1 block - * and the BLIST_BMAP_RADIX block allocation cases. Other cases are - * somewhat slower. The 1 block allocation case is log2 and extremely - * quick. + * This is the core of the allocator and is optimized for the + * BLIST_BMAP_RADIX block allocation case. Otherwise, execution + * time is proportional to log2(count) + log2(BLIST_BMAP_RADIX). */ static daddr_t -blst_leaf_alloc( - blmeta_t *scan, - daddr_t blk, - int count -) { - u_daddr_t orig = scan->u.bmu_bitmap; +blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, daddr_t cursor) +{ + u_daddr_t mask; + int count1, hi, lo, mid, num_shifts, range1, range_ext; - if (orig == 0) { + if (count == BLIST_BMAP_RADIX) { /* - * Optimize bitmap all-allocated case. Also, count = 1 - * case assumes at least 1 bit is free in the bitmap, so - * we have to take care of this case here. + * Optimize allocation of BLIST_BMAP_RADIX bits. If this wasn't + * a special case, then forming the final value of 'mask' below + * would require special handling to avoid an invalid left shift + * when count equals the number of bits in mask. */ + if (~scan->u.bmu_bitmap != 0) { + scan->bm_bighint = BLIST_BMAP_RADIX - 1; + return (SWAPBLK_NONE); + } + if (cursor != blk) + return (SWAPBLK_NONE); + scan->u.bmu_bitmap = 0; scan->bm_bighint = 0; - return(SWAPBLK_NONE); + return (blk); } - if (count == 1) { + range1 = 0; + count1 = count - 1; + num_shifts = fls(count1); + mask = scan->u.bmu_bitmap; + while (mask != 0 && num_shifts > 0) { /* - * Optimized code to allocate one bit out of the bitmap + * If bit i is set in mask, then bits in [i, i+range1] are set + * in scan->u.bmu_bitmap. The value of range1 is equal to + * count1 >> num_shifts. Grow range and reduce num_shifts to 0, + * while preserving these invariants. The updates to mask leave + * fewer bits set, but each bit that remains set represents a + * longer string of consecutive bits set in scan->u.bmu_bitmap. */ - u_daddr_t mask; - int j = BLIST_BMAP_RADIX/2; - int r = 0; - - mask = (u_daddr_t)-1 >> (BLIST_BMAP_RADIX/2); - - while (j) { - if ((orig & mask) == 0) { - r += j; - orig >>= j; - } - j >>= 1; - mask >>= j; - } - scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r); - return(blk + r); + num_shifts--; + range_ext = range1 + ((count1 >> num_shifts) & 1); + mask &= mask >> range_ext; + range1 += range_ext; } - if (count <= BLIST_BMAP_RADIX) { + if (mask == 0) { /* - * non-optimized code to allocate N bits out of the bitmap. - * The more bits, the faster the code runs. It will run - * the slowest allocating 2 bits, but since there aren't any - * memory ops in the core loop (or shouldn't be, anyway), - * you probably won't notice the difference. + * Update bighint. There is no allocation bigger than range1 + * available in this leaf. */ - int j; - int n = BLIST_BMAP_RADIX - count; - u_daddr_t mask; + scan->bm_bighint = range1; + return (SWAPBLK_NONE); + } - mask = (u_daddr_t)-1 >> n; + /* + * Discard any candidates that appear before the cursor. + */ + lo = cursor - blk; + mask &= ~(u_daddr_t)0 << lo; - for (j = 0; j <= n; ++j) { - if ((orig & mask) == mask) { - scan->u.bmu_bitmap &= ~mask; - return(blk + j); - } - mask = (mask << 1); - } + if (mask == 0) + return (SWAPBLK_NONE); + + /* + * The least significant set bit in mask marks the start of the first + * available range of sufficient size. Clear all the bits but that one, + * and then perform a binary search to find its position. + */ + mask &= -mask; + hi = BLIST_BMAP_RADIX - count1; + while (lo + 1 < hi) { + mid = (lo + hi) >> 1; + if ((mask >> mid) != 0) + lo = mid; + else + hi = mid; } + /* - * We couldn't allocate count in this subtree, update bighint. + * Set in mask exactly the bits being allocated, and clear them from + * the set of available bits. */ - scan->bm_bighint = count - 1; - return(SWAPBLK_NONE); + mask = (mask << count) - mask; + scan->u.bmu_bitmap &= ~mask; + return (blk + lo); } /* @@ -424,16 +452,12 @@ blst_leaf_alloc( */ static daddr_t -blst_meta_alloc( - blmeta_t *scan, - daddr_t blk, - daddr_t count, - daddr_t radix, - int skip -) { - daddr_t r; - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); +blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t cursor) +{ + daddr_t i, next_skip, r; + int child; + bool scan_from_start; if (scan->u.bmu_avail < count) { /* @@ -444,6 +468,7 @@ blst_meta_alloc( scan->bm_bighint = scan->u.bmu_avail; return (SWAPBLK_NONE); } + next_skip = skip / BLIST_META_RADIX; /* * An ALL-FREE meta node requires special handling before allocating @@ -457,13 +482,11 @@ blst_meta_alloc( * meta node cannot have a terminator in any subtree. */ for (i = 1; i <= skip; i += next_skip) { - if (next_skip == 1) { + if (next_skip == 1) scan[i].u.bmu_bitmap = (u_daddr_t)-1; - scan[i].bm_bighint = BLIST_BMAP_RADIX; - } else { - scan[i].bm_bighint = radix; + else scan[i].u.bmu_avail = radix; - } + scan[i].bm_bighint = radix; } } else { radix /= BLIST_META_RADIX; @@ -476,16 +499,21 @@ blst_meta_alloc( */ panic("allocation too large"); } - for (i = 1; i <= skip; i += next_skip) { + scan_from_start = cursor == blk; + child = (cursor - blk) / radix; + blk += child * radix; + for (i = 1 + child * next_skip; i <= skip; i += next_skip) { if (count <= scan[i].bm_bighint) { /* * The allocation might fit in the i'th subtree. */ if (next_skip == 1) { - r = blst_leaf_alloc(&scan[i], blk, count); + r = blst_leaf_alloc(&scan[i], blk, count, + cursor > blk ? cursor : blk); } else { r = blst_meta_alloc(&scan[i], blk, count, - radix, next_skip - 1); + radix, next_skip - 1, cursor > blk ? + cursor : blk); } if (r != SWAPBLK_NONE) { scan->u.bmu_avail -= count; @@ -503,9 +531,10 @@ blst_meta_alloc( /* * We couldn't allocate count in this subtree, update bighint. */ - if (scan->bm_bighint >= count) + if (scan_from_start && scan->bm_bighint >= count) scan->bm_bighint = count - 1; - return(SWAPBLK_NONE); + + return (SWAPBLK_NONE); } /* @@ -558,16 +587,11 @@ blst_leaf_free( */ static void -blst_meta_free( - blmeta_t *scan, - daddr_t freeBlk, - daddr_t count, - daddr_t radix, - int skip, - daddr_t blk -) { - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); +blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t blk) +{ + daddr_t i, next_skip, v; + int child; #if 0 printf("free (%llx,%lld) FROM (%llx,%lld)\n", @@ -575,6 +599,7 @@ blst_meta_free( (long long)blk, (long long)radix ); #endif + next_skip = skip / BLIST_META_RADIX; if (scan->u.bmu_avail == 0) { /* @@ -619,13 +644,10 @@ blst_meta_free( radix /= BLIST_META_RADIX; - i = (freeBlk - blk) / radix; - blk += i * radix; - i = i * next_skip + 1; - + child = (freeBlk - blk) / radix; + blk += child * radix; + i = 1 + child * next_skip; while (i <= skip && blk < freeBlk + count) { - daddr_t v; - v = blk + radix - freeBlk; if (v > count) v = count; @@ -662,8 +684,7 @@ static void blst_copy( blist_t dest, daddr_t count ) { - int next_skip; - int i; + daddr_t i, next_skip; /* * Leaf node @@ -708,7 +729,7 @@ static void blst_copy( radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; for (i = 1; count && i <= skip; i += next_skip) { if (scan[i].bm_bighint == (daddr_t)-1) @@ -775,17 +796,11 @@ blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count) * number of blocks allocated by the call. */ static daddr_t -blst_meta_fill( - blmeta_t *scan, - daddr_t allocBlk, - daddr_t count, - daddr_t radix, - int skip, - daddr_t blk -) { - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); - daddr_t nblks = 0; +blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t blk) +{ + daddr_t i, nblks, next_skip, v; + int child; if (count > radix) { /* @@ -803,6 +818,7 @@ blst_meta_fill( scan->bm_bighint = 0; return nblks; } + next_skip = skip / BLIST_META_RADIX; /* * An ALL-FREE meta node requires special handling before allocating @@ -828,13 +844,11 @@ blst_meta_fill( radix /= BLIST_META_RADIX; } - i = (allocBlk - blk) / radix; - blk += i * radix; - i = i * next_skip + 1; - + nblks = 0; + child = (allocBlk - blk) / radix; + blk += child * radix; + i = 1 + child * next_skip; while (i <= skip && blk < allocBlk + count) { - daddr_t v; - v = blk + radix - allocBlk; if (v > count) v = count; @@ -867,12 +881,12 @@ blst_meta_fill( */ static daddr_t -blst_radix_init(blmeta_t *scan, daddr_t radix, int skip, daddr_t count) +blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t skip, daddr_t count) { - int i; - int next_skip; - daddr_t memindex = 0; + daddr_t i, memindex, next_skip; + memindex = 0; + /* * Leaf node */ @@ -897,7 +911,7 @@ blst_radix_init(blmeta_t *scan, daddr_t radix, int ski } radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; for (i = 1; i <= skip; i += next_skip) { if (count >= radix) { @@ -939,11 +953,10 @@ blst_radix_init(blmeta_t *scan, daddr_t radix, int ski #ifdef BLIST_DEBUG static void -blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, int skip, int tab) +blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, daddr_t skip, + int tab) { - int i; - int next_skip; - int lastState = 0; + daddr_t i, next_skip; if (radix == BLIST_BMAP_RADIX) { printf( @@ -985,7 +998,7 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t ); radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; tab += 4; for (i = 1; i <= skip; i += next_skip) { @@ -995,7 +1008,6 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t tab, tab, "", (long long)blk, (long long)radix ); - lastState = 0; break; } blst_radix_print( Modified: stable/11/sys/sys/blist.h ============================================================================== --- stable/11/sys/sys/blist.h Tue Jul 25 03:41:05 2017 (r321452) +++ stable/11/sys/sys/blist.h Tue Jul 25 03:43:00 2017 (r321453) @@ -82,6 +82,7 @@ typedef struct blist { daddr_t bl_blocks; /* area of coverage */ daddr_t bl_radix; /* coverage radix */ daddr_t bl_skip; /* starting skip */ + daddr_t bl_cursor; /* next-fit search starts at */ blmeta_t *bl_root; /* root of radix tree */ } *blist_t; From owner-svn-src-all@freebsd.org Tue Jul 25 03:54:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E7EBDB442E; Tue, 25 Jul 2017 03:54:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E185665D90; Tue, 25 Jul 2017 03:54:36 +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 v6P3sZBP062112; Tue, 25 Jul 2017 03:54:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P3sZtu062111; Tue, 25 Jul 2017 03:54:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707250354.v6P3sZtu062111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 03:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321455 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 03:54:37 -0000 Author: ngie Date: Tue Jul 25 03:54:35 2017 New Revision: 321455 URL: https://svnweb.freebsd.org/changeset/base/321455 Log: Raise WARNS to 1 This will enable warnings with the msun tests. MFC after: 1 month Modified: head/lib/msun/tests/Makefile Modified: head/lib/msun/tests/Makefile ============================================================================== --- head/lib/msun/tests/Makefile Tue Jul 25 03:48:24 2017 (r321454) +++ head/lib/msun/tests/Makefile Tue Jul 25 03:54:35 2017 (r321455) @@ -4,8 +4,6 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libm -WARNS?= 0 - # All architectures on FreeBSD have fenv.h CFLAGS+= -DHAVE_FENV_H @@ -85,6 +83,8 @@ IGNORE_PRAGMA= SRCS.ilogb2_test= ilogb_test.c LIBADD+= m + +WARNS?= 1 # Copied from lib/msun/Makefile .if ${MACHINE_CPUARCH} == "i386" From owner-svn-src-all@freebsd.org Tue Jul 25 03:55:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26DD4DB44D4; Tue, 25 Jul 2017 03:55:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0316965EF7; Tue, 25 Jul 2017 03:55:45 +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 v6P3tjYO062232; Tue, 25 Jul 2017 03:55:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P3tjVq062230; Tue, 25 Jul 2017 03:55:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707250355.v6P3tjVq062230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 03:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321456 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 03:55:46 -0000 Author: ngie Date: Tue Jul 25 03:55:44 2017 New Revision: 321456 URL: https://svnweb.freebsd.org/changeset/base/321456 Log: Convert lib/msun/trig_test from TAP to ATF format Only expose :accuracy and :reduction if !i386, similar to before, but more holistically to avoid future -Wunused issue with the unused functions. MFC after: 1 month Modified: head/lib/msun/tests/Makefile head/lib/msun/tests/trig_test.c Modified: head/lib/msun/tests/Makefile ============================================================================== --- head/lib/msun/tests/Makefile Tue Jul 25 03:54:35 2017 (r321455) +++ head/lib/msun/tests/Makefile Tue Jul 25 03:55:44 2017 (r321456) @@ -68,7 +68,7 @@ TAP_TESTS_C+= nan_test TAP_TESTS_C+= nearbyint_test TAP_TESTS_C+= next_test TAP_TESTS_C+= rem_test -TAP_TESTS_C+= trig_test +ATF_TESTS_C+= trig_test .if !empty(PROG) && !empty(TAP_TESTS_C:M${PROG}) CFLAGS+= -O0 Modified: head/lib/msun/tests/trig_test.c ============================================================================== --- head/lib/msun/tests/trig_test.c Tue Jul 25 03:54:35 2017 (r321455) +++ head/lib/msun/tests/trig_test.c Tue Jul 25 03:55:44 2017 (r321456) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "test-utils.h" #pragma STDC FENV_ACCESS ON @@ -63,9 +65,9 @@ __FBSDID("$FreeBSD$"); */ #define test(func, x, result, exceptmask, excepts) do { \ volatile long double _d = x; \ - assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ - assert(fpequal((func)(_d), (result))); \ - assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ + ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \ + ATF_CHECK(fpequal((func)(_d), (result))); \ + ATF_CHECK(((void)(func), fetestexcept(exceptmask) == (excepts))); \ } while (0) #define testall(prefix, x, result, exceptmask, excepts) do { \ @@ -79,13 +81,16 @@ __FBSDID("$FreeBSD$"); test(prefix##f, x, (float)result, exceptmask, excepts); \ } while (0) -/* - * Test special cases in sin(), cos(), and tan(). - */ -static void -run_special_tests(void) +ATF_TC(special); +ATF_TC_HEAD(special, tc) { + atf_tc_set_md_var(tc, "descr", + "test special cases in sin(), cos(), and tan()"); +} +ATF_TC_BODY(special, tc) +{ + /* Values at 0 should be exact. */ testall(tan, 0.0, 0.0, ALL_STD_EXCEPT, 0); testall(tan, -0.0, -0.0, ALL_STD_EXCEPT, 0); @@ -108,12 +113,16 @@ run_special_tests(void) testall(cos, NAN, NAN, ALL_STD_EXCEPT, 0); } -/* - * Tests to ensure argument reduction for large arguments is accurate. - */ -static void -run_reduction_tests(void) +#ifndef __i386__ +ATF_TC(reduction); +ATF_TC_HEAD(reduction, tc) { + + atf_tc_set_md_var(tc, "descr", + "tests to ensure argument reduction for large arguments is accurate"); +} +ATF_TC_BODY(reduction, tc) +{ /* floats very close to odd multiples of pi */ static const float f_pi_odd[] = { 85563208.0f, @@ -156,69 +165,72 @@ run_reduction_tests(void) unsigned i; for (i = 0; i < nitems(f_pi_odd); i++) { - assert(fabs(sinf(f_pi_odd[i])) < FLT_EPSILON); - assert(cosf(f_pi_odd[i]) == -1.0); - assert(fabs(tan(f_pi_odd[i])) < FLT_EPSILON); + ATF_CHECK(fabs(sinf(f_pi_odd[i])) < FLT_EPSILON); + ATF_CHECK(cosf(f_pi_odd[i]) == -1.0); + ATF_CHECK(fabs(tan(f_pi_odd[i])) < FLT_EPSILON); - assert(fabs(sinf(-f_pi_odd[i])) < FLT_EPSILON); - assert(cosf(-f_pi_odd[i]) == -1.0); - assert(fabs(tanf(-f_pi_odd[i])) < FLT_EPSILON); + ATF_CHECK(fabs(sinf(-f_pi_odd[i])) < FLT_EPSILON); + ATF_CHECK(cosf(-f_pi_odd[i]) == -1.0); + ATF_CHECK(fabs(tanf(-f_pi_odd[i])) < FLT_EPSILON); - assert(fabs(sinf(f_pi_odd[i] * 2)) < FLT_EPSILON); - assert(cosf(f_pi_odd[i] * 2) == 1.0); - assert(fabs(tanf(f_pi_odd[i] * 2)) < FLT_EPSILON); + ATF_CHECK(fabs(sinf(f_pi_odd[i] * 2)) < FLT_EPSILON); + ATF_CHECK(cosf(f_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabs(tanf(f_pi_odd[i] * 2)) < FLT_EPSILON); - assert(fabs(sinf(-f_pi_odd[i] * 2)) < FLT_EPSILON); - assert(cosf(-f_pi_odd[i] * 2) == 1.0); - assert(fabs(tanf(-f_pi_odd[i] * 2)) < FLT_EPSILON); + ATF_CHECK(fabs(sinf(-f_pi_odd[i] * 2)) < FLT_EPSILON); + ATF_CHECK(cosf(-f_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabs(tanf(-f_pi_odd[i] * 2)) < FLT_EPSILON); } for (i = 0; i < nitems(d_pi_odd); i++) { - assert(fabs(sin(d_pi_odd[i])) < 2 * DBL_EPSILON); - assert(cos(d_pi_odd[i]) == -1.0); - assert(fabs(tan(d_pi_odd[i])) < 2 * DBL_EPSILON); + ATF_CHECK(fabs(sin(d_pi_odd[i])) < 2 * DBL_EPSILON); + ATF_CHECK(cos(d_pi_odd[i]) == -1.0); + ATF_CHECK(fabs(tan(d_pi_odd[i])) < 2 * DBL_EPSILON); - assert(fabs(sin(-d_pi_odd[i])) < 2 * DBL_EPSILON); - assert(cos(-d_pi_odd[i]) == -1.0); - assert(fabs(tan(-d_pi_odd[i])) < 2 * DBL_EPSILON); + ATF_CHECK(fabs(sin(-d_pi_odd[i])) < 2 * DBL_EPSILON); + ATF_CHECK(cos(-d_pi_odd[i]) == -1.0); + ATF_CHECK(fabs(tan(-d_pi_odd[i])) < 2 * DBL_EPSILON); - assert(fabs(sin(d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); - assert(cos(d_pi_odd[i] * 2) == 1.0); - assert(fabs(tan(d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); + ATF_CHECK(fabs(sin(d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); + ATF_CHECK(cos(d_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabs(tan(d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); - assert(fabs(sin(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); - assert(cos(-d_pi_odd[i] * 2) == 1.0); - assert(fabs(tan(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); + ATF_CHECK(fabs(sin(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); + ATF_CHECK(cos(-d_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabs(tan(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); } #if LDBL_MANT_DIG > 53 for (i = 0; i < nitems(ld_pi_odd); i++) { - assert(fabsl(sinl(ld_pi_odd[i])) < LDBL_EPSILON); - assert(cosl(ld_pi_odd[i]) == -1.0); - assert(fabsl(tanl(ld_pi_odd[i])) < LDBL_EPSILON); + ATF_CHECK(fabsl(sinl(ld_pi_odd[i])) < LDBL_EPSILON); + ATF_CHECK(cosl(ld_pi_odd[i]) == -1.0); + ATF_CHECK(fabsl(tanl(ld_pi_odd[i])) < LDBL_EPSILON); - assert(fabsl(sinl(-ld_pi_odd[i])) < LDBL_EPSILON); - assert(cosl(-ld_pi_odd[i]) == -1.0); - assert(fabsl(tanl(-ld_pi_odd[i])) < LDBL_EPSILON); + ATF_CHECK(fabsl(sinl(-ld_pi_odd[i])) < LDBL_EPSILON); + ATF_CHECK(cosl(-ld_pi_odd[i]) == -1.0); + ATF_CHECK(fabsl(tanl(-ld_pi_odd[i])) < LDBL_EPSILON); - assert(fabsl(sinl(ld_pi_odd[i] * 2)) < LDBL_EPSILON); - assert(cosl(ld_pi_odd[i] * 2) == 1.0); - assert(fabsl(tanl(ld_pi_odd[i] * 2)) < LDBL_EPSILON); + ATF_CHECK(fabsl(sinl(ld_pi_odd[i] * 2)) < LDBL_EPSILON); + ATF_CHECK(cosl(ld_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabsl(tanl(ld_pi_odd[i] * 2)) < LDBL_EPSILON); - assert(fabsl(sinl(-ld_pi_odd[i] * 2)) < LDBL_EPSILON); - assert(cosl(-ld_pi_odd[i] * 2) == 1.0); - assert(fabsl(tanl(-ld_pi_odd[i] * 2)) < LDBL_EPSILON); + ATF_CHECK(fabsl(sinl(-ld_pi_odd[i] * 2)) < LDBL_EPSILON); + ATF_CHECK(cosl(-ld_pi_odd[i] * 2) == 1.0); + ATF_CHECK(fabsl(tanl(-ld_pi_odd[i] * 2)) < LDBL_EPSILON); } #endif } -/* - * Tests the accuracy of these functions over the primary range. - */ -static void -run_accuracy_tests(void) +ATF_TC(accuracy); +ATF_TC_HEAD(accuracy, tc) { + atf_tc_set_md_var(tc, "descr", + "tests the accuracy of these functions over the primary range"); +} +ATF_TC_BODY(accuracy, tc) +{ + /* For small args, sin(x) = tan(x) = x, and cos(x) = 1. */ testall(sin, 0xd.50ee515fe4aea16p-114L, 0xd.50ee515fe4aea16p-114L, ALL_STD_EXCEPT, FE_INEXACT); @@ -256,25 +268,17 @@ run_accuracy_tests(void) * - tests for large numbers that get reduced to hi+lo with lo!=0 */ } +#endif -int -main(void) +ATF_TP_ADD_TCS(tp) { - printf("1..3\n"); + ATF_TP_ADD_TC(tp, special); - run_special_tests(); - printf("ok 1 - trig\n"); - #ifndef __i386__ - run_reduction_tests(); + ATF_TP_ADD_TC(tp, accuracy); + ATF_TP_ADD_TC(tp, reduction); #endif - printf("ok 2 - trig\n"); -#ifndef __i386__ - run_accuracy_tests(); -#endif - printf("ok 3 - trig\n"); - - return (0); + return (atf_no_error()); } From owner-svn-src-all@freebsd.org Tue Jul 25 03:56:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73222DB4564; Tue, 25 Jul 2017 03:56:43 +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 42ABC66055; Tue, 25 Jul 2017 03:56:43 +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 v6P3ugSk062322; Tue, 25 Jul 2017 03:56:42 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P3ugDo062321; Tue, 25 Jul 2017 03:56:42 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707250356.v6P3ugDo062321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 03:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321457 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 03:56:43 -0000 Author: ngie Date: Tue Jul 25 03:56:42 2017 New Revision: 321457 URL: https://svnweb.freebsd.org/changeset/base/321457 Log: Mark :reduction as an expected failure It fails with clang 5.0+. PR: 220989 MFC after: 2 months MFC with: r321369 Reported by: Jenkins Modified: head/lib/msun/tests/trig_test.c Modified: head/lib/msun/tests/trig_test.c ============================================================================== --- head/lib/msun/tests/trig_test.c Tue Jul 25 03:55:44 2017 (r321456) +++ head/lib/msun/tests/trig_test.c Tue Jul 25 03:56:42 2017 (r321457) @@ -162,6 +162,11 @@ ATF_TC_BODY(reduction, tc) }; #endif +#if defined(__clang__) && \ + ((__clang_major__ >= 5)) + atf_tc_expect_fail("test fails with clang 5.0+ - bug 220989"); +#endif + unsigned i; for (i = 0; i < nitems(f_pi_odd); i++) { From owner-svn-src-all@freebsd.org Tue Jul 25 04:13:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84808DB4F17; Tue, 25 Jul 2017 04:13:44 +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 4F0FA66B86; Tue, 25 Jul 2017 04:13:44 +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 v6P4DhHO070301; Tue, 25 Jul 2017 04:13:43 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P4DhQR070299; Tue, 25 Jul 2017 04:13:43 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707250413.v6P4DhQR070299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 25 Jul 2017 04:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321459 - in stable/10/sys: kern sys X-SVN-Group: stable-10 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/10/sys: kern sys X-SVN-Commit-Revision: 321459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 04:13:44 -0000 Author: alc Date: Tue Jul 25 04:13:43 2017 New Revision: 321459 URL: https://svnweb.freebsd.org/changeset/base/321459 Log: MFC r320077 Change blist_alloc()'s allocation policy from first-fit to next-fit so that disk writes are more likely to be sequential. This change is beneficial on both the solid state and mechanical disks that I've tested. (A similar change in allocation policy was made by DragonFly BSD in 2013 to speed up Poudriere with "stressful memory parameters".) Increase the width of blst_meta_alloc()'s parameter "skip" and the local variables whose values are derived from it to 64 bits. (This matches the width of the field "skip" that is stored in the structure "blist" and passed to blst_meta_alloc().) Eliminate a pointless check for a NULL blist_t. Simplify blst_meta_alloc()'s handling of the ALL-FREE case. Address nearby style errors. MFC r320417 Address the remaining integer overflow issues with the "skip" parameters and "next_skip" variables. The "skip" value in struct blist has long been a 64-bit quantity but various functions have implicitly truncated this value to 32 bits. Now, all arithmetic involving the "skip" value is 64 bits wide. (This should allow us to relax the size limit on a swap device in the swap pager.) Maintain the ability to test this allocator as a user-space application by including . Remove an unused variable from blst_radix_print(). MFC r320527 Change blst_leaf_alloc() to handle a cursor argument, and to improve performance. To find in the leaf bitmap all ranges of sufficient length, use a doubling strategy with shift-and-and until each bit still set represents a bit sequence of length 'count', or until the bitmask is zero. In the latter case, update the hint based on the first bit sequence length not found to be available. For example, seeking an interval of length 12, the set bits of the bitmap would represent intervals of length 1, then 2, then 3, then 6, then 12. If no bits are set at the point when each bit represents an interval of length 6, then the hint can be updated to 5 and the search terminated. If long-enough intervals are found, discard those before the cursor. If any remain, use binary search to find the position of the first of them, and allocate that interval. Modified: stable/10/sys/kern/subr_blist.c stable/10/sys/sys/blist.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_blist.c ============================================================================== --- stable/10/sys/kern/subr_blist.c Tue Jul 25 03:59:35 2017 (r321458) +++ stable/10/sys/kern/subr_blist.c Tue Jul 25 04:13:43 2017 (r321459) @@ -105,6 +105,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define bitcount64(x) __bitcount64((uint64_t)(x)) #define malloc(a,b,c) calloc(a, 1) @@ -120,22 +121,23 @@ void panic(const char *ctl, ...); * static support functions */ -static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count); -static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, - daddr_t count, daddr_t radix, int skip); +static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, + daddr_t cursor); +static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, + daddr_t radix, daddr_t skip, daddr_t cursor); static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count); static void blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, - daddr_t radix, int skip, daddr_t blk); + daddr_t radix, daddr_t skip, daddr_t blk); static void blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, daddr_t skip, blist_t dest, daddr_t count); static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count); static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, - daddr_t radix, int skip, daddr_t blk); -static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, - int skip, daddr_t count); + daddr_t radix, daddr_t skip, daddr_t blk); +static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t skip, + daddr_t count); #ifndef _KERNEL -static void blst_radix_print(blmeta_t *scan, daddr_t blk, - daddr_t radix, int skip, int tab); +static void blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, + daddr_t skip, int tab); #endif #ifdef _KERNEL @@ -157,18 +159,18 @@ blist_t blist_create(daddr_t blocks, int flags) { blist_t bl; - daddr_t nodes, radix; - int skip = 0; + daddr_t nodes, radix, skip; /* * Calculate radix and skip field used for scanning. */ radix = BLIST_BMAP_RADIX; - + skip = 0; while (radix < blocks) { radix *= BLIST_META_RADIX; skip = (skip + 1) * BLIST_META_RADIX; } + nodes = 1 + blst_radix_init(NULL, radix, skip, blocks); bl = malloc(sizeof(struct blist), M_SWAP, flags); if (bl == NULL) @@ -177,13 +179,13 @@ blist_create(daddr_t blocks, int flags) bl->bl_blocks = blocks; bl->bl_radix = radix; bl->bl_skip = skip; - nodes = 1 + blst_radix_init(NULL, radix, bl->bl_skip, blocks); + bl->bl_cursor = 0; bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags); if (bl->bl_root == NULL) { free(bl, M_SWAP); return (NULL); } - blst_radix_init(bl->bl_root, radix, bl->bl_skip, blocks); + blst_radix_init(bl->bl_root, radix, skip, blocks); #if defined(BLIST_DEBUG) printf( @@ -218,13 +220,24 @@ blist_alloc(blist_t bl, daddr_t count) { daddr_t blk; - if (bl != NULL && count <= bl->bl_root->bm_bighint) { + /* + * This loop iterates at most twice. An allocation failure in the + * first iteration leads to a second iteration only if the cursor was + * non-zero. When the cursor is zero, an allocation failure will + * reduce the hint, stopping further iterations. + */ + while (count <= bl->bl_root->bm_bighint) { if (bl->bl_radix == BLIST_BMAP_RADIX) - blk = blst_leaf_alloc(bl->bl_root, 0, count); + blk = blst_leaf_alloc(bl->bl_root, 0, count, + bl->bl_cursor); else blk = blst_meta_alloc(bl->bl_root, 0, count, - bl->bl_radix, bl->bl_skip); - return (blk); + bl->bl_radix, bl->bl_skip, bl->bl_cursor); + if (blk != SWAPBLK_NONE) { + bl->bl_cursor = blk + count; + return (blk); + } else if (bl->bl_cursor != 0) + bl->bl_cursor = 0; } return (SWAPBLK_NONE); } @@ -341,77 +354,92 @@ blist_print(blist_t bl) /* * blist_leaf_alloc() - allocate at a leaf in the radix tree (a bitmap). * - * This is the core of the allocator and is optimized for the 1 block - * and the BLIST_BMAP_RADIX block allocation cases. Other cases are - * somewhat slower. The 1 block allocation case is log2 and extremely - * quick. + * This is the core of the allocator and is optimized for the + * BLIST_BMAP_RADIX block allocation case. Otherwise, execution + * time is proportional to log2(count) + log2(BLIST_BMAP_RADIX). */ static daddr_t -blst_leaf_alloc( - blmeta_t *scan, - daddr_t blk, - int count -) { - u_daddr_t orig = scan->u.bmu_bitmap; +blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, daddr_t cursor) +{ + u_daddr_t mask; + int count1, hi, lo, mid, num_shifts, range1, range_ext; - if (orig == 0) { + if (count == BLIST_BMAP_RADIX) { /* - * Optimize bitmap all-allocated case. Also, count = 1 - * case assumes at least 1 bit is free in the bitmap, so - * we have to take care of this case here. + * Optimize allocation of BLIST_BMAP_RADIX bits. If this wasn't + * a special case, then forming the final value of 'mask' below + * would require special handling to avoid an invalid left shift + * when count equals the number of bits in mask. */ + if (~scan->u.bmu_bitmap != 0) { + scan->bm_bighint = BLIST_BMAP_RADIX - 1; + return (SWAPBLK_NONE); + } + if (cursor != blk) + return (SWAPBLK_NONE); + scan->u.bmu_bitmap = 0; scan->bm_bighint = 0; - return(SWAPBLK_NONE); + return (blk); } - if (count == 1) { + range1 = 0; + count1 = count - 1; + num_shifts = fls(count1); + mask = scan->u.bmu_bitmap; + while (mask != 0 && num_shifts > 0) { /* - * Optimized code to allocate one bit out of the bitmap + * If bit i is set in mask, then bits in [i, i+range1] are set + * in scan->u.bmu_bitmap. The value of range1 is equal to + * count1 >> num_shifts. Grow range and reduce num_shifts to 0, + * while preserving these invariants. The updates to mask leave + * fewer bits set, but each bit that remains set represents a + * longer string of consecutive bits set in scan->u.bmu_bitmap. */ - u_daddr_t mask; - int j = BLIST_BMAP_RADIX/2; - int r = 0; - - mask = (u_daddr_t)-1 >> (BLIST_BMAP_RADIX/2); - - while (j) { - if ((orig & mask) == 0) { - r += j; - orig >>= j; - } - j >>= 1; - mask >>= j; - } - scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r); - return(blk + r); + num_shifts--; + range_ext = range1 + ((count1 >> num_shifts) & 1); + mask &= mask >> range_ext; + range1 += range_ext; } - if (count <= BLIST_BMAP_RADIX) { + if (mask == 0) { /* - * non-optimized code to allocate N bits out of the bitmap. - * The more bits, the faster the code runs. It will run - * the slowest allocating 2 bits, but since there aren't any - * memory ops in the core loop (or shouldn't be, anyway), - * you probably won't notice the difference. + * Update bighint. There is no allocation bigger than range1 + * available in this leaf. */ - int j; - int n = BLIST_BMAP_RADIX - count; - u_daddr_t mask; + scan->bm_bighint = range1; + return (SWAPBLK_NONE); + } - mask = (u_daddr_t)-1 >> n; + /* + * Discard any candidates that appear before the cursor. + */ + lo = cursor - blk; + mask &= ~(u_daddr_t)0 << lo; - for (j = 0; j <= n; ++j) { - if ((orig & mask) == mask) { - scan->u.bmu_bitmap &= ~mask; - return(blk + j); - } - mask = (mask << 1); - } + if (mask == 0) + return (SWAPBLK_NONE); + + /* + * The least significant set bit in mask marks the start of the first + * available range of sufficient size. Clear all the bits but that one, + * and then perform a binary search to find its position. + */ + mask &= -mask; + hi = BLIST_BMAP_RADIX - count1; + while (lo + 1 < hi) { + mid = (lo + hi) >> 1; + if ((mask >> mid) != 0) + lo = mid; + else + hi = mid; } + /* - * We couldn't allocate count in this subtree, update bighint. + * Set in mask exactly the bits being allocated, and clear them from + * the set of available bits. */ - scan->bm_bighint = count - 1; - return(SWAPBLK_NONE); + mask = (mask << count) - mask; + scan->u.bmu_bitmap &= ~mask; + return (blk + lo); } /* @@ -424,16 +452,12 @@ blst_leaf_alloc( */ static daddr_t -blst_meta_alloc( - blmeta_t *scan, - daddr_t blk, - daddr_t count, - daddr_t radix, - int skip -) { - daddr_t r; - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); +blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t cursor) +{ + daddr_t i, next_skip, r; + int child; + bool scan_from_start; if (scan->u.bmu_avail < count) { /* @@ -444,6 +468,7 @@ blst_meta_alloc( scan->bm_bighint = scan->u.bmu_avail; return (SWAPBLK_NONE); } + next_skip = skip / BLIST_META_RADIX; /* * An ALL-FREE meta node requires special handling before allocating @@ -457,13 +482,11 @@ blst_meta_alloc( * meta node cannot have a terminator in any subtree. */ for (i = 1; i <= skip; i += next_skip) { - if (next_skip == 1) { + if (next_skip == 1) scan[i].u.bmu_bitmap = (u_daddr_t)-1; - scan[i].bm_bighint = BLIST_BMAP_RADIX; - } else { - scan[i].bm_bighint = radix; + else scan[i].u.bmu_avail = radix; - } + scan[i].bm_bighint = radix; } } else { radix /= BLIST_META_RADIX; @@ -476,16 +499,21 @@ blst_meta_alloc( */ panic("allocation too large"); } - for (i = 1; i <= skip; i += next_skip) { + scan_from_start = cursor == blk; + child = (cursor - blk) / radix; + blk += child * radix; + for (i = 1 + child * next_skip; i <= skip; i += next_skip) { if (count <= scan[i].bm_bighint) { /* * The allocation might fit in the i'th subtree. */ if (next_skip == 1) { - r = blst_leaf_alloc(&scan[i], blk, count); + r = blst_leaf_alloc(&scan[i], blk, count, + cursor > blk ? cursor : blk); } else { r = blst_meta_alloc(&scan[i], blk, count, - radix, next_skip - 1); + radix, next_skip - 1, cursor > blk ? + cursor : blk); } if (r != SWAPBLK_NONE) { scan->u.bmu_avail -= count; @@ -503,9 +531,10 @@ blst_meta_alloc( /* * We couldn't allocate count in this subtree, update bighint. */ - if (scan->bm_bighint >= count) + if (scan_from_start && scan->bm_bighint >= count) scan->bm_bighint = count - 1; - return(SWAPBLK_NONE); + + return (SWAPBLK_NONE); } /* @@ -558,16 +587,11 @@ blst_leaf_free( */ static void -blst_meta_free( - blmeta_t *scan, - daddr_t freeBlk, - daddr_t count, - daddr_t radix, - int skip, - daddr_t blk -) { - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); +blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t blk) +{ + daddr_t i, next_skip, v; + int child; #if 0 printf("free (%llx,%lld) FROM (%llx,%lld)\n", @@ -575,6 +599,7 @@ blst_meta_free( (long long)blk, (long long)radix ); #endif + next_skip = skip / BLIST_META_RADIX; if (scan->u.bmu_avail == 0) { /* @@ -619,13 +644,10 @@ blst_meta_free( radix /= BLIST_META_RADIX; - i = (freeBlk - blk) / radix; - blk += i * radix; - i = i * next_skip + 1; - + child = (freeBlk - blk) / radix; + blk += child * radix; + i = 1 + child * next_skip; while (i <= skip && blk < freeBlk + count) { - daddr_t v; - v = blk + radix - freeBlk; if (v > count) v = count; @@ -662,8 +684,7 @@ static void blst_copy( blist_t dest, daddr_t count ) { - int next_skip; - int i; + daddr_t i, next_skip; /* * Leaf node @@ -708,7 +729,7 @@ static void blst_copy( radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; for (i = 1; count && i <= skip; i += next_skip) { if (scan[i].bm_bighint == (daddr_t)-1) @@ -775,17 +796,11 @@ blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count) * number of blocks allocated by the call. */ static daddr_t -blst_meta_fill( - blmeta_t *scan, - daddr_t allocBlk, - daddr_t count, - daddr_t radix, - int skip, - daddr_t blk -) { - int i; - int next_skip = ((u_int)skip / BLIST_META_RADIX); - daddr_t nblks = 0; +blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, daddr_t radix, + daddr_t skip, daddr_t blk) +{ + daddr_t i, nblks, next_skip, v; + int child; if (count > radix) { /* @@ -803,6 +818,7 @@ blst_meta_fill( scan->bm_bighint = 0; return nblks; } + next_skip = skip / BLIST_META_RADIX; /* * An ALL-FREE meta node requires special handling before allocating @@ -828,13 +844,11 @@ blst_meta_fill( radix /= BLIST_META_RADIX; } - i = (allocBlk - blk) / radix; - blk += i * radix; - i = i * next_skip + 1; - + nblks = 0; + child = (allocBlk - blk) / radix; + blk += child * radix; + i = 1 + child * next_skip; while (i <= skip && blk < allocBlk + count) { - daddr_t v; - v = blk + radix - allocBlk; if (v > count) v = count; @@ -867,12 +881,12 @@ blst_meta_fill( */ static daddr_t -blst_radix_init(blmeta_t *scan, daddr_t radix, int skip, daddr_t count) +blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t skip, daddr_t count) { - int i; - int next_skip; - daddr_t memindex = 0; + daddr_t i, memindex, next_skip; + memindex = 0; + /* * Leaf node */ @@ -897,7 +911,7 @@ blst_radix_init(blmeta_t *scan, daddr_t radix, int ski } radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; for (i = 1; i <= skip; i += next_skip) { if (count >= radix) { @@ -939,11 +953,10 @@ blst_radix_init(blmeta_t *scan, daddr_t radix, int ski #ifdef BLIST_DEBUG static void -blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, int skip, int tab) +blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, daddr_t skip, + int tab) { - int i; - int next_skip; - int lastState = 0; + daddr_t i, next_skip; if (radix == BLIST_BMAP_RADIX) { printf( @@ -985,7 +998,7 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t ); radix /= BLIST_META_RADIX; - next_skip = ((u_int)skip / BLIST_META_RADIX); + next_skip = skip / BLIST_META_RADIX; tab += 4; for (i = 1; i <= skip; i += next_skip) { @@ -995,7 +1008,6 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t tab, tab, "", (long long)blk, (long long)radix ); - lastState = 0; break; } blst_radix_print( Modified: stable/10/sys/sys/blist.h ============================================================================== --- stable/10/sys/sys/blist.h Tue Jul 25 03:59:35 2017 (r321458) +++ stable/10/sys/sys/blist.h Tue Jul 25 04:13:43 2017 (r321459) @@ -82,6 +82,7 @@ typedef struct blist { daddr_t bl_blocks; /* area of coverage */ daddr_t bl_radix; /* coverage radix */ daddr_t bl_skip; /* starting skip */ + daddr_t bl_cursor; /* next-fit search starts at */ blmeta_t *bl_root; /* root of radix tree */ } *blist_t; From owner-svn-src-all@freebsd.org Tue Jul 25 06:59:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2494FDBC25B; Tue, 25 Jul 2017 06:59:37 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E28F56B0A3; Tue, 25 Jul 2017 06:59:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6P6xaoB035800; Tue, 25 Jul 2017 06:59:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P6xa88035799; Tue, 25 Jul 2017 06:59:36 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707250659.v6P6xa88035799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Tue, 25 Jul 2017 06:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321460 - head/sys/fs/fdescfs X-SVN-Group: head X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: head/sys/fs/fdescfs X-SVN-Commit-Revision: 321460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 06:59:37 -0000 Author: dchagin Date: Tue Jul 25 06:59:35 2017 New Revision: 321460 URL: https://svnweb.freebsd.org/changeset/base/321460 Log: Replace unnecessary _KERNEL by double-include protection. MFC after: 2 week Modified: head/sys/fs/fdescfs/fdesc.h Modified: head/sys/fs/fdescfs/fdesc.h ============================================================================== --- head/sys/fs/fdescfs/fdesc.h Tue Jul 25 04:13:43 2017 (r321459) +++ head/sys/fs/fdescfs/fdesc.h Tue Jul 25 06:59:35 2017 (r321460) @@ -34,7 +34,9 @@ * $FreeBSD$ */ -#ifdef _KERNEL +#ifndef _FS_FDESC_H_ +#define _FS_FDESC_H_ + /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 struct fdescmount { @@ -66,4 +68,4 @@ extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, struct vnode **); -#endif /* _KERNEL */ +#endif /* !_FS_FDESC_H_ */ From owner-svn-src-all@freebsd.org Tue Jul 25 09:48:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0509C0886E; Tue, 25 Jul 2017 09:48:34 +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 9DC696FD59; Tue, 25 Jul 2017 09:48:34 +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 v6P9mXhi005492; Tue, 25 Jul 2017 09:48:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6P9mXWs005491; Tue, 25 Jul 2017 09:48:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707250948.v6P9mXWs005491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 25 Jul 2017 09:48:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321461 - head/lib/libc/x86/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/x86/sys X-SVN-Commit-Revision: 321461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 09:48:34 -0000 Author: kib Date: Tue Jul 25 09:48:33 2017 New Revision: 321461 URL: https://svnweb.freebsd.org/changeset/base/321461 Log: Fix indent. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/lib/libc/x86/sys/__vdso_gettc.c Modified: head/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- head/lib/libc/x86/sys/__vdso_gettc.c Tue Jul 25 06:59:35 2017 (r321460) +++ head/lib/libc/x86/sys/__vdso_gettc.c Tue Jul 25 09:48:33 2017 (r321461) @@ -158,7 +158,7 @@ __vdso_init_hpet(uint32_t u) if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)new_map) == 0 && new_map != MAP_FAILED) - munmap((void *)new_map, PAGE_SIZE); + munmap((void *)new_map, PAGE_SIZE); return; fail: From owner-svn-src-all@freebsd.org Tue Jul 25 10:41:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BAFCC31A2D; Tue, 25 Jul 2017 10:41:35 +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 693BC715E6; Tue, 25 Jul 2017 10:41:35 +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 v6PAfYra026256; Tue, 25 Jul 2017 10:41:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PAfYIT026255; Tue, 25 Jul 2017 10:41:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201707251041.v6PAfYIT026255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Jul 2017 10:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321462 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 321462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 10:41:35 -0000 Author: andrew Date: Tue Jul 25 10:41:34 2017 New Revision: 321462 URL: https://svnweb.freebsd.org/changeset/base/321462 Log: Build the 32-bit ARM libstand and loader parts with -fPIC. Many of them are already built with this flag so libstand should also be build as such. This will be needed when moving to lld as it refuses to link due to incompatible relocations. Sponsored by: DARPA, AFRL Modified: head/share/mk/bsd.stand.mk Modified: head/share/mk/bsd.stand.mk ============================================================================== --- head/share/mk/bsd.stand.mk Tue Jul 25 09:48:33 2017 (r321461) +++ head/share/mk/bsd.stand.mk Tue Jul 25 10:41:34 2017 (r321462) @@ -21,6 +21,9 @@ CFLAGS+= -fPIC -mno-red-zone .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -fPIC -mgeneral-regs-only .endif +.if ${MACHINE_CPUARCH} == "arm" +CFLAGS+= -fPIC +.endif .if ${MACHINE_CPUARCH} == "mips" CFLAGS+= -G0 -fno-pic -mno-abicalls .endif From owner-svn-src-all@freebsd.org Tue Jul 25 11:05:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6F70C7829D; Tue, 25 Jul 2017 11:05:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73B947207C; Tue, 25 Jul 2017 11:05:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PB5rk4037985; Tue, 25 Jul 2017 11:05:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PB5r4W037984; Tue, 25 Jul 2017 11:05:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201707251105.v6PB5r4W037984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 25 Jul 2017 11:05:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321463 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 321463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 11:05:54 -0000 Author: tuexen Date: Tue Jul 25 11:05:53 2017 New Revision: 321463 URL: https://svnweb.freebsd.org/changeset/base/321463 Log: Remove duplicate statement. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Tue Jul 25 10:41:34 2017 (r321462) +++ head/sys/netinet/sctp_indata.c Tue Jul 25 11:05:53 2017 (r321463) @@ -2074,7 +2074,6 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc struct mbuf *mm; control->data = dmbuf; - mm = control->data; for (mm = control->data; mm; mm = mm->m_next) { control->length += SCTP_BUF_LEN(mm); } From owner-svn-src-all@freebsd.org Tue Jul 25 12:52:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EF7AC7B993; Tue, 25 Jul 2017 12:52:34 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 014A375A9B; Tue, 25 Jul 2017 12:52:33 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PCqX9n084131; Tue, 25 Jul 2017 12:52:33 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PCqW4V084128; Tue, 25 Jul 2017 12:52:32 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251252.v6PCqW4V084128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 12:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321464 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/probes usr.sbin/dtrace/tests/common/probes X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/probes usr.sbin/dtrace/tests/common/probes X-SVN-Commit-Revision: 321464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 12:52:34 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 12:52:32 2017 New Revision: 321464 URL: https://svnweb.freebsd.org/changeset/base/321464 Log: Add a simple program which calls sigtimedwait(2) to generate events for testing This test timeout on a quiet system because there is nobody triggers 'syscall::*wait*:entry' probe while test execution. Reviewed by: gnn, markj, ngie Differential Revision: https://reviews.freebsd.org/D11668 Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c (contents, props changed) Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d head/cddl/usr.sbin/dtrace/tests/common/probes/Makefile Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c Tue Jul 25 12:52:32 2017 (r321464) @@ -0,0 +1,47 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2017 Li-Wen Hsu + */ + +#include +#include +#include + +int +main(void) +{ + + sigset_t set; + siginfo_t info; + struct timespec timeout; + + (void)sigemptyset(&set); + (void)sigaddset(&set, SIGHUP); + timeout.tv_sec = 1; + timeout.tv_nsec = 0; + + for (;;) + (void)sigtimedwait(&set, &info, &timeout); + + return (0); +} Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d Tue Jul 25 11:05:53 2017 (r321463) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d Tue Jul 25 12:52:32 2017 (r321464) @@ -45,6 +45,7 @@ BEGIN } syscall::*wait*:entry +/pid == $1/ { exit(0); } Modified: head/cddl/usr.sbin/dtrace/tests/common/probes/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/probes/Makefile Tue Jul 25 11:05:53 2017 (r321463) +++ head/cddl/usr.sbin/dtrace/tests/common/probes/Makefile Tue Jul 25 12:52:32 2017 (r321464) @@ -32,6 +32,7 @@ TESTEXES= \ CFILES= \ + tst.probestar.c \ From owner-svn-src-all@freebsd.org Tue Jul 25 12:58:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02E44C7BA66; Tue, 25 Jul 2017 12:58:05 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE33B75D15; Tue, 25 Jul 2017 12:58:04 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PCw3ls084435; Tue, 25 Jul 2017 12:58:03 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PCw3Bv084432; Tue, 25 Jul 2017 12:58:03 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251258.v6PCw3Bv084432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 12:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321465 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/speculation usr.sbin/dtrace/tests/common/speculation X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/speculation usr.sbin/dtrace/tests/common/speculation X-SVN-Commit-Revision: 321465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 12:58:05 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 12:58:03 2017 New Revision: 321465 URL: https://svnweb.freebsd.org/changeset/base/321465 Log: Add a simple script which calls open(2) and others to generate events for testing. This test times-out on a quiet system because there is nobody triggers syscall::open:entry or syscall::: probe while test execution. Reviewed by: gnn, markj (earlier version) Differential Revision: https://reviews.freebsd.org/D11671 Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe (contents, props changed) Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d head/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d Tue Jul 25 12:52:32 2017 (r321464) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d Tue Jul 25 12:58:03 2017 (r321465) @@ -39,6 +39,7 @@ BEGIN { i = 0; + notused = $1; } syscall::open:entry Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Tue Jul 25 12:58:03 2017 (r321465) @@ -0,0 +1,30 @@ +#!/usr/bin/env ksh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2017 Li-Wen Hsu + +while true +do + sleep 0.1 + cat /etc/motd > /dev/null +done Modified: head/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile Tue Jul 25 12:52:32 2017 (r321464) +++ head/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile Tue Jul 25 12:58:03 2017 (r321465) @@ -68,6 +68,7 @@ ${PACKAGE}FILES= \ tst.zerosize.d \ TESTEXES= \ + tst.NoSpecBuffer.exe \ CFILES= \ From owner-svn-src-all@freebsd.org Tue Jul 25 13:01:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD90C7BC7D; Tue, 25 Jul 2017 13:01:11 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C53B76022; Tue, 25 Jul 2017 13:01:11 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PD1ARu085444; Tue, 25 Jul 2017 13:01:10 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PD1A2b085443; Tue, 25 Jul 2017 13:01:10 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251301.v6PD1A2b085443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321466 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Commit-Revision: 321466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:01:11 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:01:10 2017 New Revision: 321466 URL: https://svnweb.freebsd.org/changeset/base/321466 Log: Add an auxiliary subroutine to generate read(2) event while testing. Reviewed by: gnn, ngie Differential Revision: https://reviews.freebsd.org/D11673 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Tue Jul 25 12:58:03 2017 (r321465) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Tue Jul 25 13:01:10 2017 (r321466) @@ -38,6 +38,14 @@ ## +reader() +{ + while true + do + sleep 0.1 + cat /etc/motd > /dev/null + done +} if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' @@ -46,11 +54,16 @@ fi dtrace=$1 +reader & +child=$! + $dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi + +kill $child exit $status From owner-svn-src-all@freebsd.org Tue Jul 25 13:04:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E43CC7BD30; Tue, 25 Jul 2017 13:04:25 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BAB3763C7; Tue, 25 Jul 2017 13:04:25 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PD4OZG088669; Tue, 25 Jul 2017 13:04:24 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PD4OSB088668; Tue, 25 Jul 2017 13:04:24 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251304.v6PD4OSB088668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321467 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Commit-Revision: 321467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:04:25 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:04:24 2017 New Revision: 321467 URL: https://svnweb.freebsd.org/changeset/base/321467 Log: Explicitly set dynamic variable buffer size. We added too many variable assignments in BEGIN block, which will run out of default auto-configured variable buffer space. The test VM has 4G RAM which should be enough for most cases so it's reasonable to increase limitation to these case. Reviewed by: gnn, markj, ngie Differential Revision: https://reviews.freebsd.org/D11674 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d Tue Jul 25 13:01:10 2017 (r321466) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d Tue Jul 25 13:04:24 2017 (r321467) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #pragma D option quiet +#pragma D option dynvarsize=2m BEGIN { From owner-svn-src-all@freebsd.org Tue Jul 25 13:07:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB8C7C7BE02; Tue, 25 Jul 2017 13:07:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4DCB7657D; Tue, 25 Jul 2017 13:07:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PD76iC088813; Tue, 25 Jul 2017 13:07:06 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PD76uq088812; Tue, 25 Jul 2017 13:07:06 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251307.v6PD76uq088812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321468 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Commit-Revision: 321468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:07:08 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:07:06 2017 New Revision: 321468 URL: https://svnweb.freebsd.org/changeset/base/321468 Log: Explicitly set dynamic variable buffer size. We added too many variable assignments in BEGIN block, which will run out of default auto-configured variable buffer space. The test VM has 4G RAM which should be enough for most cases so it's reasonable to increase limitation to these case. Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D11676 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d Tue Jul 25 13:04:24 2017 (r321467) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d Tue Jul 25 13:07:06 2017 (r321468) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #pragma D option quiet +#pragma D option dynvarsize=2m /* * This test verifies that the basename() and dirname() functions are working From owner-svn-src-all@freebsd.org Tue Jul 25 13:11:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1595C7BF79; Tue, 25 Jul 2017 13:11:21 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD4DB7688B; Tue, 25 Jul 2017 13:11:21 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PDBKO8089034; Tue, 25 Jul 2017 13:11:20 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDBKgC089032; Tue, 25 Jul 2017 13:11:20 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251311.v6PDBKgC089032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321469 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Commit-Revision: 321469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:11:22 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:11:20 2017 New Revision: 321469 URL: https://svnweb.freebsd.org/changeset/base/321469 Log: Make this test case accepts basename() in D script returns "" or "." In Solaris, basename(1) and basename(3) both return "." while being given an empty string (""), while in BSD (and Linux) basename(1) returns "" and basename(3) returns "." While here, also change #!/usr/bin/ksh to #!/usr/bin/env ksh to find ksh in $PATH Reviewed by: gnn, markj (earlier version), ngie (earlier version) Differential Revision: https://reviews.freebsd.org/D11707 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d Tue Jul 25 13:07:06 2017 (r321468) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d Tue Jul 25 13:11:20 2017 (r321469) @@ -55,12 +55,16 @@ BEGIN dir[i++] = "f"; dir[i++] = "f/"; dir[i++] = "/////"; + /* + * basename(3) and basename(1) return different results for the empty + * string on FreeBSD, so we need special handling. dir[i++] = ""; + */ end = i; i = 0; - printf("#!/usr/bin/ksh\n\n"); + printf("#!/usr/bin/env ksh\n\n"); } tick-1ms @@ -84,5 +88,19 @@ tick-1ms tick-1ms /i == end/ { + dir[i] = ""; + printf("if [ \"`basename \"%s\"`\" != \"%s\" -a \".\" != \"%s\" ]; then\n", + dir[i], basename(dir[i]), basename(dir[i])); + printf(" echo \"basename(\\\"%s\\\") is \\\"%s\\\"; ", + dir[i], basename(dir[i])); + printf("expected \\\"`basename \"%s\"`\\\" or \\\".\\\"\"\n", dir[i]); + printf("fi\n\n"); + printf("if [ `dirname \"%s\"` != \"%s\" ]; then\n", + dir[i], dirname(dir[i])); + printf(" echo \"dirname(\\\"%s\\\") is \\\"%s\\\"; ", + dir[i], dirname(dir[i])); + printf("expected \\\"`dirname \"%s\"`\"\\\"\n", dir[i]); + printf("fi\n\n"); + exit(0); } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out Tue Jul 25 13:07:06 2017 (r321468) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out Tue Jul 25 13:11:20 2017 (r321469) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh if [ `basename "/foo/bar/baz"` != "baz" ]; then echo "basename(\"/foo/bar/baz\") is \"baz\"; expected \"`basename "/foo/bar/baz"`"\" @@ -152,8 +152,8 @@ if [ `dirname "/////"` != "/" ]; then echo "dirname(\"/////\") is \"/\"; expected \"`dirname "/////"`"\" fi -if [ `basename ""` != "." ]; then - echo "basename(\"\") is \".\"; expected \"`basename ""`"\" +if [ "`basename ""`" != "." -a "." != "." ]; then + echo "basename(\"\") is \".\"; expected \"`basename ""`\" or \".\"" fi if [ `dirname ""` != "." ]; then From owner-svn-src-all@freebsd.org Tue Jul 25 13:14:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5267C7C154; Tue, 25 Jul 2017 13:14:03 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8208C76BC8; Tue, 25 Jul 2017 13:14:03 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PDE2WI092686; Tue, 25 Jul 2017 13:14:02 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDE26v092684; Tue, 25 Jul 2017 13:14:02 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251314.v6PDE26v092684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321470 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc X-SVN-Commit-Revision: 321470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:14:03 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:14:02 2017 New Revision: 321470 URL: https://svnweb.freebsd.org/changeset/base/321470 Log: Modify glob patterns and expected output to match FreeBSD's implementation. Reviewed by: gnn, markj, ngie Differential Revision: https://reviews.freebsd.org/D11713 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh Tue Jul 25 13:11:20 2017 (r321469) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh Tue Jul 25 13:14:02 2017 (r321470) @@ -31,11 +31,12 @@ fi dtrace=$1 -$dtrace -ln 'syscall::*$1:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::$1*:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::p$1[0-9][0-9]:entry' read | awk '{print $(NF-1),$NF}' | \ - sort +$dtrace -ln 'syscall:freebsd:*$1:entry' read | \ + awk '{print $(NF-1),$NF}' | grep -v -E 'compat.\.' | sort +$dtrace -ln 'syscall:freebsd:$1*:entry' read | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:w$1[0-9]:entry' ait | \ + awk '{print $(NF-1),$NF}' | sort exit $status Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out Tue Jul 25 13:11:20 2017 (r321469) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out Tue Jul 25 13:14:02 2017 (r321470) @@ -1,15 +1,22 @@ FUNCTION NAME +aio_read entry +obs_vread entry pread entry read entry +rtprio_thread entry FUNCTION NAME read entry readlink entry +readlinkat entry readv entry FUNCTION NAME read entry readlink entry +readlinkat entry readv entry FUNCTION NAME readlink entry +readlinkat entry FUNCTION NAME -pread64 entry +wait4 entry +wait6 entry From owner-svn-src-all@freebsd.org Tue Jul 25 13:17:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 735A6C7C268; Tue, 25 Jul 2017 13:17:07 +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 40E1E76DB7; Tue, 25 Jul 2017 13:17:07 +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 v6PDH60A092909; Tue, 25 Jul 2017 13:17:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDH63E092908; Tue, 25 Jul 2017 13:17:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201707251317.v6PDH63E092908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 25 Jul 2017 13:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321471 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:17:07 -0000 Author: avg Date: Tue Jul 25 13:17:06 2017 New Revision: 321471 URL: https://svnweb.freebsd.org/changeset/base/321471 Log: spa_import_rootpool should be able to handle an imported root pool That is required to support reboot -r with a new root filesystem being on an already imported pool. PR: 210721 Reported by: Jan Bramkamp MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Jul 25 13:14:02 2017 (r321470) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Jul 25 13:17:06 2017 (r321471) @@ -4270,6 +4270,16 @@ spa_import_rootpool(const char *name) if ((spa = spa_lookup(pname)) != NULL) { /* + * The pool could already be imported, + * e.g., after reboot -r. + */ + if (spa->spa_state == POOL_STATE_ACTIVE) { + mutex_exit(&spa_namespace_lock); + nvlist_free(config); + return (0); + } + + /* * Remove the existing root pool from the namespace so * that we can replace it with the correct config * we just read in. From owner-svn-src-all@freebsd.org Tue Jul 25 13:18:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BBBEC7C2FF; Tue, 25 Jul 2017 13:18:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 689E076F19; Tue, 25 Jul 2017 13:18:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PDISvI093013; Tue, 25 Jul 2017 13:18:28 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDISfa093012; Tue, 25 Jul 2017 13:18:28 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707251318.v6PDISfa093012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 25 Jul 2017 13:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321472 - head/cddl/usr.sbin/dtrace/tests/tools X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/usr.sbin/dtrace/tests/tools X-SVN-Commit-Revision: 321472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:18:29 -0000 Author: lwhsu (ports committer) Date: Tue Jul 25 13:18:28 2017 New Revision: 321472 URL: https://svnweb.freebsd.org/changeset/base/321472 Log: The test case common.funcs.t_dtrace_contrib.tst_basename_d generates a verifying script which needs being run to complete the test. While here, add missing shebang. Reviewed by: gnn, markj, ngie Differential Revision: https://reviews.freebsd.org/D11716 Modified: head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh Modified: head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh Tue Jul 25 13:17:06 2017 (r321471) +++ head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh Tue Jul 25 13:18:28 2017 (r321472) @@ -1,3 +1,5 @@ +#!/bin/sh + # $FreeBSD$ usage() @@ -83,6 +85,12 @@ runtest() retval=1 ;; esac + + if [ $retval -eq 0 ] && \ + head -n 1 $STDOUT | grep -q -E '^#!/.*ksh$'; then + ksh $STDOUT + retval=$? + fi return $retval } From owner-svn-src-all@freebsd.org Tue Jul 25 13:43:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 275C6C7CDAD; Tue, 25 Jul 2017 13:43:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E195A7C04C; Tue, 25 Jul 2017 13:43:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PDhFVa005359; Tue, 25 Jul 2017 13:43:15 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDhFnD005358; Tue, 25 Jul 2017 13:43:15 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707251343.v6PDhFnD005358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Jul 2017 13:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321473 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 321473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:43:16 -0000 Author: gjb Date: Tue Jul 25 13:43:14 2017 New Revision: 321473 URL: https://svnweb.freebsd.org/changeset/base/321473 Log: Fix a typo. PR: 220917 (related) Submitted by: fbsdbugs4 _at_ sentry dot org Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 13:18:28 2017 (r321472) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 13:43:14 2017 (r321473) @@ -105,8 +105,8 @@ without recompiling the kernel. To mitigate system crashes with such configurations, - chose Escape to loader prompt in the boot - menu and enter the following lines from &man.loader.8; + choose Escape to loader prompt in the + boot menu and enter the following lines from &man.loader.8; prompt, after an OK: set kern.kstack_pages=4 From owner-svn-src-all@freebsd.org Tue Jul 25 13:43:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5B07C7CE27; Tue, 25 Jul 2017 13:43:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6D97C17B; Tue, 25 Jul 2017 13:43:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PDhpTT005433; Tue, 25 Jul 2017 13:43:51 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PDhpnQ005431; Tue, 25 Jul 2017 13:43:51 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707251343.v6PDhpnQ005431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Jul 2017 13:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321474 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 321474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 13:43:52 -0000 Author: gjb Date: Tue Jul 25 13:43:51 2017 New Revision: 321474 URL: https://svnweb.freebsd.org/changeset/base/321474 Log: Trim stale entries from 11.0. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Tue Jul 25 13:43:14 2017 (r321473) +++ stable/11/release/doc/share/xml/errata.xml Tue Jul 25 13:43:51 2017 (r321474) @@ -19,73 +19,9 @@ - FreeBSD-EN-16:18.loader - 25 October 2016 - Loader may hang during boot - - - - FreeBSD-EN-16:19.tzcode - 6 December 2016 - Fix warnings about invalid timezone - abbreviations - - - - FreeBSD-EN-16:20.tzdata - 6 December 2016 - Update timezone database - information - - - - FreeBSD-EN-16:21.localedef - 6 December 2016 - Fix incorrectly defined unicode - characters - - - - FreeBSD-EN-17:01.pcie - 23 February 2017 - Fix system hang when booting when PCI-express - HotPlug is enabled - - - - FreeBSD-EN-17:02.yp - 23 February 2017 - Fix NIS master updates are not pushed to an NIS - slave - - - - FreeBSD-EN-17:03.hyperv - 23 February 2017 - Fix compatibility with Hyper-V/storage after - KB3172614 or KB3179574 - - - - FreeBSD-EN-17:04.mandoc - 23 February 2017 - Make &man.makewhatis.1; output - reproducible - - - - FreeBSD-EN-17:05.xen - 23 February 2017 - Xen migration enhancements + No notices +   +   Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Tue Jul 25 13:43:14 2017 (r321473) +++ stable/11/release/doc/share/xml/security.xml Tue Jul 25 13:43:51 2017 (r321474) @@ -19,84 +19,9 @@ - FreeBSD-SA-16:32.bhyve - 25 October 2016 - Privilege escalation vulnerability - - - - FreeBSD-SA-16:33.openssh - 2 November 2016 - Remote Denial of Service - vulnerability - - - - FreeBSD-SA-16:36.telnetd - 6 December 2016 - Possible &man.login.1; argument - injection - - - - FreeBSD-SA-16:37.libc - 6 December 2016 - &man.link.ntoa.3; buffer overflow - - - - FreeBSD-SA-16:38.bhyve - 6 December 2016 - Possible escape from &man.bhyve.8; virtual - machine - - - - FreeBSD-SA-16:39.ntp - 22 December 2016 - Multiple vulnerabilities - - - - FreeBSD-SA-17:01.openssh - 10 January 2017 - Multiple vulnerabilities - - - - FreeBSD-SA-17:02.openssl - 23 February 2017 - Multiple vulnerabilities - - - - FreeBSD-SA-17:03.ntp - 12 April 2017 - Multiple vulnerabilities - - - - FreeBSD-SA-17:04.ipfilter - 27 April 2017 - Fix fragment handling panic - - - - FreeBSD-SA-17:05.heimdal - 12 July 2017 - Fix KDC-REP service name validation - vulnerability + No advisories +   +   From owner-svn-src-all@freebsd.org Tue Jul 25 14:35:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2C94C7D8D4; Tue, 25 Jul 2017 14:35:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6BA7D63F; Tue, 25 Jul 2017 14:35:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PEZifK025987; Tue, 25 Jul 2017 14:35:44 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PEZisI025985; Tue, 25 Jul 2017 14:35:44 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707251435.v6PEZisI025985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Jul 2017 14:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321475 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 321475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 14:35:45 -0000 Author: gjb Date: Tue Jul 25 14:35:44 2017 New Revision: 321475 URL: https://svnweb.freebsd.org/changeset/base/321475 Log: Mention arm64 lacking EFI RTC support, and a workaround. Submitted by: emaste Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 13:43:51 2017 (r321474) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 14:35:44 2017 (r321475) @@ -131,6 +131,17 @@ boot upgrade from anywhere on earlier stable branches, so caution should be exercised. + + + [2017-07-25] &os;/&arch.arm64; currently lacks + EFI real-time clock + (RTC) support, which may cause the system + to boot with the wrong time set. + + As a workaround, either enable &man.ntpdate.8; or + include ntpd_sync_on_start="YES" in + &man.rc.conf.5;. + From owner-svn-src-all@freebsd.org Tue Jul 25 14:38:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFC62C7DA20; Tue, 25 Jul 2017 14:38:31 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D0B17D8FE; Tue, 25 Jul 2017 14:38:31 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PEcUPX026284; Tue, 25 Jul 2017 14:38:30 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PEcUAC026283; Tue, 25 Jul 2017 14:38:30 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707251438.v6PEcUAC026283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 25 Jul 2017 14:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321476 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 321476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 14:38:31 -0000 Author: sbruno Date: Tue Jul 25 14:38:30 2017 New Revision: 321476 URL: https://svnweb.freebsd.org/changeset/base/321476 Log: Drop ixgbe RX lock during TCP_LRO processing. This eliminates a "storm" of LOR detection and a bit of lock release/acquire collision when using LRO. Submitted by: Kevin Bowling MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D11712 Modified: head/sys/dev/ixgbe/ix_txrx.c Modified: head/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- head/sys/dev/ixgbe/ix_txrx.c Tue Jul 25 14:35:44 2017 (r321475) +++ head/sys/dev/ixgbe/ix_txrx.c Tue Jul 25 14:38:30 2017 (r321476) @@ -1593,9 +1593,7 @@ ixgbe_rx_input(struct rx_ring *rxr, struct ifnet *ifp, if (tcp_lro_rx(&rxr->lro, m, 0) == 0) return; } - IXGBE_RX_UNLOCK(rxr); (*ifp->if_input)(ifp, m); - IXGBE_RX_LOCK(rxr); } /* ixgbe_rx_input */ /************************************************************************ @@ -1880,7 +1878,9 @@ next_desc: /* Now send to the stack or do LRO */ if (sendmp != NULL) { rxr->next_to_check = i; + IXGBE_RX_UNLOCK(rxr); ixgbe_rx_input(rxr, ifp, sendmp, ptype); + IXGBE_RX_LOCK(rxr); i = rxr->next_to_check; } @@ -1897,12 +1897,12 @@ next_desc: rxr->next_to_check = i; + IXGBE_RX_UNLOCK(rxr); + /* * Flush any outstanding LRO work */ tcp_lro_flush_all(lro); - - IXGBE_RX_UNLOCK(rxr); /* * Still have cleaning to do? From owner-svn-src-all@freebsd.org Tue Jul 25 14:41:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 603EEC7DD6C; Tue, 25 Jul 2017 14:41:52 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8C857DE76; Tue, 25 Jul 2017 14:41:51 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PEfogn030335; Tue, 25 Jul 2017 14:41:50 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PEfocM030334; Tue, 25 Jul 2017 14:41:50 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707251441.v6PEfocM030334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 25 Jul 2017 14:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321477 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 321477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 14:41:52 -0000 Author: sbruno Date: Tue Jul 25 14:41:50 2017 New Revision: 321477 URL: https://svnweb.freebsd.org/changeset/base/321477 Log: Don't hold the RM lock during lagg_proto_addport() to avoid an LOR. Submitted by: Kevin Bowling Reviewed by: mav MFC after: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D11711 Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Tue Jul 25 14:38:30 2017 (r321476) +++ head/sys/net/if_lagg.c Tue Jul 25 14:41:50 2017 (r321477) @@ -738,14 +738,15 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * lagg_setmulti(lp); + LAGG_WUNLOCK(sc); + if ((error = lagg_proto_addport(sc, lp)) != 0) { /* Remove the port, without calling pr_delport. */ + LAGG_WLOCK(sc); lagg_port_destroy(lp, 0); LAGG_UNLOCK_ASSERT(sc); return (error); } - - LAGG_WUNLOCK(sc); /* Update lagg capabilities */ lagg_capabilities(sc); From owner-svn-src-all@freebsd.org Tue Jul 25 14:46:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C009C7DFD0; Tue, 25 Jul 2017 14:46:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D977C7E2EC; Tue, 25 Jul 2017 14:46:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PEkEe7030729; Tue, 25 Jul 2017 14:46:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PEkEgZ030728; Tue, 25 Jul 2017 14:46:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707251446.v6PEkEgZ030728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Jul 2017 14:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321478 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 321478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 14:46:15 -0000 Author: gjb Date: Tue Jul 25 14:46:13 2017 New Revision: 321478 URL: https://svnweb.freebsd.org/changeset/base/321478 Log: Document a late-discovered issue where 'root on ZFS' installations on arm64 fail to find the root pool. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 14:41:50 2017 (r321477) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 25 14:46:13 2017 (r321478) @@ -142,6 +142,15 @@ boot include ntpd_sync_on_start="YES" in &man.rc.conf.5;. + + + [2017-07-25] A late issue was discovered with + &os;/&arch.arm64; and "root on + ZFS" installations where the root + ZFS pool would fail to be located. + + There currently is no workaround. + From owner-svn-src-all@freebsd.org Tue Jul 25 15:03:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0A7CC7E6C3; Tue, 25 Jul 2017 15:03:07 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91D257ECE1; Tue, 25 Jul 2017 15:03:07 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PF367m038787; Tue, 25 Jul 2017 15:03:06 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PF35cf038781; Tue, 25 Jul 2017 15:03:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707251503.v6PF35cf038781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 25 Jul 2017 15:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321479 - in head/sys/netinet: . cc X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys/netinet: . cc X-SVN-Commit-Revision: 321479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 15:03:07 -0000 Author: sbruno Date: Tue Jul 25 15:03:05 2017 New Revision: 321479 URL: https://svnweb.freebsd.org/changeset/base/321479 Log: Revert r308180 - Set slow start threshold more accurrately on loss ... This was discussed between various transport@ members and it was requested to be reverted and discussed. Submitted by: kevin Reported by: lawerence Reviewed by: hiren Modified: head/sys/netinet/cc/cc_cdg.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c Modified: head/sys/netinet/cc/cc_cdg.c ============================================================================== --- head/sys/netinet/cc/cc_cdg.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/cc/cc_cdg.c Tue Jul 25 15:03:05 2017 (r321479) @@ -474,9 +474,7 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_ty ENTER_RECOVERY(CCV(ccv, t_flags)); break; case CC_RTO: - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); CCV(ccv, snd_cwnd) = mss; break; default: Modified: head/sys/netinet/cc/cc_chd.c ============================================================================== --- head/sys/netinet/cc/cc_chd.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/cc/cc_chd.c Tue Jul 25 15:03:05 2017 (r321479) @@ -330,11 +330,13 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty struct ertt *e_t; struct chd *chd_data; int qdly; + uint32_t cwin; u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; + cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); switch(signal_type) { @@ -376,9 +378,7 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty ENTER_FASTRECOVERY(CCV(ccv, t_flags)); break; case CC_RTO: - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); CCV(ccv, snd_cwnd) = mss; break; Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/cc/cc_dctcp.c Tue Jul 25 15:03:05 2017 (r321479) @@ -230,21 +230,19 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - uint32_t cwin, ssthresh_on_loss; + uint32_t cwin; u_int mss; dctcp_data = ccv->cc_data; cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); - ssthresh_on_loss = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = mss * + max(cwin / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion @@ -252,7 +250,8 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) * snd_cwnd_prev and recalculate snd_ssthresh */ cwin = CCV(ccv, snd_cwnd_prev); - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = + max(cwin / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -266,7 +265,8 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = + mss * max(cwin / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; @@ -285,7 +285,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); CCV(ccv, snd_cwnd) = mss; } break; Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/cc/cc_htcp.c Tue Jul 25 15:03:05 2017 (r321479) @@ -325,9 +325,7 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); CCV(ccv, snd_cwnd) = mss; break; } @@ -520,10 +518,6 @@ htcp_ssthresh_update(struct cc_var *ccv) CCV(ccv, snd_ssthresh) = ((u_long)CCV(ccv, snd_cwnd) * htcp_data->beta) >> HTCP_SHIFT; } - - /* Align ssthresh to MSS boundary */ - CCV(ccv, snd_ssthresh) = (CCV(ccv, snd_ssthresh) / CCV(ccv, t_maxseg)) - * CCV(ccv, t_maxseg); } Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/cc/cc_newreno.c Tue Jul 25 15:03:05 2017 (r321479) @@ -182,26 +182,23 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - uint32_t cwin, ssthresh_on_loss; + uint32_t cwin; u_int mss; cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); - ssthresh_on_loss = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - cwin = max(cwin / 2 / mss, 2) * mss; + cwin = max(2*mss, cwin/2); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_cwnd) = cwin; } ENTER_RECOVERY(CCV(ccv, t_flags)); @@ -209,13 +206,13 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; case CC_RTO: - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_cwnd) = mss; break; } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Jul 25 14:46:13 2017 (r321478) +++ head/sys/netinet/tcp_input.c Tue Jul 25 15:03:05 2017 (r321479) @@ -441,8 +441,7 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) */ tp->snd_ssthresh = - max((tp->snd_max - tp->snd_una) / 2 / maxseg, 2) - * maxseg; + max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); tp->snd_cwnd = maxseg; } break; From owner-svn-src-all@freebsd.org Tue Jul 25 15:08:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF181C7E871; Tue, 25 Jul 2017 15:08:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C1B47F138; Tue, 25 Jul 2017 15:08:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PF8rNa039346; Tue, 25 Jul 2017 15:08:53 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PF8qQ8039338; Tue, 25 Jul 2017 15:08:52 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707251508.v6PF8qQ8039338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 25 Jul 2017 15:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321480 - in head/sys/netinet: . cc tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys/netinet: . cc tcp_stacks X-SVN-Commit-Revision: 321480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 15:08:54 -0000 Author: sbruno Date: Tue Jul 25 15:08:52 2017 New Revision: 321480 URL: https://svnweb.freebsd.org/changeset/base/321480 Log: Revert r307901 - Inform CC modules about loss events. This was discussed between various transport@ members and it was requested to be reverted and discussed. Submitted by: Kevin Bowling Reported by: lawrence Reviewed by: hiren Sponsored by: Limelight Networks Modified: head/sys/netinet/cc/cc_cdg.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/cc/cc_cdg.c ============================================================================== --- head/sys/netinet/cc/cc_cdg.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_cdg.c Tue Jul 25 15:08:52 2017 (r321480) @@ -431,12 +431,7 @@ static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) { struct cdg *cdg_data = ccv->cc_data; - uint32_t cwin; - u_int mss; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); - switch(signal_type) { case CC_CDG_DELAY: CCV(ccv, snd_ssthresh) = cdg_window_decrease(ccv, @@ -453,7 +448,7 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_ty */ if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || cdg_data->queue_state < CDG_Q_FULL) { - CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); CCV(ccv, snd_recover) = CCV(ccv, snd_max); } else { /* @@ -466,16 +461,12 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_ty cdg_data->shadow_w, RENO_BETA); CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, - cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), + V_cdg_beta_loss)); cdg_data->window_incr = cdg_data->rtt_count = 0; } ENTER_RECOVERY(CCV(ccv, t_flags)); - break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); - CCV(ccv, snd_cwnd) = mss; break; default: newreno_cc_algo.cong_signal(ccv, signal_type); Modified: head/sys/netinet/cc/cc_chd.c ============================================================================== --- head/sys/netinet/cc/cc_chd.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_chd.c Tue Jul 25 15:08:52 2017 (r321480) @@ -330,14 +330,10 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty struct ertt *e_t; struct chd *chd_data; int qdly; - uint32_t cwin; - u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CHD_DELAY: @@ -376,10 +372,6 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty CCV(ccv, t_maxseg) / 2, 2) * CCV(ccv, t_maxseg); } ENTER_FASTRECOVERY(CCV(ccv, t_flags)); - break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); - CCV(ccv, snd_cwnd) = mss; break; default: Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_cubic.c Tue Jul 25 15:08:52 2017 (r321480) @@ -225,12 +225,8 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; - uint32_t cwin; - u_int mss; cubic_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -239,8 +235,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -251,7 +246,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->t_last_cong = ticks; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -266,13 +261,9 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) { + if (CCV(ccv, t_rxtshift) >= 2) cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; - cubic_ssthresh_update(ccv); - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = mss; - } break; } } Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_dctcp.c Tue Jul 25 15:08:52 2017 (r321480) @@ -230,11 +230,10 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - uint32_t cwin; - u_int mss; + u_int win, mss; dctcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); + win = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); switch (type) { @@ -242,16 +241,16 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { CCV(ccv, snd_ssthresh) = mss * - max(cwin / 2 / mss, 2); + max(win / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion * recovery. Reverse cwnd value using * snd_cwnd_prev and recalculate snd_ssthresh */ - cwin = CCV(ccv, snd_cwnd_prev); + win = CCV(ccv, snd_cwnd_prev); CCV(ccv, snd_ssthresh) = - max(cwin / 2 / mss, 2) * mss; + max(win / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -261,18 +260,18 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) * Save current snd_cwnd when the host encounters both * congestion recovery and fast recovery. */ - CCV(ccv, snd_cwnd_prev) = cwin; + CCV(ccv, snd_cwnd_prev) = win; if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { CCV(ccv, snd_ssthresh) = - mss * max(cwin / 2 / mss, 2); + mss * max(win / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } else - CCV(ccv, snd_ssthresh) = max((cwin - ((cwin * + CCV(ccv, snd_ssthresh) = max((win - ((win * dctcp_data->alpha) >> 11)) / mss, 2) * mss; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -285,8 +284,6 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; - CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); - CCV(ccv, snd_cwnd) = mss; } break; } Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_htcp.c Tue Jul 25 15:08:52 2017 (r321480) @@ -271,12 +271,8 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; - uint32_t cwin; - u_int mss; htcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -291,9 +287,8 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) (htcp_data->maxrtt - htcp_data->minrtt) * 95) / 100; htcp_ssthresh_update(ccv); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -310,7 +305,7 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) htcp_ssthresh_update(ccv); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -325,8 +320,6 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; - CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); - CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/cc/cc_newreno.c Tue Jul 25 15:08:52 2017 (r321480) @@ -182,38 +182,29 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - uint32_t cwin; - u_int mss; + u_int win; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); - /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - cwin = max(2*mss, cwin/2); + win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * + CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = cwin; - } + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) + CCV(ccv, snd_ssthresh) = win; ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = cwin; + CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_cwnd) = win; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } - break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/tcp_input.c Tue Jul 25 15:08:52 2017 (r321480) @@ -435,15 +435,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - if (CC_ALGO(tp)->cong_signal == NULL) { - /* - * RFC5681 Section 3.1 - * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) - */ - tp->snd_ssthresh = - max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); - tp->snd_cwnd = maxseg; - } + tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / + maxseg) * maxseg; + tp->snd_cwnd = maxseg; break; case CC_RTO_ERR: TCPSTAT_INC(tcps_sndrexmitbad); @@ -2612,15 +2606,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += maxseg; - /* - * RFC5681 Section 3.2 talks about cwnd - * inflation on additional dupacks and - * deflation on recovering from loss. - * - * We keep cwnd into check so that - * we don't have to 'deflate' it when we - * get out of recovery. - */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -2660,22 +2645,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->snd_ssthresh + - maxseg * - (tp->t_dupacks - tp->snd_limited); + tp->snd_cwnd = tp->snd_ssthresh + + maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Tue Jul 25 15:03:05 2017 (r321479) +++ head/sys/netinet/tcp_stacks/fastpath.c Tue Jul 25 15:08:52 2017 (r321480) @@ -1052,15 +1052,6 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, str if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += tp->t_maxseg; - /* - * RFC5681 Section 3.2 talks about cwnd - * inflation on additional dupacks and - * deflation on recovering from loss. - * - * We keep cwnd into check so that - * we don't have to 'deflate' it when we - * get out of recovery. - */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -1100,22 +1091,19 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, str TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->t_maxseg; + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->t_maxseg; + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * - (tp->t_dupacks - tp->snd_limited); + tp->snd_cwnd = tp->snd_ssthresh + + tp->t_maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; From owner-svn-src-all@freebsd.org Tue Jul 25 15:33:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0046C7EF22; Tue, 25 Jul 2017 15:33:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F7277FE11; Tue, 25 Jul 2017 15:33:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PFXY8D051422; Tue, 25 Jul 2017 15:33:34 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PFXYG7051417; Tue, 25 Jul 2017 15:33:34 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707251533.v6PFXYG7051417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 25 Jul 2017 15:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321481 - head/sys/dev/bnxt X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/bnxt X-SVN-Commit-Revision: 321481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 15:33:35 -0000 Author: sbruno Date: Tue Jul 25 15:33:34 2017 New Revision: 321481 URL: https://svnweb.freebsd.org/changeset/base/321481 Log: bnxt: Implement interrupt coalescing options using sysctl. Submitted by: bhargava.marreddy@broadcom.com Differential Revision: https://reviews.freebsd.org/D11702 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/bnxt_hwrm.c head/sys/dev/bnxt/bnxt_hwrm.h head/sys/dev/bnxt/bnxt_sysctl.c head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Tue Jul 25 15:08:52 2017 (r321480) +++ head/sys/dev/bnxt/bnxt.h Tue Jul 25 15:33:34 2017 (r321481) @@ -214,6 +214,18 @@ __FBSDID("$FreeBSD$"); /* Chip info */ #define BNXT_TSO_SIZE UINT16_MAX +#define min_t(type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1 : __min2; }) + +#define max_t(type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1 : __max2; }) + +#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) + /* NVRAM access */ enum bnxt_nvm_directory_type { BNX_DIR_TYPE_UNUSED = 0, @@ -569,6 +581,20 @@ struct bnxt_softc { struct bnxt_nvram_info *nvm_info; bool wol; uint8_t wol_filter_id; + uint16_t rx_coal_usecs; + uint16_t rx_coal_usecs_irq; + uint16_t rx_coal_frames; + uint16_t rx_coal_frames_irq; + uint16_t tx_coal_usecs; + uint16_t tx_coal_usecs_irq; + uint16_t tx_coal_frames; + uint16_t tx_coal_frames_irq; + +#define BNXT_USEC_TO_COAL_TIMER(x) ((x) * 25 / 2) +#define BNXT_DEF_STATS_COAL_TICKS 1000000 +#define BNXT_MIN_STATS_COAL_TICKS 250000 +#define BNXT_MAX_STATS_COAL_TICKS 1000000 + }; struct bnxt_filter_info { Modified: head/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c Tue Jul 25 15:08:52 2017 (r321480) +++ head/sys/dev/bnxt/bnxt_hwrm.c Tue Jul 25 15:33:34 2017 (r321481) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include "bnxt.h" #include "bnxt_hwrm.h" @@ -1547,3 +1548,131 @@ bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc) req.wol_filter_id = softc->wol_filter_id; return hwrm_send_message(softc, &req, sizeof(req)); } + +static void bnxt_hwrm_set_coal_params(struct bnxt_softc *softc, uint32_t max_frames, + uint32_t buf_tmrs, uint16_t flags, + struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req) +{ + req->flags = htole16(flags); + req->num_cmpl_dma_aggr = htole16((uint16_t)max_frames); + req->num_cmpl_dma_aggr_during_int = htole16(max_frames >> 16); + req->cmpl_aggr_dma_tmr = htole16((uint16_t)buf_tmrs); + req->cmpl_aggr_dma_tmr_during_int = htole16(buf_tmrs >> 16); + /* Minimum time between 2 interrupts set to buf_tmr x 2 */ + req->int_lat_tmr_min = htole16((uint16_t)buf_tmrs * 2); + req->int_lat_tmr_max = htole16((uint16_t)buf_tmrs * 4); + req->num_cmpl_aggr_int = htole16((uint16_t)max_frames * 4); +} + + +int bnxt_hwrm_set_coal(struct bnxt_softc *softc) +{ + int i, rc = 0; + struct hwrm_ring_cmpl_ring_cfg_aggint_params_input req_rx = {0}, + req_tx = {0}, *req; + uint16_t max_buf, max_buf_irq; + uint16_t buf_tmr, buf_tmr_irq; + uint32_t flags; + + bnxt_hwrm_cmd_hdr_init(softc, &req_rx, + HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS); + bnxt_hwrm_cmd_hdr_init(softc, &req_tx, + HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS); + + /* Each rx completion (2 records) should be DMAed immediately. + * DMA 1/4 of the completion buffers at a time. + */ + max_buf = min_t(uint16_t, softc->rx_coal_frames / 4, 2); + /* max_buf must not be zero */ + max_buf = clamp_t(uint16_t, max_buf, 1, 63); + max_buf_irq = clamp_t(uint16_t, softc->rx_coal_frames_irq, 1, 63); + buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs); + /* buf timer set to 1/4 of interrupt timer */ + buf_tmr = max_t(uint16_t, buf_tmr / 4, 1); + buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs_irq); + buf_tmr_irq = max_t(uint16_t, buf_tmr_irq, 1); + + flags = HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_TIMER_RESET; + + /* RING_IDLE generates more IRQs for lower latency. Enable it only + * if coal_usecs is less than 25 us. + */ + if (softc->rx_coal_usecs < 25) + flags |= HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_RING_IDLE; + + bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, + buf_tmr_irq << 16 | buf_tmr, flags, &req_rx); + + /* max_buf must not be zero */ + max_buf = clamp_t(uint16_t, softc->tx_coal_frames, 1, 63); + max_buf_irq = clamp_t(uint16_t, softc->tx_coal_frames_irq, 1, 63); + buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs); + /* buf timer set to 1/4 of interrupt timer */ + buf_tmr = max_t(uint16_t, buf_tmr / 4, 1); + buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs_irq); + buf_tmr_irq = max_t(uint16_t, buf_tmr_irq, 1); + flags = HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_TIMER_RESET; + bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, + buf_tmr_irq << 16 | buf_tmr, flags, &req_tx); + + for (i = 0; i < softc->nrxqsets; i++) { + + + req = &req_rx; + /* + * TBD: + * Check if Tx also needs to be done + * So far, Tx processing has been done in softirq contest + * + * req = &req_tx; + */ + req->ring_id = htole16(softc->grp_info[i].cp_ring_id); + + rc = hwrm_send_message(softc, req, sizeof(*req)); + if (rc) + break; + } + return rc; +} + + + +int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, + int bmap_size) +{ + struct hwrm_func_drv_rgtr_input req = {0}; + bitstr_t *async_events_bmap; + uint32_t *events; + int i; + + async_events_bmap = bit_alloc(256, M_DEVBUF, M_WAITOK|M_ZERO); + events = (uint32_t *)async_events_bmap; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_RGTR); + + req.enables = + htole32(HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD); + + memset(async_events_bmap, 0, sizeof(256 / 8)); + + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE); + + if (bmap && bmap_size) { + for (i = 0; i < bmap_size; i++) { + if (bit_test(bmap, i)) + bit_set(async_events_bmap, i); + } + } + + for (i = 0; i < 8; i++) + req.async_event_fwd[i] |= htole32(events[i]); + + free(async_events_bmap, M_DEVBUF); + + return hwrm_send_message(softc, &req, sizeof(req)); +} + Modified: head/sys/dev/bnxt/bnxt_hwrm.h ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.h Tue Jul 25 15:08:52 2017 (r321480) +++ head/sys/dev/bnxt/bnxt_hwrm.h Tue Jul 25 15:33:34 2017 (r321481) @@ -101,5 +101,7 @@ int bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc); uint16_t bnxt_hwrm_get_wol_fltrs(struct bnxt_softc *softc, uint16_t handle); int bnxt_hwrm_alloc_wol_fltr(struct bnxt_softc *softc); int bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc); - +int bnxt_hwrm_set_coal(struct bnxt_softc *softc); +int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, + int bmap_size); #endif Modified: head/sys/dev/bnxt/bnxt_sysctl.c ============================================================================== --- head/sys/dev/bnxt/bnxt_sysctl.c Tue Jul 25 15:08:52 2017 (r321480) +++ head/sys/dev/bnxt/bnxt_sysctl.c Tue Jul 25 15:33:34 2017 (r321481) @@ -549,6 +549,166 @@ bnxt_vlan_strip_sysctl(SYSCTL_HANDLER_ARGS) { return rc; } +static int +bnxt_set_coal_rx_usecs(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_usecs; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_usecs = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_frames(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_frames; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_frames = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_usecs_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_usecs_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_usecs_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_frames_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_frames_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_frames_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_usecs(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_usecs; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_usecs = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_frames(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_frames; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_frames = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_usecs_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_usecs_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_usecs_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_frames_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_frames_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_frames_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + int bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) { @@ -571,6 +731,31 @@ bnxt_create_config_sysctls_pre(struct bnxt_softc *soft "strip VLAN tag in the RX path"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "if_name", CTLFLAG_RD, iflib_get_ifp(softc->ctx)->if_xname, 0, "interface name"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs, + "I", "interrupt coalescing Rx Usecs"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames, + "I", "interrupt coalescing Rx Frames"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs_irq, + "I", "interrupt coalescing Rx Usecs IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames_irq, + "I", "interrupt coalescing Rx Frames IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs, + "I", "interrupt coalescing Tx Usces"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames, + "I", "interrupt coalescing Tx Frames"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs_irq, + "I", "interrupt coalescing Tx Usecs IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames_irq, + "I", "interrupt coalescing Tx Frames IRQ"); return 0; } Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Tue Jul 25 15:08:52 2017 (r321480) +++ head/sys/dev/bnxt/if_bnxt.c Tue Jul 25 15:33:34 2017 (r321481) @@ -691,6 +691,12 @@ bnxt_attach_pre(if_ctx_t ctx) goto drv_rgtr_fail; } + rc = bnxt_hwrm_func_rgtr_async_events(softc, NULL, 0); + if (rc) { + device_printf(softc->dev, "attach: hwrm rgtr async evts failed\n"); + goto drv_rgtr_fail; + } + /* Get the HW capabilities */ rc = bnxt_hwrm_func_qcaps(softc); if (rc) @@ -2286,11 +2292,11 @@ bnxt_report_link(struct bnxt_softc *softc) HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) flow_ctrl = "FC - receive"; else - flow_ctrl = "none"; + flow_ctrl = "FC - none"; iflib_link_state_change(softc->ctx, LINK_STATE_UP, IF_Gbps(100)); - device_printf(softc->dev, "Link is UP %s, %s\n", duplex, - flow_ctrl); + device_printf(softc->dev, "Link is UP %s, %s - %d Mbps \n", duplex, + flow_ctrl, (softc->link_info.link_speed * 100)); } else { iflib_link_state_change(softc->ctx, LINK_STATE_DOWN, bnxt_get_baudrate(&softc->link_info)); From owner-svn-src-all@freebsd.org Tue Jul 25 16:11:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77566C7FB25; Tue, 25 Jul 2017 16:11:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AD658134A; Tue, 25 Jul 2017 16:11:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PGBaGM064338; Tue, 25 Jul 2017 16:11:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PGBaB7064337; Tue, 25 Jul 2017 16:11:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707251611.v6PGBaB7064337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 16:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321483 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 16:11:37 -0000 Author: ngie Date: Tue Jul 25 16:11:36 2017 New Revision: 321483 URL: https://svnweb.freebsd.org/changeset/base/321483 Log: Mask issues with duplicate definitions for __fnstcw, __fldenv, and __fldcw on i386 by ignoring -Wmacro-redefined. This is a bandaid until the code is fixed and will be reverted before MFC. Modified: head/lib/msun/tests/Makefile Modified: head/lib/msun/tests/Makefile ============================================================================== --- head/lib/msun/tests/Makefile Tue Jul 25 15:58:44 2017 (r321482) +++ head/lib/msun/tests/Makefile Tue Jul 25 16:11:36 2017 (r321483) @@ -84,6 +84,10 @@ SRCS.ilogb2_test= ilogb_test.c LIBADD+= m +.if ${MACHINE_CPUARCH} == "i386" +# XXX: __fldcw macro mismatch between fenv.h and ieeefp.h . +CWARNFLAGS.clang+= -Wno-error=macro-redefined +.endif WARNS?= 1 # Copied from lib/msun/Makefile From owner-svn-src-all@freebsd.org Tue Jul 25 16:21:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2804C7FDF6; Tue, 25 Jul 2017 16:21:23 +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 7FDBE819A8; Tue, 25 Jul 2017 16:21:23 +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 v6PGLMY6070738; Tue, 25 Jul 2017 16:21:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PGLMmg070737; Tue, 25 Jul 2017 16:21:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707251621.v6PGLMmg070737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 16:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321484 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 16:21:23 -0000 Author: ngie Date: Tue Jul 25 16:21:22 2017 New Revision: 321484 URL: https://svnweb.freebsd.org/changeset/base/321484 Log: Only test ld_pi_odd with LDBL_MANT_DIG == 64 to fix the build The empty (unimplemented) test inputs for sparc64 trigger a -Wtype-limits build failure because nitems of an empty array is always false, i.e., deadcode. MFC after: 1 month MFC with: r321455 Reported by: Jenkins (sparc64 job) Modified: head/lib/msun/tests/trig_test.c Modified: head/lib/msun/tests/trig_test.c ============================================================================== --- head/lib/msun/tests/trig_test.c Tue Jul 25 16:11:36 2017 (r321483) +++ head/lib/msun/tests/trig_test.c Tue Jul 25 16:21:22 2017 (r321484) @@ -156,11 +156,6 @@ ATF_TC_BODY(reduction, tc) 9.8477555741888350649e+4314L, 1.6061597222105160737e+4326L, }; -#elif LDBL_MANT_DIG == 113 - static const long double ld_pi_odd[] = { - /* XXX */ - }; -#endif #if defined(__clang__) && \ ((__clang_major__ >= 5)) @@ -205,7 +200,7 @@ ATF_TC_BODY(reduction, tc) ATF_CHECK(fabs(tan(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); } -#if LDBL_MANT_DIG > 53 +#if LDBL_MANT_DIG == 64 /* XXX: || LDBL_MANT_DIG == 113 */ for (i = 0; i < nitems(ld_pi_odd); i++) { ATF_CHECK(fabsl(sinl(ld_pi_odd[i])) < LDBL_EPSILON); ATF_CHECK(cosl(ld_pi_odd[i]) == -1.0); From owner-svn-src-all@freebsd.org Tue Jul 25 16:46:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01E8ACFCA64; Tue, 25 Jul 2017 16:46:14 +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 C300183279; Tue, 25 Jul 2017 16:46:13 +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 v6PGkCR2082760; Tue, 25 Jul 2017 16:46:12 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PGkCAQ082758; Tue, 25 Jul 2017 16:46:12 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707251646.v6PGkCAQ082758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Jul 2017 16:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321485 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 321485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 16:46:14 -0000 Author: bdrewery Date: Tue Jul 25 16:46:12 2017 New Revision: 321485 URL: https://svnweb.freebsd.org/changeset/base/321485 Log: Allow -DNO_SKIP_DEPEND to override the _SKIP_DEPEND logic. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/sys/conf/kern.post.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Jul 25 16:21:22 2017 (r321484) +++ head/share/mk/bsd.dep.mk Tue Jul 25 16:46:12 2017 (r321485) @@ -88,7 +88,7 @@ _meta_filemon= 1 # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used # for _meta_filemon but not for _SKIP_DEPEND. -.if defined(_SKIP_BUILD) +.if !defined(NO_SKIP_DEPEND) && defined(_SKIP_BUILD) _SKIP_DEPEND= 1 .endif .if ${MK_DIRDEPS_BUILD} == "no" Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Jul 25 16:21:22 2017 (r321484) +++ head/sys/conf/kern.post.mk Tue Jul 25 16:46:12 2017 (r321485) @@ -201,9 +201,9 @@ _meta_filemon= 1 # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used # for _meta_filemon but not for _SKIP_DEPEND. -.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \ +.if !defined(NO_SKIP_DEPEND) && (make(*obj) || \ ${.TARGETS:M*clean*} == ${.TARGETS} || \ - ${.TARGETS:M*install*} == ${.TARGETS} + ${.TARGETS:M*install*} == ${.TARGETS}) _SKIP_DEPEND= 1 .endif .if defined(_SKIP_DEPEND) || defined(_meta_filemon) From owner-svn-src-all@freebsd.org Tue Jul 25 16:57:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6253FCFCCC9; Tue, 25 Jul 2017 16:57: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 26E08837D3; Tue, 25 Jul 2017 16:57: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 v6PGvPgR086705; Tue, 25 Jul 2017 16:57:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PGvPo7086704; Tue, 25 Jul 2017 16:57:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707251657.v6PGvPo7086704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 25 Jul 2017 16:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321486 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 321486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 16:57:26 -0000 Author: ngie Date: Tue Jul 25 16:57:25 2017 New Revision: 321486 URL: https://svnweb.freebsd.org/changeset/base/321486 Log: Re-add #endif accidentally deleted in r321484 MFC after: 1 month MFC with: r321455, r321484 Modified: head/lib/msun/tests/trig_test.c Modified: head/lib/msun/tests/trig_test.c ============================================================================== --- head/lib/msun/tests/trig_test.c Tue Jul 25 16:46:12 2017 (r321485) +++ head/lib/msun/tests/trig_test.c Tue Jul 25 16:57:25 2017 (r321486) @@ -156,6 +156,7 @@ ATF_TC_BODY(reduction, tc) 9.8477555741888350649e+4314L, 1.6061597222105160737e+4326L, }; +#endif #if defined(__clang__) && \ ((__clang_major__ >= 5)) From owner-svn-src-all@freebsd.org Tue Jul 25 17:04:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D2E1CFD175; Tue, 25 Jul 2017 17:04:37 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCE1083CD3; Tue, 25 Jul 2017 17:04:36 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PH4a9i090929; Tue, 25 Jul 2017 17:04:36 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PH4ZLP090923; Tue, 25 Jul 2017 17:04:35 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201707251704.v6PH4ZLP090923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Tue, 25 Jul 2017 17:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321487 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 321487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 17:04:37 -0000 Author: pstef Date: Tue Jul 25 17:04:35 2017 New Revision: 321487 URL: https://svnweb.freebsd.org/changeset/base/321487 Log: indent(1): add option -tsn for setting tab size. Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.1 head/usr.bin/indent/indent.c head/usr.bin/indent/indent_globs.h head/usr.bin/indent/io.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/args.c Tue Jul 25 17:04:35 2017 (r321487) @@ -166,6 +166,7 @@ struct pro { {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines}, {"st", PRO_SPECIAL, 0, STDIN, 0}, {"ta", PRO_BOOL, false, ON, &auto_typedefs}, + {"ts", PRO_INT, 8, 0, &tabsize}, {"troff", PRO_BOOL, false, ON, &troff}, {"ut", PRO_BOOL, true, ON, &use_tabs}, {"v", PRO_BOOL, false, ON, &verbose}, Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/indent.1 Tue Jul 25 17:04:35 2017 (r321487) @@ -30,7 +30,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd January 2, 2017 +.Dd July 25, 2017 .Dt INDENT 1 .Os .Sh NAME @@ -85,6 +85,7 @@ .Op Fl \&st .Op Fl \&ta .Op Fl troff +.Op Fl ts Ns Ar n .Op Fl U Ns Ar file .Op Fl ut | Fl nut .Op Fl v | Fl \&nv @@ -459,13 +460,15 @@ listing in much the same spirit as .Xr vgrind 1 . If the output file is not specified, the default is standard output, rather than formatting in place. +.It Fl ts Ns Ar n +Assumed distance between tab stops. +The default is 8. .It Fl U Ns Ar file Adds type names from .Ar file to the list of type keywords. .It Fl ut , nut Enables (disables) the use of tab characters in the output. -Tabs are assumed to be aligned on columns divisible by 8. The default is .Fl ut . .It Fl v , \&nv Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/indent.c Tue Jul 25 17:04:35 2017 (r321487) @@ -292,7 +292,7 @@ main(int argc, char **argv) if (*p == ' ') col++; else if (*p == '\t') - col = ((col - 1) & ~7) + 9; + col = tabsize * (1 + (col - 1) / tabsize) + 1; else break; p++; @@ -1050,7 +1050,7 @@ check_type: if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) ps.block_init = 0; - if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - 8)) + if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - tabsize)) force_nl = true; } break; @@ -1267,18 +1267,21 @@ indent_declaration(int cur_dec_ind, int tabs_to_var) char *startpos = e_code; /* - * get the tab math right for indentations that are not multiples of 8 + * get the tab math right for indentations that are not multiples of tabsize */ - if ((ps.ind_level * ps.ind_size) % 8 != 0) { - pos += (ps.ind_level * ps.ind_size) % 8; - cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + if ((ps.ind_level * ps.ind_size) % tabsize != 0) { + pos += (ps.ind_level * ps.ind_size) % tabsize; + cur_dec_ind += (ps.ind_level * ps.ind_size) % tabsize; } - if (tabs_to_var) - while ((pos & ~7) + 8 <= cur_dec_ind) { + if (tabs_to_var) { + int tpos; + + while ((tpos = tabsize * (1 + pos / tabsize)) <= cur_dec_ind) { CHECK_SIZE_CODE; *e_code++ = '\t'; - pos = (pos & ~7) + 8; + pos = tpos; } + } while (pos < cur_dec_ind) { CHECK_SIZE_CODE; *e_code++ = ' '; Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/indent_globs.h Tue Jul 25 17:04:35 2017 (r321487) @@ -42,11 +42,7 @@ #define label_offset 2 /* number of levels a label is placed to left * of code */ -#define tabsize 8 /* the size of a tab */ -#define tabmask 0177770 /* mask used when figuring length of lines - * with tabs */ - #define false 0 #define true 1 @@ -213,6 +209,7 @@ int use_tabs; /* set true to use tabs for spacin int auto_typedefs; /* set true to recognize identifiers * ending in "_t" like typedefs */ int space_after_cast; /* "b = (int) a" vs "b = (int)a" */ +int tabsize; /* the size of a tab */ /* -troff font state information */ Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/io.c Tue Jul 25 17:04:35 2017 (r321487) @@ -227,12 +227,12 @@ dump_line(void) target += ps.comment_delta; while (*com_st == '\t') /* consider original indentation in * case this is a box comment */ - com_st++, target += 8; + com_st++, target += tabsize; while (target <= 0) if (*com_st == ' ') target++, com_st++; else if (*com_st == '\t') - target = ((target - 1) & ~7) + 9, com_st++; + target = tabsize * (1 + (target - 1) / tabsize) + 1, com_st++; else target = 1; if (cur_col > target) { /* if comment can't fit on this line, @@ -458,17 +458,19 @@ pad_output(int current, int target) /* current: the current column value */ /* target: position we want it at */ { - int curr; /* internal column pointer */ - int tcur; if (troff) fprintf(output, "\\h'|%dp'", (target - 1) * 7); else { + int curr; /* internal column pointer */ + if (current >= target) return (current); /* line is already long enough */ curr = current; if (use_tabs) { - while ((tcur = ((curr - 1) & tabmask) + tabsize + 1) <= target) { + int tcur; + + while ((tcur = tabsize * (1 + (curr - 1) / tabsize) + 1) <= target) { putc('\t', output); curr = tcur; } @@ -517,7 +519,7 @@ count_spaces_until(int cur, char *buffer, char *end) break; case '\t': - cur = ((cur - 1) & tabmask) + tabsize + 1; + cur = tabsize * (1 + (cur - 1) / tabsize) + 1; break; case 010: /* backspace */ Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Tue Jul 25 16:57:25 2017 (r321486) +++ head/usr.bin/indent/pr_comment.c Tue Jul 25 17:04:35 2017 (r321487) @@ -142,7 +142,7 @@ pr_comment(void) } ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind; if (ps.com_col <= target_col) - ps.com_col = ((target_col + 7) & ~7) + 1; + ps.com_col = tabsize * (1 + (target_col - 1) / tabsize) + 1; if (ps.com_col + 24 > adj_max_col) adj_max_col = ps.com_col + 24; } From owner-svn-src-all@freebsd.org Tue Jul 25 17:24:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5E9CCFDA38; Tue, 25 Jul 2017 17:24:51 +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 818298461F; Tue, 25 Jul 2017 17:24:51 +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 v6PHOoYr098867; Tue, 25 Jul 2017 17:24:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PHOoJ5098866; Tue, 25 Jul 2017 17:24:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707251724.v6PHOoJ5098866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 25 Jul 2017 17:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321488 - stable/11/contrib/elftoolchain/readelf X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 321488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 17:24:51 -0000 Author: emaste Date: Tue Jul 25 17:24:50 2017 New Revision: 321488 URL: https://svnweb.freebsd.org/changeset/base/321488 Log: readelf: fix printing of DT_FILTER and some other DT_* values MFC r321045: readelf: fix printing of DT_FILTER and some other DT_* values Some non-processor-specific DT_* values overlap the range DT_LOPROC to DT_HIPROC. Handle common ones first, then the processor-specific ones. MFC r321046: readelf: correct printing of DT_FILTER and DT_AUXILIARY values Previously these were shown only for MIPS objects. Obtained from: ELF Tool Chain r3563, r3564 Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/elftoolchain/readelf/readelf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/11/contrib/elftoolchain/readelf/readelf.c Tue Jul 25 17:04:35 2017 (r321487) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Tue Jul 25 17:24:50 2017 (r321488) @@ -783,6 +783,80 @@ dt_type(unsigned int mach, unsigned int dtype) { static char s_dtype[32]; + switch (dtype) { + case DT_NULL: return "NULL"; + case DT_NEEDED: return "NEEDED"; + case DT_PLTRELSZ: return "PLTRELSZ"; + case DT_PLTGOT: return "PLTGOT"; + case DT_HASH: return "HASH"; + case DT_STRTAB: return "STRTAB"; + case DT_SYMTAB: return "SYMTAB"; + case DT_RELA: return "RELA"; + case DT_RELASZ: return "RELASZ"; + case DT_RELAENT: return "RELAENT"; + case DT_STRSZ: return "STRSZ"; + case DT_SYMENT: return "SYMENT"; + case DT_INIT: return "INIT"; + case DT_FINI: return "FINI"; + case DT_SONAME: return "SONAME"; + case DT_RPATH: return "RPATH"; + case DT_SYMBOLIC: return "SYMBOLIC"; + case DT_REL: return "REL"; + case DT_RELSZ: return "RELSZ"; + case DT_RELENT: return "RELENT"; + case DT_PLTREL: return "PLTREL"; + case DT_DEBUG: return "DEBUG"; + case DT_TEXTREL: return "TEXTREL"; + case DT_JMPREL: return "JMPREL"; + case DT_BIND_NOW: return "BIND_NOW"; + case DT_INIT_ARRAY: return "INIT_ARRAY"; + case DT_FINI_ARRAY: return "FINI_ARRAY"; + case DT_INIT_ARRAYSZ: return "INIT_ARRAYSZ"; + case DT_FINI_ARRAYSZ: return "FINI_ARRAYSZ"; + case DT_RUNPATH: return "RUNPATH"; + case DT_FLAGS: return "FLAGS"; + case DT_PREINIT_ARRAY: return "PREINIT_ARRAY"; + case DT_PREINIT_ARRAYSZ: return "PREINIT_ARRAYSZ"; + case DT_MAXPOSTAGS: return "MAXPOSTAGS"; + case DT_SUNW_AUXILIARY: return "SUNW_AUXILIARY"; + case DT_SUNW_RTLDINF: return "SUNW_RTLDINF"; + case DT_SUNW_FILTER: return "SUNW_FILTER"; + case DT_SUNW_CAP: return "SUNW_CAP"; + case DT_CHECKSUM: return "CHECKSUM"; + case DT_PLTPADSZ: return "PLTPADSZ"; + case DT_MOVEENT: return "MOVEENT"; + case DT_MOVESZ: return "MOVESZ"; + case DT_FEATURE: return "FEATURE"; + case DT_POSFLAG_1: return "POSFLAG_1"; + case DT_SYMINSZ: return "SYMINSZ"; + case DT_SYMINENT: return "SYMINENT"; + case DT_GNU_HASH: return "GNU_HASH"; + case DT_TLSDESC_PLT: return "DT_TLSDESC_PLT"; + case DT_TLSDESC_GOT: return "DT_TLSDESC_GOT"; + case DT_GNU_CONFLICT: return "GNU_CONFLICT"; + case DT_GNU_LIBLIST: return "GNU_LIBLIST"; + case DT_CONFIG: return "CONFIG"; + case DT_DEPAUDIT: return "DEPAUDIT"; + case DT_AUDIT: return "AUDIT"; + case DT_PLTPAD: return "PLTPAD"; + case DT_MOVETAB: return "MOVETAB"; + case DT_SYMINFO: return "SYMINFO"; + case DT_VERSYM: return "VERSYM"; + case DT_RELACOUNT: return "RELACOUNT"; + case DT_RELCOUNT: return "RELCOUNT"; + case DT_FLAGS_1: return "FLAGS_1"; + case DT_VERDEF: return "VERDEF"; + case DT_VERDEFNUM: return "VERDEFNUM"; + case DT_VERNEED: return "VERNEED"; + case DT_VERNEEDNUM: return "VERNEEDNUM"; + case DT_AUXILIARY: return "AUXILIARY"; + case DT_USED: return "USED"; + case DT_FILTER: return "FILTER"; + case DT_GNU_PRELINKED: return "GNU_PRELINKED"; + case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ"; + case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ"; + } + if (dtype >= DT_LOPROC && dtype <= DT_HIPROC) { switch (mach) { case EM_ARM: @@ -903,86 +977,10 @@ dt_type(unsigned int mach, unsigned int dtype) default: break; } - snprintf(s_dtype, sizeof(s_dtype), "", dtype); - return (s_dtype); } - switch (dtype) { - case DT_NULL: return "NULL"; - case DT_NEEDED: return "NEEDED"; - case DT_PLTRELSZ: return "PLTRELSZ"; - case DT_PLTGOT: return "PLTGOT"; - case DT_HASH: return "HASH"; - case DT_STRTAB: return "STRTAB"; - case DT_SYMTAB: return "SYMTAB"; - case DT_RELA: return "RELA"; - case DT_RELASZ: return "RELASZ"; - case DT_RELAENT: return "RELAENT"; - case DT_STRSZ: return "STRSZ"; - case DT_SYMENT: return "SYMENT"; - case DT_INIT: return "INIT"; - case DT_FINI: return "FINI"; - case DT_SONAME: return "SONAME"; - case DT_RPATH: return "RPATH"; - case DT_SYMBOLIC: return "SYMBOLIC"; - case DT_REL: return "REL"; - case DT_RELSZ: return "RELSZ"; - case DT_RELENT: return "RELENT"; - case DT_PLTREL: return "PLTREL"; - case DT_DEBUG: return "DEBUG"; - case DT_TEXTREL: return "TEXTREL"; - case DT_JMPREL: return "JMPREL"; - case DT_BIND_NOW: return "BIND_NOW"; - case DT_INIT_ARRAY: return "INIT_ARRAY"; - case DT_FINI_ARRAY: return "FINI_ARRAY"; - case DT_INIT_ARRAYSZ: return "INIT_ARRAYSZ"; - case DT_FINI_ARRAYSZ: return "FINI_ARRAYSZ"; - case DT_RUNPATH: return "RUNPATH"; - case DT_FLAGS: return "FLAGS"; - case DT_PREINIT_ARRAY: return "PREINIT_ARRAY"; - case DT_PREINIT_ARRAYSZ: return "PREINIT_ARRAYSZ"; - case DT_MAXPOSTAGS: return "MAXPOSTAGS"; - case DT_SUNW_AUXILIARY: return "SUNW_AUXILIARY"; - case DT_SUNW_RTLDINF: return "SUNW_RTLDINF"; - case DT_SUNW_FILTER: return "SUNW_FILTER"; - case DT_SUNW_CAP: return "SUNW_CAP"; - case DT_CHECKSUM: return "CHECKSUM"; - case DT_PLTPADSZ: return "PLTPADSZ"; - case DT_MOVEENT: return "MOVEENT"; - case DT_MOVESZ: return "MOVESZ"; - case DT_FEATURE: return "FEATURE"; - case DT_POSFLAG_1: return "POSFLAG_1"; - case DT_SYMINSZ: return "SYMINSZ"; - case DT_SYMINENT: return "SYMINENT"; - case DT_GNU_HASH: return "GNU_HASH"; - case DT_TLSDESC_PLT: return "DT_TLSDESC_PLT"; - case DT_TLSDESC_GOT: return "DT_TLSDESC_GOT"; - case DT_GNU_CONFLICT: return "GNU_CONFLICT"; - case DT_GNU_LIBLIST: return "GNU_LIBLIST"; - case DT_CONFIG: return "CONFIG"; - case DT_DEPAUDIT: return "DEPAUDIT"; - case DT_AUDIT: return "AUDIT"; - case DT_PLTPAD: return "PLTPAD"; - case DT_MOVETAB: return "MOVETAB"; - case DT_SYMINFO: return "SYMINFO"; - case DT_VERSYM: return "VERSYM"; - case DT_RELACOUNT: return "RELACOUNT"; - case DT_RELCOUNT: return "RELCOUNT"; - case DT_FLAGS_1: return "FLAGS_1"; - case DT_VERDEF: return "VERDEF"; - case DT_VERDEFNUM: return "VERDEFNUM"; - case DT_VERNEED: return "VERNEED"; - case DT_VERNEEDNUM: return "VERNEEDNUM"; - case DT_AUXILIARY: return "AUXILIARY"; - case DT_USED: return "USED"; - case DT_FILTER: return "FILTER"; - case DT_GNU_PRELINKED: return "GNU_PRELINKED"; - case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ"; - case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ"; - default: - snprintf(s_dtype, sizeof(s_dtype), "", dtype); - return (s_dtype); - } + snprintf(s_dtype, sizeof(s_dtype), "", dtype); + return (s_dtype); } static const char * @@ -2638,10 +2636,8 @@ dyn_str(struct readelf *re, uint32_t stab, uint64_t d_ } static void -dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab) +dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn) { - const char *name; - switch (re->ehdr.e_machine) { case EM_MIPS: case EM_MIPS_RS3_LE: @@ -2694,11 +2690,6 @@ dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn, u break; case DT_MIPS_IVERSION: case DT_MIPS_PERF_SUFFIX: - case DT_AUXILIARY: - case DT_FILTER: - name = dyn_str(re, stab, dyn->d_un.d_val); - printf(" %s\n", name); - break; case DT_MIPS_TIME_STAMP: printf(" %s\n", timestamp(dyn->d_un.d_val)); break; @@ -2715,14 +2706,16 @@ dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32 { const char *name; - if (dyn->d_tag >= DT_LOPROC && dyn->d_tag <= DT_HIPROC) { - dump_arch_dyn_val(re, dyn, stab); + if (dyn->d_tag >= DT_LOPROC && dyn->d_tag <= DT_HIPROC && + dyn->d_tag != DT_AUXILIARY && dyn->d_tag != DT_FILTER) { + dump_arch_dyn_val(re, dyn); return; } /* These entry values are index into the string table. */ name = NULL; - if (dyn->d_tag == DT_NEEDED || dyn->d_tag == DT_SONAME || + if (dyn->d_tag == DT_AUXILIARY || dyn->d_tag == DT_FILTER || + dyn->d_tag == DT_NEEDED || dyn->d_tag == DT_SONAME || dyn->d_tag == DT_RPATH || dyn->d_tag == DT_RUNPATH) name = dyn_str(re, stab, dyn->d_un.d_val); @@ -2766,6 +2759,12 @@ dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32 case DT_VERDEFNUM: case DT_VERNEEDNUM: printf(" %ju\n", (uintmax_t) dyn->d_un.d_val); + break; + case DT_AUXILIARY: + printf(" Auxiliary library: [%s]\n", name); + break; + case DT_FILTER: + printf(" Filter library: [%s]\n", name); break; case DT_NEEDED: printf(" Shared library: [%s]\n", name); From owner-svn-src-all@freebsd.org Tue Jul 25 17:27:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAF74CFDB33; Tue, 25 Jul 2017 17:27:40 +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 A3FEF848BA; Tue, 25 Jul 2017 17:27:40 +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 4C84810AF01; Tue, 25 Jul 2017 13:27:33 -0400 (EDT) From: John Baldwin To: Kristof Provost Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321370 - head/lib/libsysdecode Date: Tue, 25 Jul 2017 10:25:29 -0700 Message-ID: <2783492.qOfDobczBC@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <8FA5355F-E374-49BE-B2B2-25351ED827A9@FreeBSD.org> References: <201707221251.v6MCpKn4014224@repo.freebsd.org> <8FA5355F-E374-49BE-B2B2-25351ED827A9@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 25 Jul 2017 13:27:33 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 17:27:40 -0000 On Sunday, July 23, 2017 06:03:48 PM Kristof Provost wrote: > On 22 Jul 2017, at 17:42, Ngie Cooper (yaneurabeya) wrote: > > > On Jul 22, 2017, at 5:51 AM, Kristof Provost wro= te: > >> > >> Author: kp > >> Date: Sat Jul 22 12:51:19 2017 > >> New Revision: 321370 > >> URL: https://svnweb.freebsd.org/changeset/base/321370 > >> > >> Log: > >> Handle WITH/WITHOUT_PF in libsysdecode > >> > >> Only filter out the PF ioctls if we're building without pf suppor= t. > >> Until now those were always filtered out, so truss did not show=20= > >> symbolic > >> names for pf ioctls. > > > > > > Hi Kristof! > > =09'MFC after:=091 week=E2=80=9D should have probably be added to t= his commit. > > =09This change should be MFCed to ^/stable/11 and probably ^/stable= /10=20 > > (in usr.sbin/kdump on 10:=20 > > https://svnweb.freebsd.org/base/stable/10/usr.bin/kdump/mkioctls?re= vision=3D291815&view=3Dmarkup#l25=20 > > ). >=20 > To be honest I wasn=E2=80=99t planning on MFCing this, because it=E2=80= =99s not a=20 > terribly important issue. > That said, if it=E2=80=99d be useful to you (or anyone else) I=E2=80=99= m certainly=20 > willing to do so. >=20 > I=E2=80=99m not sure how much the code changed between 10 and 11, but= MFC to=20 > 11 should be easy, and if the changes are not too extensive I can do = the=20 > merge to 10 as well. libsysdecode is not present in 10. In 10 you'd have to patch the kdump= mkioctls script and the truss and kdump Makefile's. I think it's proba= bly not worth the trouble to MFC to 10. 11 should probably merge fine, tho= ugh you'll have to tweak it since the previous change to remove the disk ha= ck can't be MFC'.d :( Your original version of the patch would be fine fo= r 11 though. --=20 John Baldwin From owner-svn-src-all@freebsd.org Tue Jul 25 17:27:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B546FCFDB40; Tue, 25 Jul 2017 17:27:41 +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 91524848C3; Tue, 25 Jul 2017 17:27:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8AECC10AF07; Tue, 25 Jul 2017 13:27:34 -0400 (EDT) From: John Baldwin To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321422 - head/usr.bin/ktrace Date: Tue, 25 Jul 2017 10:02:36 -0700 Message-ID: <1562826.93kvieM9Pp@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201707241658.v6OGwsc2092289@repo.freebsd.org> References: <201707241658.v6OGwsc2092289@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, 25 Jul 2017 13:27:34 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 17:27:41 -0000 On Monday, July 24, 2017 04:58:54 PM Edward Tomasz Napierala wrote: > Author: trasz > Date: Mon Jul 24 16:58:54 2017 > New Revision: 321422 > URL: https://svnweb.freebsd.org/changeset/base/321422 > > Log: > Improve the ktrace(1) man page to make it slightly more obvious that there > are _two_ options that control its behaviour wrt child processes; slightly > improve the example[1], and add Xrefs. > > Discussed with: wblock [1] > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > > Modified: > head/usr.bin/ktrace/ktrace.1 > > Modified: head/usr.bin/ktrace/ktrace.1 > ============================================================================== > --- head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:45:38 2017 (r321421) > +++ head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:58:54 2017 (r321422) > @@ -166,16 +175,15 @@ Enable tracing of > on process 67: > .Dl $ ktrace -ti -p 67 > .Pp > -Run the command "w", tracing only system calls: > -.Dl $ ktrace -tc w > -.Pp Did you mean to remove this example? -- John Baldwin From owner-svn-src-all@freebsd.org Tue Jul 25 17:39:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01B5ECFE084; Tue, 25 Jul 2017 17:39:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C047A371; Tue, 25 Jul 2017 17:39:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6PHd6dd003745; Tue, 25 Jul 2017 17:39:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PHd6Uo003744; Tue, 25 Jul 2017 17:39:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707251739.v6PHd6Uo003744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 25 Jul 2017 17:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321489 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 321489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 17:39:08 -0000 Author: ian Date: Tue Jul 25 17:39:06 2017 New Revision: 321489 URL: https://svnweb.freebsd.org/changeset/base/321489 Log: Use the MD __size_t to avoid a dependency on/include of non-MD header files. This should fix the compilation of the lua 5.3.4 port, among others. Reported by: Russell Haley Modified: head/sys/arm/include/ucontext.h Modified: head/sys/arm/include/ucontext.h ============================================================================== --- head/sys/arm/include/ucontext.h Tue Jul 25 17:24:50 2017 (r321488) +++ head/sys/arm/include/ucontext.h Tue Jul 25 17:39:06 2017 (r321489) @@ -78,7 +78,7 @@ typedef struct { * Originally, rest of this structure was named __fpu, 35 * 4 bytes * long, never accessed from kernel. */ - size_t mc_vfp_size; + __size_t mc_vfp_size; void *mc_vfp_ptr; unsigned int mc_spare[33]; } mcontext_t; From owner-svn-src-all@freebsd.org Tue Jul 25 20:24:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51535D7D5F4; Tue, 25 Jul 2017 20:24:35 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBE7F651C5; Tue, 25 Jul 2017 20:24:34 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr0-x235.google.com with SMTP id k71so70063420wrc.2; Tue, 25 Jul 2017 13:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ec26lT2p0XRMv98WQt0vcZFxtztkZizGfdw4zsCVm/w=; b=BqfcpZF6p9v+Cxt6qhW19k2IqIYK/TWkD6as8aQbC6HzUImWBCVCYFW+KZudnxo9YL OM2n6PJYa8mBOxcF0iYk5WYsJr+XEpeCqeFll98N/DpTFuOyaD2Ms7i50xux9G6+93Io yU3oUCJDGTD/c/E6R/EGcPI18OV+pNSeB3kKmEU0k7uU1DjEhH7cVHdKbFSu64dlrnsz A9UQKaeDwcONxUJUC5pXkPViX+g5+osXVVLcUyWUWDeSpD8d6d2YsIeQNqCXjqLHn75E zUsAXlN/6DOvUBiCsLxsY56ieiSTDAu0RUIqY5KULg8AlNR9OzKMbTz9L0QZxoRkruPh GmVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=ec26lT2p0XRMv98WQt0vcZFxtztkZizGfdw4zsCVm/w=; b=YyI4bNRF/8V160HkfEFBDWUdM9Ms5KbyulfT104vC4GuKedZBSJ8k7DMGe++o6j2QN 4r4Xa9BFE8OLAw0/7N9VJv/vuzzmlekT9+Cr5Q9A/rKNlCkx98dI9g9CwBJ8dGa9wdAV Vqp+LDnlIYy7jkZDJ6W3GaRxlyhnZcGpuTGDJFud4GQFtEq9JKkH3pnbTH048IciT0M1 S9DJ5nQaRXtDp5ZA45dVNOtGcOScWeqt+quGHTdNZstkmTEnICcm0S9N1SLQI6jLYkDw uyGMhKEHB+pMP1NbDqWAkz4EspQej73/HjQ237ie8xYRimktrxCW1/FvdDq5P8YTbctB gf7Q== X-Gm-Message-State: AIVw111eAAl4P903t2KZM5e74W4O8xWQv7UHwkiYPLIOYG4vebcQZJBL 1ma8OXE+2haJSUBz X-Received: by 10.223.178.84 with SMTP id y20mr19755223wra.240.1501014271890; Tue, 25 Jul 2017 13:24:31 -0700 (PDT) Received: from brick (cpc92310-cmbg19-2-0-cust934.5-4.cable.virginm.net. [82.9.227.167]) by smtp.gmail.com with ESMTPSA id e17sm11532831wma.19.2017.07.25.13.24.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 13:24:31 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Tue, 25 Jul 2017 21:24:29 +0100 From: Edward Tomasz Napierala To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321422 - head/usr.bin/ktrace Message-ID: <20170725202429.GA4589@brick> Mail-Followup-To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201707241658.v6OGwsc2092289@repo.freebsd.org> <1562826.93kvieM9Pp@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1562826.93kvieM9Pp@ralph.baldwin.cx> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 20:24:35 -0000 On 0725T1002, John Baldwin wrote: > On Monday, July 24, 2017 04:58:54 PM Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Mon Jul 24 16:58:54 2017 > > New Revision: 321422 > > URL: https://svnweb.freebsd.org/changeset/base/321422 > > > > Log: > > Improve the ktrace(1) man page to make it slightly more obvious that there > > are _two_ options that control its behaviour wrt child processes; slightly > > improve the example[1], and add Xrefs. > > > > Discussed with: wblock [1] > > MFC after: 2 weeks > > Sponsored by: DARPA, AFRL > > > > Modified: > > head/usr.bin/ktrace/ktrace.1 > > > > Modified: head/usr.bin/ktrace/ktrace.1 > > ============================================================================== > > --- head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:45:38 2017 (r321421) > > +++ head/usr.bin/ktrace/ktrace.1 Mon Jul 24 16:58:54 2017 (r321422) > > @@ -166,16 +175,15 @@ Enable tracing of > > on process 67: > > .Dl $ ktrace -ti -p 67 > > .Pp > > -Run the command "w", tracing only system calls: > > -.Dl $ ktrace -tc w > > -.Pp > > Did you mean to remove this example? I've replaced it with a new one, at the top, showing something more commonly used. From owner-svn-src-all@freebsd.org Tue Jul 25 20:36:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6636FD7DAC8; Tue, 25 Jul 2017 20:36:45 +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 3445C65979; Tue, 25 Jul 2017 20:36:45 +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 v6PKaiMM077239; Tue, 25 Jul 2017 20:36:44 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PKaiLp077238; Tue, 25 Jul 2017 20:36:44 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707252036.v6PKaiLp077238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 25 Jul 2017 20:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321490 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 321490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 20:36:45 -0000 Author: marius Date: Tue Jul 25 20:36:44 2017 New Revision: 321490 URL: https://svnweb.freebsd.org/changeset/base/321490 Log: Improve the clarity of a comment added in r321385 by not referring to volatile SDHCI specification lingo. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Tue Jul 25 17:39:06 2017 (r321489) +++ head/sys/dev/mmc/mmcsd.c Tue Jul 25 20:36:44 2017 (r321490) @@ -235,7 +235,7 @@ mmcsd_attach(device_t dev) * insertion that results in switches to/from a transfer mode involving * re-tuning, iff there are multiple devices on a given bus. Until now * mmc(4) lacks support for rescanning already attached buses, however, - * and sdhci(4) has no support for embedded/shared buses in the first + * and sdhci(4) to date has no support for shared buses in the first * place either. */ sc->max_data = mmc_get_max_data(dev); From owner-svn-src-all@freebsd.org Tue Jul 25 20:43:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 793C0D7DEFB; Tue, 25 Jul 2017 20:43:27 +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 468DB6601D; Tue, 25 Jul 2017 20:43:27 +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 v6PKhQfM081356; Tue, 25 Jul 2017 20:43:26 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PKhQ2g081355; Tue, 25 Jul 2017 20:43:26 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707252043.v6PKhQ2g081355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Jul 2017 20:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321491 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 20:43:27 -0000 Author: bdrewery Date: Tue Jul 25 20:43:26 2017 New Revision: 321491 URL: https://svnweb.freebsd.org/changeset/base/321491 Log: Remove unneeded dependency for libzfs. This dependency does nothing since cddl/lib/libzfs is never added into the 'make libraries' dependency chain directly. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 25 20:36:44 2017 (r321490) +++ head/Makefile.inc1 Tue Jul 25 20:43:26 2017 (r321491) @@ -2340,7 +2340,6 @@ _cddl_lib_libzfs_core= cddl/lib/libzfs_core _cddl_lib_libctf= cddl/lib/libctf _cddl_lib= cddl/lib cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L -cddl/lib/libzfs__L: lib/libgeom__L cddl/lib/libctf__L: lib/libz__L .endif # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built From owner-svn-src-all@freebsd.org Tue Jul 25 20:43:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BBA5D7DF36; Tue, 25 Jul 2017 20:43:39 +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 CB6C2660CC; Tue, 25 Jul 2017 20:43:38 +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 v6PKhbs4081404; Tue, 25 Jul 2017 20:43:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PKhbt0081403; Tue, 25 Jul 2017 20:43:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707252043.v6PKhbt0081403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Jul 2017 20:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321492 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 20:43:39 -0000 Author: bdrewery Date: Tue Jul 25 20:43:37 2017 New Revision: 321492 URL: https://svnweb.freebsd.org/changeset/base/321492 Log: Only build libzfs_core in 'make libraries' if needed. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 25 20:43:26 2017 (r321491) +++ head/Makefile.inc1 Tue Jul 25 20:43:37 2017 (r321492) @@ -2336,10 +2336,12 @@ _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair _cddl_lib_libavl= cddl/lib/libavl _cddl_lib_libuutil= cddl/lib/libuutil +.if ${MK_ZFS} != "no" _cddl_lib_libzfs_core= cddl/lib/libzfs_core +cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L +.endif _cddl_lib_libctf= cddl/lib/libctf _cddl_lib= cddl/lib -cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L cddl/lib/libctf__L: lib/libz__L .endif # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built From owner-svn-src-all@freebsd.org Tue Jul 25 20:51:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A885D7E0DD; Tue, 25 Jul 2017 20:51:07 +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 4FAE1664C2; Tue, 25 Jul 2017 20:51:07 +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 v6PKp6XK082379; Tue, 25 Jul 2017 20:51:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6PKp6HZ082378; Tue, 25 Jul 2017 20:51:06 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707252051.v6PKp6HZ082378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Jul 2017 20:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321493 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 20:51:07 -0000 Author: bdrewery Date: Tue Jul 25 20:51:06 2017 New Revision: 321493 URL: https://svnweb.freebsd.org/changeset/base/321493 Log: NO_CLEAN: Hide delete-old output. It is full of distracting noise about UPDATING and may confuse the user about what is actually being deleted. It is also possible to have directories removed on every run with use of WITHOUT_ knobs that the mtree files do not account for and for which the directories are incorrectly in OLD_DIRS currently. X-MFC-With: r321443 MFC after: 1 month Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 25 20:43:37 2017 (r321492) +++ head/Makefile.inc1 Tue Jul 25 20:51:06 2017 (r321493) @@ -761,12 +761,13 @@ _worldtmp: .PHONY rm -rf ${LIBCOMPATTMP} .endif .else + @echo ">>> Deleting stale files in build tree..." ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ - delete-old delete-old-libs + delete-old delete-old-libs >/dev/null .if defined(LIBCOMPAT) ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ DESTDIR=${LIBCOMPATTMP} \ - delete-old delete-old-libs + delete-old delete-old-libs >/dev/null .endif rm -rf ${WORLDTMP}/legacy/usr/include .if ${USING_SYSTEM_COMPILER} == "yes" From owner-svn-src-all@freebsd.org Wed Jul 26 01:12:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7944DAD24E; Wed, 26 Jul 2017 01:12:29 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3DB66EE0C; Wed, 26 Jul 2017 01:12:29 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1CS0G091865; Wed, 26 Jul 2017 01:12:28 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1CSDe091863; Wed, 26 Jul 2017 01:12:28 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260112.v6Q1CSDe091863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321494 - stable/11/sys/dev/qlxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/qlxgbe X-SVN-Commit-Revision: 321494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:12:30 -0000 Author: davidcs Date: Wed Jul 26 01:12:28 2017 New Revision: 321494 URL: https://svnweb.freebsd.org/changeset/base/321494 Log: MFC 320694 Allow MTU changes without ifconfig down/up Modified: stable/11/sys/dev/qlxgbe/ql_hw.c stable/11/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.c Tue Jul 25 20:51:06 2017 (r321493) +++ stable/11/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:12:28 2017 (r321494) @@ -2498,6 +2498,9 @@ ql_init_hw_if(qla_host_t *ha) if (qla_hw_add_all_mcast(ha)) return (-1); + if (ql_set_max_mtu(ha, ha->max_frame_size, ha->hw.rcv_cntxt_id)) + return (-1); + if (qla_config_rss(ha, ha->hw.rcv_cntxt_id)) return (-1); Modified: stable/11/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_os.c Tue Jul 25 20:51:06 2017 (r321493) +++ stable/11/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:12:28 2017 (r321494) @@ -980,8 +980,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } if (ifp->if_mtu > ETHERMTU) @@ -1014,11 +1013,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ret = ql_set_allmulti(ha); } } else { - qla_init_locked(ha); ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) From owner-svn-src-all@freebsd.org Wed Jul 26 01:15:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F8D8DAD321; Wed, 26 Jul 2017 01:15:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B13B6EF90; Wed, 26 Jul 2017 01:15:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1FVs7092026; Wed, 26 Jul 2017 01:15:31 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1FVY3092025; Wed, 26 Jul 2017 01:15:31 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260115.v6Q1FVY3092025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:15:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321495 - stable/11/sys/dev/qlxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/qlxgbe X-SVN-Commit-Revision: 321495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:15:32 -0000 Author: davidcs Date: Wed Jul 26 01:15:31 2017 New Revision: 321495 URL: https://svnweb.freebsd.org/changeset/base/321495 Log: MFC 320705 Release mtx hw_lock before calling pause() in qla_stop() and qla_error_recovery() Modified: stable/11/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:12:28 2017 (r321494) +++ stable/11/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:15:31 2017 (r321495) @@ -1519,8 +1519,11 @@ qla_stop(qla_host_t *ha) ha->flags.qla_watchdog_pause = 1; - while (!ha->qla_watchdog_paused) + while (!ha->qla_watchdog_paused) { + QLA_UNLOCK(ha); qla_mdelay(__func__, 1); + QLA_LOCK(ha); + } ha->flags.qla_interface_up = 0; @@ -1915,7 +1918,10 @@ qla_error_recovery(void *context, int pending) if (ha->flags.qla_interface_up) { ha->hw.imd_compl = 1; + + QLA_UNLOCK(ha); qla_mdelay(__func__, 300); + QLA_LOCK(ha); ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); From owner-svn-src-all@freebsd.org Wed Jul 26 01:19:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 348A7DAD597; Wed, 26 Jul 2017 01:19:51 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10D766F278; Wed, 26 Jul 2017 01:19:50 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1JoeV092230; Wed, 26 Jul 2017 01:19:50 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1JnkZ092226; Wed, 26 Jul 2017 01:19:49 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260119.v6Q1JnkZ092226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321496 - stable/11/sys/dev/qlxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/qlxgbe X-SVN-Commit-Revision: 321496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:19:51 -0000 Author: davidcs Date: Wed Jul 26 01:19:49 2017 New Revision: 321496 URL: https://svnweb.freebsd.org/changeset/base/321496 Log: MFC 321233 Raise the watchdog timer interval to 2 ticks, there by guaranteeing that it fires between 1ms and 2ms. ` Treat two consecutive occurrences of Heartbeat failures as a legitimate Heartbeat failure Modified: stable/11/sys/dev/qlxgbe/ql_def.h stable/11/sys/dev/qlxgbe/ql_hw.c stable/11/sys/dev/qlxgbe/ql_hw.h stable/11/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlxgbe/ql_def.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:15:31 2017 (r321495) +++ stable/11/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:19:49 2017 (r321496) @@ -105,7 +105,7 @@ struct qla_ivec { typedef struct qla_ivec qla_ivec_t; -#define QLA_WATCHDOG_CALLOUT_TICKS 1 +#define QLA_WATCHDOG_CALLOUT_TICKS 2 typedef struct _qla_tx_ring { qla_tx_buf_t tx_buf[NUM_TX_DESCRIPTORS]; Modified: stable/11/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:15:31 2017 (r321495) +++ stable/11/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:19:49 2017 (r321496) @@ -3366,7 +3366,7 @@ ql_hw_check_health(qla_host_t *ha) ha->hw.health_count++; - if (ha->hw.health_count < 1000) + if (ha->hw.health_count < 500) return 0; ha->hw.health_count = 0; @@ -3385,10 +3385,18 @@ ql_hw_check_health(qla_host_t *ha) if ((val != ha->hw.hbeat_value) && (!(QL_ERR_INJECT(ha, INJCT_HEARTBEAT_FAILURE)))) { ha->hw.hbeat_value = val; + ha->hw.hbeat_failure = 0; return 0; } - device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", - __func__, val); + + ha->hw.hbeat_failure++; + + if (ha->hw.hbeat_failure < 2) /* we ignore the first failure */ + return 0; + else + device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", + __func__, val); + return -1; } Modified: stable/11/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:15:31 2017 (r321495) +++ stable/11/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:19:49 2017 (r321496) @@ -1671,6 +1671,7 @@ typedef struct _qla_hw { /* heart beat register value */ uint32_t hbeat_value; uint32_t health_count; + uint32_t hbeat_failure; uint32_t max_tx_segs; uint32_t min_lro_pkt_size; Modified: stable/11/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:15:31 2017 (r321495) +++ stable/11/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:19:49 2017 (r321496) @@ -276,7 +276,7 @@ qla_watchdog(void *arg) ha->qla_watchdog_paused = 1; } - ha->watchdog_ticks = ha->watchdog_ticks++ % 1000; + ha->watchdog_ticks = ha->watchdog_ticks++ % 500; callout_reset(&ha->tx_callout, QLA_WATCHDOG_CALLOUT_TICKS, qla_watchdog, ha); } From owner-svn-src-all@freebsd.org Wed Jul 26 01:23:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17C11DAD7EE; Wed, 26 Jul 2017 01:23:37 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8DBE6F670; Wed, 26 Jul 2017 01:23:36 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1Naiq096157; Wed, 26 Jul 2017 01:23:36 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1NZ3v096155; Wed, 26 Jul 2017 01:23:35 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260123.v6Q1NZ3v096155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321497 - stable/10/sys/dev/qlxgbe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/qlxgbe X-SVN-Commit-Revision: 321497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:23:37 -0000 Author: davidcs Date: Wed Jul 26 01:23:35 2017 New Revision: 321497 URL: https://svnweb.freebsd.org/changeset/base/321497 Log: MFC 320694 Allow MTU changes without ifconfig down/up Modified: stable/10/sys/dev/qlxgbe/ql_hw.c stable/10/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:19:49 2017 (r321496) +++ stable/10/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:23:35 2017 (r321497) @@ -2498,6 +2498,9 @@ ql_init_hw_if(qla_host_t *ha) if (qla_hw_add_all_mcast(ha)) return (-1); + if (ql_set_max_mtu(ha, ha->max_frame_size, ha->hw.rcv_cntxt_id)) + return (-1); + if (qla_config_rss(ha, ha->hw.rcv_cntxt_id)) return (-1); Modified: stable/10/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:19:49 2017 (r321496) +++ stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:23:35 2017 (r321497) @@ -985,8 +985,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } if (ifp->if_mtu > ETHERMTU) @@ -1019,11 +1018,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ret = ql_set_allmulti(ha); } } else { - qla_init_locked(ha); ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) From owner-svn-src-all@freebsd.org Wed Jul 26 01:25:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C0FDDAD8B4; Wed, 26 Jul 2017 01:25:53 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC7486F7BB; Wed, 26 Jul 2017 01:25:52 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1PpCt096296; Wed, 26 Jul 2017 01:25:51 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1Pp8F096295; Wed, 26 Jul 2017 01:25:51 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260125.v6Q1Pp8F096295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321498 - stable/10/sys/dev/qlxgbe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/qlxgbe X-SVN-Commit-Revision: 321498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:25:53 -0000 Author: davidcs Date: Wed Jul 26 01:25:51 2017 New Revision: 321498 URL: https://svnweb.freebsd.org/changeset/base/321498 Log: MFC 320705 Release mtx hw_lock before calling pause() in qla_stop() and qla_error_recovery() Modified: stable/10/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:23:35 2017 (r321497) +++ stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:25:51 2017 (r321498) @@ -1524,8 +1524,11 @@ qla_stop(qla_host_t *ha) ha->flags.qla_watchdog_pause = 1; - while (!ha->qla_watchdog_paused) + while (!ha->qla_watchdog_paused) { + QLA_UNLOCK(ha); qla_mdelay(__func__, 1); + QLA_LOCK(ha); + } ha->flags.qla_interface_up = 0; @@ -1920,7 +1923,10 @@ qla_error_recovery(void *context, int pending) if (ha->flags.qla_interface_up) { ha->hw.imd_compl = 1; + + QLA_UNLOCK(ha); qla_mdelay(__func__, 300); + QLA_LOCK(ha); ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); From owner-svn-src-all@freebsd.org Wed Jul 26 01:28:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35D63DAD96D; Wed, 26 Jul 2017 01:28:29 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E90D6F93E; Wed, 26 Jul 2017 01:28:28 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1SSEA096436; Wed, 26 Jul 2017 01:28:28 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1SRp5096432; Wed, 26 Jul 2017 01:28:27 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260128.v6Q1SRp5096432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321499 - stable/10/sys/dev/qlxgbe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/qlxgbe X-SVN-Commit-Revision: 321499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:28:29 -0000 Author: davidcs Date: Wed Jul 26 01:28:27 2017 New Revision: 321499 URL: https://svnweb.freebsd.org/changeset/base/321499 Log: MFC 321233 Raise the watchdog timer interval to 2 ticks, there by guaranteeing that it fires between 1ms and 2ms. ` Treat two consecutive occurrences of Heartbeat failures as a legitimate Heartbeat failure Modified: stable/10/sys/dev/qlxgbe/ql_def.h stable/10/sys/dev/qlxgbe/ql_hw.c stable/10/sys/dev/qlxgbe/ql_hw.h stable/10/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlxgbe/ql_def.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:25:51 2017 (r321498) +++ stable/10/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:28:27 2017 (r321499) @@ -105,7 +105,7 @@ struct qla_ivec { typedef struct qla_ivec qla_ivec_t; -#define QLA_WATCHDOG_CALLOUT_TICKS 1 +#define QLA_WATCHDOG_CALLOUT_TICKS 2 typedef struct _qla_tx_ring { qla_tx_buf_t tx_buf[NUM_TX_DESCRIPTORS]; Modified: stable/10/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:25:51 2017 (r321498) +++ stable/10/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:28:27 2017 (r321499) @@ -3366,7 +3366,7 @@ ql_hw_check_health(qla_host_t *ha) ha->hw.health_count++; - if (ha->hw.health_count < 1000) + if (ha->hw.health_count < 500) return 0; ha->hw.health_count = 0; @@ -3385,10 +3385,18 @@ ql_hw_check_health(qla_host_t *ha) if ((val != ha->hw.hbeat_value) && (!(QL_ERR_INJECT(ha, INJCT_HEARTBEAT_FAILURE)))) { ha->hw.hbeat_value = val; + ha->hw.hbeat_failure = 0; return 0; } - device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", - __func__, val); + + ha->hw.hbeat_failure++; + + if (ha->hw.hbeat_failure < 2) /* we ignore the first failure */ + return 0; + else + device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", + __func__, val); + return -1; } Modified: stable/10/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:25:51 2017 (r321498) +++ stable/10/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:28:27 2017 (r321499) @@ -1671,6 +1671,7 @@ typedef struct _qla_hw { /* heart beat register value */ uint32_t hbeat_value; uint32_t health_count; + uint32_t hbeat_failure; uint32_t max_tx_segs; uint32_t min_lro_pkt_size; Modified: stable/10/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:25:51 2017 (r321498) +++ stable/10/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:28:27 2017 (r321499) @@ -276,7 +276,7 @@ qla_watchdog(void *arg) ha->qla_watchdog_paused = 1; } - ha->watchdog_ticks = ha->watchdog_ticks++ % 1000; + ha->watchdog_ticks = ha->watchdog_ticks++ % 500; callout_reset(&ha->tx_callout, QLA_WATCHDOG_CALLOUT_TICKS, qla_watchdog, ha); } From owner-svn-src-all@freebsd.org Wed Jul 26 01:43:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6B11DADF03; Wed, 26 Jul 2017 01:43:45 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A28B570155; Wed, 26 Jul 2017 01:43:45 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1hixW004449; Wed, 26 Jul 2017 01:43:44 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1hi5n004447; Wed, 26 Jul 2017 01:43:44 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260143.v6Q1hi5n004447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:43:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r321500 - stable/9/sys/dev/qlxgbe X-SVN-Group: stable-9 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/9/sys/dev/qlxgbe X-SVN-Commit-Revision: 321500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:43:45 -0000 Author: davidcs Date: Wed Jul 26 01:43:44 2017 New Revision: 321500 URL: https://svnweb.freebsd.org/changeset/base/321500 Log: MFC 320694 Allow MTU changes without ifconfig down/up Modified: stable/9/sys/dev/qlxgbe/ql_hw.c stable/9/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:28:27 2017 (r321499) +++ stable/9/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:43:44 2017 (r321500) @@ -2498,6 +2498,9 @@ ql_init_hw_if(qla_host_t *ha) if (qla_hw_add_all_mcast(ha)) return (-1); + if (ql_set_max_mtu(ha, ha->max_frame_size, ha->hw.rcv_cntxt_id)) + return (-1); + if (qla_config_rss(ha, ha->hw.rcv_cntxt_id)) return (-1); Modified: stable/9/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:28:27 2017 (r321499) +++ stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:43:44 2017 (r321500) @@ -985,8 +985,7 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } if (ifp->if_mtu > ETHERMTU) @@ -1019,11 +1018,9 @@ qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ret = ql_set_allmulti(ha); } } else { - qla_init_locked(ha); ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - ret = ql_set_max_mtu(ha, ha->max_frame_size, - ha->hw.rcv_cntxt_id); + qla_init_locked(ha); } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) From owner-svn-src-all@freebsd.org Wed Jul 26 01:46:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 145B0DADFB3; Wed, 26 Jul 2017 01:46:27 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9BDE702BC; Wed, 26 Jul 2017 01:46:26 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1kPUg004615; Wed, 26 Jul 2017 01:46:25 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1kPno004614; Wed, 26 Jul 2017 01:46:25 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260146.v6Q1kPno004614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:46:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r321501 - stable/9/sys/dev/qlxgbe X-SVN-Group: stable-9 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/9/sys/dev/qlxgbe X-SVN-Commit-Revision: 321501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:46:27 -0000 Author: davidcs Date: Wed Jul 26 01:46:25 2017 New Revision: 321501 URL: https://svnweb.freebsd.org/changeset/base/321501 Log: MFC 320705 Release mtx hw_lock before calling pause() in qla_stop() and qla_error_recovery() Modified: stable/9/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:43:44 2017 (r321500) +++ stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:46:25 2017 (r321501) @@ -1540,8 +1540,11 @@ qla_stop(qla_host_t *ha) ha->flags.qla_watchdog_pause = 1; - while (!ha->qla_watchdog_paused) + while (!ha->qla_watchdog_paused) { + QLA_UNLOCK(ha); qla_mdelay(__func__, 1); + QLA_LOCK(ha); + } ha->flags.qla_interface_up = 0; @@ -1936,7 +1939,10 @@ qla_error_recovery(void *context, int pending) if (ha->flags.qla_interface_up) { ha->hw.imd_compl = 1; + + QLA_UNLOCK(ha); qla_mdelay(__func__, 300); + QLA_LOCK(ha); ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); From owner-svn-src-all@freebsd.org Wed Jul 26 01:48:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD337DAE043; Wed, 26 Jul 2017 01:48:14 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C51A703F5; Wed, 26 Jul 2017 01:48:14 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1mDiJ004732; Wed, 26 Jul 2017 01:48:13 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1mD6u004731; Wed, 26 Jul 2017 01:48:13 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201707260148.v6Q1mD6u004731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 26 Jul 2017 01:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321502 - head/sys/dev/mpr X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/mpr X-SVN-Commit-Revision: 321502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:48:14 -0000 Author: scottl Date: Wed Jul 26 01:48:13 2017 New Revision: 321502 URL: https://svnweb.freebsd.org/changeset/base/321502 Log: Quiet a message that sounds far more dire than it really is. Modified: head/sys/dev/mpr/mpr_sas.c Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Wed Jul 26 01:46:25 2017 (r321501) +++ head/sys/dev/mpr/mpr_sas.c Wed Jul 26 01:48:13 2017 (r321502) @@ -2677,7 +2677,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_INFO, "Error sending command, " + mpr_dprint(sc, MPR_XINFO, "Error sending command, " "freezing SIM queue\n"); } } From owner-svn-src-all@freebsd.org Wed Jul 26 01:48:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79D16DAE10B; Wed, 26 Jul 2017 01:48:59 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53F1170537; Wed, 26 Jul 2017 01:48:59 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q1mwto004800; Wed, 26 Jul 2017 01:48:58 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q1mwp4004796; Wed, 26 Jul 2017 01:48:58 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201707260148.v6Q1mwp4004796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 26 Jul 2017 01:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r321503 - stable/9/sys/dev/qlxgbe X-SVN-Group: stable-9 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/9/sys/dev/qlxgbe X-SVN-Commit-Revision: 321503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 01:48:59 -0000 Author: davidcs Date: Wed Jul 26 01:48:57 2017 New Revision: 321503 URL: https://svnweb.freebsd.org/changeset/base/321503 Log: MFC 321233 Raise the watchdog timer interval to 2 ticks, there by guaranteeing that it fires between 1ms and 2ms. ` Treat two consecutive occurrences of Heartbeat failures as a legitimate Heartbeat failure Modified: stable/9/sys/dev/qlxgbe/ql_def.h stable/9/sys/dev/qlxgbe/ql_hw.c stable/9/sys/dev/qlxgbe/ql_hw.h stable/9/sys/dev/qlxgbe/ql_os.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/qlxgbe/ql_def.h ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:48:13 2017 (r321502) +++ stable/9/sys/dev/qlxgbe/ql_def.h Wed Jul 26 01:48:57 2017 (r321503) @@ -105,7 +105,7 @@ struct qla_ivec { typedef struct qla_ivec qla_ivec_t; -#define QLA_WATCHDOG_CALLOUT_TICKS 1 +#define QLA_WATCHDOG_CALLOUT_TICKS 2 typedef struct _qla_tx_ring { qla_tx_buf_t tx_buf[NUM_TX_DESCRIPTORS]; Modified: stable/9/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:48:13 2017 (r321502) +++ stable/9/sys/dev/qlxgbe/ql_hw.c Wed Jul 26 01:48:57 2017 (r321503) @@ -3366,7 +3366,7 @@ ql_hw_check_health(qla_host_t *ha) ha->hw.health_count++; - if (ha->hw.health_count < 1000) + if (ha->hw.health_count < 500) return 0; ha->hw.health_count = 0; @@ -3385,10 +3385,18 @@ ql_hw_check_health(qla_host_t *ha) if ((val != ha->hw.hbeat_value) && (!(QL_ERR_INJECT(ha, INJCT_HEARTBEAT_FAILURE)))) { ha->hw.hbeat_value = val; + ha->hw.hbeat_failure = 0; return 0; } - device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", - __func__, val); + + ha->hw.hbeat_failure++; + + if (ha->hw.hbeat_failure < 2) /* we ignore the first failure */ + return 0; + else + device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", + __func__, val); + return -1; } Modified: stable/9/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:48:13 2017 (r321502) +++ stable/9/sys/dev/qlxgbe/ql_hw.h Wed Jul 26 01:48:57 2017 (r321503) @@ -1671,6 +1671,7 @@ typedef struct _qla_hw { /* heart beat register value */ uint32_t hbeat_value; uint32_t health_count; + uint32_t hbeat_failure; uint32_t max_tx_segs; uint32_t min_lro_pkt_size; Modified: stable/9/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:48:13 2017 (r321502) +++ stable/9/sys/dev/qlxgbe/ql_os.c Wed Jul 26 01:48:57 2017 (r321503) @@ -276,7 +276,7 @@ qla_watchdog(void *arg) ha->qla_watchdog_paused = 1; } - ha->watchdog_ticks = ha->watchdog_ticks++ % 1000; + ha->watchdog_ticks = ha->watchdog_ticks++ % 500; callout_reset(&ha->tx_callout, QLA_WATCHDOG_CALLOUT_TICKS, qla_watchdog, ha); } From owner-svn-src-all@freebsd.org Wed Jul 26 02:05:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E871DAE4E4; Wed, 26 Jul 2017 02:05:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FEC470BAC; Wed, 26 Jul 2017 02:05:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q259NJ012655; Wed, 26 Jul 2017 02:05:09 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q259L3012654; Wed, 26 Jul 2017 02:05:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201707260205.v6Q259L3012654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Jul 2017 02:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321504 - head/kerberos5/lib/libkafs5 X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/lib/libkafs5 X-SVN-Commit-Revision: 321504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 02:05:10 -0000 Author: cy Date: Wed Jul 26 02:05:09 2017 New Revision: 321504 URL: https://svnweb.freebsd.org/changeset/base/321504 Log: Remove trailing slash (/) for consistency. Modified: head/kerberos5/lib/libkafs5/Makefile Modified: head/kerberos5/lib/libkafs5/Makefile ============================================================================== --- head/kerberos5/lib/libkafs5/Makefile Wed Jul 26 01:48:57 2017 (r321503) +++ head/kerberos5/lib/libkafs5/Makefile Wed Jul 26 02:05:09 2017 (r321504) @@ -26,7 +26,7 @@ SRCS= afssys.c afskrb5.c common.c krb5_err.h CFLAGS+= -I${KRB5DIR}/lib/kafs \ -I${KRB5DIR}/lib/krb5 \ - -I${.OBJDIR:H}/libkrb5/ \ + -I${.OBJDIR:H}/libkrb5 \ -I${KRB5DIR}/lib/roken CLEANFILES= kafs5.3 From owner-svn-src-all@freebsd.org Wed Jul 26 05:26:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 152A4DB1BC8; Wed, 26 Jul 2017 05:26:03 +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 E616C759DD; Wed, 26 Jul 2017 05:26:02 +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 v6Q5Q2QM094323; Wed, 26 Jul 2017 05:26:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5Q2FP094322; Wed, 26 Jul 2017 05:26:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260526.v6Q5Q2FP094322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321507 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:26:03 -0000 Author: adrian Date: Wed Jul 26 05:26:01 2017 New Revision: 321507 URL: https://svnweb.freebsd.org/changeset/base/321507 Log: [iwm] if_iwm - Use chan list from ieee80211_scan_state for scan, not ic_channels. * Limiting the channel list with "ifconfig wlan0 chanlist ..." now will actually set the list of channels scanned by iwm. Tested: * Intel 7260, STA mode, setting chanlist to 1-14 and 36-254, and indeed it does what it should! Modified: head/sys/dev/iwm/if_iwm_scan.c Modified: head/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- head/sys/dev/iwm/if_iwm_scan.c Wed Jul 26 05:01:46 2017 (r321506) +++ head/sys/dev/iwm/if_iwm_scan.c Wed Jul 26 05:26:01 2017 (r321507) @@ -307,15 +307,13 @@ iwm_mvm_lmac_scan_fill_channels(struct iwm_softc *sc, int j; for (nchan = j = 0; - j < ic->ic_nchans && nchan < sc->ucode_capa.n_scan_channels; j++) { - c = &ic->ic_channels[j]; - /* For 2GHz, only populate 11b channels */ - /* For 5GHz, only populate 11a channels */ + j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or * something in the chanlist. */ - if (iwm_mvm_scan_skip_channel(c)) { + if (!IEEE80211_IS_CHAN_2GHZ(c) && !IEEE80211_IS_CHAN_5GHZ(c)) { IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_EEPROM, "%s: skipping channel (freq=%d, ieee=%d, flags=0x%08x)\n", __func__, c->ic_freq, c->ic_ieee, c->ic_flags); @@ -346,20 +344,19 @@ iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, struct iwm_scan_channel_cfg_umac *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; for (nchan = j = 0; - j < ic->ic_nchans && nchan < sc->ucode_capa.n_scan_channels; j++) { - c = &ic->ic_channels[j]; - /* For 2GHz, only populate 11b channels */ - /* For 5GHz, only populate 11a channels */ + j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or * something in the chanlist. */ - if (iwm_mvm_scan_skip_channel(c)) { + if (!IEEE80211_IS_CHAN_2GHZ(c) && !IEEE80211_IS_CHAN_5GHZ(c)) { IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_EEPROM, "%s: skipping channel (freq=%d, ieee=%d, flags=0x%08x)\n", __func__, c->ic_freq, c->ic_ieee, c->ic_flags); @@ -726,7 +723,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) if (iwm_mvm_rrm_scan_needed(sc)) req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); - req->flags = iwm_mvm_scan_rxon_flags(&sc->sc_ic.ic_channels[0]); + req->flags = iwm_mvm_scan_rxon_flags(sc->sc_ic.ic_scan->ss_chans[0]); req->filter_flags = htole32(IWM_MAC_FILTER_ACCEPT_GRP | IWM_MAC_FILTER_IN_BEACON); From owner-svn-src-all@freebsd.org Wed Jul 26 05:29:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F18FDB1CBC; Wed, 26 Jul 2017 05:29:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B2EE75B59; Wed, 26 Jul 2017 05:29:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q5T8mk094496; Wed, 26 Jul 2017 05:29:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5T8q6094494; Wed, 26 Jul 2017 05:29:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260529.v6Q5T8q6094494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321508 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:29:09 -0000 Author: adrian Date: Wed Jul 26 05:29:08 2017 New Revision: 321508 URL: https://svnweb.freebsd.org/changeset/base/321508 Log: [iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4). * iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible memory leak, compared to using just mbufq_drain(). * Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be handled in the caller. Obtained from: dragonflybsd.git 339d45fda40072e0aca5ece639173204716f11fe Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_sta.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:26:01 2017 (r321507) +++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:29:08 2017 (r321508) @@ -388,6 +388,7 @@ static struct ieee80211vap * const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void iwm_vap_delete(struct ieee80211vap *); +static void iwm_xmit_queue_drain(struct iwm_softc *); static void iwm_scan_start(struct ieee80211com *); static void iwm_scan_end(struct ieee80211com *); static void iwm_update_mcast(struct ieee80211com *); @@ -4103,7 +4104,7 @@ iwm_release(struct iwm_softc *sc, struct iwm_node *in) * get here from RUN state. */ tfd_msk = 0xf; - mbufq_drain(&sc->sc_snd); + iwm_xmit_queue_drain(sc); iwm_mvm_flush_tx_path(sc, tfd_msk, IWM_CMD_SYNC); /* * We seem to get away with just synchronously sending the @@ -6214,6 +6215,19 @@ iwm_vap_delete(struct ieee80211vap *vap) } static void +iwm_xmit_queue_drain(struct iwm_softc *sc) +{ + struct mbuf *m; + struct ieee80211_node *ni; + + while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + ieee80211_free_node(ni); + m_freem(m); + } +} + +static void iwm_scan_start(struct ieee80211com *ic) { struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); @@ -6372,6 +6386,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211 callout_drain(&sc->sc_watchdog_to); iwm_stop_device(sc); if (do_net80211) { + IWM_LOCK(sc); + iwm_xmit_queue_drain(sc); + IWM_UNLOCK(sc); ieee80211_ifdetach(&sc->sc_ic); } @@ -6405,7 +6422,6 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211 sc->sc_notif_wait = NULL; } - mbufq_drain(&sc->sc_snd); IWM_LOCK_DESTROY(sc); return (0); Modified: head/sys/dev/iwm/if_iwm_sta.c ============================================================================== --- head/sys/dev/iwm/if_iwm_sta.c Wed Jul 26 05:26:01 2017 (r321507) +++ head/sys/dev/iwm/if_iwm_sta.c Wed Jul 26 05:29:08 2017 (r321508) @@ -283,7 +283,6 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211v ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE); if (ret) return ret; - mbufq_drain(&sc->sc_snd); /* XXX needed ? */ for (ac = 0; ac < WME_NUM_AC; ac++) { tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]); } From owner-svn-src-all@freebsd.org Wed Jul 26 05:40:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8414DB1EC7; Wed, 26 Jul 2017 05:40:54 +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 A3CB0760C4; Wed, 26 Jul 2017 05:40:54 +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 v6Q5erTg099402; Wed, 26 Jul 2017 05:40:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5erqv099399; Wed, 26 Jul 2017 05:40:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260540.v6Q5erqv099399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:40:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321509 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:40:54 -0000 Author: adrian Date: Wed Jul 26 05:40:52 2017 New Revision: 321509 URL: https://svnweb.freebsd.org/changeset/base/321509 Log: [iwm] Sync statistics API definitions with Linux iwlwifi. Obtained from: dragonflybsd.git 75895a53a9c1ba60d75be9b4bf6e49a37f91a7cf Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:40:52 2017 (r321509) @@ -325,8 +325,10 @@ static int iwm_mvm_get_signal_strength(struct iwm_soft struct iwm_rx_phy_info *); static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); -static int iwm_get_noise(struct iwm_softc *sc, +static int iwm_get_noise(struct iwm_softc *, const struct iwm_mvm_statistics_rx_non_phy *); +static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, + struct iwm_rx_packet *); static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *, uint32_t, boolean_t); static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, @@ -3159,6 +3161,15 @@ iwm_get_noise(struct iwm_softc *sc, #endif } +static void +iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +{ + struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; + + memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); + sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); +} + /* * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * @@ -5292,13 +5303,9 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_CALIB_RES_NOTIF_PHY_DB: break; - case IWM_STATISTICS_NOTIFICATION: { - struct iwm_notif_statistics *stats; - stats = (void *)pkt->data; - memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); - sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); + case IWM_STATISTICS_NOTIFICATION: + iwm_mvm_handle_rx_statistics(sc, pkt); break; - } case IWM_NVM_ACCESS_CMD: case IWM_MCC_UPDATE_CMD: Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:40:52 2017 (r321509) @@ -2898,6 +2898,18 @@ struct iwm_mcast_filter_cmd { uint8_t addr_list[0]; } __packed; /* IWM_MCAST_FILTERING_CMD_API_S_VER_1 */ +/* + * The first MAC indices (starting from 0) + * are available to the driver, AUX follows + */ +#define IWM_MAC_INDEX_AUX 4 +#define IWM_MAC_INDEX_MIN_DRIVER 0 +#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX +#define IWM_NUM_MAC_INDEX (IWM_MAC_INDEX_AUX + 1) + +/*********************************** + * Statistics API + ***********************************/ struct iwm_mvm_statistics_dbg { uint32_t burst_check; uint32_t burst_count; @@ -2914,24 +2926,6 @@ struct iwm_mvm_statistics_div { uint32_t reserved2; } __packed; /* IWM_STATISTICS_SLOW_DIV_API_S_VER_2 */ -struct iwm_mvm_statistics_general_common { - uint32_t temperature; /* radio temperature */ - uint32_t temperature_m; /* radio voltage */ - struct iwm_mvm_statistics_dbg dbg; - uint32_t sleep_time; - uint32_t slots_out; - uint32_t slots_idle; - uint32_t ttl_timestamp; - struct iwm_mvm_statistics_div div; - uint32_t rx_enable_counter; - /* - * num_of_sos_states: - * count the number of times we have to re-tune - * in order to get out of bad PHY status - */ - uint32_t num_of_sos_states; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ - struct iwm_mvm_statistics_rx_non_phy { uint32_t bogus_cts; /* CTS received when not expecting CTS */ uint32_t bogus_ack; /* ACK received when not expecting ACK */ @@ -3002,6 +2996,23 @@ struct iwm_mvm_statistics_rx_ht_phy { uint32_t unsupport_mcs; } __packed; /* IWM_STATISTICS_HT_RX_PHY_API_S_VER_1 */ +struct iwm_mvm_statistics_tx_non_phy { + uint32_t preamble_cnt; + uint32_t rx_detected_cnt; + uint32_t bt_prio_defer_cnt; + uint32_t bt_prio_kill_cnt; + uint32_t few_bytes_cnt; + uint32_t cts_timeout; + uint32_t ack_timeout; + uint32_t expected_ack_cnt; + uint32_t actual_ack_cnt; + uint32_t dump_msdu_cnt; + uint32_t burst_abort_next_frame_mismatch_cnt; + uint32_t burst_abort_missing_next_frame_cnt; + uint32_t cts_timeout_collision; + uint32_t ack_or_ba_timeout_collision; +} __packed; /* IWM_STATISTICS_TX_NON_PHY_API_S_VER_3 */ + #define IWM_MAX_CHAINS 3 struct iwm_mvm_statistics_tx_non_phy_agg { @@ -3032,20 +3043,7 @@ struct iwm_mvm_statistics_tx_channel_width { }; /* IWM_STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */ struct iwm_mvm_statistics_tx { - uint32_t preamble_cnt; - uint32_t rx_detected_cnt; - uint32_t bt_prio_defer_cnt; - uint32_t bt_prio_kill_cnt; - uint32_t few_bytes_cnt; - uint32_t cts_timeout; - uint32_t ack_timeout; - uint32_t expected_ack_cnt; - uint32_t actual_ack_cnt; - uint32_t dump_msdu_cnt; - uint32_t burst_abort_next_frame_mismatch_cnt; - uint32_t burst_abort_missing_next_frame_cnt; - uint32_t cts_timeout_collision; - uint32_t ack_or_ba_timeout_collision; + struct iwm_mvm_statistics_tx_non_phy general; struct iwm_mvm_statistics_tx_non_phy_agg agg; struct iwm_mvm_statistics_tx_channel_width channel_width; } __packed; /* IWM_STATISTICS_TX_API_S_VER_4 */ @@ -3062,17 +3060,38 @@ struct iwm_mvm_statistics_bt_activity { uint32_t lo_priority_rx_denied_cnt; } __packed; /* IWM_STATISTICS_BT_ACTIVITY_API_S_VER_1 */ -struct iwm_mvm_statistics_general { - struct iwm_mvm_statistics_general_common common; +struct iwm_mvm_statistics_general_v8 { + uint32_t radio_temperature; + uint32_t radio_voltage; + struct iwm_mvm_statistics_dbg dbg; + uint32_t sleep_time; + uint32_t slots_out; + uint32_t slots_idle; + uint32_t ttl_timestamp; + struct iwm_mvm_statistics_div slow_div; + uint32_t rx_enable_counter; + /* + * num_of_sos_states: + * count the number of times we have to re-tune + * in order to get out of bad PHY status + */ + uint32_t num_of_sos_states; uint32_t beacon_filtered; uint32_t missed_beacons; - int8_t beacon_filter_average_energy; - int8_t beacon_filter_reason; - int8_t beacon_filter_current_energy; - int8_t beacon_filter_reserved; + uint8_t beacon_filter_average_energy; + uint8_t beacon_filter_reason; + uint8_t beacon_filter_current_energy; + uint8_t beacon_filter_reserved; uint32_t beacon_filter_delta_time; struct iwm_mvm_statistics_bt_activity bt_activity; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ + uint64_t rx_time; + uint64_t on_time_rf; + uint64_t on_time_scan; + uint64_t tx_time; + uint32_t beacon_counter[IWM_NUM_MAC_INDEX]; + uint8_t beacon_average_energy[IWM_NUM_MAC_INDEX]; + uint8_t reserved[4 - (IWM_NUM_MAC_INDEX % 4)]; +} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_8 */ struct iwm_mvm_statistics_rx { struct iwm_mvm_statistics_rx_phy ofdm; @@ -3086,24 +3105,23 @@ struct iwm_mvm_statistics_rx { * * By default, uCode issues this notification after receiving a beacon * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * IWM_REPLY_STATISTICS_CMD 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues IWM_REPLY_STATISTICS_CMD - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears statistics - * appropriately so that each notification contains statistics for only the - * one channel that has just been scanned. + * IWM_STATISTICS_CMD (0x9c), below. */ -struct iwm_notif_statistics { /* IWM_STATISTICS_NTFY_API_S_VER_8 */ +struct iwm_notif_statistics_v10 { uint32_t flag; struct iwm_mvm_statistics_rx rx; struct iwm_mvm_statistics_tx tx; - struct iwm_mvm_statistics_general general; -} __packed; + struct iwm_mvm_statistics_general_v8 general; +} __packed; /* IWM_STATISTICS_NTFY_API_S_VER_10 */ +#define IWM_STATISTICS_FLG_CLEAR 0x1 +#define IWM_STATISTICS_FLG_DISABLE_NOTIF 0x2 + +struct iwm_statistics_cmd { + uint32_t flags; +} __packed; /* IWM_STATISTICS_CMD_API_S_VER_1 */ + /*********************************** * Smart Fifo API ***********************************/ @@ -3186,14 +3204,6 @@ struct iwm_sf_cfg_cmd { /* * BEGIN mvm/fw-api-mac.h */ - -/* - * The first MAC indices (starting from 0) - * are available to the driver, AUX follows - */ -#define IWM_MAC_INDEX_AUX 4 -#define IWM_MAC_INDEX_MIN_DRIVER 0 -#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX enum iwm_ac { IWM_AC_BK, Modified: head/sys/dev/iwm/if_iwmvar.h ============================================================================== --- head/sys/dev/iwm/if_iwmvar.h Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwmvar.h Wed Jul 26 05:40:52 2017 (r321509) @@ -529,7 +529,7 @@ struct iwm_softc { /* phy contexts. we only use the first one */ struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX]; - struct iwm_notif_statistics sc_stats; + struct iwm_notif_statistics_v10 sc_stats; int sc_noise; caddr_t sc_drvbpf; From owner-svn-src-all@freebsd.org Wed Jul 26 05:51:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1BC5DB223A; Wed, 26 Jul 2017 05:51:32 +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 761F676459; Wed, 26 Jul 2017 05:51:32 +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 v6Q5pVS2005672; Wed, 26 Jul 2017 05:51:31 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5pVUh005669; Wed, 26 Jul 2017 05:51:31 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260551.v6Q5pVUh005669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:51:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321510 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:51:32 -0000 Author: adrian Date: Wed Jul 26 05:51:31 2017 New Revision: 321510 URL: https://svnweb.freebsd.org/changeset/base/321510 Log: [iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c. Obtained from: dragonflybsd.git 8a5dd7783e407856754093f5b1c9c757c64534b7 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_util.c head/sys/dev/iwm/if_iwm_util.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:51:31 2017 (r321510) @@ -4451,13 +4451,6 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ break; case IEEE80211_S_RUN: - { - struct iwm_host_cmd cmd = { - .id = IWM_LQ_CMD, - .len = { sizeof(in->in_lq), }, - .flags = IWM_CMD_SYNC, - }; - in = IWM_NODE(vap->iv_bss); /* Update the association state, now we have it all */ /* (eg associd comes in at this point */ @@ -4482,15 +4475,13 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ iwm_mvm_update_quotas(sc, ivp); iwm_setrates(sc, in); - cmd.data[0] = &in->in_lq; - if ((error = iwm_send_cmd(sc, &cmd)) != 0) { + if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, - "%s: IWM_LQ_CMD failed\n", __func__); + "%s: IWM_LQ_CMD failed: %d\n", __func__, error); } iwm_mvm_led_enable(sc); break; - } default: break; Modified: head/sys/dev/iwm/if_iwm_util.c ============================================================================== --- head/sys/dev/iwm/if_iwm_util.c Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm_util.c Wed Jul 26 05:51:31 2017 (r321510) @@ -489,6 +489,32 @@ iwm_dma_contig_free(struct iwm_dma_info *dma) } } +/** + * iwm_mvm_send_lq_cmd() - Send link quality command + * @init: This command is sent as part of station initialization right + * after station has been added. + * + * The link quality command is sent as the last step of station creation. + * This is the special case in which init is set and we call a callback in + * this case to clear the state indicating that station creation is in + * progress. + */ +int +iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init) +{ + struct iwm_host_cmd cmd = { + .id = IWM_LQ_CMD, + .len = { sizeof(struct iwm_lq_cmd), }, + .flags = init ? 0 : IWM_CMD_ASYNC, + .data = { lq, }, + }; + + if (lq->sta_id == IWM_MVM_STATION_COUNT) + return EINVAL; + + return iwm_send_cmd(sc, &cmd); +} + boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc) { Modified: head/sys/dev/iwm/if_iwm_util.h ============================================================================== --- head/sys/dev/iwm/if_iwm_util.h Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm_util.h Wed Jul 26 05:51:31 2017 (r321510) @@ -120,6 +120,9 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, str bus_size_t size, bus_size_t alignment); extern void iwm_dma_contig_free(struct iwm_dma_info *); +extern int iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, + boolean_t init); + extern boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc); extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx); From owner-svn-src-all@freebsd.org Wed Jul 26 05:52:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12192DB22E9; Wed, 26 Jul 2017 05:52:39 +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 C913476753; Wed, 26 Jul 2017 05:52:38 +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 v6Q5qc39006586; Wed, 26 Jul 2017 05:52:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5qcqM006585; Wed, 26 Jul 2017 05:52:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260552.v6Q5qcqM006585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:52:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321511 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:52:39 -0000 Author: adrian Date: Wed Jul 26 05:52:37 2017 New Revision: 321511 URL: https://svnweb.freebsd.org/changeset/base/321511 Log: [iwm] Sync rs (rate-selection) API definitions from Linux iwlwifi. * While there clean up alignments and line wrapping in existing definitions for rs API in if_iwmreg.h Obtained from: dragonflybsd.git 085e37a042bdb17081e495e46919359ce43aa118 Modified: head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:51:31 2017 (r321510) +++ head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:52:37 2017 (r321511) @@ -3981,12 +3981,12 @@ enum { * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT */ -#define IWM_RATE_MCS_CHAN_WIDTH_POS 11 -#define IWM_RATE_MCS_CHAN_WIDTH_MSK (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_20 (0 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_40 (1 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_80 (2 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_160 (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_POS 11 +#define IWM_RATE_MCS_CHAN_WIDTH_MSK (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_20 (0 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_40 (1 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_80 (2 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_160 (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ #define IWM_RATE_MCS_SGI_POS 13 @@ -3999,7 +3999,7 @@ enum { #define IWM_RATE_MCS_ANT_C_MSK (4 << IWM_RATE_MCS_ANT_POS) #define IWM_RATE_MCS_ANT_AB_MSK (IWM_RATE_MCS_ANT_A_MSK | \ IWM_RATE_MCS_ANT_B_MSK) -#define IWM_RATE_MCS_ANT_ABC_MSK (IWM_RATE_MCS_ANT_AB_MSK | \ +#define IWM_RATE_MCS_ANT_ABC_MSK (IWM_RATE_MCS_ANT_AB_MSK | \ IWM_RATE_MCS_ANT_C_MSK) #define IWM_RATE_MCS_ANT_MSK IWM_RATE_MCS_ANT_ABC_MSK #define IWM_RATE_MCS_ANT_NUM 3 @@ -4009,8 +4009,8 @@ enum { #define IWM_RATE_MCS_STBC_MSK (1 << IWM_RATE_MCS_STBC_POS) /* Bit 19: (0) Beamforming is off, (1) Beamforming is on */ -#define IWM_RATE_MCS_BF_POS 19 -#define IWM_RATE_MCS_BF_MSK (1 << IWM_RATE_MCS_BF_POS) +#define IWM_RATE_MCS_BF_POS 19 +#define IWM_RATE_MCS_BF_MSK (1 << IWM_RATE_MCS_BF_POS) /* Bit 20: (0) ZLF is off, (1) ZLF is on */ #define IWM_RATE_MCS_ZLF_POS 20 @@ -4033,29 +4033,65 @@ enum { /* Link quality command flags bit fields */ /* Bit 0: (0) Don't use RTS (1) Use RTS */ -#define IWM_LQ_FLAG_USE_RTS_POS 0 -#define IWM_LQ_FLAG_USE_RTS_MSK (1 << IWM_LQ_FLAG_USE_RTS_POS) +#define IWM_LQ_FLAG_USE_RTS_POS 0 +#define IWM_LQ_FLAG_USE_RTS_MSK (1 << IWM_LQ_FLAG_USE_RTS_POS) /* Bit 1-3: LQ command color. Used to match responses to LQ commands */ -#define IWM_LQ_FLAG_COLOR_POS 1 -#define IWM_LQ_FLAG_COLOR_MSK (7 << IWM_LQ_FLAG_COLOR_POS) +#define IWM_LQ_FLAG_COLOR_POS 1 +#define IWM_LQ_FLAG_COLOR_MSK (7 << IWM_LQ_FLAG_COLOR_POS) /* Bit 4-5: Tx RTS BW Signalling * (0) No RTS BW signalling * (1) Static BW signalling * (2) Dynamic BW signalling */ -#define IWM_LQ_FLAG_RTS_BW_SIG_POS 4 -#define IWM_LQ_FLAG_RTS_BW_SIG_NONE (0 << IWM_LQ_FLAG_RTS_BW_SIG_POS) -#define IWM_LQ_FLAG_RTS_BW_SIG_STATIC (1 << IWM_LQ_FLAG_RTS_BW_SIG_POS) -#define IWM_LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_POS 4 +#define IWM_LQ_FLAG_RTS_BW_SIG_NONE (0 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_STATIC (1 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << IWM_LQ_FLAG_RTS_BW_SIG_POS) /* Bit 6: (0) No dynamic BW selection (1) Allow dynamic BW selection * Dyanmic BW selection allows Tx with narrower BW then requested in rates */ -#define IWM_LQ_FLAG_DYNAMIC_BW_POS 6 -#define IWM_LQ_FLAG_DYNAMIC_BW_MSK (1 << IWM_LQ_FLAG_DYNAMIC_BW_POS) +#define IWM_LQ_FLAG_DYNAMIC_BW_POS 6 +#define IWM_LQ_FLAG_DYNAMIC_BW_MSK (1 << IWM_LQ_FLAG_DYNAMIC_BW_POS) +/* Single Stream Tx Parameters (lq_cmd->ss_params) + * Flags to control a smart FW decision about whether BFER/STBC/SISO will be + * used for single stream Tx. + */ + +/* Bit 0-1: Max STBC streams allowed. Can be 0-3. + * (0) - No STBC allowed + * (1) - 2x1 STBC allowed (HT/VHT) + * (2) - 4x2 STBC allowed (HT/VHT) + * (3) - 3x2 STBC allowed (HT only) + * All our chips are at most 2 antennas so only (1) is valid for now. + */ +#define IWM_LQ_SS_STBC_ALLOWED_POS 0 +#define IWM_LQ_SS_STBC_ALLOWED_MSK (3 << IWM_LQ_SS_STBC_ALLOWED_MSK) + +/* 2x1 STBC is allowed */ +#define IWM_LQ_SS_STBC_1SS_ALLOWED (1 << IWM_LQ_SS_STBC_ALLOWED_POS) + +/* Bit 2: Beamformer (VHT only) is allowed */ +#define IWM_LQ_SS_BFER_ALLOWED_POS 2 +#define IWM_LQ_SS_BFER_ALLOWED (1 << IWM_LQ_SS_BFER_ALLOWED_POS) + +/* Bit 3: Force BFER or STBC for testing + * If this is set: + * If BFER is allowed then force the ucode to choose BFER else + * If STBC is allowed then force the ucode to choose STBC over SISO + */ +#define IWM_LQ_SS_FORCE_POS 3 +#define IWM_LQ_SS_FORCE (1 << IWM_LQ_SS_FORCE_POS) + +/* Bit 31: ss_params field is valid. Used for FW backward compatibility + * with other drivers which don't support the ss_params API yet + */ +#define IWM_LQ_SS_PARAMS_VALID_POS 31 +#define IWM_LQ_SS_PARAMS_VALID (1 << IWM_LQ_SS_PARAMS_VALID_POS) + /** * struct iwm_lq_cmd - link quality command * @sta_id: station to update @@ -4078,11 +4114,11 @@ enum { * 2 - 0x3f: maximal number of frames (up to 3f == 63) * @rs_table: array of rates for each TX try, each is rate_n_flags, * meaning it is a combination of IWM_RATE_MCS_* and IWM_RATE_*_PLCP - * @bf_params: beam forming params, currently not used + * @ss_params: single stream features. declare whether STBC or BFER are allowed. */ struct iwm_lq_cmd { uint8_t sta_id; - uint8_t reserved1; + uint8_t reduced_tpc; uint16_t control; /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */ uint8_t flags; @@ -4096,7 +4132,7 @@ struct iwm_lq_cmd { uint8_t agg_frame_cnt_limit; uint32_t reserved2; uint32_t rs_table[IWM_LQ_MAX_RETRY_NUM]; - uint32_t bf_params; + uint32_t ss_params; }; /* LINK_QUALITY_CMD_API_S_VER_1 */ /* @@ -4533,7 +4569,8 @@ struct iwm_mvm_tx_resp { uint8_t pa_integ_res_b[3]; uint8_t pa_integ_res_c[3]; uint16_t measurement_req_id; - uint16_t reserved; + uint8_t reduced_tpc; + uint8_t reserved; uint32_t tfd_info; uint16_t seq_ctl; From owner-svn-src-all@freebsd.org Wed Jul 26 06:42:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03EADDB2CFE; Wed, 26 Jul 2017 06:42:03 +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 C23A6777E0; Wed, 26 Jul 2017 06:42:02 +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 v6Q6g1cL026599; Wed, 26 Jul 2017 06:42:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q6g1K8026598; Wed, 26 Jul 2017 06:42:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707260642.v6Q6g1K8026598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jul 2017 06:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321512 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 321512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 06:42:03 -0000 Author: kib Date: Wed Jul 26 06:42:01 2017 New Revision: 321512 URL: https://svnweb.freebsd.org/changeset/base/321512 Log: Mark name_PCTRIE_LOOKUP_LE() generated function unused. The PCTRIE macro will be shortly applied in a situation where LOOKUP_LE is not needed. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D11435 Modified: head/sys/sys/pctrie.h Modified: head/sys/sys/pctrie.h ============================================================================== --- head/sys/sys/pctrie.h Wed Jul 26 05:52:37 2017 (r321511) +++ head/sys/sys/pctrie.h Wed Jul 26 06:42:01 2017 (r321512) @@ -76,7 +76,7 @@ name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t ke return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key)); \ } \ \ -static __inline struct type * \ +static __inline __unused struct type * \ name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key) \ { \ \ From owner-svn-src-all@freebsd.org Wed Jul 26 06:52:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3B8EDB2F05; Wed, 26 Jul 2017 06:52:47 +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 7587077C79; Wed, 26 Jul 2017 06:52:47 +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 v6Q6qkT2030526; Wed, 26 Jul 2017 06:52:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q6qjDu030520; Wed, 26 Jul 2017 06:52:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707260652.v6Q6qjDu030520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jul 2017 06:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321513 - in stable/11/sys: sys vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: sys vm X-SVN-Commit-Revision: 321513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 06:52:47 -0000 Author: kib Date: Wed Jul 26 06:52:45 2017 New Revision: 321513 URL: https://svnweb.freebsd.org/changeset/base/321513 Log: MFC r321247: Add pctrie_init() and vm_radix_init() to initialize generic pctrie and vm_radix trie. Modified: stable/11/sys/sys/_pctrie.h stable/11/sys/sys/pctrie.h stable/11/sys/vm/_vm_radix.h stable/11/sys/vm/vm_object.c stable/11/sys/vm/vm_radix.c stable/11/sys/vm/vm_radix.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/_pctrie.h ============================================================================== --- stable/11/sys/sys/_pctrie.h Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/sys/_pctrie.h Wed Jul 26 06:52:45 2017 (r321513) @@ -38,14 +38,4 @@ struct pctrie { uintptr_t pt_root; }; -#ifdef _KERNEL - -static __inline boolean_t -pctrie_is_empty(struct pctrie *ptree) -{ - - return (ptree->pt_root == 0); -} - -#endif /* _KERNEL */ #endif /* !__SYS_PCTRIE_H_ */ Modified: stable/11/sys/sys/pctrie.h ============================================================================== --- stable/11/sys/sys/pctrie.h Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/sys/pctrie.h Wed Jul 26 06:52:45 2017 (r321513) @@ -119,5 +119,19 @@ void pctrie_remove(struct pctrie *ptree, uint64_t key size_t pctrie_node_size(void); int pctrie_zone_init(void *mem, int size, int flags); +static __inline void +pctrie_init(struct pctrie *ptree) +{ + + ptree->pt_root = 0; +} + +static __inline boolean_t +pctrie_is_empty(struct pctrie *ptree) +{ + + return (ptree->pt_root == 0); +} + #endif /* _KERNEL */ #endif /* !_SYS_PCTRIE_H_ */ Modified: stable/11/sys/vm/_vm_radix.h ============================================================================== --- stable/11/sys/vm/_vm_radix.h Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/vm/_vm_radix.h Wed Jul 26 06:52:45 2017 (r321513) @@ -38,14 +38,4 @@ struct vm_radix { uintptr_t rt_root; }; -#ifdef _KERNEL - -static __inline boolean_t -vm_radix_is_empty(struct vm_radix *rtree) -{ - - return (rtree->rt_root == 0); -} - -#endif /* _KERNEL */ #endif /* !__VM_RADIX_H_ */ Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/vm/vm_object.c Wed Jul 26 06:52:45 2017 (r321513) @@ -204,7 +204,7 @@ vm_object_zinit(void *mem, int size, int flags) /* These are true for any object that has been freed */ object->type = OBJT_DEAD; object->ref_count = 0; - object->rtree.rt_root = 0; + vm_radix_init(&object->rtree); object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; @@ -301,7 +301,7 @@ vm_object_init(void) #endif vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - vm_radix_init(); + vm_radix_zinit(); } void Modified: stable/11/sys/vm/vm_radix.c ============================================================================== --- stable/11/sys/vm/vm_radix.c Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/vm/vm_radix.c Wed Jul 26 06:52:45 2017 (r321513) @@ -310,7 +310,7 @@ SYSINIT(vm_radix_reserve_kva, SI_SUB_KMEM, SI_ORDER_TH * Initialize the UMA slab zone. */ void -vm_radix_init(void) +vm_radix_zinit(void) { vm_radix_node_zone = uma_zcreate("RADIX NODE", Modified: stable/11/sys/vm/vm_radix.h ============================================================================== --- stable/11/sys/vm/vm_radix.h Wed Jul 26 06:42:01 2017 (r321512) +++ stable/11/sys/vm/vm_radix.h Wed Jul 26 06:52:45 2017 (r321513) @@ -35,7 +35,6 @@ #ifdef _KERNEL -void vm_radix_init(void); int vm_radix_insert(struct vm_radix *rtree, vm_page_t page); boolean_t vm_radix_is_singleton(struct vm_radix *rtree); vm_page_t vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index); @@ -44,6 +43,21 @@ vm_page_t vm_radix_lookup_le(struct vm_radix *rtree, v void vm_radix_reclaim_allnodes(struct vm_radix *rtree); vm_page_t vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index); vm_page_t vm_radix_replace(struct vm_radix *rtree, vm_page_t newpage); +void vm_radix_zinit(void); + +static __inline void +vm_radix_init(struct vm_radix *rtree) +{ + + rtree->rt_root = 0; +} + +static __inline boolean_t +vm_radix_is_empty(struct vm_radix *rtree) +{ + + return (rtree->rt_root == 0); +} #endif /* _KERNEL */ #endif /* !_VM_RADIX_H_ */ From owner-svn-src-all@freebsd.org Wed Jul 26 06:57:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83BF2DB303F; Wed, 26 Jul 2017 06:57:17 +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 261AD77E19; Wed, 26 Jul 2017 06:57:17 +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 v6Q6vGqB030756; Wed, 26 Jul 2017 06:57:16 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q6vFWM030745; Wed, 26 Jul 2017 06:57:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201707260657.v6Q6vFWM030745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 26 Jul 2017 06:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321514 - in head: sys/compat/cloudabi sys/compat/cloudabi32 sys/compat/cloudabi64 sys/contrib/cloudabi usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: in head: sys/compat/cloudabi sys/compat/cloudabi32 sys/compat/cloudabi64 sys/contrib/cloudabi usr.bin/truss X-SVN-Commit-Revision: 321514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 06:57:17 -0000 Author: ed Date: Wed Jul 26 06:57:15 2017 New Revision: 321514 URL: https://svnweb.freebsd.org/changeset/base/321514 Log: Upgrade to the latest sources generated from the CloudABI specification. The CloudABI specification has had some minor changes over the last half year. No substantial features have been added, but some features that are deemed unnecessary in retrospect have been removed: - mlock()/munlock(): These calls tend to be used for two different purposes: real-time support and handling of sensitive (cryptographic) material that shouldn't end up in swap. The former use case is out of scope for CloudABI. The latter may also be handled by encrypting swap. Removing this has the advantage that we no longer need to worry about having resource limits put in place. - SOCK_SEQPACKET: Support for SOCK_SEQPACKET is rather inconsistent across various operating systems. Some operating systems supported by CloudABI (e.g., macOS) don't support it at all. Considering that they are rarely used, remove support for the time being. - getsockname(), getpeername(), etc.: A shortcoming of the sockets API is that it doesn't allow you to create socket(pair)s, having fake socket addresses associated with them. This makes it harder to test applications or transparently forward (proxy) connections to them. With CloudABI, we're slowly moving networking connectivity into a separate daemon called Flower. In addition to passing around socket file descriptors, this daemon provides address information in the form of arbitrary string labels. There is thus no longer any need for requesting socket address information from the kernel itself. This change also updates consumers of the generated code accordingly. Even though system calls end up getting renumbered, this won't cause any problems in practice. CloudABI programs always call into the kernel through a kernel-supplied vDSO that has the numbers updated as well. Obtained from: https://github.com/NuxiNL/cloudabi Modified: head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/cloudabi/cloudabi_mem.c head/sys/compat/cloudabi/cloudabi_sock.c head/sys/compat/cloudabi/cloudabi_util.h head/sys/compat/cloudabi32/cloudabi32_proto.h head/sys/compat/cloudabi32/cloudabi32_sock.c head/sys/compat/cloudabi32/cloudabi32_syscall.h head/sys/compat/cloudabi32/cloudabi32_syscalls.c head/sys/compat/cloudabi32/cloudabi32_sysent.c head/sys/compat/cloudabi32/cloudabi32_systrace_args.c head/sys/compat/cloudabi64/cloudabi64_proto.h head/sys/compat/cloudabi64/cloudabi64_sock.c head/sys/compat/cloudabi64/cloudabi64_syscall.h head/sys/compat/cloudabi64/cloudabi64_syscalls.c head/sys/compat/cloudabi64/cloudabi64_sysent.c head/sys/compat/cloudabi64/cloudabi64_systrace_args.c head/sys/contrib/cloudabi/cloudabi32_types.h head/sys/contrib/cloudabi/cloudabi64_types.h head/sys/contrib/cloudabi/cloudabi_types_common.h head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S head/sys/contrib/cloudabi/cloudabi_vdso_armv6.S head/sys/contrib/cloudabi/cloudabi_vdso_i686.S head/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S head/sys/contrib/cloudabi/syscalls32.master head/sys/contrib/cloudabi/syscalls64.master head/usr.bin/truss/syscalls.c Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 26 06:57:15 2017 (r321514) @@ -111,8 +111,6 @@ cloudabi_sys_fd_create1(struct thread *td, return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps)); case CLOUDABI_FILETYPE_SOCKET_DGRAM: return (kern_socket(td, AF_UNIX, SOCK_DGRAM, 0)); - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: - return (kern_socket(td, AF_UNIX, SOCK_SEQPACKET, 0)); case CLOUDABI_FILETYPE_SOCKET_STREAM: return (kern_socket(td, AF_UNIX, SOCK_STREAM, 0)); default: @@ -145,9 +143,6 @@ cloudabi_sys_fd_create2(struct thread *td, case CLOUDABI_FILETYPE_SOCKET_DGRAM: error = kern_socketpair(td, AF_UNIX, SOCK_DGRAM, 0, fds); break; - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: - error = kern_socketpair(td, AF_UNIX, SOCK_SEQPACKET, 0, fds); - break; case CLOUDABI_FILETYPE_SOCKET_STREAM: error = kern_socketpair(td, AF_UNIX, SOCK_STREAM, 0, fds); break; @@ -245,8 +240,6 @@ cloudabi_convert_filetype(const struct file *fp) switch (so->so_type) { case SOCK_DGRAM: return (CLOUDABI_FILETYPE_SOCKET_DGRAM); - case SOCK_SEQPACKET: - return (CLOUDABI_FILETYPE_SOCKET_SEQPACKET); case SOCK_STREAM: return (CLOUDABI_FILETYPE_SOCKET_STREAM); default: @@ -400,7 +393,6 @@ cloudabi_remove_conflicting_rights(cloudabi_filetype_t *inheriting = 0; break; case CLOUDABI_FILETYPE_SOCKET_DGRAM: - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: case CLOUDABI_FILETYPE_SOCKET_STREAM: *base &= CLOUDABI_RIGHT_FD_READ | CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | Modified: head/sys/compat/cloudabi/cloudabi_mem.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_mem.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi/cloudabi_mem.c Wed Jul 26 06:57:15 2017 (r321514) @@ -90,14 +90,6 @@ cloudabi_sys_mem_advise(struct thread *td, } int -cloudabi_sys_mem_lock(struct thread *td, struct cloudabi_sys_mem_lock_args *uap) -{ - - return (kern_mlock(td->td_proc, td->td_ucred, - __DECONST(uintptr_t, uap->mapping), uap->mapping_len)); -} - -int cloudabi_sys_mem_map(struct thread *td, struct cloudabi_sys_mem_map_args *uap) { int error, flags, prot; @@ -158,15 +150,6 @@ cloudabi_sys_mem_sync(struct thread *td, struct clouda return (kern_msync(td, (uintptr_t)uap->mapping, uap->mapping_len, flags)); -} - -int -cloudabi_sys_mem_unlock(struct thread *td, - struct cloudabi_sys_mem_unlock_args *uap) -{ - - return (kern_munlock(td, __DECONST(uintptr_t, uap->mapping), - uap->mapping_len)); } int Modified: head/sys/compat/cloudabi/cloudabi_sock.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_sock.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi/cloudabi_sock.c Wed Jul 26 06:57:15 2017 (r321514) @@ -49,43 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* Converts FreeBSD's struct sockaddr to CloudABI's cloudabi_sockaddr_t. */ -static void -cloudabi_convert_sockaddr(const struct sockaddr *sa, socklen_t sal, - cloudabi_sockaddr_t *rsa) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - /* Zero-sized socket address. */ - if (sal < offsetof(struct sockaddr, sa_family) + sizeof(sa->sa_family)) - return; - - switch (sa->sa_family) { - case AF_INET: - if (sal < sizeof(struct sockaddr_in)) - return; - sin = (const struct sockaddr_in *)sa; - rsa->sa_family = CLOUDABI_AF_INET; - memcpy(&rsa->sa_inet.addr, &sin->sin_addr, - sizeof(rsa->sa_inet.addr)); - rsa->sa_inet.port = ntohs(sin->sin_port); - return; - case AF_INET6: - if (sal < sizeof(struct sockaddr_in6)) - return; - sin6 = (const struct sockaddr_in6 *)sa; - rsa->sa_family = CLOUDABI_AF_INET6; - memcpy(&rsa->sa_inet6.addr, &sin6->sin6_addr, - sizeof(rsa->sa_inet6.addr)); - rsa->sa_inet6.port = ntohs(sin6->sin6_port); - return; - case AF_UNIX: - rsa->sa_family = CLOUDABI_AF_UNIX; - return; - } -} - /* Copies a pathname into a UNIX socket address structure. */ static int copyin_sockaddr_un(const char *path, size_t pathlen, struct sockaddr_un *sun) @@ -112,27 +75,8 @@ int cloudabi_sys_sock_accept(struct thread *td, struct cloudabi_sys_sock_accept_args *uap) { - struct sockaddr *sa; - cloudabi_sockstat_t ss = {}; - socklen_t sal; - int error; - if (uap->buf == NULL) { - /* Only return the new file descriptor number. */ - return (kern_accept(td, uap->sock, NULL, NULL, NULL)); - } else { - /* Also return properties of the new socket descriptor. */ - sal = MAX(sizeof(struct sockaddr_in), - sizeof(struct sockaddr_in6)); - error = kern_accept(td, uap->sock, (void *)&sa, &sal, NULL); - if (error != 0) - return (error); - - /* TODO(ed): Fill the other members of cloudabi_sockstat_t. */ - cloudabi_convert_sockaddr(sa, sal, &ss.ss_peername); - free(sa, M_SONAME); - return (copyout(&ss, uap->buf, sizeof(ss))); - } + return (kern_accept(td, uap->sock, NULL, NULL, NULL)); } int @@ -200,7 +144,6 @@ cloudabi_sys_sock_stat_get(struct thread *td, cloudabi_sockstat_t ss = {}; cap_rights_t rights; struct file *fp; - struct sockaddr *sa; struct socket *so; int error; @@ -210,27 +153,6 @@ cloudabi_sys_sock_stat_get(struct thread *td, return (error); so = fp->f_data; - CURVNET_SET(so->so_vnet); - - /* Set ss_sockname. */ - error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - if (error == 0) { - cloudabi_convert_sockaddr(sa, sa->sa_len, &ss.ss_sockname); - free(sa, M_SONAME); - } - - /* Set ss_peername. */ - if ((so->so_state & (SS_ISCONNECTED | SS_ISCONFIRMING)) != 0) { - error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa); - if (error == 0) { - cloudabi_convert_sockaddr(sa, sa->sa_len, - &ss.ss_peername); - free(sa, M_SONAME); - } - } - - CURVNET_RESTORE(); - /* Set ss_error. */ SOCK_LOCK(so); ss.ss_error = cloudabi_convert_errno(so->so_error); @@ -249,8 +171,8 @@ cloudabi_sys_sock_stat_get(struct thread *td, int cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, size_t datalen, cloudabi_fd_t *fds, size_t fdslen, - cloudabi_msgflags_t flags, size_t *rdatalen, size_t *rfdslen, - cloudabi_sockaddr_t *peername, cloudabi_msgflags_t *rflags) + cloudabi_riflags_t flags, size_t *rdatalen, size_t *rfdslen, + cloudabi_roflags_t *rflags) { struct sockaddr_storage ss; struct msghdr hdr = { @@ -263,9 +185,9 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd int error; /* Convert flags. */ - if (flags & CLOUDABI_MSG_PEEK) + if (flags & CLOUDABI_SOCK_RECV_PEEK) hdr.msg_flags |= MSG_PEEK; - if (flags & CLOUDABI_MSG_WAITALL) + if (flags & CLOUDABI_SOCK_RECV_WAITALL) hdr.msg_flags |= MSG_WAITALL; control = NULL; @@ -278,13 +200,9 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd *rdatalen = td->td_retval[0]; td->td_retval[0] = 0; *rfdslen = 0; - cloudabi_convert_sockaddr((struct sockaddr *)&ss, - MIN(hdr.msg_namelen, sizeof(ss)), peername); *rflags = 0; - if (hdr.msg_flags & MSG_EOR) - *rflags |= CLOUDABI_MSG_EOR; if (hdr.msg_flags & MSG_TRUNC) - *rflags |= CLOUDABI_MSG_TRUNC; + *rflags |= CLOUDABI_SOCK_RECV_DATA_TRUNCATED; /* Extract file descriptors from SCM_RIGHTS messages. */ if (control != NULL) { @@ -303,7 +221,8 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd if (nfds > fdslen) { /* Unable to store file descriptors. */ nfds = fdslen; - *rflags |= CLOUDABI_MSG_CTRUNC; + *rflags |= + CLOUDABI_SOCK_RECV_FDS_TRUNCATED; } error = copyout(CMSG_DATA(chdr), fds, nfds * sizeof(int)); @@ -323,21 +242,15 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd int cloudabi_sock_send(struct thread *td, cloudabi_fd_t fd, struct iovec *data, - size_t datalen, const cloudabi_fd_t *fds, size_t fdslen, - cloudabi_msgflags_t flags, size_t *rdatalen) + size_t datalen, const cloudabi_fd_t *fds, size_t fdslen, size_t *rdatalen) { struct msghdr hdr = { .msg_iov = data, .msg_iovlen = datalen, }; struct mbuf *control; - int error, mflags; + int error; - /* Convert flags. */ - mflags = MSG_NOSIGNAL; - if (flags & CLOUDABI_MSG_EOR) - mflags |= MSG_EOR; - /* Convert file descriptor array to an SCM_RIGHTS message. */ if (fdslen > MCLBYTES || CMSG_SPACE(fdslen * sizeof(int)) > MCLBYTES) { return (EINVAL); @@ -361,7 +274,7 @@ cloudabi_sock_send(struct thread *td, cloudabi_fd_t fd control = NULL; } - error = kern_sendit(td, fd, &hdr, mflags, control, UIO_USERSPACE); + error = kern_sendit(td, fd, &hdr, MSG_NOSIGNAL, control, UIO_USERSPACE); if (error != 0) return (error); *rdatalen = td->td_retval[0]; Modified: head/sys/compat/cloudabi/cloudabi_util.h ============================================================================== --- head/sys/compat/cloudabi/cloudabi_util.h Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi/cloudabi_util.h Wed Jul 26 06:57:15 2017 (r321514) @@ -75,10 +75,10 @@ int cloudabi_futex_lock_wrlock(struct thread *, clouda /* Socket operations. */ int cloudabi_sock_recv(struct thread *, cloudabi_fd_t, struct iovec *, size_t, - cloudabi_fd_t *, size_t, cloudabi_msgflags_t, size_t *, size_t *, - cloudabi_sockaddr_t *, cloudabi_msgflags_t *); + cloudabi_fd_t *, size_t, cloudabi_riflags_t, size_t *, size_t *, + cloudabi_roflags_t *); int cloudabi_sock_send(struct thread *, cloudabi_fd_t, struct iovec *, size_t, - const cloudabi_fd_t *, size_t, cloudabi_msgflags_t, size_t *); + const cloudabi_fd_t *, size_t, size_t *); /* vDSO setup and teardown. */ void cloudabi_vdso_init(struct sysentvec *, char *, char *); Modified: head/sys/compat/cloudabi32/cloudabi32_proto.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_proto.h Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_proto.h Wed Jul 26 06:57:15 2017 (r321514) @@ -200,10 +200,6 @@ struct cloudabi_sys_mem_advise_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; }; -struct cloudabi_sys_mem_lock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_map_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; @@ -222,10 +218,6 @@ struct cloudabi_sys_mem_sync_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char flags_l_[PADL_(cloudabi_msflags_t)]; cloudabi_msflags_t flags; char flags_r_[PADR_(cloudabi_msflags_t)]; }; -struct cloudabi_sys_mem_unlock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_unmap_args { char mapping_l_[PADL_(void *)]; void * mapping; char mapping_r_[PADR_(void *)]; char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; @@ -265,7 +257,7 @@ struct cloudabi_sys_random_get_args { }; struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; + char unused_l_[PADL_(void *)]; void * unused; char unused_r_[PADR_(void *)]; }; struct cloudabi_sys_sock_bind_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; @@ -345,11 +337,9 @@ int cloudabi_sys_file_symlink(struct thread *, struct int cloudabi_sys_file_unlink(struct thread *, struct cloudabi_sys_file_unlink_args *); int cloudabi_sys_lock_unlock(struct thread *, struct cloudabi_sys_lock_unlock_args *); int cloudabi_sys_mem_advise(struct thread *, struct cloudabi_sys_mem_advise_args *); -int cloudabi_sys_mem_lock(struct thread *, struct cloudabi_sys_mem_lock_args *); int cloudabi_sys_mem_map(struct thread *, struct cloudabi_sys_mem_map_args *); int cloudabi_sys_mem_protect(struct thread *, struct cloudabi_sys_mem_protect_args *); int cloudabi_sys_mem_sync(struct thread *, struct cloudabi_sys_mem_sync_args *); -int cloudabi_sys_mem_unlock(struct thread *, struct cloudabi_sys_mem_unlock_args *); int cloudabi_sys_mem_unmap(struct thread *, struct cloudabi_sys_mem_unmap_args *); int cloudabi32_sys_poll(struct thread *, struct cloudabi32_sys_poll_args *); int cloudabi32_sys_poll_fd(struct thread *, struct cloudabi32_sys_poll_fd_args *); @@ -399,6 +389,12 @@ int cloudabi_sys_thread_yield(struct thread *, struct #endif /* COMPAT_FREEBSD10 */ + +#ifdef COMPAT_FREEBSD11 + + +#endif /* COMPAT_FREEBSD11 */ + #define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_res_get AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_time_get AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_condvar_signal AUE_NULL @@ -432,11 +428,9 @@ int cloudabi_sys_thread_yield(struct thread *, struct #define CLOUDABI32_SYS_AUE_cloudabi_sys_file_unlink AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_lock_unlock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_advise AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_lock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_map AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_protect AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_sync AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unlock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unmap AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll_fd AUE_NULL Modified: head/sys/compat/cloudabi32/cloudabi32_sock.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_sock.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_sock.c Wed Jul 26 06:57:15 2017 (r321514) @@ -75,7 +75,7 @@ cloudabi32_sys_sock_recv(struct thread *td, error = cloudabi_sock_recv(td, uap->sock, iov, ri.ri_data_len, TO_PTR(ri.ri_fds), ri.ri_fds_len, ri.ri_flags, &rdatalen, - &rfdslen, &ro.ro_peername, &ro.ro_flags); + &rfdslen, &ro.ro_flags); free(iov, M_SOCKET); if (error != 0) return (error); @@ -118,7 +118,7 @@ cloudabi32_sys_sock_send(struct thread *td, } error = cloudabi_sock_send(td, uap->sock, iov, si.si_data_len, - TO_PTR(si.si_fds), si.si_fds_len, si.si_flags, &datalen); + TO_PTR(si.si_fds), si.si_fds_len, &datalen); free(iov, M_SOCKET); if (error != 0) return (error); Modified: head/sys/compat/cloudabi32/cloudabi32_syscall.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_syscall.h Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_syscall.h Wed Jul 26 06:57:15 2017 (r321514) @@ -38,28 +38,26 @@ #define CLOUDABI32_SYS_cloudabi_sys_file_unlink 30 #define CLOUDABI32_SYS_cloudabi_sys_lock_unlock 31 #define CLOUDABI32_SYS_cloudabi_sys_mem_advise 32 -#define CLOUDABI32_SYS_cloudabi_sys_mem_lock 33 -#define CLOUDABI32_SYS_cloudabi_sys_mem_map 34 -#define CLOUDABI32_SYS_cloudabi_sys_mem_protect 35 -#define CLOUDABI32_SYS_cloudabi_sys_mem_sync 36 -#define CLOUDABI32_SYS_cloudabi_sys_mem_unlock 37 -#define CLOUDABI32_SYS_cloudabi_sys_mem_unmap 38 -#define CLOUDABI32_SYS_cloudabi32_sys_poll 39 -#define CLOUDABI32_SYS_cloudabi32_sys_poll_fd 40 -#define CLOUDABI32_SYS_cloudabi_sys_proc_exec 41 -#define CLOUDABI32_SYS_cloudabi_sys_proc_exit 42 -#define CLOUDABI32_SYS_cloudabi_sys_proc_fork 43 -#define CLOUDABI32_SYS_cloudabi_sys_proc_raise 44 -#define CLOUDABI32_SYS_cloudabi_sys_random_get 45 -#define CLOUDABI32_SYS_cloudabi_sys_sock_accept 46 -#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 47 -#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 48 -#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 49 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 50 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 51 -#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 52 -#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 53 -#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 54 -#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 55 -#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 56 -#define CLOUDABI32_SYS_MAXSYSCALL 57 +#define CLOUDABI32_SYS_cloudabi_sys_mem_map 33 +#define CLOUDABI32_SYS_cloudabi_sys_mem_protect 34 +#define CLOUDABI32_SYS_cloudabi_sys_mem_sync 35 +#define CLOUDABI32_SYS_cloudabi_sys_mem_unmap 36 +#define CLOUDABI32_SYS_cloudabi32_sys_poll 37 +#define CLOUDABI32_SYS_cloudabi32_sys_poll_fd 38 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exec 39 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exit 40 +#define CLOUDABI32_SYS_cloudabi_sys_proc_fork 41 +#define CLOUDABI32_SYS_cloudabi_sys_proc_raise 42 +#define CLOUDABI32_SYS_cloudabi_sys_random_get 43 +#define CLOUDABI32_SYS_cloudabi_sys_sock_accept 44 +#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 45 +#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 46 +#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 47 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 48 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 49 +#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 50 +#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 51 +#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 52 +#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 53 +#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 54 +#define CLOUDABI32_SYS_MAXSYSCALL 55 Modified: head/sys/compat/cloudabi32/cloudabi32_syscalls.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_syscalls.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_syscalls.c Wed Jul 26 06:57:15 2017 (r321514) @@ -39,28 +39,26 @@ const char *cloudabi32_syscallnames[] = { "cloudabi_sys_file_unlink", /* 30 = cloudabi_sys_file_unlink */ "cloudabi_sys_lock_unlock", /* 31 = cloudabi_sys_lock_unlock */ "cloudabi_sys_mem_advise", /* 32 = cloudabi_sys_mem_advise */ - "cloudabi_sys_mem_lock", /* 33 = cloudabi_sys_mem_lock */ - "cloudabi_sys_mem_map", /* 34 = cloudabi_sys_mem_map */ - "cloudabi_sys_mem_protect", /* 35 = cloudabi_sys_mem_protect */ - "cloudabi_sys_mem_sync", /* 36 = cloudabi_sys_mem_sync */ - "cloudabi_sys_mem_unlock", /* 37 = cloudabi_sys_mem_unlock */ - "cloudabi_sys_mem_unmap", /* 38 = cloudabi_sys_mem_unmap */ - "cloudabi32_sys_poll", /* 39 = cloudabi32_sys_poll */ - "cloudabi32_sys_poll_fd", /* 40 = cloudabi32_sys_poll_fd */ - "cloudabi_sys_proc_exec", /* 41 = cloudabi_sys_proc_exec */ - "cloudabi_sys_proc_exit", /* 42 = cloudabi_sys_proc_exit */ - "cloudabi_sys_proc_fork", /* 43 = cloudabi_sys_proc_fork */ - "cloudabi_sys_proc_raise", /* 44 = cloudabi_sys_proc_raise */ - "cloudabi_sys_random_get", /* 45 = cloudabi_sys_random_get */ - "cloudabi_sys_sock_accept", /* 46 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 47 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 48 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 49 = cloudabi_sys_sock_listen */ - "cloudabi32_sys_sock_recv", /* 50 = cloudabi32_sys_sock_recv */ - "cloudabi32_sys_sock_send", /* 51 = cloudabi32_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 52 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 53 = cloudabi_sys_sock_stat_get */ - "cloudabi32_sys_thread_create", /* 54 = cloudabi32_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 55 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_yield", /* 56 = cloudabi_sys_thread_yield */ + "cloudabi_sys_mem_map", /* 33 = cloudabi_sys_mem_map */ + "cloudabi_sys_mem_protect", /* 34 = cloudabi_sys_mem_protect */ + "cloudabi_sys_mem_sync", /* 35 = cloudabi_sys_mem_sync */ + "cloudabi_sys_mem_unmap", /* 36 = cloudabi_sys_mem_unmap */ + "cloudabi32_sys_poll", /* 37 = cloudabi32_sys_poll */ + "cloudabi32_sys_poll_fd", /* 38 = cloudabi32_sys_poll_fd */ + "cloudabi_sys_proc_exec", /* 39 = cloudabi_sys_proc_exec */ + "cloudabi_sys_proc_exit", /* 40 = cloudabi_sys_proc_exit */ + "cloudabi_sys_proc_fork", /* 41 = cloudabi_sys_proc_fork */ + "cloudabi_sys_proc_raise", /* 42 = cloudabi_sys_proc_raise */ + "cloudabi_sys_random_get", /* 43 = cloudabi_sys_random_get */ + "cloudabi_sys_sock_accept", /* 44 = cloudabi_sys_sock_accept */ + "cloudabi_sys_sock_bind", /* 45 = cloudabi_sys_sock_bind */ + "cloudabi_sys_sock_connect", /* 46 = cloudabi_sys_sock_connect */ + "cloudabi_sys_sock_listen", /* 47 = cloudabi_sys_sock_listen */ + "cloudabi32_sys_sock_recv", /* 48 = cloudabi32_sys_sock_recv */ + "cloudabi32_sys_sock_send", /* 49 = cloudabi32_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 50 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 51 = cloudabi_sys_sock_stat_get */ + "cloudabi32_sys_thread_create", /* 52 = cloudabi32_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 53 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 54 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi32/cloudabi32_sysent.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_sysent.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_sysent.c Wed Jul 26 06:57:15 2017 (r321514) @@ -47,28 +47,26 @@ struct sysent cloudabi32_sysent[] = { { AS(cloudabi_sys_file_unlink_args), (sy_call_t *)cloudabi_sys_file_unlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 30 = cloudabi_sys_file_unlink */ { AS(cloudabi_sys_lock_unlock_args), (sy_call_t *)cloudabi_sys_lock_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 31 = cloudabi_sys_lock_unlock */ { AS(cloudabi_sys_mem_advise_args), (sy_call_t *)cloudabi_sys_mem_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 32 = cloudabi_sys_mem_advise */ - { AS(cloudabi_sys_mem_lock_args), (sy_call_t *)cloudabi_sys_mem_lock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_lock */ - { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_map */ - { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_protect */ - { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_sync */ - { AS(cloudabi_sys_mem_unlock_args), (sy_call_t *)cloudabi_sys_mem_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi_sys_mem_unlock */ - { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi_sys_mem_unmap */ - { AS(cloudabi32_sys_poll_args), (sy_call_t *)cloudabi32_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi32_sys_poll */ - { AS(cloudabi32_sys_poll_fd_args), (sy_call_t *)cloudabi32_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi32_sys_poll_fd */ - { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_exec */ - { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_exit */ - { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_proc_fork */ - { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_proc_raise */ - { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_random_get */ - { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi_sys_sock_listen */ - { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi32_sys_sock_recv */ - { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi32_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi32_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 55 = cloudabi_sys_thread_exit */ - { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 56 = cloudabi_sys_thread_yield */ + { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_map */ + { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_protect */ + { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_sync */ + { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_unmap */ + { AS(cloudabi32_sys_poll_args), (sy_call_t *)cloudabi32_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi32_sys_poll */ + { AS(cloudabi32_sys_poll_fd_args), (sy_call_t *)cloudabi32_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi32_sys_poll_fd */ + { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi_sys_proc_exec */ + { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi_sys_proc_exit */ + { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_fork */ + { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_raise */ + { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_random_get */ + { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_sock_accept */ + { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_bind */ + { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_connect */ + { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_listen */ + { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi32_sys_sock_recv */ + { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi32_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi32_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_thread_exit */ + { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi32/cloudabi32_systrace_args.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_systrace_args.c Wed Jul 26 06:52:45 2017 (r321513) +++ head/sys/compat/cloudabi32/cloudabi32_systrace_args.c Wed Jul 26 06:57:15 2017 (r321514) @@ -310,16 +310,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* cloudabi_sys_mem_lock */ - case 33: { - struct cloudabi_sys_mem_lock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_map */ - case 34: { + case 33: { struct cloudabi_sys_mem_map_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ @@ -331,7 +323,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_mem_protect */ - case 35: { + case 34: { struct cloudabi_sys_mem_protect_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -340,7 +332,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_mem_sync */ - case 36: { + case 35: { struct cloudabi_sys_mem_sync_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -348,16 +340,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* cloudabi_sys_mem_unlock */ - case 37: { - struct cloudabi_sys_mem_unlock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_unmap */ - case 38: { + case 36: { struct cloudabi_sys_mem_unmap_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -365,7 +349,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_poll */ - case 39: { + case 37: { struct cloudabi32_sys_poll_args *p = params; uarg[0] = (intptr_t) p->in; /* const cloudabi32_subscription_t * */ uarg[1] = (intptr_t) p->out; /* cloudabi32_event_t * */ @@ -374,7 +358,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_poll_fd */ - case 40: { + case 38: { struct cloudabi32_sys_poll_fd_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_subscription_t * */ @@ -386,7 +370,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_proc_exec */ - case 41: { + case 39: { struct cloudabi_sys_proc_exec_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->data; /* const void * */ @@ -397,26 +381,26 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_proc_exit */ - case 42: { + case 40: { struct cloudabi_sys_proc_exit_args *p = params; iarg[0] = p->rval; /* cloudabi_exitcode_t */ *n_args = 1; break; } /* cloudabi_sys_proc_fork */ - case 43: { + case 41: { *n_args = 0; break; } /* cloudabi_sys_proc_raise */ - case 44: { + case 42: { struct cloudabi_sys_proc_raise_args *p = params; iarg[0] = p->sig; /* cloudabi_signal_t */ *n_args = 1; break; } /* cloudabi_sys_random_get */ - case 45: { + case 43: { struct cloudabi_sys_random_get_args *p = params; uarg[0] = (intptr_t) p->buf; /* void * */ uarg[1] = p->buf_len; /* size_t */ @@ -424,15 +408,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_accept */ - case 46: { + case 44: { struct cloudabi_sys_sock_accept_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ - uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ + uarg[1] = (intptr_t) p->unused; /* void * */ *n_args = 2; break; } /* cloudabi_sys_sock_bind */ - case 47: { + case 45: { struct cloudabi_sys_sock_bind_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -442,7 +426,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_connect */ - case 48: { + case 46: { struct cloudabi_sys_sock_connect_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -452,7 +436,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_listen */ - case 49: { + case 47: { struct cloudabi_sys_sock_listen_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->backlog; /* cloudabi_backlog_t */ @@ -460,7 +444,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_sock_recv */ - case 50: { + case 48: { struct cloudabi32_sys_sock_recv_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_recv_in_t * */ @@ -469,7 +453,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_sock_send */ - case 51: { + case 49: { struct cloudabi32_sys_sock_send_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_send_in_t * */ @@ -478,7 +462,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_shutdown */ - case 52: { + case 50: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ @@ -486,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_stat_get */ - case 53: { + case 51: { struct cloudabi_sys_sock_stat_get_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ @@ -495,14 +479,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_thread_create */ - case 54: { + case 52: { struct cloudabi32_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi32_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 55: { + case 53: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ @@ -510,7 +494,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_thread_yield */ - case 56: { + case 54: { *n_args = 0; break; } @@ -1058,23 +1042,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* cloudabi_sys_mem_lock */ + /* cloudabi_sys_mem_map */ case 33: switch(ndx) { case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; - /* cloudabi_sys_mem_map */ - case 34: - switch(ndx) { - case 0: p = "userland void *"; break; case 1: @@ -1097,7 +1068,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_mem_protect */ - case 35: + case 34: switch(ndx) { case 0: p = "userland void *"; @@ -1113,7 +1084,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_mem_sync */ - case 36: + case 35: switch(ndx) { case 0: p = "userland void *"; @@ -1128,21 +1099,8 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* cloudabi_sys_mem_unlock */ - case 37: - switch(ndx) { - case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; /* cloudabi_sys_mem_unmap */ - case 38: + case 36: switch(ndx) { case 0: p = "userland void *"; @@ -1155,7 +1113,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_poll */ - case 39: + case 37: switch(ndx) { case 0: p = "userland const cloudabi32_subscription_t *"; @@ -1171,7 +1129,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_poll_fd */ - case 40: + case 38: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1196,7 +1154,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_proc_exec */ - case 41: + case 39: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1218,7 +1176,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_proc_exit */ - case 42: + case 40: switch(ndx) { case 0: p = "cloudabi_exitcode_t"; @@ -1228,10 +1186,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_proc_fork */ - case 43: + case 41: break; /* cloudabi_sys_proc_raise */ - case 44: + case 42: switch(ndx) { case 0: p = "cloudabi_signal_t"; @@ -1241,7 +1199,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_random_get */ - case 45: + case 43: switch(ndx) { case 0: p = "userland void *"; @@ -1254,20 +1212,20 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_accept */ - case 46: + case 44: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: - p = "userland cloudabi_sockstat_t *"; + p = "userland void *"; break; default: break; }; break; /* cloudabi_sys_sock_bind */ - case 47: + case 45: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1286,7 +1244,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_connect */ - case 48: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1305,7 +1263,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_listen */ - case 49: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1318,7 +1276,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_sock_recv */ - case 50: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1334,7 +1292,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_sock_send */ - case 51: + case 49: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1350,7 +1308,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_shutdown */ - case 52: + case 50: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1363,7 +1321,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_stat_get */ - case 53: + case 51: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1379,7 +1337,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_thread_create */ - case 54: + case 52: switch(ndx) { case 0: p = "userland cloudabi32_threadattr_t *"; @@ -1389,7 +1347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_exit */ - case 55: + case 53: switch(ndx) { case 0: p = "userland cloudabi_lock_t *"; @@ -1402,7 +1360,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_yield */ - case 56: + case 54: break; default: break; @@ -1580,120 +1538,110 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_lock */ + /* cloudabi_sys_mem_map */ case 33: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_map */ + /* cloudabi_sys_mem_protect */ case 34: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_protect */ + /* cloudabi_sys_mem_sync */ case 35: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_sync */ + /* cloudabi_sys_mem_unmap */ case 36: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_unlock */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 07:00:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 145E5DB311F; Wed, 26 Jul 2017 07:00:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5C797C157; Wed, 26 Jul 2017 07:00:28 +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 v6Q70SZE030942; Wed, 26 Jul 2017 07:00:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q70RnG030940; Wed, 26 Jul 2017 07:00:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707260700.v6Q70RnG030940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jul 2017 07:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321515 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 321515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 07:00:29 -0000 Author: kib Date: Wed Jul 26 07:00:27 2017 New Revision: 321515 URL: https://svnweb.freebsd.org/changeset/base/321515 Log: MFC r321217: Remove unused function swap_pager_isswapped(). Modified: stable/11/sys/vm/swap_pager.c stable/11/sys/vm/swap_pager.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Wed Jul 26 06:57:15 2017 (r321514) +++ stable/11/sys/vm/swap_pager.c Wed Jul 26 07:00:27 2017 (r321515) @@ -1585,43 +1585,6 @@ swp_pager_async_iodone(struct buf *bp) } /* - * swap_pager_isswapped: - * - * Return 1 if at least one page in the given object is paged - * out to the given swap device. - * - * This routine may not sleep. - */ -int -swap_pager_isswapped(vm_object_t object, struct swdevt *sp) -{ - daddr_t index = 0; - int bcount; - int i; - - VM_OBJECT_ASSERT_WLOCKED(object); - if (object->type != OBJT_SWAP) - return (0); - - mtx_lock(&swhash_mtx); - for (bcount = 0; bcount < object->un_pager.swp.swp_bcount; bcount++) { - struct swblock *swap; - - if ((swap = *swp_pager_hash(object, index)) != NULL) { - for (i = 0; i < SWAP_META_PAGES; ++i) { - if (swp_pager_isondev(swap->swb_pages[i], sp)) { - mtx_unlock(&swhash_mtx); - return (1); - } - } - } - index += SWAP_META_PAGES; - } - mtx_unlock(&swhash_mtx); - return (0); -} - -/* * SWP_PAGER_FORCE_PAGEIN() - force a swap block to be paged in * * This routine dissociates the page at the given index within an object Modified: stable/11/sys/vm/swap_pager.h ============================================================================== --- stable/11/sys/vm/swap_pager.h Wed Jul 26 06:57:15 2017 (r321514) +++ stable/11/sys/vm/swap_pager.h Wed Jul 26 07:00:27 2017 (r321515) @@ -82,7 +82,6 @@ void swap_pager_copy(vm_object_t, vm_object_t, vm_pind vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); -int swap_pager_isswapped(vm_object_t, struct swdevt *); int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_status(int *total, int *used); void swapoff_all(void); From owner-svn-src-all@freebsd.org Wed Jul 26 11:03:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 405B1DB7701; Wed, 26 Jul 2017 11:03:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F11183101; Wed, 26 Jul 2017 11:03:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QB3E1t033158; Wed, 26 Jul 2017 11:03:14 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QB3EId033156; Wed, 26 Jul 2017 11:03:14 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201707261103.v6QB3EId033156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 26 Jul 2017 11:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321516 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/10/sys/dev/bxe X-SVN-Commit-Revision: 321516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 11:03:15 -0000 Author: ae Date: Wed Jul 26 11:03:13 2017 New Revision: 321516 URL: https://svnweb.freebsd.org/changeset/base/321516 Log: MFC r321203: Add HPE FlexFabric 10Gb 4-port 536FLR-T device id to the bxe(4) driver. Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/bxe.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Wed Jul 26 07:00:27 2017 (r321515) +++ stable/10/sys/dev/bxe/bxe.c Wed Jul 26 11:03:13 2017 (r321516) @@ -167,6 +167,12 @@ static struct bxe_device_type bxe_devs[] = { "QLogic NetXtreme II BCM57840 4x10GbE" }, { + QLOGIC_VENDORID, + CHIP_NUM_57840_4_10, + PCI_ANY_ID, PCI_ANY_ID, + "QLogic NetXtreme II BCM57840 4x10GbE" + }, + { BRCM_VENDORID, CHIP_NUM_57840_MF, PCI_ANY_ID, PCI_ANY_ID, Modified: stable/10/sys/dev/bxe/bxe.h ============================================================================== --- stable/10/sys/dev/bxe/bxe.h Wed Jul 26 07:00:27 2017 (r321515) +++ stable/10/sys/dev/bxe/bxe.h Wed Jul 26 11:03:13 2017 (r321516) @@ -168,6 +168,7 @@ int bxe_ilog2(int x) #include "ecore_sp.h" #define BRCM_VENDORID 0x14e4 +#define QLOGIC_VENDORID 0x1077 #define PCI_ANY_ID (uint16_t)(~0U) struct bxe_device_type From owner-svn-src-all@freebsd.org Wed Jul 26 11:04:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB895DB777D; Wed, 26 Jul 2017 11:04:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A9758325D; Wed, 26 Jul 2017 11:04:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QB4Ume033253; Wed, 26 Jul 2017 11:04:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QB4UVL033251; Wed, 26 Jul 2017 11:04:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201707261104.v6QB4UVL033251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 26 Jul 2017 11:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321517 - stable/11/sys/dev/bxe X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/dev/bxe X-SVN-Commit-Revision: 321517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 11:04:31 -0000 Author: ae Date: Wed Jul 26 11:04:30 2017 New Revision: 321517 URL: https://svnweb.freebsd.org/changeset/base/321517 Log: MFC r321203: Add HPE FlexFabric 10Gb 4-port 536FLR-T device id to the bxe(4) driver. Modified: stable/11/sys/dev/bxe/bxe.c stable/11/sys/dev/bxe/bxe.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bxe/bxe.c ============================================================================== --- stable/11/sys/dev/bxe/bxe.c Wed Jul 26 11:03:13 2017 (r321516) +++ stable/11/sys/dev/bxe/bxe.c Wed Jul 26 11:04:30 2017 (r321517) @@ -167,6 +167,12 @@ static struct bxe_device_type bxe_devs[] = { "QLogic NetXtreme II BCM57840 4x10GbE" }, { + QLOGIC_VENDORID, + CHIP_NUM_57840_4_10, + PCI_ANY_ID, PCI_ANY_ID, + "QLogic NetXtreme II BCM57840 4x10GbE" + }, + { BRCM_VENDORID, CHIP_NUM_57840_2_20, PCI_ANY_ID, PCI_ANY_ID, Modified: stable/11/sys/dev/bxe/bxe.h ============================================================================== --- stable/11/sys/dev/bxe/bxe.h Wed Jul 26 11:03:13 2017 (r321516) +++ stable/11/sys/dev/bxe/bxe.h Wed Jul 26 11:04:30 2017 (r321517) @@ -168,6 +168,7 @@ int bxe_ilog2(int x) #include "ecore_sp.h" #define BRCM_VENDORID 0x14e4 +#define QLOGIC_VENDORID 0x1077 #define PCI_ANY_ID (uint16_t)(~0U) struct bxe_device_type From owner-svn-src-all@freebsd.org Wed Jul 26 12:07:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FB30DBCF3F; Wed, 26 Jul 2017 12:07:47 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44AFFF77; Wed, 26 Jul 2017 12:07:47 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QC7kEr057834; Wed, 26 Jul 2017 12:07:46 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QC7kgO057833; Wed, 26 Jul 2017 12:07:46 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201707261207.v6QC7kgO057833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 26 Jul 2017 12:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321518 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Commit-Revision: 321518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 12:07:47 -0000 Author: lwhsu (ports committer) Date: Wed Jul 26 12:07:46 2017 New Revision: 321518 URL: https://svnweb.freebsd.org/changeset/base/321518 Log: Add an auxiliary subroutine to generate some events for testing This test is also timeout on a quiet system because there is nobody triggering read probefunc while test execution. Reviewed by: gnn, markj, ngie Differential Revision: https://reviews.freebsd.org/D11731 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Wed Jul 26 11:04:30 2017 (r321517) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Wed Jul 26 12:07:46 2017 (r321518) @@ -39,6 +39,15 @@ ## +reader() +{ + while true + do + sleep 0.1 + cat /etc/motd > /dev/null + done +} + if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 @@ -46,6 +55,9 @@ fi dtrace=$1 +reader & +child=$! + $dtrace -qZf wassup'{printf("Iamkool");}' \ -qf read'{printf("I am done"); exit(0);}' @@ -54,5 +66,7 @@ status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi + +kill $child exit $status From owner-svn-src-all@freebsd.org Wed Jul 26 14:55:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C78FDBFCF7; Wed, 26 Jul 2017 14:55:49 +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 078DC656B1; Wed, 26 Jul 2017 14:55:48 +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 v6QEtmgW030580; Wed, 26 Jul 2017 14:55:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QEtlq6030576; Wed, 26 Jul 2017 14:55:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261455.v6QEtlq6030576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 14:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321519 - in stable/11/sys: boot/zfs cddl/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: boot/zfs cddl/boot/zfs X-SVN-Commit-Revision: 321519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 14:55:49 -0000 Author: mav Date: Wed Jul 26 14:55:47 2017 New Revision: 321519 URL: https://svnweb.freebsd.org/changeset/base/321519 Log: MFC r303630 (by allanjude): Make boot code and loader check for unsupported ZFS feature flags OpenZFS uses feature flags instead of a zpool version number to track features since the split from Oracle. In addition to avoiding confusion on ZFS vs OpenZFS version numbers, this also allows features to be added to different operating systems that use OpenZFS in different order. The previous zfs boot code (gptzfsboot) and loader (zfsloader) blindly tries to read the pool, and if failed provided only a vague error message. With this change, both the boot code and loader check the MOS features list in the ZFS label and compare it against the list of features that the loader supports. If any unsupported feature is active, the pool is not considered as a candidate for booting, and a helpful diagnostic message is printed to the screen. Features that are merely enabled via zpool upgrade, but not in use, do not block booting from the pool. Submitted by: Toomas Soome Reviewed by: delphij, mav Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6857 Modified: stable/11/sys/boot/zfs/libzfs.h stable/11/sys/boot/zfs/zfs.c stable/11/sys/boot/zfs/zfsimpl.c stable/11/sys/cddl/boot/zfs/zfsimpl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/libzfs.h ============================================================================== --- stable/11/sys/boot/zfs/libzfs.h Wed Jul 26 12:07:46 2017 (r321518) +++ stable/11/sys/boot/zfs/libzfs.h Wed Jul 26 14:55:47 2017 (r321519) @@ -65,7 +65,7 @@ int zfs_probe_dev(const char *devname, uint64_t *pool_ int zfs_list(const char *name); void init_zfs_bootenv(char *currdev); int zfs_bootenv(const char *name); -int zfs_belist_add(const char *name); +int zfs_belist_add(const char *name, uint64_t __unused); int zfs_set_env(void); extern struct devsw zfs_dev; Modified: stable/11/sys/boot/zfs/zfs.c ============================================================================== --- stable/11/sys/boot/zfs/zfs.c Wed Jul 26 12:07:46 2017 (r321518) +++ stable/11/sys/boot/zfs/zfs.c Wed Jul 26 14:55:47 2017 (r321519) @@ -801,7 +801,7 @@ zfs_bootenv(const char *name) } int -zfs_belist_add(const char *name) +zfs_belist_add(const char *name, uint64_t value __unused) { /* Skip special datasets that start with a $ character */ Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 12:07:46 2017 (r321518) +++ stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 14:55:47 2017 (r321519) @@ -1472,12 +1472,12 @@ zap_lookup(const spa_t *spa, const dnode_phys_t *dnode * the directory contents. */ static int -mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *)) +mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; size_t size; - int chunks, i; + int chunks, i, rc; /* * Microzap objects use exactly one block. Read the whole @@ -1489,9 +1489,11 @@ mzap_list(const dnode_phys_t *dnode, int (*callback)(c for (i = 0; i < chunks; i++) { mze = &mz->mz_chunk[i]; - if (mze->mze_name[0]) - //printf("%-32s 0x%jx\n", mze->mze_name, (uintmax_t)mze->mze_value); - callback(mze->mze_name); + if (mze->mze_name[0]) { + rc = callback(mze->mze_name, mze->mze_value); + if (rc != 0) + return (rc); + } } return (0); @@ -1502,12 +1504,12 @@ mzap_list(const dnode_phys_t *dnode, int (*callback)(c * the directory header. */ static int -fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *)) +fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; fat_zap_t z; - int i, j; + int i, j, rc; if (zh.zap_magic != ZAP_MAGIC) return (EIO); @@ -1565,14 +1567,16 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, value = fzap_leaf_value(&zl, zc); //printf("%s 0x%jx\n", name, (uintmax_t)value); - callback((const char *)name); + rc = callback((const char *)name, value); + if (rc != 0) + return (rc); } } return (0); } -static int zfs_printf(const char *name) +static int zfs_printf(const char *name, uint64_t value __unused) { printf("%s\n", name); @@ -1867,7 +1871,7 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, } int -zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *name)) +zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *, uint64_t)) { uint64_t dir_obj, child_dir_zapobj, zap_type; dnode_phys_t child_dir_zap, dir, dataset; @@ -2007,9 +2011,67 @@ zfs_mount(const spa_t *spa, uint64_t rootobj, struct z return (0); } +/* + * callback function for feature name checks. + */ static int +check_feature(const char *name, uint64_t value) +{ + int i; + + if (value == 0) + return (0); + if (name[0] == '\0') + return (0); + + for (i = 0; features_for_read[i] != NULL; i++) { + if (strcmp(name, features_for_read[i]) == 0) + return (0); + } + printf("ZFS: unsupported feature: %s\n", name); + return (EIO); +} + +/* + * Checks whether the MOS features that are active are supported. + */ +static int +check_mos_features(const spa_t *spa) +{ + dnode_phys_t dir; + uint64_t objnum, zap_type; + size_t size; + int rc; + + if ((rc = objset_get_dnode(spa, &spa->spa_mos, DMU_OT_OBJECT_DIRECTORY, + &dir)) != 0) + return (rc); + if ((rc = zap_lookup(spa, &dir, DMU_POOL_FEATURES_FOR_READ, &objnum)) != 0) + return (rc); + + if ((rc = objset_get_dnode(spa, &spa->spa_mos, objnum, &dir)) != 0) + return (rc); + + if (dir.dn_type != DMU_OTN_ZAP_METADATA) + return (EIO); + + size = dir.dn_datablkszsec * 512; + if (dnode_read(spa, &dir, 0, zap_scratch, size)) + return (EIO); + + zap_type = *(uint64_t *) zap_scratch; + if (zap_type == ZBT_MICRO) + rc = mzap_list(&dir, check_feature); + else + rc = fzap_list(spa, &dir, check_feature); + + return (rc); +} + +static int zfs_spa_init(spa_t *spa) { + int rc; if (zio_read(spa, &spa->spa_uberblock.ub_rootbp, &spa->spa_mos)) { printf("ZFS: can't read MOS of pool %s\n", spa->spa_name); @@ -2019,7 +2081,13 @@ zfs_spa_init(spa_t *spa) printf("ZFS: corrupted MOS of pool %s\n", spa->spa_name); return (EIO); } - return (0); + + rc = check_mos_features(spa); + if (rc != 0) { + printf("ZFS: pool %s is not supported\n", spa->spa_name); + } + + return (rc); } static int Modified: stable/11/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- stable/11/sys/cddl/boot/zfs/zfsimpl.h Wed Jul 26 12:07:46 2017 (r321518) +++ stable/11/sys/cddl/boot/zfs/zfsimpl.h Wed Jul 26 14:55:47 2017 (r321519) @@ -63,6 +63,8 @@ #define _NOTE(s) +typedef enum { B_FALSE, B_TRUE } boolean_t; + /* CRC64 table */ #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ @@ -899,6 +901,41 @@ typedef struct dnode_phys { blkptr_t dn_spill; } dnode_phys_t; +typedef enum dmu_object_byteswap { + DMU_BSWAP_UINT8, + DMU_BSWAP_UINT16, + DMU_BSWAP_UINT32, + DMU_BSWAP_UINT64, + DMU_BSWAP_ZAP, + DMU_BSWAP_DNODE, + DMU_BSWAP_OBJSET, + DMU_BSWAP_ZNODE, + DMU_BSWAP_OLDACL, + DMU_BSWAP_ACL, + /* + * Allocating a new byteswap type number makes the on-disk format + * incompatible with any other format that uses the same number. + * + * Data can usually be structured to work with one of the + * DMU_BSWAP_UINT* or DMU_BSWAP_ZAP types. + */ + DMU_BSWAP_NUMFUNCS +} dmu_object_byteswap_t; + +#define DMU_OT_NEWTYPE 0x80 +#define DMU_OT_METADATA 0x40 +#define DMU_OT_BYTESWAP_MASK 0x3f + +/* + * Defines a uint8_t object type. Object types specify if the data + * in the object is metadata (boolean) and how to byteswap the data + * (dmu_object_byteswap_t). + */ +#define DMU_OT(byteswap, metadata) \ + (DMU_OT_NEWTYPE | \ + ((metadata) ? DMU_OT_METADATA : 0) | \ + ((byteswap) & DMU_OT_BYTESWAP_MASK)) + typedef enum dmu_object_type { DMU_OT_NONE, /* general: */ @@ -959,7 +996,21 @@ typedef enum dmu_object_type { DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */ DMU_OT_SCAN_XLATE, /* ZAP */ DMU_OT_DEDUP, /* fake dedup BP from ddt_bp_create() */ - DMU_OT_NUMTYPES + DMU_OT_NUMTYPES, + + /* + * Names for valid types declared with DMU_OT(). + */ + DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE), + DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE), + DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE), + DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE), + DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE), + DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE), + DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE), + DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE), + DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE), + DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE) } dmu_object_type_t; typedef enum dmu_objset_type { @@ -1097,6 +1148,7 @@ typedef struct dsl_dataset_phys { */ #define DMU_POOL_DIRECTORY_OBJECT 1 #define DMU_POOL_CONFIG "config" +#define DMU_POOL_FEATURES_FOR_READ "features_for_read" #define DMU_POOL_ROOT_DATASET "root_dataset" #define DMU_POOL_SYNC_BPLIST "sync_bplist" #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" From owner-svn-src-all@freebsd.org Wed Jul 26 14:56:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2B47DBFD35; Wed, 26 Jul 2017 14:56:04 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E45665791; Wed, 26 Jul 2017 14:56:04 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QEu3EO030637; Wed, 26 Jul 2017 14:56:03 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QEu3TS030636; Wed, 26 Jul 2017 14:56:03 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707261456.v6QEu3TS030636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 26 Jul 2017 14:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321520 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 321520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 14:56:04 -0000 Author: gjb Date: Wed Jul 26 14:56:03 2017 New Revision: 321520 URL: https://svnweb.freebsd.org/changeset/base/321520 Log: Add a note regarding VirtualBox vboxguest panics during 11.1-RC2. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Wed Jul 26 14:55:47 2017 (r321519) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Wed Jul 26 14:56:03 2017 (r321520) @@ -151,6 +151,34 @@ boot There currently is no workaround. + + + [2017-07-26] Note for those upgrading from 11.1-RC2 in + VirtualBox: + + If system panics were experienced when upgrading from + 11.1-RC1 to 11.1-RC2, and the emulators/virtualbox-ose-additions{,-nox11} + port was built locally as a resolution, the port will either + need to be rebuilt when upgrading from 11.1-RC2 to + 11.1-RELEASE, or reinstall the package from the pkg(8) + mirrors using either: + + &prompt.root; pkg install -f virtualbox-ose-additions + + or + + &prompt.root; pkg install -f virtualbox-ose-additions-nox11 + + To ensure the system does not panic after rebooting into + the updated kernel, it is recommended to disable the + vboxguest service in &man.rc.conf.5; + prior to rebooting the system if possible, or use + &man.pkg.8; to forcefully reinstall the package. + + Systems being upgraded from 11.1-RC1 and earlier and + 11.1-RC3 to 11.1-RELEASE should be unaffected. + From owner-svn-src-all@freebsd.org Wed Jul 26 15:09:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 936B0DC0041; Wed, 26 Jul 2017 15:09:10 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-ua0-f178.google.com (mail-ua0-f178.google.com [209.85.217.178]) (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 5251865EA6; Wed, 26 Jul 2017 15:09:09 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-ua0-f178.google.com with SMTP id q25so100188698uah.1; Wed, 26 Jul 2017 08:09:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VjF/2004FgQZrqLKJJ7pgWJ7Pko0fKoazVGBiT91YAc=; b=ukCtHEc/s7Mc2Fk7YqEfhUDhBwdcHuoW6PeBjgmrvbubSER5ZjmGikxCPMep0hNtAq J9S/6YpsJEt6669zRH95Cv4N0WaY2ZMh8iPmFM+OgbL0fbDEhDOchamoqex5WwIt3tLw SITRCmmgUBMdexpgb0sgripboPb4XO1V9motMeOiFvd4B1aqc4lKtDsUIVBnAVqWeoec lkU17Cngsd9u9UOJiA+E/OdFb0haGlM9WPjw5qlBEDvtixXyLlFhRYd0J2VdEvB0eTBG 0EqgiZcoXrS8cMku8wMM2O58xdZy/xxGguxzkPlVLaulYfXhSnAgkQzJzpOqye2RIn0M Zd/g== X-Gm-Message-State: AIVw111RiAnHJBG8jVeECzJu/E88rts8sGEc6F3BEPEsxrxG6aMoerPZ rHxOgzZzgpRpDkmvOYIC3g== X-Received: by 10.176.79.155 with SMTP id m27mr730604uah.66.1501081742753; Wed, 26 Jul 2017 08:09:02 -0700 (PDT) Received: from mail-ua0-f182.google.com (mail-ua0-f182.google.com. [209.85.217.182]) by smtp.gmail.com with ESMTPSA id 71sm3763200vkh.56.2017.07.26.08.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 08:09:02 -0700 (PDT) Received: by mail-ua0-f182.google.com with SMTP id f9so119219125uaf.4; Wed, 26 Jul 2017 08:09:01 -0700 (PDT) X-Received: by 10.176.79.43 with SMTP id n43mr791361uah.101.1501081741519; Wed, 26 Jul 2017 08:09:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.32.75 with HTTP; Wed, 26 Jul 2017 08:09:00 -0700 (PDT) In-Reply-To: <201705191304.v4JD45Sn021851@repo.freebsd.org> References: <201705191304.v4JD45Sn021851@repo.freebsd.org> From: Michael Zhilin Date: Wed, 26 Jul 2017 18:09:00 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r318539 - head/lib/libthr/thread To: Eric van Gyzen , kib@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Michael Zhilin Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:09:10 -0000 Hi Eric, Konstantin, This commit breaks libthread_db a bit, particular change is: -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; In libthread_db there is check if _thread_keytable is found in symbols of debugged process: https://svnweb.freebsd.org/base/head/lib/libthread_db/libthr_db.c?revision=241720&view=markup#l148 LOOKUP_SYM(ph, "_thread_keytable", &ta->thread_keytable_addr); If symbol is not found, pt_ta_new returns "TD_NOLIBTHREAD", even if process uses libthr. It impacts sysutils/pstack port, it doesn't work for multithreaded processes anymore. Eric, Konstantin, Could you please advise what is best way to fix it: - rollback change of "_thread_keytable" (it looks easy) - or remove "_thread_keytable" from libthread_db ? Thanks! On Fri, May 19, 2017 at 4:04 PM, Eric van Gyzen wrote: > Author: vangyzen > Date: Fri May 19 13:04:05 2017 > New Revision: 318539 > URL: https://svnweb.freebsd.org/changeset/base/318539 > > Log: > libthr: fix warnings at WARNS=6 > > Fix warnings about the following when WARNS=6 (which I will commit soon): > > - casting away const > - no previous 'extern' declaration for non-static variable > - others as explained by #pragmas and comments > - unused parameters > > The last is the only functional change. > > Reviewed by: kib > MFC after: 3 days > Sponsored by: Dell EMC > Differential Revision: https://reviews.freebsd.org/D10808 > > Modified: > head/lib/libthr/thread/thr_attr.c > head/lib/libthr/thread/thr_exit.c > head/lib/libthr/thread/thr_sig.c > head/lib/libthr/thread/thr_spec.c > head/lib/libthr/thread/thr_stack.c > head/lib/libthr/thread/thr_symbols.c > head/lib/libthr/thread/thr_umtx.c > head/lib/libthr/thread/thr_umtx.h > > Modified: head/lib/libthr/thread/thr_attr.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_attr.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_attr.c Fri May 19 13:04:05 2017 > (r318539) > @@ -607,7 +607,7 @@ _pthread_attr_setaffinity_np(pthread_att > /* Kernel checks invalid bits, we check it here > too. */ > size_t i; > for (i = kern_size; i < cpusetsize; ++i) { > - if (((char *)cpusetp)[i]) > + if (((const char *)cpusetp)[i]) > return (EINVAL); > } > } > > Modified: head/lib/libthr/thread/thr_exit.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_exit.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_exit.c Fri May 19 13:04:05 2017 > (r318539) > @@ -119,7 +119,8 @@ _Unwind_GetCFA(struct _Unwind_Context *c > #endif /* PIC */ > > static void > -thread_unwind_cleanup(_Unwind_Reason_Code code, struct _Unwind_Exception > *e) > +thread_unwind_cleanup(_Unwind_Reason_Code code __unused, > + struct _Unwind_Exception *e __unused) > { > /* > * Specification said that _Unwind_Resume should not be used here, > @@ -130,10 +131,10 @@ thread_unwind_cleanup(_Unwind_Reason_Cod > } > > static _Unwind_Reason_Code > -thread_unwind_stop(int version, _Unwind_Action actions, > - int64_t exc_class, > - struct _Unwind_Exception *exc_obj, > - struct _Unwind_Context *context, void *stop_parameter) > +thread_unwind_stop(int version __unused, _Unwind_Action actions, > + int64_t exc_class __unused, > + struct _Unwind_Exception *exc_obj __unused, > + struct _Unwind_Context *context, void *stop_parameter __unused) > { > struct pthread *curthread = _get_curthread(); > struct pthread_cleanup *cur; > > Modified: head/lib/libthr/thread/thr_sig.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_sig.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_sig.c Fri May 19 13:04:05 2017 > (r318539) > @@ -441,7 +441,7 @@ _thr_signal_init(int dlopened) > } > > void > -_thr_sigact_unload(struct dl_phdr_info *phdr_info) > +_thr_sigact_unload(struct dl_phdr_info *phdr_info __unused) > { > #if 0 > struct pthread *curthread = _get_curthread(); > > Modified: head/lib/libthr/thread/thr_spec.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_spec.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_spec.c Fri May 19 13:04:05 2017 > (r318539) > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); > > #include "thr_private.h" > > -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > > __weak_reference(_pthread_key_create, pthread_key_create); > __weak_reference(_pthread_key_delete, pthread_key_delete); > > Modified: head/lib/libthr/thread/thr_stack.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_stack.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_stack.c Fri May 19 13:04:05 2017 > (r318539) > @@ -290,6 +290,19 @@ _thr_stack_alloc(struct pthread_attr *at > return (-1); > } > > +/* > + * Disable this warning from clang: > + * > + * cast from 'char *' to > + * 'struct stack *' increases required alignment from 1 to 8 > + * [-Werror,-Wcast-align] > + * spare_stack = (struct stack *) > + */ > +#ifdef __clang__ > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wcast-align" > +#endif > + > /* This function must be called with _thread_list_lock held. */ > void > _thr_stack_free(struct pthread_attr *attr) > @@ -316,3 +329,7 @@ _thr_stack_free(struct pthread_attr *att > attr->stackaddr_attr = NULL; > } > } > + > +#ifdef __clang__ > +#pragma GCC diagnostic pop > +#endif > > Modified: head/lib/libthr/thread/thr_symbols.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_symbols.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_symbols.c Fri May 19 13:04:05 2017 > (r318539) > @@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$"); > > #include "thr_private.h" > > +#ifdef __clang__ > +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" > +#endif > + > /* A collection of symbols needed by debugger */ > > /* int _libthr_debug */ > > Modified: head/lib/libthr/thread/thr_umtx.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_umtx.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_umtx.c Fri May 19 13:04:05 2017 > (r318539) > @@ -168,7 +168,7 @@ __thr_umutex_timedlock(struct umutex *mt > } > > int > -__thr_umutex_unlock(struct umutex *mtx, uint32_t id) > +__thr_umutex_unlock(struct umutex *mtx) > { > > return (_umtx_op_err(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0)); > > Modified: head/lib/libthr/thread/thr_umtx.h > ============================================================ > ================== > --- head/lib/libthr/thread/thr_umtx.h Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_umtx.h Fri May 19 13:04:05 2017 > (r318539) > @@ -44,7 +44,7 @@ int __thr_umutex_lock(struct umutex *mtx > int __thr_umutex_lock_spin(struct umutex *mtx, uint32_t id) __hidden; > int __thr_umutex_timedlock(struct umutex *mtx, uint32_t id, > const struct timespec *timeout) __hidden; > -int __thr_umutex_unlock(struct umutex *mtx, uint32_t id) __hidden; > +int __thr_umutex_unlock(struct umutex *mtx) __hidden; > int __thr_umutex_trylock(struct umutex *mtx) __hidden; > int __thr_umutex_set_ceiling(struct umutex *mtx, uint32_t ceiling, > uint32_t *oldceiling) __hidden; > @@ -155,7 +155,7 @@ _thr_umutex_unlock2(struct umutex *mtx, > if (atomic_cmpset_rel_32(&mtx->m_owner, id, noncst ? > UMUTEX_RB_NOTRECOV : UMUTEX_UNOWNED)) > return (0); > - return (__thr_umutex_unlock(mtx, id)); > + return (__thr_umutex_unlock(mtx)); > } > > do { > > From owner-svn-src-all@freebsd.org Wed Jul 26 15:15:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CB72DC02FD; Wed, 26 Jul 2017 15:15:21 +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 1757D66452; Wed, 26 Jul 2017 15:15:21 +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 v6QFFK1F038592; Wed, 26 Jul 2017 15:15:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFFKmc038591; Wed, 26 Jul 2017 15:15:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261515.v6QFFKmc038591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:15:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321521 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:15:21 -0000 Author: mav Date: Wed Jul 26 15:15:20 2017 New Revision: 321521 URL: https://svnweb.freebsd.org/changeset/base/321521 Log: MFC r305701 (by allanjude): MFV r268120: 4936 lz4 could theoretically overflow a pointer with a certain input illumos/illumos-gate@58d0718061c87e3d647c891ec5281b93c08dba4e Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Wed Jul 26 14:56:03 2017 (r321520) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Wed Jul 26 15:15:20 2017 (r321521) @@ -187,21 +187,18 @@ lz4_decompress(void *s_start, void *d_start, size_t s_ defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \ defined(__LP64__) || defined(_LP64)) #define LZ4_ARCH64 1 -/* - * Illumos: On amd64 we have 20k of stack and 24k on sun4u and sun4v, so we - * can spend 16k on the algorithm - */ -/* FreeBSD: Use heap for all platforms for now */ -#define STACKLIMIT 0 #else #define LZ4_ARCH64 0 +#endif + /* - * Illumos: On i386 we only have 12k of stack, so in order to maintain the - * same COMPRESSIONLEVEL we have to use heap allocation. Performance will - * suck, but alas, it's ZFS on 32-bit we're talking about, so... + * Limits the amount of stack space that the algorithm may consume to hold + * the compression lookup table. The value `9' here means we'll never use + * more than 2k of stack (see above for a description of COMPRESSIONLEVEL). + * If more memory is needed, it is allocated from the heap. */ +/* FreeBSD: Use heap for all platforms for now */ #define STACKLIMIT 0 -#endif /* * Little Endian or Big Endian? @@ -870,7 +867,7 @@ real_LZ4_compress(const char *source, char *dest, int /* Decompression functions */ /* - * Note: The decoding functionLZ4_uncompress_unknownOutputSize() is safe + * Note: The decoding function LZ4_uncompress_unknownOutputSize() is safe * against "buffer overflow" attack type. They will never write nor * read outside of the provided output buffers. * LZ4_uncompress_unknownOutputSize() also insures that it will never @@ -913,6 +910,9 @@ LZ4_uncompress_unknownOutputSize(const char *source, c } /* copy literals */ cpy = op + length; + /* CORNER-CASE: cpy might overflow. */ + if (cpy < op) + goto _output_error; /* cpy was overflowed, bail! */ if ((cpy > oend - COPYLENGTH) || (ip + length > iend - COPYLENGTH)) { if (cpy > oend) From owner-svn-src-all@freebsd.org Wed Jul 26 15:19:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B86CDC039A; Wed, 26 Jul 2017 15:19:36 +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 DB616665F1; Wed, 26 Jul 2017 15:19: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 v6QFJYNd038804; Wed, 26 Jul 2017 15:19:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFJY0F038803; Wed, 26 Jul 2017 15:19:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261519.v6QFJY0F038803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321522 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 321522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:19:36 -0000 Author: mav Date: Wed Jul 26 15:19:34 2017 New Revision: 321522 URL: https://svnweb.freebsd.org/changeset/base/321522 Log: MFC r309096 (by avg): MFV r308989: 6428 set canmount=off on unmounted filesystem tries to unmount children This is a cosmetic and bookkeeping change as the actual change is already in FreeBSD. See r297521, r304520, r308985. Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 15:15:20 2017 (r321521) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 15:19:34 2017 (r321522) @@ -1620,7 +1620,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) */ if (prop != ZFS_PROP_CANMOUNT || (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF && - zfs_is_mounted(zhp, NULL))) { + zfs_is_mounted(zhp, NULL))) { cls[cl_idx] = changelist_gather(zhp, prop, 0, 0); if (cls[cl_idx] == NULL) goto error; From owner-svn-src-all@freebsd.org Wed Jul 26 15:23:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C6EDC057E; Wed, 26 Jul 2017 15:23:02 +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 5DBC0669F6; Wed, 26 Jul 2017 15:23:02 +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 v6QFN1ow042745; Wed, 26 Jul 2017 15:23:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFN1oa042742; Wed, 26 Jul 2017 15:23:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261523.v6QFN1oa042742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321523 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:23:02 -0000 Author: mav Date: Wed Jul 26 15:23:01 2017 New Revision: 321523 URL: https://svnweb.freebsd.org/changeset/base/321523 Log: MFC r312535: MFV 312436 6569 large file delete can starve out write ops illumos/illumos-gate@ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6 https://github.com/illumos/illumos-gate/commit/ff5177ee8bf9a355131ce2cc61ae2da 6a5a6fdd6 https://www.illumos.org/issues/6569 The core issue I've found is that there is no throttle for how many deletes get assigned to one TXG. As a results when deleting large files we end up filling consecutive TXGs with deletes/frees, then write throttling other (more important) ops. There is an easy test case for this problem. Try deleting several large files (at least 1/2 TB) while you do write ops on the same pool. What we've seen is performance of these write ops (let's call it sideload I/O) would drop to zero. More specifically the problem is that dmu_free_long_range_impl() can/will fill up all of the dirty data in the pool "instantly", before many of the sideload ops can get in. So sideload performance will be impacted until all the files are freed. The solution we have tested at Nexenta (with positive results) creates a relatively simple throttle for how many "free" ops we let into one TXG. However this solution exposes other problems that should also be addressed. If we are to slow down freeing of data that means one has to wait even longer (assuming vnode ref count of 1) to get shell back after an rm or for NFS thread to finish the free-ing op. To avoid this the proposed solution is to call zfs_inactive() async for "large" files. Async freeing then begs for the reclaimed space to be accounted for in the zpool's "freeing" prop. The other issue with having a longer delete is the inability to export/unmount for a longer period of time. The proposed solution is to interrupt freeing of blocks when a fs is unmounted. Author: Alek Pinchuk Reviewed by: Matt Ahrens Reviewed by: Sanjay Nadkarni Reviewed by: Pavel Zakharov Approved by: Dan McDonald Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 15:19:34 2017 (r321522) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 15:23:01 2017 (r321523) @@ -60,6 +60,16 @@ SYSCTL_DECL(_vfs_zfs); SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFLAG_RDTUN, &zfs_nopwrite_enabled, 0, "Enable nopwrite feature"); +/* + * Tunable to control percentage of dirtied blocks from frees in one TXG. + * After this threshold is crossed, additional dirty blocks from frees + * wait until the next TXG. + * A value of zero will disable this throttle. + */ +uint32_t zfs_per_txg_dirty_frees_percent = 30; +SYSCTL_INT(_vfs_zfs, OID_AUTO, per_txg_dirty_frees_percent, CTLFLAG_RWTUN, + &zfs_per_txg_dirty_frees_percent, 0, "Percentage of dirtied blocks from frees in one txg"); + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, "object directory" }, @@ -718,15 +728,25 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui { uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz; int err; + uint64_t dirty_frees_threshold; + dsl_pool_t *dp = dmu_objset_pool(os); if (offset >= object_size) return (0); + if (zfs_per_txg_dirty_frees_percent <= 100) + dirty_frees_threshold = + zfs_per_txg_dirty_frees_percent * zfs_dirty_data_max / 100; + else + dirty_frees_threshold = zfs_dirty_data_max / 4; + if (length == DMU_OBJECT_END || offset + length > object_size) length = object_size - offset; while (length != 0) { - uint64_t chunk_end, chunk_begin; + uint64_t chunk_end, chunk_begin, chunk_len; + uint64_t long_free_dirty_all_txgs = 0; + dmu_tx_t *tx; chunk_end = chunk_begin = offset + length; @@ -737,11 +757,30 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui ASSERT3U(chunk_begin, >=, offset); ASSERT3U(chunk_begin, <=, chunk_end); - dmu_tx_t *tx = dmu_tx_create(os); - dmu_tx_hold_free(tx, dn->dn_object, - chunk_begin, chunk_end - chunk_begin); + chunk_len = chunk_end - chunk_begin; + mutex_enter(&dp->dp_lock); + for (int t = 0; t < TXG_SIZE; t++) { + long_free_dirty_all_txgs += + dp->dp_long_free_dirty_pertxg[t]; + } + mutex_exit(&dp->dp_lock); + /* + * To avoid filling up a TXG with just frees wait for + * the next TXG to open before freeing more chunks if + * we have reached the threshold of frees + */ + if (dirty_frees_threshold != 0 && + long_free_dirty_all_txgs >= dirty_frees_threshold) { + txg_wait_open(dp, 0); + continue; + } + + tx = dmu_tx_create(os); + dmu_tx_hold_free(tx, dn->dn_object, chunk_begin, chunk_len); + + /* * Mark this transaction as typically resulting in a net * reduction in space used. */ @@ -751,10 +790,18 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui dmu_tx_abort(tx); return (err); } - dnode_free_range(dn, chunk_begin, chunk_end - chunk_begin, tx); + + mutex_enter(&dp->dp_lock); + dp->dp_long_free_dirty_pertxg[dmu_tx_get_txg(tx) & TXG_MASK] += + chunk_len; + mutex_exit(&dp->dp_lock); + DTRACE_PROBE3(free__long__range, + uint64_t, long_free_dirty_all_txgs, uint64_t, chunk_len, + uint64_t, dmu_tx_get_txg(tx)); + dnode_free_range(dn, chunk_begin, chunk_len, tx); dmu_tx_commit(tx); - length -= chunk_end - chunk_begin; + length -= chunk_len; } return (0); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 15:19:34 2017 (r321522) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 15:23:01 2017 (r321523) @@ -24,6 +24,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #include @@ -588,6 +589,16 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg) * Shore up the accounting of any dirtied space now. */ dsl_pool_undirty_space(dp, dp->dp_dirty_pertxg[txg & TXG_MASK], txg); + + /* + * Update the long range free counter after + * we're done syncing user data + */ + mutex_enter(&dp->dp_lock); + ASSERT(spa_sync_pass(dp->dp_spa) == 1 || + dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] == 0); + dp->dp_long_free_dirty_pertxg[txg & TXG_MASK] = 0; + mutex_exit(&dp->dp_lock); /* * After the data blocks have been written (ensured by the zio_wait() Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Wed Jul 26 15:19:34 2017 (r321522) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Wed Jul 26 15:23:01 2017 (r321523) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_DSL_POOL_H @@ -103,6 +104,7 @@ typedef struct dsl_pool { kcondvar_t dp_spaceavail_cv; uint64_t dp_dirty_pertxg[TXG_SIZE]; uint64_t dp_dirty_total; + uint64_t dp_long_free_dirty_pertxg[TXG_SIZE]; uint64_t dp_mos_used_delta; uint64_t dp_mos_compressed_delta; uint64_t dp_mos_uncompressed_delta; From owner-svn-src-all@freebsd.org Wed Jul 26 15:23:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 325ACDC05C2; Wed, 26 Jul 2017 15:23:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBF9866B1D; Wed, 26 Jul 2017 15:23:23 +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 v6QFNDtx039892 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 26 Jul 2017 18:23:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v6QFNDtx039892 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v6QFNDwj039891; Wed, 26 Jul 2017 18:23:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Jul 2017 18:23:13 +0300 From: Konstantin Belousov To: Michael Zhilin Cc: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Michael Zhilin Subject: Re: svn commit: r318539 - head/lib/libthr/thread Message-ID: <20170726152313.GF1700@kib.kiev.ua> References: <201705191304.v4JD45Sn021851@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:23:24 -0000 On Wed, Jul 26, 2017 at 06:09:00PM +0300, Michael Zhilin wrote: > Hi Eric, Konstantin, > > This commit breaks libthread_db a bit, particular change is: > -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > > In libthread_db there is check if _thread_keytable is found in symbols of > debugged process: > https://svnweb.freebsd.org/base/head/lib/libthread_db/libthr_db.c?revision=241720&view=markup#l148 > > LOOKUP_SYM(ph, "_thread_keytable", &ta->thread_keytable_addr); > > If symbol is not found, pt_ta_new returns "TD_NOLIBTHREAD", even if process > uses libthr. > It impacts sysutils/pstack port, it doesn't work for multithreaded > processes anymore. > > Eric, Konstantin, > Could you please advise what is best way to fix it: > > - rollback change of "_thread_keytable" (it looks easy) > - or remove "_thread_keytable" from libthread_db > > ? The td_ta_tsd_iter() API implementation for libthr depends on the ability to lookup the symbol. I think that the change should be reverted, it is easiest solution. Perhaps a comment should be added noting that the symbol is used by libthread_db so that the mistake is not repeated. From owner-svn-src-all@freebsd.org Wed Jul 26 15:24:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F1A3DC0681; Wed, 26 Jul 2017 15:24:18 +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 690C166CE2; Wed, 26 Jul 2017 15:24:18 +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 v6QFOHpk042848; Wed, 26 Jul 2017 15:24:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFOHC2042845; Wed, 26 Jul 2017 15:24:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261524.v6QFOHC2042845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321524 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:24:18 -0000 Author: mav Date: Wed Jul 26 15:24:17 2017 New Revision: 321524 URL: https://svnweb.freebsd.org/changeset/base/321524 Log: MFC r313813: MFV 313786 7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216 https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216 https://www.illumos.org/issues/7500 With the integration of: commit 0f6d88aded0d165f5954688a9b13bac76c38da84 Author: Alex Reece Date: Sat Jul 26 13:40:04 2014 -0800 4873 zvol unmap calls can take a very long time for larger datasets the dnode's dn_bufs field was changed from a list to a tree. As a result, the dn_unlisted_l0_blkid field is no longer necessary. Author: Stephen Blinick Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Gordon Ross Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 15:23:01 2017 (r321523) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 15:24:17 2017 (r321524) @@ -49,12 +49,6 @@ uint_t zfs_dbuf_evict_key; -/* - * Number of times that zfs_free_range() took the slow path while doing - * a zfs receive. A nonzero value indicates a potential performance problem. - */ -uint64_t zfs_free_range_recv_miss; - static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); @@ -1220,9 +1214,6 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) * Evict (if its unreferenced) or clear (if its referenced) any level-0 * data blocks in the free range, so that any future readers will find * empty blocks. - * - * This is a no-op if the dataset is in the middle of an incremental - * receive; see comment below for details. */ void dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, @@ -1232,10 +1223,9 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uin dmu_buf_impl_t *db, *db_next; uint64_t txg = tx->tx_txg; avl_index_t where; - boolean_t freespill = - (start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID); - if (end_blkid > dn->dn_maxblkid && !freespill) + if (end_blkid > dn->dn_maxblkid && + !(start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID)) end_blkid = dn->dn_maxblkid; dprintf_dnode(dn, "start=%llu end=%llu\n", start_blkid, end_blkid); @@ -1244,29 +1234,9 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uin db_search.db_state = DB_SEARCH; mutex_enter(&dn->dn_dbufs_mtx); - if (start_blkid >= dn->dn_unlisted_l0_blkid && !freespill) { - /* There can't be any dbufs in this range; no need to search. */ -#ifdef DEBUG - db = avl_find(&dn->dn_dbufs, &db_search, &where); - ASSERT3P(db, ==, NULL); - db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); - ASSERT(db == NULL || db->db_level > 0); -#endif - mutex_exit(&dn->dn_dbufs_mtx); - return; - } else if (dmu_objset_is_receiving(dn->dn_objset)) { - /* - * If we are receiving, we expect there to be no dbufs in - * the range to be freed, because receive modifies each - * block at most once, and in offset order. If this is - * not the case, it can lead to performance problems, - * so note that we unexpectedly took the slow path. - */ - atomic_inc_64(&zfs_free_range_recv_miss); - } - db = avl_find(&dn->dn_dbufs, &db_search, &where); ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); for (; db != NULL; db = db_next) { @@ -2283,9 +2253,7 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid return (odb); } avl_add(&dn->dn_dbufs, db); - if (db->db_level == 0 && db->db_blkid >= - dn->dn_unlisted_l0_blkid) - dn->dn_unlisted_l0_blkid = db->db_blkid + 1; + db->db_state = DB_UNCACHED; mutex_exit(&dn->dn_dbufs_mtx); arc_space_consume(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 15:23:01 2017 (r321523) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 15:24:17 2017 (r321524) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -153,7 +153,6 @@ dnode_cons(void *arg, void *unused, int kmflag) dn->dn_id_flags = 0; dn->dn_dbufs_count = 0; - dn->dn_unlisted_l0_blkid = 0; avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); @@ -207,7 +206,6 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_id_flags); ASSERT0(dn->dn_dbufs_count); - ASSERT0(dn->dn_unlisted_l0_blkid); avl_destroy(&dn->dn_dbufs); } @@ -525,7 +523,6 @@ dnode_destroy(dnode_t *dn) dn->dn_newuid = 0; dn->dn_newgid = 0; dn->dn_id_flags = 0; - dn->dn_unlisted_l0_blkid = 0; dmu_zfetch_fini(&dn->dn_zfetch); kmem_cache_free(dnode_cache, dn); @@ -761,7 +758,6 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) ASSERT(avl_is_empty(&ndn->dn_dbufs)); avl_swap(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; - ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; ndn->dn_have_spill = odn->dn_have_spill; ndn->dn_zio = odn->dn_zio; @@ -794,7 +790,6 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) avl_create(&odn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; - odn->dn_unlisted_l0_blkid = 0; odn->dn_bonus = NULL; odn->dn_zfetch.zf_dnode = NULL; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 15:23:01 2017 (r321523) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 15:24:17 2017 (r321524) @@ -195,8 +195,6 @@ struct dnode { /* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */ uint32_t dn_dbufs_count; /* count of dn_dbufs */ - /* There are no level-0 blocks of this blkid or higher in dn_dbufs */ - uint64_t dn_unlisted_l0_blkid; /* protected by os_lock: */ list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */ From owner-svn-src-all@freebsd.org Wed Jul 26 15:29:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17703DC07A4; Wed, 26 Jul 2017 15:29:58 +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 E4B8366EC2; Wed, 26 Jul 2017 15:29:57 +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 v6QFTv8N043107; Wed, 26 Jul 2017 15:29:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFTv4U043105; Wed, 26 Jul 2017 15:29:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261529.v6QFTv4U043105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321525 - in stable/11/sys: boot/zfs cddl/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: boot/zfs cddl/boot/zfs X-SVN-Commit-Revision: 321525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:29:58 -0000 Author: mav Date: Wed Jul 26 15:29:56 2017 New Revision: 321525 URL: https://svnweb.freebsd.org/changeset/base/321525 Log: MFC r314112 (by tsoome): loader: update symlink support in zfs reader As the current zfs file system is providing symlink via system attributes, need to update the code accordingly. Note, as the zfsboot code does not free the memory at this time, the object list will put some stress on the boot2 heap, eventually we should address the issue. Differential Revision: https://reviews.freebsd.org/D9706 Modified: stable/11/sys/boot/zfs/zfsimpl.c stable/11/sys/cddl/boot/zfs/zfsimpl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 15:24:17 2017 (r321524) +++ stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 15:29:56 2017 (r321525) @@ -2142,6 +2142,61 @@ zfs_dnode_stat(const spa_t *spa, dnode_phys_t *dn, str return (0); } +static int +zfs_dnode_readlink(const spa_t *spa, dnode_phys_t *dn, char *path, size_t psize) +{ + int rc = 0; + + if (dn->dn_bonustype == DMU_OT_SA) { + sa_hdr_phys_t *sahdrp = NULL; + size_t size = 0; + void *buf = NULL; + int hdrsize; + char *p; + + if (dn->dn_bonuslen != 0) + sahdrp = (sa_hdr_phys_t *)DN_BONUS(dn); + else { + blkptr_t *bp; + + if ((dn->dn_flags & DNODE_FLAG_SPILL_BLKPTR) == 0) + return (EIO); + bp = &dn->dn_spill; + + size = BP_GET_LSIZE(bp); + buf = zfs_alloc(size); + rc = zio_read(spa, bp, buf); + if (rc != 0) { + zfs_free(buf, size); + return (rc); + } + sahdrp = buf; + } + hdrsize = SA_HDR_SIZE(sahdrp); + p = (char *)((uintptr_t)sahdrp + hdrsize + SA_SYMLINK_OFFSET); + memcpy(path, p, psize); + if (buf != NULL) + zfs_free(buf, size); + return (0); + } + /* + * Second test is purely to silence bogus compiler + * warning about accessing past the end of dn_bonus. + */ + if (psize + sizeof(znode_phys_t) <= dn->dn_bonuslen && + sizeof(znode_phys_t) <= sizeof(dn->dn_bonus)) { + memcpy(path, &dn->dn_bonus[sizeof(znode_phys_t)], psize); + } else { + rc = dnode_read(spa, dn, 0, path, psize); + } + return (rc); +} + +struct obj_list { + uint64_t objnum; + STAILQ_ENTRY(obj_list) entry; +}; + /* * Lookup a file and return its dnode. */ @@ -2149,7 +2204,7 @@ static int zfs_lookup(const struct zfsmount *mount, const char *upath, dnode_phys_t *dnode) { int rc; - uint64_t objnum, rootnum, parentnum; + uint64_t objnum; const spa_t *spa; dnode_phys_t dn; const char *p, *q; @@ -2157,6 +2212,8 @@ zfs_lookup(const struct zfsmount *mount, const char *u char path[1024]; int symlinks_followed = 0; struct stat sb; + struct obj_list *entry; + STAILQ_HEAD(, obj_list) on_cache = STAILQ_HEAD_INITIALIZER(on_cache); spa = mount->spa; if (mount->objset.os_type != DMU_OST_ZFS) { @@ -2165,102 +2222,145 @@ zfs_lookup(const struct zfsmount *mount, const char *u return (EIO); } + if ((entry = malloc(sizeof(struct obj_list))) == NULL) + return (ENOMEM); + /* * Get the root directory dnode. */ rc = objset_get_dnode(spa, &mount->objset, MASTER_NODE_OBJ, &dn); - if (rc) + if (rc) { + free(entry); return (rc); + } rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, &rootnum); - if (rc) + if (rc) { + free(entry); return (rc); + } + entry->objnum = objnum; + STAILQ_INSERT_HEAD(&on_cache, entry, entry); - rc = objset_get_dnode(spa, &mount->objset, rootnum, &dn); - if (rc) - return (rc); + rc = objset_get_dnode(spa, &mount->objset, objnum, &dn); + if (rc != 0) + goto done; - objnum = rootnum; p = upath; while (p && *p) { + rc = objset_get_dnode(spa, &mount->objset, objnum, &dn); + if (rc != 0) + goto done; + while (*p == '/') p++; - if (!*p) + if (*p == '\0') break; - q = strchr(p, '/'); - if (q) { - memcpy(element, p, q - p); - element[q - p] = 0; - p = q; - } else { - strcpy(element, p); - p = NULL; + q = p; + while (*q != '\0' && *q != '/') + q++; + + /* skip dot */ + if (p + 1 == q && p[0] == '.') { + p++; + continue; } + /* double dot */ + if (p + 2 == q && p[0] == '.' && p[1] == '.') { + p += 2; + if (STAILQ_FIRST(&on_cache) == + STAILQ_LAST(&on_cache, obj_list, entry)) { + rc = ENOENT; + goto done; + } + entry = STAILQ_FIRST(&on_cache); + STAILQ_REMOVE_HEAD(&on_cache, entry); + free(entry); + objnum = (STAILQ_FIRST(&on_cache))->objnum; + continue; + } + if (q - p + 1 > sizeof(element)) { + rc = ENAMETOOLONG; + goto done; + } + memcpy(element, p, q - p); + element[q - p] = 0; + p = q; - rc = zfs_dnode_stat(spa, &dn, &sb); - if (rc) - return (rc); - if (!S_ISDIR(sb.st_mode)) - return (ENOTDIR); + if ((rc = zfs_dnode_stat(spa, &dn, &sb)) != 0) + goto done; + if (!S_ISDIR(sb.st_mode)) { + rc = ENOTDIR; + goto done; + } - parentnum = objnum; rc = zap_lookup(spa, &dn, element, &objnum); if (rc) - return (rc); + goto done; objnum = ZFS_DIRENT_OBJ(objnum); + if ((entry = malloc(sizeof(struct obj_list))) == NULL) { + rc = ENOMEM; + goto done; + } + entry->objnum = objnum; + STAILQ_INSERT_HEAD(&on_cache, entry, entry); rc = objset_get_dnode(spa, &mount->objset, objnum, &dn); if (rc) - return (rc); + goto done; /* * Check for symlink. */ rc = zfs_dnode_stat(spa, &dn, &sb); if (rc) - return (rc); + goto done; if (S_ISLNK(sb.st_mode)) { - if (symlinks_followed > 10) - return (EMLINK); + if (symlinks_followed > 10) { + rc = EMLINK; + goto done; + } symlinks_followed++; /* * Read the link value and copy the tail of our * current path onto the end. */ - if (p) - strcpy(&path[sb.st_size], p); - else - path[sb.st_size] = 0; - /* - * Second test is purely to silence bogus compiler - * warning about accessing past the end of dn_bonus. - */ - if (sb.st_size + sizeof(znode_phys_t) <= - dn.dn_bonuslen && sizeof(znode_phys_t) <= - sizeof(dn.dn_bonus)) { - memcpy(path, &dn.dn_bonus[sizeof(znode_phys_t)], - sb.st_size); - } else { - rc = dnode_read(spa, &dn, 0, path, sb.st_size); - if (rc) - return (rc); + if (sb.st_size + strlen(p) + 1 > sizeof(path)) { + rc = ENAMETOOLONG; + goto done; } + strcpy(&path[sb.st_size], p); + rc = zfs_dnode_readlink(spa, &dn, path, sb.st_size); + if (rc != 0) + goto done; + /* * Restart with the new path, starting either at * the root or at the parent depending whether or * not the link is relative. */ p = path; - if (*p == '/') - objnum = rootnum; - else - objnum = parentnum; - objset_get_dnode(spa, &mount->objset, objnum, &dn); + if (*p == '/') { + while (STAILQ_FIRST(&on_cache) != + STAILQ_LAST(&on_cache, obj_list, entry)) { + entry = STAILQ_FIRST(&on_cache); + STAILQ_REMOVE_HEAD(&on_cache, entry); + free(entry); + } + } else { + entry = STAILQ_FIRST(&on_cache); + STAILQ_REMOVE_HEAD(&on_cache, entry); + free(entry); + } + objnum = (STAILQ_FIRST(&on_cache))->objnum; } } *dnode = dn; - return (0); +done: + STAILQ_FOREACH(entry, &on_cache, entry) + free(entry); + return (rc); } Modified: stable/11/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- stable/11/sys/cddl/boot/zfs/zfsimpl.h Wed Jul 26 15:24:17 2017 (r321524) +++ stable/11/sys/cddl/boot/zfs/zfsimpl.h Wed Jul 26 15:29:56 2017 (r321525) @@ -1070,6 +1070,7 @@ typedef struct sa_hdr_phys { #define SA_UID_OFFSET 24 #define SA_GID_OFFSET 32 #define SA_PARENT_OFFSET 40 +#define SA_SYMLINK_OFFSET 160 /* * Intent log header - this on disk structure holds fields to manage From owner-svn-src-all@freebsd.org Wed Jul 26 15:52:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED7F3DC0E6F; Wed, 26 Jul 2017 15:52:52 +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 B3D4C67A91; Wed, 26 Jul 2017 15:52:52 +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 v6QFqpB0055116; Wed, 26 Jul 2017 15:52:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QFqpMh055115; Wed, 26 Jul 2017 15:52:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261552.v6QFqpMh055115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 15:52:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321526 - stable/11/sys/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/boot/zfs X-SVN-Commit-Revision: 321526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:52:53 -0000 Author: mav Date: Wed Jul 26 15:52:51 2017 New Revision: 321526 URL: https://svnweb.freebsd.org/changeset/base/321526 Log: Fix mismerge in r321525. Modified: stable/11/sys/boot/zfs/zfsimpl.c Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 15:29:56 2017 (r321525) +++ stable/11/sys/boot/zfs/zfsimpl.c Wed Jul 26 15:52:51 2017 (r321526) @@ -2234,7 +2234,7 @@ zfs_lookup(const struct zfsmount *mount, const char *u return (rc); } - rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, &rootnum); + rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, &objnum); if (rc) { free(entry); return (rc); From owner-svn-src-all@freebsd.org Wed Jul 26 16:08:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84C1ED98168; Wed, 26 Jul 2017 16:08:46 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-ua0-f178.google.com (mail-ua0-f178.google.com [209.85.217.178]) (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 383036806E; Wed, 26 Jul 2017 16:08:45 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-ua0-f178.google.com with SMTP id q25so101597607uah.1; Wed, 26 Jul 2017 09:08:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=g9PN1BrZ+otLND06NKhr2fRszLKvveqN+jgCTsYYCs4=; b=WfHYY5WL376It/NSuJVec2FoQmXXj9uqcXN1K5IK5tt4js/Yt7mALkS+y/AgFNpB46 pFnrnQ9avSWq4YXVN21pLLx4mLxqtv/Qen/qr7cYUBjFWWKWwFwehDhIyCgmjB/XS0pS +6C5DHS5+PySM40kNKIME4FvY7DJuV8mwahrHHXVf0Ata65tNnWR8xVtPaNBMv+gjfHu fwa6w0fBDY19keeYORYSaOXcqwyDqq5IFld3wSLgETyLDpxBipOPBnOhmdjxPhRQqgB9 3uOOCiNdZFDl7tW5mbrOUhITCZ/B4nmXR627qTiBAtphAV3UhOwJ5OjaVwF7QDjazNh0 Z29g== X-Gm-Message-State: AIVw113hPQ5bq148FWJVU+PQRzHJscnZBdbhLWPRUuiGCDhbztvAievp rlgAGSdqBhkDZq0h64DOGg== X-Received: by 10.176.84.153 with SMTP id p25mr970993uaa.174.1501083540916; Wed, 26 Jul 2017 08:39:00 -0700 (PDT) Received: from mail-ua0-f169.google.com (mail-ua0-f169.google.com. [209.85.217.169]) by smtp.gmail.com with ESMTPSA id 34sm3922455uai.50.2017.07.26.08.39.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 08:39:00 -0700 (PDT) Received: by mail-ua0-f169.google.com with SMTP id k43so83030668uaf.3; Wed, 26 Jul 2017 08:39:00 -0700 (PDT) X-Received: by 10.31.13.78 with SMTP id 75mr775435vkn.121.1501083540311; Wed, 26 Jul 2017 08:39:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.32.75 with HTTP; Wed, 26 Jul 2017 08:38:59 -0700 (PDT) In-Reply-To: <20170726152313.GF1700@kib.kiev.ua> References: <201705191304.v4JD45Sn021851@repo.freebsd.org> <20170726152313.GF1700@kib.kiev.ua> From: Michael Zhilin Date: Wed, 26 Jul 2017 18:38:59 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r318539 - head/lib/libthr/thread To: Konstantin Belousov Cc: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:08:46 -0000 Konstantin, Thank you for quick reply. Here is review request to revert field change: https://reviews.freebsd.org/D11738 Thanks! On Wed, Jul 26, 2017 at 6:23 PM, Konstantin Belousov wrote: > On Wed, Jul 26, 2017 at 06:09:00PM +0300, Michael Zhilin wrote: > > Hi Eric, Konstantin, > > > > This commit breaks libthread_db a bit, particular change is: > > -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > > +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > > > > In libthread_db there is check if _thread_keytable is found in symbols of > > debugged process: > > https://svnweb.freebsd.org/base/head/lib/libthread_db/ > libthr_db.c?revision=241720&view=markup#l148 > > > > LOOKUP_SYM(ph, "_thread_keytable", &ta->thread_keytable_addr); > > > > If symbol is not found, pt_ta_new returns "TD_NOLIBTHREAD", even if > process > > uses libthr. > > It impacts sysutils/pstack port, it doesn't work for multithreaded > > processes anymore. > > > > Eric, Konstantin, > > Could you please advise what is best way to fix it: > > > > - rollback change of "_thread_keytable" (it looks easy) > > - or remove "_thread_keytable" from libthread_db > > > > ? > > The td_ta_tsd_iter() API implementation for libthr depends on the ability > to lookup the symbol. I think that the change should be reverted, it is > easiest solution. > > Perhaps a comment should be added noting that the symbol is used by > libthread_db so that the mistake is not repeated. > From owner-svn-src-all@freebsd.org Wed Jul 26 16:11:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AFA3D98249; Wed, 26 Jul 2017 16:11:10 +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 2381F68294; Wed, 26 Jul 2017 16:11:10 +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 v6QGB9da061775; Wed, 26 Jul 2017 16:11:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGB8sE061766; Wed, 26 Jul 2017 16:11:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261611.v6QGB8sE061766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321527 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:11:10 -0000 Author: mav Date: Wed Jul 26 16:11:08 2017 New Revision: 321527 URL: https://svnweb.freebsd.org/changeset/base/321527 Log: MFC r314267: MFV 314243 6676 Race between unique_insert() and unique_remove() causes ZFS fsid change illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725ee b0f1dac https://www.illumos.org/issues/6676 The fsid of zfs filesystems might change after reboot or remount. The problem seems to be caused by a race between unique_insert() and unique_remove(). The unique_re move() is called from dsl_dataset_evict() which is now an asynchronous thread. In a c ase the dsl_dataset_evict() thread is very slow and calls unique_remove() too late we will end up with changed fsid on zfs mount. This problem is very likely caused by #5056. Steps to Reproduce Note: I'm able to reproduce this always on a single core (virtual) machine. On multicore machines it is not so easy to reproduce. # uname -a SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris # zfs create rpool/TEST # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}') # echo $FS::print vfs_t vfs_fsid | mdb -k vfs_fsid = { vfs_fsid.val = [ 0x54d7028a, 0x70311508 ] } # zfs umount rpool/TEST # zfs mount rpool/TEST # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}') # echo $FS::print vfs_t vfs_fsid | mdb -k vfs_fsid = { vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ] } # Impact The persistent fsid (filesystem id) is essential for proper NFS functionality. If the fsid of a filesystem changes on remount (or after reboot) the NFS clients might not be able to automatically recover from such event and the manual remount of the NFS filesystems on every NFS client might be needed. Author: Josef 'Jeff' Sipek Reviewed by: Saso Kiselkov Reviewed by: Sanjay Nadkarni Reviewed by: Dan Vatca Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Sebastien Roy Approved by: Robert Mustacchi Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:11:08 2017 (r321527) @@ -54,7 +54,9 @@ static void dbuf_write(dbuf_dirty_record_t *dr, arc_bu #ifndef __lint extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu, - dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp); + dmu_buf_evict_func_t *evict_func_sync, + dmu_buf_evict_func_t *evict_func_async, + dmu_buf_t **clear_on_evict_dbufp); #endif /* ! __lint */ /* @@ -361,11 +363,24 @@ dbuf_evict_user(dmu_buf_impl_t *db) #endif /* - * Invoke the callback from a taskq to avoid lock order reversals - * and limit stack depth. + * There are two eviction callbacks - one that we call synchronously + * and one that we invoke via a taskq. The async one is useful for + * avoiding lock order reversals and limiting stack depth. + * + * Note that if we have a sync callback but no async callback, + * it's likely that the sync callback will free the structure + * containing the dbu. In that case we need to take care to not + * dereference dbu after calling the sync evict func. */ - taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func, dbu, 0, - &dbu->dbu_tqent); + boolean_t has_async = (dbu->dbu_evict_func_async != NULL); + + if (dbu->dbu_evict_func_sync != NULL) + dbu->dbu_evict_func_sync(dbu); + + if (has_async) { + taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func_async, + dbu, 0, &dbu->dbu_tqent); + } } boolean_t Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 16:11:08 2017 (r321527) @@ -1014,7 +1014,7 @@ dnode_special_open(objset_t *os, dnode_phys_t *dnp, ui } static void -dnode_buf_pageout(void *dbu) +dnode_buf_evict_async(void *dbu) { dnode_children_t *children_dnodes = dbu; int i; @@ -1140,8 +1140,8 @@ dnode_hold_impl(objset_t *os, uint64_t object, int fla for (i = 0; i < epb; i++) { zrl_init(&dnh[i].dnh_zrlock); } - dmu_buf_init_user(&children_dnodes->dnc_dbu, - dnode_buf_pageout, NULL); + dmu_buf_init_user(&children_dnodes->dnc_dbu, NULL, + dnode_buf_evict_async, NULL); winner = dmu_buf_set_user(&db->db, &children_dnodes->dnc_dbu); if (winner != NULL) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 16:11:08 2017 (r321527) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -279,17 +279,31 @@ dsl_dataset_block_freeable(dsl_dataset_t *ds, const bl return (B_TRUE); } +/* + * We have to release the fsid syncronously or we risk that a subsequent + * mount of the same dataset will fail to unique_insert the fsid. This + * failure would manifest itself as the fsid of this dataset changing + * between mounts which makes NFS clients quite unhappy. + */ static void -dsl_dataset_evict(void *dbu) +dsl_dataset_evict_sync(void *dbu) { dsl_dataset_t *ds = dbu; ASSERT(ds->ds_owner == NULL); - ds->ds_dbuf = NULL; - unique_remove(ds->ds_fsid_guid); +} +static void +dsl_dataset_evict_async(void *dbu) +{ + dsl_dataset_t *ds = dbu; + + ASSERT(ds->ds_owner == NULL); + + ds->ds_dbuf = NULL; + if (ds->ds_objset != NULL) dmu_objset_evict(ds->ds_objset); @@ -528,7 +542,8 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v ds->ds_reserved = ds->ds_quota = 0; } - dmu_buf_init_user(&ds->ds_dbu, dsl_dataset_evict, &ds->ds_dbuf); + dmu_buf_init_user(&ds->ds_dbu, dsl_dataset_evict_sync, + dsl_dataset_evict_async, &ds->ds_dbuf); if (err == 0) winner = dmu_buf_set_user_ie(dbuf, &ds->ds_dbu); @@ -551,6 +566,16 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v } else { ds->ds_fsid_guid = unique_insert(dsl_dataset_phys(ds)->ds_fsid_guid); + if (ds->ds_fsid_guid != + dsl_dataset_phys(ds)->ds_fsid_guid) { + zfs_dbgmsg("ds_fsid_guid changed from " + "%llx to %llx for pool %s dataset id %llu", + (long long) + dsl_dataset_phys(ds)->ds_fsid_guid, + (long long)ds->ds_fsid_guid, + spa_name(dp->dp_spa), + dsobj); + } } } ASSERT3P(ds->ds_dbuf, ==, dbuf); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Jul 26 16:11:08 2017 (r321527) @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. @@ -133,7 +133,7 @@ extern inline dsl_dir_phys_t *dsl_dir_phys(dsl_dir_t * static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd); static void -dsl_dir_evict(void *dbu) +dsl_dir_evict_async(void *dbu) { dsl_dir_t *dd = dbu; dsl_pool_t *dp = dd->dd_pool; @@ -240,7 +240,8 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj, dmu_buf_rele(origin_bonus, FTAG); } - dmu_buf_init_user(&dd->dd_dbu, dsl_dir_evict, &dd->dd_dbuf); + dmu_buf_init_user(&dd->dd_dbu, NULL, dsl_dir_evict_async, + &dd->dd_dbuf); winner = dmu_buf_set_user_ie(dbuf, &dd->dd_dbu); if (winner != NULL) { if (dd->dd_parent) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Wed Jul 26 16:11:08 2017 (r321527) @@ -22,7 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 iXsystems, Inc - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -1299,7 +1299,7 @@ sa_build_index(sa_handle_t *hdl, sa_buf_type_t buftype /*ARGSUSED*/ static void -sa_evict(void *dbu) +sa_evict_sync(void *dbu) { panic("evicting sa dbuf\n"); } @@ -1383,7 +1383,8 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, voi sa_handle_t *winner = NULL; handle = kmem_cache_alloc(sa_cache, KM_SLEEP); - handle->sa_dbu.dbu_evict_func = NULL; + handle->sa_dbu.dbu_evict_func_sync = NULL; + handle->sa_dbu.dbu_evict_func_async = NULL; handle->sa_userp = userp; handle->sa_bonus = db; handle->sa_os = os; @@ -1394,7 +1395,8 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, voi error = sa_build_index(handle, SA_BONUS); if (hdl_type == SA_HDL_SHARED) { - dmu_buf_init_user(&handle->sa_dbu, sa_evict, NULL); + dmu_buf_init_user(&handle->sa_dbu, sa_evict_sync, NULL, + NULL); winner = dmu_buf_set_user_ie(db, &handle->sa_dbu); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:11:08 2017 (r321527) @@ -539,8 +539,14 @@ typedef struct dmu_buf_user { */ taskq_ent_t dbu_tqent; - /* This instance's eviction function pointer. */ - dmu_buf_evict_func_t *dbu_evict_func; + /* + * This instance's eviction function pointers. + * + * dbu_evict_func_sync is called synchronously and then + * dbu_evict_func_async is executed asynchronously on a taskq. + */ + dmu_buf_evict_func_t *dbu_evict_func_sync; + dmu_buf_evict_func_t *dbu_evict_func_async; #ifdef ZFS_DEBUG /* * Pointer to user's dbuf pointer. NULL for clients that do @@ -564,15 +570,19 @@ typedef struct dmu_buf_user { /* Very ugly, but it beats issuing suppression directives in many Makefiles. */ extern void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, - dmu_buf_t **clear_on_evict_dbufp); + dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp); #else /* __lint */ inline void -dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, - dmu_buf_t **clear_on_evict_dbufp) +dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, + dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp) { - ASSERT(dbu->dbu_evict_func == NULL); - ASSERT(evict_func != NULL); - dbu->dbu_evict_func = evict_func; + ASSERT(dbu->dbu_evict_func_sync == NULL); + ASSERT(dbu->dbu_evict_func_async == NULL); + + /* must have at least one evict func */ + IMPLY(evict_func_sync == NULL, evict_func_async != NULL); + dbu->dbu_evict_func_sync = evict_func_sync; + dbu->dbu_evict_func_async = evict_func_async; #ifdef ZFS_DEBUG dbu->dbu_clear_on_evict_dbufp = clear_on_evict_dbufp; #endif Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Wed Jul 26 16:11:08 2017 (r321527) @@ -199,7 +199,7 @@ boolean_t zap_match(zap_name_t *zn, const char *matchn int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp); void zap_unlockdir(zap_t *zap, void *tag); -void zap_evict(void *dbu); +void zap_evict_sync(void *dbu); zap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt); void zap_name_free(zap_name_t *zn); int zap_hashbits(zap_t *zap); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed Jul 26 16:11:08 2017 (r321527) @@ -81,7 +81,8 @@ fzap_upgrade(zap_t *zap, dmu_tx_t *tx, zap_flags_t fla ASSERT(RW_WRITE_HELD(&zap->zap_rwlock)); zap->zap_ismicro = FALSE; - zap->zap_dbu.dbu_evict_func = zap_evict; + zap->zap_dbu.dbu_evict_func_sync = zap_evict_sync; + zap->zap_dbu.dbu_evict_func_async = NULL; mutex_init(&zap->zap_f.zap_num_entries_mtx, 0, 0, 0); zap->zap_f.zap_block_shift = highbit64(zap->zap_dbuf->db_size) - 1; @@ -399,7 +400,7 @@ zap_allocate_blocks(zap_t *zap, int nblocks) } static void -zap_leaf_pageout(void *dbu) +zap_leaf_evict_sync(void *dbu) { zap_leaf_t *l = dbu; @@ -423,7 +424,7 @@ zap_create_leaf(zap_t *zap, dmu_tx_t *tx) VERIFY(0 == dmu_buf_hold(zap->zap_objset, zap->zap_object, l->l_blkid << FZAP_BLOCK_SHIFT(zap), NULL, &l->l_dbuf, DMU_READ_NO_PREFETCH)); - dmu_buf_init_user(&l->l_dbu, zap_leaf_pageout, &l->l_dbuf); + dmu_buf_init_user(&l->l_dbu, zap_leaf_evict_sync, NULL, &l->l_dbuf); winner = dmu_buf_set_user(l->l_dbuf, &l->l_dbu); ASSERT(winner == NULL); dmu_buf_will_dirty(l->l_dbuf, tx); @@ -470,13 +471,13 @@ zap_open_leaf(uint64_t blkid, dmu_buf_t *db) l->l_bs = highbit64(db->db_size) - 1; l->l_dbuf = db; - dmu_buf_init_user(&l->l_dbu, zap_leaf_pageout, &l->l_dbuf); + dmu_buf_init_user(&l->l_dbu, zap_leaf_evict_sync, NULL, &l->l_dbuf); winner = dmu_buf_set_user(db, &l->l_dbu); rw_exit(&l->l_rwlock); if (winner != NULL) { /* someone else set it first */ - zap_leaf_pageout(&l->l_dbu); + zap_leaf_evict_sync(&l->l_dbu); l = winner; } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 15:52:51 2017 (r321526) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 16:11:08 2017 (r321527) @@ -403,7 +403,7 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db) * it, because zap_lockdir() checks zap_ismicro without the lock * held. */ - dmu_buf_init_user(&zap->zap_dbu, zap_evict, &zap->zap_dbuf); + dmu_buf_init_user(&zap->zap_dbu, zap_evict_sync, NULL, &zap->zap_dbuf); winner = dmu_buf_set_user(db, &zap->zap_dbu); if (winner != NULL) @@ -747,7 +747,7 @@ zap_destroy(objset_t *os, uint64_t zapobj, dmu_tx_t *t } void -zap_evict(void *dbu) +zap_evict_sync(void *dbu) { zap_t *zap = dbu; From owner-svn-src-all@freebsd.org Wed Jul 26 16:12:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1129D9840D; Wed, 26 Jul 2017 16:12:21 +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 8B91A68596; Wed, 26 Jul 2017 16:12:21 +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 v6QGCKPn063259; Wed, 26 Jul 2017 16:12:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGCKgu063258; Wed, 26 Jul 2017 16:12:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261612.v6QGCKgu063258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321528 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:12:21 -0000 Author: mav Date: Wed Jul 26 16:12:20 2017 New Revision: 321528 URL: https://svnweb.freebsd.org/changeset/base/321528 Log: MFC r314280: MFV 314276 7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517 https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517 https://www.illumos.org/issues/7570 Based on the discovery that every unmap waits for the commit of the txn to the ZIL, introducing a very high latency to unmap commands, this behavior was made into a tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is that by default SCSI unmap commands will result in space being freed within the zvol (today they are ignored and returned with good status). However, unlike the code today, instead of 18+ms per unmap, they take about 30us. With the testing done on NTFS against a Win2k12 target, the new behavior should work seamlessly. Files on the zvol that have already been set with the zfree application will continue to write 0's when deleted, and any new files created since zvol creation will send unmap commands when deleted. This behavior exists today, but with this change the unmap commands will be processed and result in reclaim of space. Author: Stephen Blinick Reviewed by: Dan Kimmel Reviewed by: Matt Ahrens Reviewed by: Steve Gonczi Reviewed by: Pavel Zakharov Reviewed by: Saso Kiselkov Reviewed by: Yuri Pankov Approved by: Robert Mustacchi Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Wed Jul 26 16:11:08 2017 (r321527) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Wed Jul 26 16:12:20 2017 (r321528) @@ -27,7 +27,7 @@ * Portions Copyright 2010 Robert Milkowski * * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -202,11 +202,22 @@ int zvol_maxphys = DMU_MAX_ACCESS/2; * Toggle unmap functionality. */ boolean_t zvol_unmap_enabled = B_TRUE; + +/* + * If true, unmaps requested as synchronous are executed synchronously, + * otherwise all unmaps are asynchronous. + */ +boolean_t zvol_unmap_sync_enabled = B_FALSE; + #ifndef illumos SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN, &zvol_unmap_enabled, 0, "Enable UNMAP functionality"); +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_sync_enabled, CTLFLAG_RWTUN, + &zvol_unmap_sync_enabled, 0, + "UNMAPs requested as sync are executed synchronously"); + static d_open_t zvol_d_open; static d_close_t zvol_d_close; static d_read_t zvol_read; @@ -2277,26 +2288,21 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, zfs_range_unlock(rl); - if (error == 0) { - /* - * If the write-cache is disabled or 'sync' property - * is set to 'always' then treat this as a synchronous - * operation (i.e. commit to zil). - */ - if (!(zv->zv_flags & ZVOL_WCE) || - (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS)) - zil_commit(zv->zv_zilog, ZVOL_OBJ); - - /* - * If the caller really wants synchronous writes, and - * can't wait for them, don't return until the write - * is done. - */ - if (df.df_flags & DF_WAIT_SYNC) { - txg_wait_synced( - dmu_objset_pool(zv->zv_objset), 0); - } + /* + * If the write-cache is disabled, 'sync' property + * is set to 'always', or if the caller is asking for + * a synchronous free, commit this operation to the zil. + * This will sync any previous uncommitted writes to the + * zvol object. + * Can be overridden by the zvol_unmap_sync_enabled tunable. + */ + if ((error == 0) && zvol_unmap_sync_enabled && + (!(zv->zv_flags & ZVOL_WCE) || + (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) || + (df.df_flags & DF_WAIT_SYNC))) { + zil_commit(zv->zv_zilog, ZVOL_OBJ); } + return (error); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:14:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34D9CD984E7; Wed, 26 Jul 2017 16:14:07 +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 C50C4686FF; Wed, 26 Jul 2017 16:14:06 +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 v6QGE6nQ063374; Wed, 26 Jul 2017 16:14:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGE5r3063367; Wed, 26 Jul 2017 16:14:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261614.v6QGE5r3063367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321529 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/kern sys/cddl/compat... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl... X-SVN-Commit-Revision: 321529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:14:07 -0000 Author: mav Date: Wed Jul 26 16:14:05 2017 New Revision: 321529 URL: https://svnweb.freebsd.org/changeset/base/321529 Log: MFC r315896: MFV r315290, r315291: 7303 dynamic metaslab selection illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18 https://www.illumos.org/issues/7303 This change introduces a new weighting algorithm to improve metaslab selection . The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a res ult, the metaslab weight now encodes the type of weighting algorithm used (size-based vs segment-based). This also introduce a new allocation tracing facility and two new dcmds to hel p debug allocation problems. Each zio now contains a zio_alloc_list_t structure that is populated as the zio goes through the allocations stage. Here's an example of how to use the tracing facility: > c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace MSID DVA ASIZE WEIGHT RESULT VDEV - 0 400 0 NOT_ALLOCATABLE ztest.0a - 0 400 0 NOT_ALLOCATABLE ztest.0a - 0 400 0 ENOSPC ztest.0a - 0 200 0 NOT_ALLOCATABLE ztest.0a - 0 200 0 NOT_ALLOCATABLE ztest.0a - 0 200 0 ENOSPC ztest.0a 1 0 400 1 x 8M 17b1a00 ztest.0a > 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace MSID DVA ASIZE WEIGHT RESULT VDEV - 0 200 0 NOT_ALLOCATABLE mirror-2 - 0 200 0 NOT_ALLOCATABLE mirror-0 1 0 200 1 x 4M 112ae00 mirror-1 - 1 200 0 NOT_ALLOCATABLE mirror-2 - 1 200 0 NOT_ALLOCATABLE mirror-0 1 1 200 1 x 4M 112b000 mirror-1 - 2 200 0 NOT_ALLOCATABLE mirror-2 If the metaslab is using segment-based weighting then the WEIGHT column will display the number of segments available in the bucket where the allocation attempt was made. Author: George Wilson Reviewed by: Alex Reece Reviewed by: Chris Siden Reviewed by: Dan Kimmel Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Pavel Zakharov Reviewed by: Prakash Surya Reviewed by: Don Brady Approved by: Richard Lowe Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c stable/11/sys/cddl/compat/opensolaris/sys/kstat.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 26 16:14:05 2017 (r321529) @@ -2585,10 +2585,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; + + /* + * We are going to be changing the meaning of the metaslab's + * ms_tree. Ensure that the allocator doesn't try to + * use the tree. + */ + spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; + spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; + metaslab_group_t *mg = vd->vdev_mg; for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; + ASSERT3P(msp->ms_group, ==, mg); mutex_enter(&msp->ms_lock); metaslab_unload(msp); @@ -2609,8 +2620,6 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) (longlong_t)m, (longlong_t)vd->vdev_ms_count); - msp->ms_ops = &zdb_metaslab_ops; - /* * We don't want to spend the CPU * manipulating the size-ordered @@ -2620,7 +2629,10 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) msp->ms_tree->rt_ops = NULL; VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); - msp->ms_loaded = B_TRUE; + + if (!msp->ms_loaded) { + msp->ms_loaded = B_TRUE; + } } mutex_exit(&msp->ms_lock); } @@ -2642,8 +2654,10 @@ zdb_leak_fini(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; for (int c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; + metaslab_group_t *mg = vd->vdev_mg; for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; + ASSERT3P(mg, ==, msp->ms_group); mutex_enter(&msp->ms_lock); /* @@ -2657,7 +2671,10 @@ zdb_leak_fini(spa_t *spa) * from the ms_tree. */ range_tree_vacate(msp->ms_tree, zdb_leak, vd); - msp->ms_loaded = B_FALSE; + + if (msp->ms_loaded) { + msp->ms_loaded = B_FALSE; + } mutex_exit(&msp->ms_lock); } Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Jul 26 16:14:05 2017 (r321529) @@ -173,7 +173,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = .zo_mirrors = 2, .zo_raidz = 4, .zo_raidz_parity = 1, - .zo_vdev_size = SPA_MINDEVSIZE * 2, + .zo_vdev_size = SPA_MINDEVSIZE * 4, /* 256m default size */ .zo_datasets = 7, .zo_threads = 23, .zo_passtime = 60, /* 60 seconds */ Modified: stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Jul 26 16:14:05 2017 (r321529) @@ -97,6 +97,11 @@ kstat_create(char *module, int instance, char *name, c /*ARGSUSED*/ void +kstat_named_init(kstat_named_t *knp, const char *name, uchar_t type) +{} + +/*ARGSUSED*/ +void kstat_install(kstat_t *ksp) {} Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c ============================================================================== --- stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Wed Jul 26 16:14:05 2017 (r321529) @@ -129,3 +129,19 @@ kstat_delete(kstat_t *ksp) sysctl_ctx_free(&ksp->ks_sysctl_ctx); free(ksp, M_KSTAT); } + +void +kstat_set_string(char *dst, const char *src) +{ + + bzero(dst, KSTAT_STRLEN); + (void) strncpy(dst, src, KSTAT_STRLEN - 1); +} + +void +kstat_named_init(kstat_named_t *knp, const char *name, uchar_t data_type) +{ + + kstat_set_string(knp->name, name); + knp->data_type = data_type; +} Modified: stable/11/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- stable/11/sys/cddl/compat/opensolaris/sys/kstat.h Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/sys/cddl/compat/opensolaris/sys/kstat.h Wed Jul 26 16:14:05 2017 (r321529) @@ -69,5 +69,7 @@ kstat_t *kstat_create(char *module, int instance, char uchar_t type, ulong_t ndata, uchar_t flags); void kstat_install(kstat_t *ksp); void kstat_delete(kstat_t *ksp); +void kstat_set_string(char *, const char *); +void kstat_named_init(kstat_named_t *, const char *, uchar_t); #endif /* _OPENSOLARIS_SYS_KSTAT_H_ */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:12:20 2017 (r321528) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:14:05 2017 (r321529) @@ -41,11 +41,6 @@ SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, #define GANG_ALLOCATION(flags) \ ((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER)) -#define METASLAB_WEIGHT_PRIMARY (1ULL << 63) -#define METASLAB_WEIGHT_SECONDARY (1ULL << 62) -#define METASLAB_ACTIVE_MASK \ - (METASLAB_WEIGHT_PRIMARY | METASLAB_WEIGHT_SECONDARY) - uint64_t metaslab_aliquot = 512ULL << 10; uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1; /* force gang blocks */ SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, gang_bang, CTLFLAG_RWTUN, @@ -55,7 +50,7 @@ SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, gang_bang, CT /* * The in-core space map representation is more compact than its on-disk form. * The zfs_condense_pct determines how much more compact the in-core - * space_map representation must be before we compact it on-disk. + * space map representation must be before we compact it on-disk. * Values should be greater than or equal to 100. */ int zfs_condense_pct = 200; @@ -153,7 +148,7 @@ SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, df_alloc_thre /* * The minimum free space, in percent, which must be available * in a space map to continue allocations in a first-fit fashion. - * Once the space_map's free space drops below this level we dynamically + * Once the space map's free space drops below this level we dynamically * switch to using best-fit allocations. */ int metaslab_df_free_pct = 4; @@ -230,9 +225,40 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, bias_enabled, &metaslab_bias_enabled, 0, "Enable metaslab group biasing"); -static uint64_t metaslab_fragmentation(metaslab_t *); +/* + * Enable/disable segment-based metaslab selection. + */ +boolean_t zfs_metaslab_segment_weight_enabled = B_TRUE; /* + * When using segment-based metaslab selection, we will continue + * allocating from the active metaslab until we have exhausted + * zfs_metaslab_switch_threshold of its buckets. + */ +int zfs_metaslab_switch_threshold = 2; + +/* + * Internal switch to enable/disable the metaslab allocation tracing + * facility. + */ +boolean_t metaslab_trace_enabled = B_TRUE; + +/* + * Maximum entries that the metaslab allocation tracing facility will keep + * in a given list when running in non-debug mode. We limit the number + * of entries in non-debug mode to prevent us from using up too much memory. + * The limit should be sufficiently large that we don't expect any allocation + * to every exceed this value. In debug mode, the system will panic if this + * limit is ever reached allowing for further investigation. + */ +uint64_t metaslab_trace_max_entries = 5000; + +static uint64_t metaslab_weight(metaslab_t *); +static void metaslab_set_fragmentation(metaslab_t *); + +kmem_cache_t *metaslab_alloc_trace_cache; + +/* * ========================================================================== * Metaslab classes * ========================================================================== @@ -475,11 +501,6 @@ metaslab_class_expandable_space(metaslab_class_t *mc) return (space); } -/* - * ========================================================================== - * Metaslab groups - * ========================================================================== - */ static int metaslab_compare(const void *x1, const void *x2) { @@ -505,6 +526,57 @@ metaslab_compare(const void *x1, const void *x2) } /* + * Verify that the space accounting on disk matches the in-core range_trees. + */ +void +metaslab_verify_space(metaslab_t *msp, uint64_t txg) +{ + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + uint64_t allocated = 0; + uint64_t freed = 0; + uint64_t sm_free_space, msp_free_space; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + if ((zfs_flags & ZFS_DEBUG_METASLAB_VERIFY) == 0) + return; + + /* + * We can only verify the metaslab space when we're called + * from syncing context with a loaded metaslab that has an allocated + * space map. Calling this in non-syncing context does not + * provide a consistent view of the metaslab since we're performing + * allocations in the future. + */ + if (txg != spa_syncing_txg(spa) || msp->ms_sm == NULL || + !msp->ms_loaded) + return; + + sm_free_space = msp->ms_size - space_map_allocated(msp->ms_sm) - + space_map_alloc_delta(msp->ms_sm); + + /* + * Account for future allocations since we would have already + * deducted that space from the ms_freetree. + */ + for (int t = 0; t < TXG_CONCURRENT_STATES; t++) { + allocated += + range_tree_space(msp->ms_alloctree[(txg + t) & TXG_MASK]); + } + freed = range_tree_space(msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]); + + msp_free_space = range_tree_space(msp->ms_tree) + allocated + + msp->ms_deferspace + freed; + + VERIFY3U(sm_free_space, ==, msp_free_space); +} + +/* + * ========================================================================== + * Metaslab groups + * ========================================================================== + */ +/* * Update the allocatable flag and the metaslab group's capacity. * The allocatable flag is set to true if the capacity is below * the zfs_mg_noalloc_threshold or has a fragmentation value that is @@ -1078,7 +1150,7 @@ static range_tree_ops_t metaslab_rt_ops = { /* * ========================================================================== - * Metaslab block operations + * Common allocator routines * ========================================================================== */ @@ -1097,33 +1169,24 @@ metaslab_block_maxsize(metaslab_t *msp) return (rs->rs_end - rs->rs_start); } -uint64_t -metaslab_block_alloc(metaslab_t *msp, uint64_t size) +static range_seg_t * +metaslab_block_find(avl_tree_t *t, uint64_t start, uint64_t size) { - uint64_t start; - range_tree_t *rt = msp->ms_tree; + range_seg_t *rs, rsearch; + avl_index_t where; - VERIFY(!msp->ms_condensing); + rsearch.rs_start = start; + rsearch.rs_end = start + size; - start = msp->ms_ops->msop_alloc(msp, size); - if (start != -1ULL) { - vdev_t *vd = msp->ms_group->mg_vd; - - VERIFY0(P2PHASE(start, 1ULL << vd->vdev_ashift)); - VERIFY0(P2PHASE(size, 1ULL << vd->vdev_ashift)); - VERIFY3U(range_tree_space(rt) - size, <=, msp->ms_size); - range_tree_remove(rt, start, size); + rs = avl_find(t, &rsearch, &where); + if (rs == NULL) { + rs = avl_nearest(t, where, AVL_AFTER); } - return (start); + + return (rs); } /* - * ========================================================================== - * Common allocator routines - * ========================================================================== - */ - -/* * This is a helper function that can be used by the allocator to find * a suitable block to allocate. This will search the specified AVL * tree looking for a block that matches the specified criteria. @@ -1132,16 +1195,8 @@ static uint64_t metaslab_block_picker(avl_tree_t *t, uint64_t *cursor, uint64_t size, uint64_t align) { - range_seg_t *rs, rsearch; - avl_index_t where; + range_seg_t *rs = metaslab_block_find(t, *cursor, size); - rsearch.rs_start = *cursor; - rsearch.rs_end = *cursor + size; - - rs = avl_find(t, &rsearch, &where); - if (rs == NULL) - rs = avl_nearest(t, where, AVL_AFTER); - while (rs != NULL) { uint64_t offset = P2ROUNDUP(rs->rs_start, align); @@ -1365,6 +1420,7 @@ int metaslab_load(metaslab_t *msp) { int error = 0; + boolean_t success = B_FALSE; ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(!msp->ms_loaded); @@ -1382,14 +1438,18 @@ metaslab_load(metaslab_t *msp) else range_tree_add(msp->ms_tree, msp->ms_start, msp->ms_size); - msp->ms_loaded = (error == 0); + success = (error == 0); msp->ms_loading = B_FALSE; - if (msp->ms_loaded) { + if (success) { + ASSERT3P(msp->ms_group, !=, NULL); + msp->ms_loaded = B_TRUE; + for (int t = 0; t < TXG_DEFER_SIZE; t++) { range_tree_walk(msp->ms_defertree[t], range_tree_remove, msp->ms_tree); } + msp->ms_max_size = metaslab_block_maxsize(msp); } cv_broadcast(&msp->ms_load_cv); return (error); @@ -1402,6 +1462,7 @@ metaslab_unload(metaslab_t *msp) range_tree_vacate(msp->ms_tree, NULL, NULL); msp->ms_loaded = B_FALSE; msp->ms_weight &= ~METASLAB_ACTIVE_MASK; + msp->ms_max_size = 0; } int @@ -1446,21 +1507,23 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 ms->ms_tree = range_tree_create(&metaslab_rt_ops, ms, &ms->ms_lock); metaslab_group_add(mg, ms); - ms->ms_fragmentation = metaslab_fragmentation(ms); - ms->ms_ops = mg->mg_class->mc_ops; + metaslab_set_fragmentation(ms); /* * If we're opening an existing pool (txg == 0) or creating * a new one (txg == TXG_INITIAL), all space is available now. * If we're adding space to an existing pool, the new space * does not become available until after this txg has synced. + * The metaslab's weight will also be initialized when we sync + * out this txg. This ensures that we don't attempt to allocate + * from it before we have initialized it completely. */ if (txg <= TXG_INITIAL) metaslab_sync_done(ms, 0); /* * If metaslab_debug_load is set and we're initializing a metaslab - * that has an allocated space_map object then load the its space + * that has an allocated space map object then load the its space * map so that can verify frees. */ if (metaslab_debug_load && ms->ms_sm != NULL) { @@ -1487,7 +1550,6 @@ metaslab_fini(metaslab_t *msp) metaslab_group_remove(mg, msp); mutex_enter(&msp->ms_lock); - VERIFY(msp->ms_group == NULL); vdev_space_update(mg->mg_vd, -space_map_allocated(msp->ms_sm), 0, -msp->ms_size); @@ -1560,8 +1622,8 @@ int zfs_frag_table[FRAGMENTATION_TABLE_SIZE] = { * not support this metric. Otherwise, the return value should be in the * range [0, 100]. */ -static uint64_t -metaslab_fragmentation(metaslab_t *msp) +static void +metaslab_set_fragmentation(metaslab_t *msp) { spa_t *spa = msp->ms_group->mg_vd->vdev_spa; uint64_t fragmentation = 0; @@ -1569,18 +1631,22 @@ metaslab_fragmentation(metaslab_t *msp) boolean_t feature_enabled = spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM); - if (!feature_enabled) - return (ZFS_FRAG_INVALID); + if (!feature_enabled) { + msp->ms_fragmentation = ZFS_FRAG_INVALID; + return; + } /* * A null space map means that the entire metaslab is free * and thus is not fragmented. */ - if (msp->ms_sm == NULL) - return (0); + if (msp->ms_sm == NULL) { + msp->ms_fragmentation = 0; + return; + } /* - * If this metaslab's space_map has not been upgraded, flag it + * If this metaslab's space map has not been upgraded, flag it * so that we upgrade next time we encounter it. */ if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t)) { @@ -1593,12 +1659,14 @@ metaslab_fragmentation(metaslab_t *msp) spa_dbgmsg(spa, "txg %llu, requesting force condense: " "msp %p, vd %p", txg, msp, vd); } - return (ZFS_FRAG_INVALID); + msp->ms_fragmentation = ZFS_FRAG_INVALID; + return; } for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { uint64_t space = 0; uint8_t shift = msp->ms_sm->sm_shift; + int idx = MIN(shift - SPA_MINBLOCKSHIFT + i, FRAGMENTATION_TABLE_SIZE - 1); @@ -1615,7 +1683,8 @@ metaslab_fragmentation(metaslab_t *msp) if (total > 0) fragmentation /= total; ASSERT3U(fragmentation, <=, 100); - return (fragmentation); + + msp->ms_fragmentation = fragmentation; } /* @@ -1624,30 +1693,20 @@ metaslab_fragmentation(metaslab_t *msp) * the LBA range, and whether the metaslab is loaded. */ static uint64_t -metaslab_weight(metaslab_t *msp) +metaslab_space_weight(metaslab_t *msp) { metaslab_group_t *mg = msp->ms_group; vdev_t *vd = mg->mg_vd; uint64_t weight, space; ASSERT(MUTEX_HELD(&msp->ms_lock)); + ASSERT(!vd->vdev_removing); /* - * This vdev is in the process of being removed so there is nothing - * for us to do here. - */ - if (vd->vdev_removing) { - ASSERT0(space_map_allocated(msp->ms_sm)); - ASSERT0(vd->vdev_ms_shift); - return (0); - } - - /* * The baseline weight is the metaslab's free space. */ space = msp->ms_size - space_map_allocated(msp->ms_sm); - msp->ms_fragmentation = metaslab_fragmentation(msp); if (metaslab_fragmentation_factor_enabled && msp->ms_fragmentation != ZFS_FRAG_INVALID) { /* @@ -1696,9 +1755,213 @@ metaslab_weight(metaslab_t *msp) weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK); } + WEIGHT_SET_SPACEBASED(weight); return (weight); } +/* + * Return the weight of the specified metaslab, according to the segment-based + * weighting algorithm. The metaslab must be loaded. This function can + * be called within a sync pass since it relies only on the metaslab's + * range tree which is always accurate when the metaslab is loaded. + */ +static uint64_t +metaslab_weight_from_range_tree(metaslab_t *msp) +{ + uint64_t weight = 0; + uint32_t segments = 0; + + ASSERT(msp->ms_loaded); + + for (int i = RANGE_TREE_HISTOGRAM_SIZE - 1; i >= SPA_MINBLOCKSHIFT; + i--) { + uint8_t shift = msp->ms_group->mg_vd->vdev_ashift; + int max_idx = SPACE_MAP_HISTOGRAM_SIZE + shift - 1; + + segments <<= 1; + segments += msp->ms_tree->rt_histogram[i]; + + /* + * The range tree provides more precision than the space map + * and must be downgraded so that all values fit within the + * space map's histogram. This allows us to compare loaded + * vs. unloaded metaslabs to determine which metaslab is + * considered "best". + */ + if (i > max_idx) + continue; + + if (segments != 0) { + WEIGHT_SET_COUNT(weight, segments); + WEIGHT_SET_INDEX(weight, i); + WEIGHT_SET_ACTIVE(weight, 0); + break; + } + } + return (weight); +} + +/* + * Calculate the weight based on the on-disk histogram. This should only + * be called after a sync pass has completely finished since the on-disk + * information is updated in metaslab_sync(). + */ +static uint64_t +metaslab_weight_from_spacemap(metaslab_t *msp) +{ + uint64_t weight = 0; + + for (int i = SPACE_MAP_HISTOGRAM_SIZE - 1; i >= 0; i--) { + if (msp->ms_sm->sm_phys->smp_histogram[i] != 0) { + WEIGHT_SET_COUNT(weight, + msp->ms_sm->sm_phys->smp_histogram[i]); + WEIGHT_SET_INDEX(weight, i + + msp->ms_sm->sm_shift); + WEIGHT_SET_ACTIVE(weight, 0); + break; + } + } + return (weight); +} + +/* + * Compute a segment-based weight for the specified metaslab. The weight + * is determined by highest bucket in the histogram. The information + * for the highest bucket is encoded into the weight value. + */ +static uint64_t +metaslab_segment_weight(metaslab_t *msp) +{ + metaslab_group_t *mg = msp->ms_group; + uint64_t weight = 0; + uint8_t shift = mg->mg_vd->vdev_ashift; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + /* + * The metaslab is completely free. + */ + if (space_map_allocated(msp->ms_sm) == 0) { + int idx = highbit64(msp->ms_size) - 1; + int max_idx = SPACE_MAP_HISTOGRAM_SIZE + shift - 1; + + if (idx < max_idx) { + WEIGHT_SET_COUNT(weight, 1ULL); + WEIGHT_SET_INDEX(weight, idx); + } else { + WEIGHT_SET_COUNT(weight, 1ULL << (idx - max_idx)); + WEIGHT_SET_INDEX(weight, max_idx); + } + WEIGHT_SET_ACTIVE(weight, 0); + ASSERT(!WEIGHT_IS_SPACEBASED(weight)); + + return (weight); + } + + ASSERT3U(msp->ms_sm->sm_dbuf->db_size, ==, sizeof (space_map_phys_t)); + + /* + * If the metaslab is fully allocated then just make the weight 0. + */ + if (space_map_allocated(msp->ms_sm) == msp->ms_size) + return (0); + /* + * If the metaslab is already loaded, then use the range tree to + * determine the weight. Otherwise, we rely on the space map information + * to generate the weight. + */ + if (msp->ms_loaded) { + weight = metaslab_weight_from_range_tree(msp); + } else { + weight = metaslab_weight_from_spacemap(msp); + } + + /* + * If the metaslab was active the last time we calculated its weight + * then keep it active. We want to consume the entire region that + * is associated with this weight. + */ + if (msp->ms_activation_weight != 0 && weight != 0) + WEIGHT_SET_ACTIVE(weight, WEIGHT_GET_ACTIVE(msp->ms_weight)); + return (weight); +} + +/* + * Determine if we should attempt to allocate from this metaslab. If the + * metaslab has a maximum size then we can quickly determine if the desired + * allocation size can be satisfied. Otherwise, if we're using segment-based + * weighting then we can determine the maximum allocation that this metaslab + * can accommodate based on the index encoded in the weight. If we're using + * space-based weights then rely on the entire weight (excluding the weight + * type bit). + */ +boolean_t +metaslab_should_allocate(metaslab_t *msp, uint64_t asize) +{ + boolean_t should_allocate; + + if (msp->ms_max_size != 0) + return (msp->ms_max_size >= asize); + + if (!WEIGHT_IS_SPACEBASED(msp->ms_weight)) { + /* + * The metaslab segment weight indicates segments in the + * range [2^i, 2^(i+1)), where i is the index in the weight. + * Since the asize might be in the middle of the range, we + * should attempt the allocation if asize < 2^(i+1). + */ + should_allocate = (asize < + 1ULL << (WEIGHT_GET_INDEX(msp->ms_weight) + 1)); + } else { + should_allocate = (asize <= + (msp->ms_weight & ~METASLAB_WEIGHT_TYPE)); + } + return (should_allocate); +} + +static uint64_t +metaslab_weight(metaslab_t *msp) +{ + vdev_t *vd = msp->ms_group->mg_vd; + spa_t *spa = vd->vdev_spa; + uint64_t weight; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + /* + * This vdev is in the process of being removed so there is nothing + * for us to do here. + */ + if (vd->vdev_removing) { + ASSERT0(space_map_allocated(msp->ms_sm)); + ASSERT0(vd->vdev_ms_shift); + return (0); + } + + metaslab_set_fragmentation(msp); + + /* + * Update the maximum size if the metaslab is loaded. This will + * ensure that we get an accurate maximum size if newly freed space + * has been added back into the free tree. + */ + if (msp->ms_loaded) + msp->ms_max_size = metaslab_block_maxsize(msp); + + /* + * Segment-based weighting requires space map histogram support. + */ + if (zfs_metaslab_segment_weight_enabled && + spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM) && + (msp->ms_sm == NULL || msp->ms_sm->sm_dbuf->db_size == + sizeof (space_map_phys_t))) { + weight = metaslab_segment_weight(msp); + } else { + weight = metaslab_space_weight(msp); + } + return (weight); +} + static int metaslab_activate(metaslab_t *msp, uint64_t activation_weight) { @@ -1714,6 +1977,7 @@ metaslab_activate(metaslab_t *msp, uint64_t activation } } + msp->ms_activation_weight = msp->ms_weight; metaslab_group_sort(msp->ms_group, msp, msp->ms_weight | activation_weight); } @@ -1724,18 +1988,56 @@ metaslab_activate(metaslab_t *msp, uint64_t activation } static void -metaslab_passivate(metaslab_t *msp, uint64_t size) +metaslab_passivate(metaslab_t *msp, uint64_t weight) { + uint64_t size = weight & ~METASLAB_WEIGHT_TYPE; + /* * If size < SPA_MINBLOCKSIZE, then we will not allocate from * this metaslab again. In that case, it had better be empty, * or we would be leaving space on the table. */ - ASSERT(size >= SPA_MINBLOCKSIZE || range_tree_space(msp->ms_tree) == 0); - metaslab_group_sort(msp->ms_group, msp, MIN(msp->ms_weight, size)); + ASSERT(size >= SPA_MINBLOCKSIZE || + range_tree_space(msp->ms_tree) == 0); + ASSERT0(weight & METASLAB_ACTIVE_MASK); + + msp->ms_activation_weight = 0; + metaslab_group_sort(msp->ms_group, msp, weight); ASSERT((msp->ms_weight & METASLAB_ACTIVE_MASK) == 0); } +/* + * Segment-based metaslabs are activated once and remain active until + * we either fail an allocation attempt (similar to space-based metaslabs) + * or have exhausted the free space in zfs_metaslab_switch_threshold + * buckets since the metaslab was activated. This function checks to see + * if we've exhaused the zfs_metaslab_switch_threshold buckets in the + * metaslab and passivates it proactively. This will allow us to select a + * metaslabs with larger contiguous region if any remaining within this + * metaslab group. If we're in sync pass > 1, then we continue using this + * metaslab so that we don't dirty more block and cause more sync passes. + */ +void +metaslab_segment_may_passivate(metaslab_t *msp) +{ + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + + if (WEIGHT_IS_SPACEBASED(msp->ms_weight) || spa_sync_pass(spa) > 1) + return; + + /* + * Since we are in the middle of a sync pass, the most accurate + * information that is accessible to us is the in-core range tree + * histogram; calculate the new weight based on that information. + */ + uint64_t weight = metaslab_weight_from_range_tree(msp); + int activation_idx = WEIGHT_GET_INDEX(msp->ms_activation_weight); + int current_idx = WEIGHT_GET_INDEX(weight); + + if (current_idx <= activation_idx - zfs_metaslab_switch_threshold) + metaslab_passivate(msp, weight); +} + static void metaslab_preload(void *arg) { @@ -1748,11 +2050,7 @@ metaslab_preload(void *arg) metaslab_load_wait(msp); if (!msp->ms_loaded) (void) metaslab_load(msp); - - /* - * Set the ms_access_txg value so that we don't unload it right away. - */ - msp->ms_access_txg = spa_syncing_txg(spa) + metaslab_unload_delay + 1; + msp->ms_selected_txg = spa_syncing_txg(spa); mutex_exit(&msp->ms_lock); } @@ -1773,10 +2071,7 @@ metaslab_group_preload(metaslab_group_t *mg) /* * Load the next potential metaslabs */ - msp = avl_first(t); - while (msp != NULL) { - metaslab_t *msp_next = AVL_NEXT(t, msp); - + for (msp = avl_first(t); msp != NULL; msp = AVL_NEXT(t, msp)) { /* * We preload only the maximum number of metaslabs specified * by metaslab_preload_limit. If a metaslab is being forced @@ -1784,27 +2079,11 @@ metaslab_group_preload(metaslab_group_t *mg) * that force condensing happens in the next txg. */ if (++m > metaslab_preload_limit && !msp->ms_condense_wanted) { - msp = msp_next; continue; } - /* - * We must drop the metaslab group lock here to preserve - * lock ordering with the ms_lock (when grabbing both - * the mg_lock and the ms_lock, the ms_lock must be taken - * first). As a result, it is possible that the ordering - * of the metaslabs within the avl tree may change before - * we reacquire the lock. The metaslab cannot be removed from - * the tree while we're in syncing context so it is safe to - * drop the mg_lock here. If the metaslabs are reordered - * nothing will break -- we just may end up loading a - * less than optimal one. - */ - mutex_exit(&mg->mg_lock); VERIFY(taskq_dispatch(mg->mg_taskq, metaslab_preload, msp, TQ_SLEEP) != 0); - mutex_enter(&mg->mg_lock); - msp = msp_next; } mutex_exit(&mg->mg_lock); } @@ -1953,7 +2232,7 @@ metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_t mutex_enter(&msp->ms_lock); /* - * While we would ideally like to create a space_map representation + * While we would ideally like to create a space map representation * that consists only of allocation records, doing so can be * prohibitively expensive because the in-core free tree can be * large, and therefore computationally expensive to subtract @@ -2016,7 +2295,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) * metaslab_sync() is the metaslab's ms_tree. No other thread can * be modifying this txg's alloctree, freetree, freed_tree, or * space_map_phys_t. Therefore, we only hold ms_lock to satify - * space_map ASSERTs. We drop it whenever we call into the DMU, + * space map ASSERTs. We drop it whenever we call into the DMU, * because the DMU can call down to us (e.g. via zio_free()) at * any time. */ @@ -2038,7 +2317,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) mutex_enter(&msp->ms_lock); /* - * Note: metaslab_condense() clears the space_map's histogram. + * Note: metaslab_condense() clears the space map's histogram. * Therefore we must verify and remove this histogram before * condensing. */ @@ -2063,16 +2342,38 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) */ space_map_histogram_clear(msp->ms_sm); space_map_histogram_add(msp->ms_sm, msp->ms_tree, tx); - } else { + /* - * Since the space map is not loaded we simply update the - * exisiting histogram with what was freed in this txg. This - * means that the on-disk histogram may not have an accurate - * view of the free space but it's close enough to allow - * us to make allocation decisions. + * Since we've cleared the histogram we need to add back + * any free space that has already been processed, plus + * any deferred space. This allows the on-disk histogram + * to accurately reflect all free space even if some space + * is not yet available for allocation (i.e. deferred). */ - space_map_histogram_add(msp->ms_sm, *freetree, tx); + space_map_histogram_add(msp->ms_sm, *freed_tree, tx); + + /* + * Add back any deferred free space that has not been + * added back into the in-core free tree yet. This will + * ensure that we don't end up with a space map histogram + * that is completely empty unless the metaslab is fully + * allocated. + */ + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + space_map_histogram_add(msp->ms_sm, + msp->ms_defertree[t], tx); + } } + + /* + * Always add the free space from this sync pass to the space + * map histogram. We want to make sure that the on-disk histogram + * accounts for all free space. If the space map is not loaded, + * then we will lose some accuracy but will correct it the next + * time we load the space map. + */ + space_map_histogram_add(msp->ms_sm, *freetree, tx); + metaslab_group_histogram_add(mg, msp); metaslab_group_histogram_verify(mg); metaslab_class_histogram_verify(mg->mg_class); @@ -2091,6 +2392,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) range_tree_vacate(alloctree, NULL, NULL); ASSERT0(range_tree_space(msp->ms_alloctree[txg & TXG_MASK])); + ASSERT0(range_tree_space(msp->ms_alloctree[TXG_CLEAN(txg) & TXG_MASK])); ASSERT0(range_tree_space(msp->ms_freetree[txg & TXG_MASK])); mutex_exit(&msp->ms_lock); @@ -2112,9 +2414,11 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) { metaslab_group_t *mg = msp->ms_group; vdev_t *vd = mg->mg_vd; + spa_t *spa = vd->vdev_spa; range_tree_t **freed_tree; range_tree_t **defer_tree; int64_t alloc_delta, defer_delta; + boolean_t defer_allowed = B_TRUE; ASSERT(!vd->vdev_ishole); @@ -2149,9 +2453,20 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) freed_tree = &msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]; defer_tree = &msp->ms_defertree[txg % TXG_DEFER_SIZE]; + uint64_t free_space = metaslab_class_get_space(spa_normal_class(spa)) - + metaslab_class_get_alloc(spa_normal_class(spa)); + if (free_space <= spa_get_slop_space(spa)) { + defer_allowed = B_FALSE; + } + + defer_delta = 0; alloc_delta = space_map_alloc_delta(msp->ms_sm); - defer_delta = range_tree_space(*freed_tree) - - range_tree_space(*defer_tree); + if (defer_allowed) { + defer_delta = range_tree_space(*freed_tree) - + range_tree_space(*defer_tree); + } else { + defer_delta -= range_tree_space(*defer_tree); + } vdev_space_update(vd, alloc_delta + defer_delta, defer_delta, 0); @@ -2172,7 +2487,12 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) */ range_tree_vacate(*defer_tree, msp->ms_loaded ? range_tree_add : NULL, msp->ms_tree); - range_tree_swap(freed_tree, defer_tree); + if (defer_allowed) { + range_tree_swap(freed_tree, defer_tree); + } else { + range_tree_vacate(*freed_tree, + msp->ms_loaded ? range_tree_add : NULL, msp->ms_tree); + } space_map_update(msp->ms_sm); @@ -2187,7 +2507,18 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); } - if (msp->ms_loaded && msp->ms_access_txg < txg) { + /* + * Calculate the new weights before unloading any metaslabs. + * This will give us the most accurate weighting. + */ + metaslab_group_sort(mg, msp, metaslab_weight(msp)); + + /* + * If the metaslab is loaded and we've not tried to load or allocate + * from it in 'metaslab_unload_delay' txgs, then unload it. + */ + if (msp->ms_loaded && + msp->ms_selected_txg + metaslab_unload_delay < txg) { for (int t = 1; t < TXG_CONCURRENT_STATES; t++) { VERIFY0(range_tree_space( msp->ms_alloctree[(txg + t) & TXG_MASK])); @@ -2197,7 +2528,6 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) metaslab_unload(msp); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 16:14:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33955D98597; Wed, 26 Jul 2017 16:14:59 +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 0142A68861; Wed, 26 Jul 2017 16:14:58 +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 v6QGEwiu063455; Wed, 26 Jul 2017 16:14:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGEwEu063453; Wed, 26 Jul 2017 16:14:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261614.v6QGEwEu063453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321530 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:14:59 -0000 Author: mav Date: Wed Jul 26 16:14:57 2017 New Revision: 321530 URL: https://svnweb.freebsd.org/changeset/base/321530 Log: MFC r316037: MFV: 315989 7603 xuio_stat_wbuf_* should be declared (void) illumos/illumos-gate@99aa8b55058e512798eafbd71f72f916bdc10181 https://github.com/illumos/illumos-gate/commit/99aa8b55058e512798eafbd71f72f916bdc10181 https://www.illumos.org/issues/7603 The funcs are declared k&r style, where the args are not specified: void xuio_stat_wbuf_copied(); They should be declared to take no arguments: void xuio_stat_wbuf_copied(void); Need to change both .c and .h. Author: Prashanth Sreenivasa Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Robert Mustacchi Approved by: Richard Lowe Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 16:14:05 2017 (r321529) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 16:14:57 2017 (r321530) @@ -1124,13 +1124,13 @@ xuio_stat_fini(void) } void -xuio_stat_wbuf_copied() +xuio_stat_wbuf_copied(void) { XUIOSTAT_BUMP(xuiostat_wbuf_copied); } void -xuio_stat_wbuf_nocopy() +xuio_stat_wbuf_nocopy(void) { XUIOSTAT_BUMP(xuiostat_wbuf_nocopy); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:14:05 2017 (r321529) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:14:57 2017 (r321530) @@ -762,8 +762,8 @@ int dmu_xuio_add(struct xuio *uio, struct arc_buf *abu int dmu_xuio_cnt(struct xuio *uio); struct arc_buf *dmu_xuio_arcbuf(struct xuio *uio, int i); void dmu_xuio_clear(struct xuio *uio, int i); -void xuio_stat_wbuf_copied(); -void xuio_stat_wbuf_nocopy(); +void xuio_stat_wbuf_copied(void); +void xuio_stat_wbuf_nocopy(void); extern boolean_t zfs_prefetch_disable; extern int zfs_max_recordsize; From owner-svn-src-all@freebsd.org Wed Jul 26 16:16:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D14D98664; Wed, 26 Jul 2017 16:16:44 +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 BCB7C689B3; Wed, 26 Jul 2017 16:16:44 +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 v6QGGhPr063581; Wed, 26 Jul 2017 16:16:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGGhhr063577; Wed, 26 Jul 2017 16:16:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261616.v6QGGhhr063577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321531 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:16:45 -0000 Author: mav Date: Wed Jul 26 16:16:43 2017 New Revision: 321531 URL: https://svnweb.freebsd.org/changeset/base/321531 Log: MFC r317235: MFV 316868 7430 Backfill metadnode more intelligently illumos/illumos-gate@af346df58864e8fe897b1ff1a3a4c12f9294391b https://github.com/illumos/illumos-gate/commit/af346df58864e8fe897b1ff1a3a4c12f9 294391b https://www.illumos.org/issues/7430 Description and patch from brought over from the following ZoL commit: https:/ / github.com/zfsonlinux/zfs/commit/68cbd56e182ab949f58d004778d463aeb3f595c6 Only attempt to backfill lower metadnode object numbers if at least 4096 objects have been freed since the last rescan, and at most once per transaction group. This avoids a pathology in dmu_object_alloc() that caused O(N^2) behavior for create-heavy workloads and substantially improves object creation rates. As summarized by @mahrens in #4636: "Normally, the object allocator simply checks to see if the next object is available. The slow calls happened when dmu_object_alloc() checks to see if it can backfill lower object numbers. This happens every time we move on to a new L1 indirect block (i.e. every 32 * 128 = 4096 objects). When re-checking lower object numbers, we use the on-disk fill count (blkptr_t:blk_fill) to quickly skip over indirect blocks that don?t have enough free dnodes (defined as an L2 with at least 393,216 of 524,288 dnodes free). Therefore, we may find that a block of dnodes has a low (or zero) fill count, and yet we can?t allocate any of its dnodes, because they've been allocated in memory but not yet written to disk. In this case we have to hold each of the dnodes and then notice that it has been allocated in memory. The end result is that allocating N objects in the same TXG can require CPU usage proportional to N^2." Add a tunable dmu_rescan_dnode_threshold to define the number of objects that must be freed before a rescan is performed. Don't bother to export this as a module option because testing doesn't show a compelling reason to change it. The vast majority of the performance gain comes from limit the rescan to at most once per TXG. Reviewed by: Alek Pinchuk Reviewed by: Brian Behlendorf Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Ned Bass Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Jul 26 16:14:57 2017 (r321530) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Jul 26 16:16:43 2017 (r321531) @@ -36,20 +36,22 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, i dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { uint64_t object; - uint64_t L2_dnode_count = DNODES_PER_BLOCK << + uint64_t L1_dnode_count = DNODES_PER_BLOCK << (DMU_META_DNODE(os)->dn_indblkshift - SPA_BLKPTRSHIFT); dnode_t *dn = NULL; - int restarted = B_FALSE; mutex_enter(&os->os_obj_lock); for (;;) { object = os->os_obj_next; /* - * Each time we polish off an L2 bp worth of dnodes - * (2^13 objects), move to another L2 bp that's still - * reasonably sparse (at most 1/4 full). Look from the - * beginning once, but after that keep looking from here. - * If we can't find one, just keep going from here. + * Each time we polish off a L1 bp worth of dnodes (2^12 + * objects), move to another L1 bp that's still reasonably + * sparse (at most 1/4 full). Look from the beginning at most + * once per txg, but after that keep looking from here. + * os_scan_dnodes is set during txg sync if enough objects + * have been freed since the previous rescan to justify + * backfilling again. If we can't find a suitable block, just + * keep going from here. * * Note that dmu_traverse depends on the behavior that we use * multiple blocks of the dnode object before going back to @@ -57,12 +59,19 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, i * that property or find another solution to the issues * described in traverse_visitbp. */ - if (P2PHASE(object, L2_dnode_count) == 0) { - uint64_t offset = restarted ? object << DNODE_SHIFT : 0; - int error = dnode_next_offset(DMU_META_DNODE(os), + + if (P2PHASE(object, L1_dnode_count) == 0) { + uint64_t offset; + int error; + if (os->os_rescan_dnodes) { + offset = 0; + os->os_rescan_dnodes = B_FALSE; + } else { + offset = object << DNODE_SHIFT; + } + error = dnode_next_offset(DMU_META_DNODE(os), DNODE_FIND_HOLE, &offset, 2, DNODES_PER_BLOCK >> 2, 0); - restarted = B_TRUE; if (error == 0) object = offset >> DNODE_SHIFT; } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:14:57 2017 (r321530) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:16:43 2017 (r321531) @@ -67,6 +67,13 @@ krwlock_t os_lock; */ int dmu_find_threads = 0; +/* + * Backfill lower metadnode objects after this many have been freed. + * Backfilling negatively impacts object creation rates, so only do it + * if there are enough holes to fill. + */ +int dmu_rescan_dnode_threshold = 131072; + static void dmu_objset_find_dp_cb(void *arg); void @@ -1176,6 +1183,13 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx if (dr->dr_zio) zio_nowait(dr->dr_zio); } + + /* Enable dnode backfill if enough objects have been freed. */ + if (os->os_freed_dnodes >= dmu_rescan_dnode_threshold) { + os->os_rescan_dnodes = B_TRUE; + os->os_freed_dnodes = 0; + } + /* * Free intent log blocks up to this tx. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:14:57 2017 (r321530) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:16:43 2017 (r321531) @@ -672,6 +672,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx) } if (freeing_dnode) { + dn->dn_objset->os_freed_dnodes++; dnode_sync_free(dn, tx); return; } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Wed Jul 26 16:14:57 2017 (r321530) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Wed Jul 26 16:16:43 2017 (r321531) @@ -112,6 +112,8 @@ struct objset { zil_header_t os_zil_header; list_t os_synced_dnodes; uint64_t os_flags; + uint64_t os_freed_dnodes; + boolean_t os_rescan_dnodes; /* Protected by os_obj_lock */ kmutex_t os_obj_lock; From owner-svn-src-all@freebsd.org Wed Jul 26 16:18:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72FDFD986F0; Wed, 26 Jul 2017 16:18:20 +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 4BFD368AE4; Wed, 26 Jul 2017 16:18:20 +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 v6QGIJDU063688; Wed, 26 Jul 2017 16:18:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGIJV8063686; Wed, 26 Jul 2017 16:18:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261618.v6QGIJV8063686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321532 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:18:20 -0000 Author: mav Date: Wed Jul 26 16:18:19 2017 New Revision: 321532 URL: https://svnweb.freebsd.org/changeset/base/321532 Log: MFC r317237: MFV 316870 7448 ZFS doesn't notice when disk vdevs have no write cache illumos/illumos-gate@295438ba3230419314faaa889a2616f561658bd5 https://github.com/illumos/illumos-gate/commit/295438ba3230419314faaa889a2616f56 1658bd5 https://www.illumos.org/issues/7448 I built a SmartOS image with all the NVMe commits including 7372 (support NVMe volatile write cache) and repeated my dd testing: > #!/bin/bash > for i in `seq 1 1000`; do > dd if=/dev/zero of=file00 bs=1M count=102400 oflag=sync & > dd if=/dev/zero of=file01 bs=1M count=102400 oflag=sync & > wait > rm file00 file01 > done > Previously each dd command took ~145 seconds to finish, now it takes ~400 seconds. Eventually I figured out it is 7372 that causes unnecessary nvme_bd_sync() executions which wasted CPU cycles. If a NVMe device doesn't support a write cache, the nvme_bd_sync function will return ENOTSUP to indicate this to upper layers. It seems this returned value is ignored by ZFS, and as such this bug is not really specific to NVMe. In vdev_disk_io_start() ZFS sends the flush to the disk driver (blkdev) with a callback to vdev_disk_ioctl_done(). As nvme filled in the bd_sync_cache function pointer, blkdev will not return ENOTSUP, as the nvme driver in general does support cache flush. Instead it will issue an asynchronous flush to nvme and immediately return 0, and hence ZFS will not se t vdev_nowritecache here. The nvme driver will at some point process the cache flush command, and if there is no write cache on the device it will return ENOTSUP, which will be delivered to the vdev_disk_ioctl_done() callback. This function will not check the error code and not set nowritecache. The right place to check the error code from the cache flush is in zio_vdev_io_assess(). This would catch both cases, synchronous and asynchronous cache flushes. This would also be independent of the implementation detail that some drivers can return ENOTSUP immediately. Reviewed by: Dan Fields Reviewed by: Alek Pinchuk Reviewed by: George Wilson Approved by: Dan McDonald Author: Hans Rosenfeld Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Wed Jul 26 16:16:43 2017 (r321531) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Wed Jul 26 16:18:19 2017 (r321532) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ @@ -743,16 +743,6 @@ vdev_disk_io_start(zio_t *zio) return; } - if (error == ENOTSUP || error == ENOTTY) { - /* - * If we get ENOTSUP or ENOTTY, we know that - * no future attempts will ever succeed. - * In this case we set a persistent bit so - * that we don't bother with the ioctl in the - * future. - */ - vd->vdev_nowritecache = B_TRUE; - } zio->io_error = error; break; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:16:43 2017 (r321531) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:18:19 2017 (r321532) @@ -3302,6 +3302,16 @@ zio_vdev_io_assess(zio_t *zio) vd->vdev_cant_write = B_TRUE; } + /* + * If a cache flush returns ENOTSUP or ENOTTY, we know that no future + * attempts will ever succeed. In this case we set a persistent bit so + * that we don't bother with it in the future. + */ + if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) && + zio->io_type == ZIO_TYPE_IOCTL && + zio->io_cmd == DKIOCFLUSHWRITECACHE && vd != NULL) + vd->vdev_nowritecache = B_TRUE; + if (zio->io_error) zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; From owner-svn-src-all@freebsd.org Wed Jul 26 16:19:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64AC8D987CD; Wed, 26 Jul 2017 16:19:05 +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 3198968C55; Wed, 26 Jul 2017 16:19:05 +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 v6QGJ4l3063775; Wed, 26 Jul 2017 16:19:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGJ4T7063774; Wed, 26 Jul 2017 16:19:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261619.v6QGJ4T7063774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321533 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:19:05 -0000 Author: mav Date: Wed Jul 26 16:19:04 2017 New Revision: 321533 URL: https://svnweb.freebsd.org/changeset/base/321533 Log: MFC r317238: MFV 316871 7490 real checksum errors are silenced when zinject is on illumos/illumos-gate@6cedfc397d92d64e442f0aae4445ac507beaf58f https://github.com/illumos/illumos-gate/commit/6cedfc397d92d64e442f0aae4445ac507beaf58f https://www.illumos.org/issues/7490 When zinject is on, error codes from zfs_checksum_error() can be overwritten due to an incorrect and overly-complex if condition. Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: Dan Kimmel Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Pavel Zakharov Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c Wed Jul 26 16:18:19 2017 (r321532) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c Wed Jul 26 16:19:04 2017 (r321533) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. */ @@ -392,12 +392,13 @@ zio_checksum_error(zio_t *zio, zio_bad_cksum_t *info) error = zio_checksum_error_impl(spa, bp, checksum, data, size, offset, info); - if (error != 0 && zio_injection_enabled && !zio->io_error && - (error = zio_handle_fault_injection(zio, ECKSUM)) != 0) { - info->zbc_injected = 1; - return (error); + if (zio_injection_enabled && error == 0 && zio->io_error == 0) { + error = zio_handle_fault_injection(zio, ECKSUM); + if (error != 0) + info->zbc_injected = 1; } + return (error); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:20:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67E45D98898; Wed, 26 Jul 2017 16:20:21 +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 323B668DAC; Wed, 26 Jul 2017 16:20:21 +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 v6QGKK1j063897; Wed, 26 Jul 2017 16:20:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGKJtJ063890; Wed, 26 Jul 2017 16:20:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261620.v6QGKJtJ063890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321534 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs X-SVN-Commit-Revision: 321534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:20:21 -0000 Author: mav Date: Wed Jul 26 16:20:19 2017 New Revision: 321534 URL: https://svnweb.freebsd.org/changeset/base/321534 Log: MFC r317267: MFV 316891 7386 zfs get does not work properly with bookmarks illumos/illumos-gate@edb901aab9c738b5eb15aa55933e82b0f2f9d9a2 https://github.com/illumos/illumos-gate/commit/edb901aab9c738b5eb15aa55933e82b0f2f9d9a2 https://www.illumos.org/issues/7386 The zfs get command does not work with the bookmark parameter while it works properly with both filesystem and snapshot: # zfs get -t all -r creation rpool/test NAME PROPERTY VALUE SOURCE rpool/test creation Fri Sep 16 15:00 2016 - rpool/test@snap creation Fri Sep 16 15:00 2016 - rpool/test#bkmark creation Fri Sep 16 15:00 2016 - # zfs get -t all -r creation rpool/test@snap NAME PROPERTY VALUE SOURCE rpool/test@snap creation Fri Sep 16 15:00 2016 - # zfs get -t all -r creation rpool/test#bkmark cannot open 'rpool/test#bkmark': invalid dataset name # The zfs get command should be modified to work properly with bookmarks too. Reviewed by: Simon Klinkert Reviewed by: Paul Dagnelie Approved by: Matthew Ahrens Author: Marcel Telka Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 26 16:20:19 2017 (r321534) @@ -25,13 +25,13 @@ .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland -.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved. +.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd May 31, 2016 +.Dd September 16, 2016 .Dt ZFS 8 .Os .Sh NAME @@ -114,7 +114,7 @@ .Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ... .Oo Fl s Ar property Oc Ns ... .Oo Fl S Ar property Oc Ns ... -.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot | Ns Ar bookmark Ns ... .Nm .Cm set .Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ... @@ -2156,7 +2156,7 @@ section. .Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... .Op Fl s Ar source Ns Oo , Ns Ar source Oc Ns ... .Ar all | property Ns Oo , Ns Ar property Oc Ns ... -.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Ns ... .Xc .Pp Displays properties for the given datasets. If no datasets are specified, then Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 26 16:20:19 2017 (r321534) @@ -243,7 +243,7 @@ get_usage(zfs_help_t idx) "[-o \"all\" | field[,...]]\n" "\t [-t type[,...]] [-s source[,...]]\n" "\t <\"all\" | property[,...]> " - "[filesystem|volume|snapshot] ...\n")); + "[filesystem|volume|snapshot|bookmark] ...\n")); case HELP_INHERIT: return (gettext("\tinherit [-rS] " " ...\n")); @@ -1622,7 +1622,7 @@ zfs_do_get(int argc, char **argv) { zprop_get_cbdata_t cb = { 0 }; int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS; - int types = ZFS_TYPE_DATASET; + int types = ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK; char *value, *fields; int ret = 0; int limit = 0; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 16:20:19 2017 (r321534) @@ -103,7 +103,7 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa char what; (void) zfs_prop_get_table(); - if (dataset_namecheck(path, &why, &what) != 0) { + if (entity_namecheck(path, &why, &what) != 0) { if (hdl != NULL) { switch (why) { case NAME_ERR_TOOLONG: @@ -132,9 +132,10 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa "'%c' in name"), what); break; - case NAME_ERR_MULTIPLE_AT: + case NAME_ERR_MULTIPLE_DELIMITERS: zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "multiple '@' delimiters in name")); + "multiple '@' and/or '#' delimiters in " + "name")); break; case NAME_ERR_NOLETTER: @@ -165,7 +166,7 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa if (!(type & ZFS_TYPE_SNAPSHOT) && strchr(path, '@') != NULL) { if (hdl != NULL) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "snapshot delimiter '@' in filesystem name")); + "snapshot delimiter '@' is not expected here")); return (0); } @@ -176,6 +177,20 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa return (0); } + if (!(type & ZFS_TYPE_BOOKMARK) && strchr(path, '#') != NULL) { + if (hdl != NULL) + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "bookmark delimiter '#' is not expected here")); + return (0); + } + + if (type == ZFS_TYPE_BOOKMARK && strchr(path, '#') == NULL) { + if (hdl != NULL) + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "missing '#' delimiter in bookmark name")); + return (0); + } + if (modifying && strchr(path, '%') != NULL) { if (hdl != NULL) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -613,8 +628,36 @@ make_bookmark_handle(zfs_handle_t *parent, const char return (zhp); } +struct zfs_open_bookmarks_cb_data { + const char *path; + zfs_handle_t *zhp; +}; + +static int +zfs_open_bookmarks_cb(zfs_handle_t *zhp, void *data) +{ + struct zfs_open_bookmarks_cb_data *dp = data; + + /* + * Is it the one we are looking for? + */ + if (strcmp(dp->path, zfs_get_name(zhp)) == 0) { + /* + * We found it. Save it and let the caller know we are done. + */ + dp->zhp = zhp; + return (EEXIST); + } + + /* + * Not found. Close the handle and ask for another one. + */ + zfs_close(zhp); + return (0); +} + /* - * Opens the given snapshot, filesystem, or volume. The 'types' + * Opens the given snapshot, bookmark, filesystem, or volume. The 'types' * argument is a mask of acceptable types. The function will print an * appropriate error message and return NULL if it can't be opened. */ @@ -623,6 +666,7 @@ zfs_open(libzfs_handle_t *hdl, const char *path, int t { zfs_handle_t *zhp; char errbuf[1024]; + char *bookp; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot open '%s'"), path); @@ -630,20 +674,68 @@ zfs_open(libzfs_handle_t *hdl, const char *path, int t /* * Validate the name before we even try to open it. */ - if (!zfs_validate_name(hdl, path, ZFS_TYPE_DATASET, B_FALSE)) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "invalid dataset name")); + if (!zfs_validate_name(hdl, path, types, B_FALSE)) { (void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf); return (NULL); } /* - * Try to get stats for the dataset, which will tell us if it exists. + * Bookmarks needs to be handled separately. */ - errno = 0; - if ((zhp = make_dataset_handle(hdl, path)) == NULL) { - (void) zfs_standard_error(hdl, errno, errbuf); - return (NULL); + bookp = strchr(path, '#'); + if (bookp == NULL) { + /* + * Try to get stats for the dataset, which will tell us if it + * exists. + */ + errno = 0; + if ((zhp = make_dataset_handle(hdl, path)) == NULL) { + (void) zfs_standard_error(hdl, errno, errbuf); + return (NULL); + } + } else { + char dsname[ZFS_MAX_DATASET_NAME_LEN]; + zfs_handle_t *pzhp; + struct zfs_open_bookmarks_cb_data cb_data = {path, NULL}; + + /* + * We need to cut out '#' and everything after '#' + * to get the parent dataset name only. + */ + assert(bookp - path < sizeof (dsname)); + (void) strncpy(dsname, path, bookp - path); + dsname[bookp - path] = '\0'; + + /* + * Create handle for the parent dataset. + */ + errno = 0; + if ((pzhp = make_dataset_handle(hdl, dsname)) == NULL) { + (void) zfs_standard_error(hdl, errno, errbuf); + return (NULL); + } + + /* + * Iterate bookmarks to find the right one. + */ + errno = 0; + if ((zfs_iter_bookmarks(pzhp, zfs_open_bookmarks_cb, + &cb_data) == 0) && (cb_data.zhp == NULL)) { + (void) zfs_error(hdl, EZFS_NOENT, errbuf); + zfs_close(pzhp); + return (NULL); + } + if (cb_data.zhp == NULL) { + (void) zfs_standard_error(hdl, errno, errbuf); + zfs_close(pzhp); + return (NULL); + } + zhp = cb_data.zhp; + + /* + * Cleanup. + */ + zfs_close(pzhp); } if (zhp == NULL) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Jul 26 16:20:19 2017 (r321534) @@ -947,9 +947,10 @@ zpool_name_valid(libzfs_handle_t *hdl, boolean_t isope "trailing slash in name")); break; - case NAME_ERR_MULTIPLE_AT: + case NAME_ERR_MULTIPLE_DELIMITERS: zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "multiple '@' delimiters in name")); + "multiple '@' and/or '#' delimiters in " + "name")); break; default: Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Jul 26 16:20:19 2017 (r321534) @@ -718,7 +718,7 @@ zfs_get_pool_handle(const zfs_handle_t *zhp) * Given a name, determine whether or not it's a valid path * (starts with '/' or "./"). If so, walk the mnttab trying * to match the device number. If not, treat the path as an - * fs/vol/snap name. + * fs/vol/snap/bkmark name. */ zfs_handle_t * zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype) Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Wed Jul 26 16:20:19 2017 (r321534) @@ -120,9 +120,9 @@ permset_namecheck(const char *path, namecheck_err_t *w } /* - * Dataset names must be of the following form: + * Entity names must be of the following form: * - * [component][/]*[component][@component] + * [component/]*[component][(@|#)component]? * * Where each component is made up of alphanumeric characters plus the following * characters: @@ -133,10 +133,10 @@ permset_namecheck(const char *path, namecheck_err_t *w * names for temporary clones (for online recv). */ int -dataset_namecheck(const char *path, namecheck_err_t *why, char *what) +entity_namecheck(const char *path, namecheck_err_t *why, char *what) { - const char *loc, *end; - int found_snapshot; + const char *start, *end; + int found_delim; /* * Make sure the name is not too long. @@ -161,12 +161,13 @@ dataset_namecheck(const char *path, namecheck_err_t *w return (-1); } - loc = path; - found_snapshot = 0; + start = path; + found_delim = 0; for (;;) { /* Find the end of this component */ - end = loc; - while (*end != '/' && *end != '@' && *end != '\0') + end = start; + while (*end != '/' && *end != '@' && *end != '#' && + *end != '\0') end++; if (*end == '\0' && end[-1] == '/') { @@ -176,25 +177,8 @@ dataset_namecheck(const char *path, namecheck_err_t *w return (-1); } - /* Zero-length components are not allowed */ - if (loc == end) { - if (why) { - /* - * Make sure this is really a zero-length - * component and not a '@@'. - */ - if (*end == '@' && found_snapshot) { - *why = NAME_ERR_MULTIPLE_AT; - } else { - *why = NAME_ERR_EMPTY_COMPONENT; - } - } - - return (-1); - } - /* Validate the contents of this component */ - while (loc != end) { + for (const char *loc = start; loc != end; loc++) { if (!valid_char(*loc) && *loc != '%') { if (why) { *why = NAME_ERR_INVALCHAR; @@ -202,43 +186,64 @@ dataset_namecheck(const char *path, namecheck_err_t *w } return (-1); } - loc++; } - /* If we've reached the end of the string, we're OK */ - if (*end == '\0') - return (0); - - if (*end == '@') { - /* - * If we've found an @ symbol, indicate that we're in - * the snapshot component, and report a second '@' - * character as an error. - */ - if (found_snapshot) { + /* Snapshot or bookmark delimiter found */ + if (*end == '@' || *end == '#') { + /* Multiple delimiters are not allowed */ + if (found_delim != 0) { if (why) - *why = NAME_ERR_MULTIPLE_AT; + *why = NAME_ERR_MULTIPLE_DELIMITERS; return (-1); } - found_snapshot = 1; + found_delim = 1; } + /* Zero-length components are not allowed */ + if (start == end) { + if (why) + *why = NAME_ERR_EMPTY_COMPONENT; + return (-1); + } + + /* If we've reached the end of the string, we're OK */ + if (*end == '\0') + return (0); + /* - * If there is a '/' in a snapshot name + * If there is a '/' in a snapshot or bookmark name * then report an error */ - if (*end == '/' && found_snapshot) { + if (*end == '/' && found_delim != 0) { if (why) *why = NAME_ERR_TRAILING_SLASH; return (-1); } /* Update to the next component */ - loc = end + 1; + start = end + 1; } } +/* + * Dataset is any entity, except bookmark + */ +int +dataset_namecheck(const char *path, namecheck_err_t *why, char *what) +{ + int ret = entity_namecheck(path, why, what); + + if (ret == 0 && strchr(path, '#') != NULL) { + if (why != NULL) { + *why = NAME_ERR_INVALCHAR; + *what = '#'; + } + return (-1); + } + + return (ret); +} /* * mountpoint names must be of the following form: Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h Wed Jul 26 16:19:04 2017 (r321533) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h Wed Jul 26 16:20:19 2017 (r321534) @@ -38,7 +38,7 @@ typedef enum { NAME_ERR_EMPTY_COMPONENT, /* name contains an empty component */ NAME_ERR_TRAILING_SLASH, /* name ends with a slash */ NAME_ERR_INVALCHAR, /* invalid character found */ - NAME_ERR_MULTIPLE_AT, /* multiple '@' characters found */ + NAME_ERR_MULTIPLE_DELIMITERS, /* multiple '@'/'#' delimiters found */ NAME_ERR_NOLETTER, /* pool doesn't begin with a letter */ NAME_ERR_RESERVED, /* entire name is reserved */ NAME_ERR_DISKLIKE, /* reserved disk name (c[0-9].*) */ @@ -49,6 +49,7 @@ typedef enum { #define ZFS_PERMSET_MAXLEN 64 int pool_namecheck(const char *, namecheck_err_t *, char *); +int entity_namecheck(const char *, namecheck_err_t *, char *); int dataset_namecheck(const char *, namecheck_err_t *, char *); int mountpoint_namecheck(const char *, namecheck_err_t *); int zfs_component_namecheck(const char *, namecheck_err_t *, char *); From owner-svn-src-all@freebsd.org Wed Jul 26 16:21:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C34F9D98A5D; Wed, 26 Jul 2017 16:21: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 4647469150; Wed, 26 Jul 2017 16:21: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 v6QGLXR2064740; Wed, 26 Jul 2017 16:21:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGLWWM064731; Wed, 26 Jul 2017 16:21:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261621.v6QGLWWM064731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321535 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/com... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/open... X-SVN-Commit-Revision: 321535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:21:34 -0000 Author: mav Date: Wed Jul 26 16:21:32 2017 New Revision: 321535 URL: https://svnweb.freebsd.org/changeset/base/321535 Log: MFC r317414: MFV 316894 7252 7628 compressed zfs send / receive illumos/illumos-gate@5602294fda888d923d57a78bafdaf48ae6223dea https://github.com/illumos/illumos-gate/commit/5602294fda888d923d57a78bafdaf48ae6223dea https://www.illumos.org/issues/7252 This feature includes code to allow a system with compressed ARC enabled to send data in its compressed form straight out of the ARC, and receive data in its compressed form directly into the ARC. https://www.illumos.org/issues/7628 We should have longer, more readable versions of the ZFS send / recv options. 7628 create long versions of ZFS send / receive options Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Pavel Zakharov Reviewed by: Sebastien Roy Reviewed by: David Quigley Reviewed by: Thomas Caputi Approved by: Dan McDonald Author: Dan Kimmel Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 26 16:21:32 2017 (r321535) @@ -180,12 +180,12 @@ .Ar bookmark .Nm .Cm send -.Op Fl DnPpRveL +.Op Fl DLPRcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm .Cm send -.Op Fl eL +.Op Fl Lce .Op Fl i Ar snapshot Ns | Ns bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm @@ -2535,7 +2535,7 @@ feature. .It Xo .Nm .Cm send -.Op Fl DnPpRveL +.Op Fl DLPRcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2580,7 +2580,7 @@ The incremental source may be specified as with the .Fl i option. -.It Fl R +.It Fl R, -replicate Generate a replication stream package, which will replicate the specified filesystem, and all descendent file systems, up to the named snapshot. When received, all properties, snapshots, descendent file systems, and clones are @@ -2598,7 +2598,7 @@ is received. If the .Fl F flag is specified when this stream is received, snapshots and file systems that do not exist on the sending side are destroyed. -.It Fl D +.It Fl D, -dedup Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must also support this feature to receive a deduplicated stream. This flag can @@ -2607,7 +2607,7 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 ) . -.It Fl L +.It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag has no effect if the @@ -2623,7 +2623,7 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. -.It Fl e +.It Fl e, -embed Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the .Sy embedded_data @@ -2646,11 +2646,25 @@ See for details on ZFS feature flags and the .Sy embedded_data feature. -.It Fl p +.It Fl c, -compressed +Generate a more compact stream by using compressed WRITE records for blocks +which are compressed on disk and in memory (see the +.Sy compression property for details). If the +.Sy lz4_compress +feature is active on the sending system, then the receiving system must have that +feature enabled as well. If the +.Sy large_blocks +feature is enabled on the sending system but the +.Fl L +option is not supplied in conjunction with +.Fl c +then the data will be decompressed before sending so it can be split +into smaller block sizes. +.It Fl p, -props Include the dataset's properties in the stream. This flag is implicit when .Fl R is specified. The receiving system must also support this feature. -.It Fl n +.It Fl n, -dryrun Do a dry-run ("No-op") send. Do not generate any actual send data. This is useful in conjunction with the .Fl v @@ -2660,9 +2674,9 @@ flags to determine what data will be sent. In this case, the verbose output will be written to standard output (contrast with a non-dry-run, where the stream is written to standard output and the verbose output goes to standard error). -.It Fl P +.It Fl P, -parsable Print machine-parsable verbose information about the stream package generated. -.It Fl v +.It Fl v, -verbose Print verbose information about the stream package generated. This information includes a per-second report of how much data has been sent. .El @@ -2673,7 +2687,7 @@ on future versions of .It Xo .Nm .Cm send -.Op Fl eL +.Op Fl Lce .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2699,7 +2713,7 @@ specified as the last component of the name If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. -.It Fl L +.It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag has no effect if the @@ -2715,7 +2729,22 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. -.It Fl e +.It Fl c, -compressed +Generate a more compact stream by using compressed WRITE records for blocks +which are compressed on disk and in memory (see the +.Sy compression +property for details). If the +.Sy lz4_compress +feature is active on the sending system, then the receiving system must have +that feature enabled as well. If the +.Sy large_blocks +feature is enabled on the sending system but the +.Fl L +option is not supplied in conjunction with +.Fl c +then the data will be decompressed before sending so it can be split +into smaller block sizes. +.It Fl e, -embed Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the .Sy embedded_data Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jul 26 16:21:32 2017 (r321535) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -278,7 +279,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRvLe] [-[iI] snapshot] " + return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] " "\n" "\tsend [-Le] [-i snapshot|bookmark] " "\n" @@ -3771,8 +3772,23 @@ zfs_do_send(int argc, char **argv) nvlist_t *dbgnv = NULL; boolean_t extraverbose = B_FALSE; + struct option long_options[] = { + {"replicate", no_argument, NULL, 'R'}, + {"props", no_argument, NULL, 'p'}, + {"parsable", no_argument, NULL, 'P'}, + {"dedup", no_argument, NULL, 'D'}, + {"verbose", no_argument, NULL, 'v'}, + {"dryrun", no_argument, NULL, 'n'}, + {"large-block", no_argument, NULL, 'L'}, + {"embed", no_argument, NULL, 'e'}, + {"resume", required_argument, NULL, 't'}, + {"compressed", no_argument, NULL, 'c'}, + {0, 0, 0, 0} + }; + /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpvnPLet:")) != -1) { + while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options, + NULL)) != -1) { switch (c) { case 'i': if (fromname) @@ -3816,12 +3832,17 @@ zfs_do_send(int argc, char **argv) case 't': resume_token = optarg; break; + case 'c': + flags.compress = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': + /*FALLTHROUGH*/ + default: (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); @@ -3892,6 +3913,8 @@ zfs_do_send(int argc, char **argv) lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; if (flags.embed_data) lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags.compress) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { Modified: stable/11/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Wed Jul 26 16:21:32 2017 (r321535) @@ -25,8 +25,8 @@ */ /* - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. */ #include @@ -39,6 +39,7 @@ #include #include +#include #include /* @@ -251,6 +252,7 @@ main(int argc, char *argv[]) (void) fprintf(stderr, "invalid option '%c'\n", optopt); usage(); + break; } } @@ -453,38 +455,50 @@ main(int argc, char *argv[]) drrw->drr_object = BSWAP_64(drrw->drr_object); drrw->drr_type = BSWAP_32(drrw->drr_type); drrw->drr_offset = BSWAP_64(drrw->drr_offset); - drrw->drr_length = BSWAP_64(drrw->drr_length); + drrw->drr_logical_size = + BSWAP_64(drrw->drr_logical_size); drrw->drr_toguid = BSWAP_64(drrw->drr_toguid); drrw->drr_key.ddk_prop = BSWAP_64(drrw->drr_key.ddk_prop); + drrw->drr_compressed_size = + BSWAP_64(drrw->drr_compressed_size); } + + uint64_t payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw); + /* * If this is verbose and/or dump output, * print info on the modified block */ if (verbose) { (void) printf("WRITE object = %llu type = %u " - "checksum type = %u\n" - " offset = %llu length = %llu " + "checksum type = %u compression type = %u\n" + " offset = %llu logical_size = %llu " + "compressed_size = %llu " + "payload_size = %llu " "props = %llx\n", (u_longlong_t)drrw->drr_object, drrw->drr_type, drrw->drr_checksumtype, + drrw->drr_compressiontype, (u_longlong_t)drrw->drr_offset, - (u_longlong_t)drrw->drr_length, + (u_longlong_t)drrw->drr_logical_size, + (u_longlong_t)drrw->drr_compressed_size, + (u_longlong_t)payload_size, (u_longlong_t)drrw->drr_key.ddk_prop); } + /* * Read the contents of the block in from STDIN to buf */ - (void) ssread(buf, drrw->drr_length, &zc); + (void) ssread(buf, payload_size, &zc); /* * If in dump mode */ if (dump) { - print_block(buf, drrw->drr_length); + print_block(buf, payload_size); } - total_write_size += drrw->drr_length; + total_write_size += payload_size; break; case DRR_WRITE_BYREF: Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Jul 26 16:21:32 2017 (r321535) @@ -616,6 +616,9 @@ typedef struct sendflags { /* WRITE_EMBEDDED records of type DATA are permitted */ boolean_t embed_data; + + /* compressed WRITE records are permitted */ + boolean_t compress; } sendflags_t; typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jul 26 16:21:32 2017 (r321535) @@ -354,8 +354,10 @@ cksummer(void *arg) { struct drr_write *drrw = &drr->drr_u.drr_write; dataref_t dataref; + uint64_t payload_size; - (void) ssread(buf, drrw->drr_length, ofp); + payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw); + (void) ssread(buf, payload_size, ofp); /* * Use the existing checksum if it's dedup-capable, @@ -369,7 +371,7 @@ cksummer(void *arg) zio_cksum_t tmpsha256; SHA256Init(&ctx); - SHA256Update(&ctx, buf, drrw->drr_length); + SHA256Update(&ctx, buf, payload_size); SHA256Final(&tmpsha256, &ctx); drrw->drr_key.ddk_cksum.zc_word[0] = BE_64(tmpsha256.zc_word[0]); @@ -399,7 +401,7 @@ cksummer(void *arg) wbr_drrr->drr_object = drrw->drr_object; wbr_drrr->drr_offset = drrw->drr_offset; - wbr_drrr->drr_length = drrw->drr_length; + wbr_drrr->drr_length = drrw->drr_logical_size; wbr_drrr->drr_toguid = drrw->drr_toguid; wbr_drrr->drr_refguid = dataref.ref_guid; wbr_drrr->drr_refobject = @@ -421,7 +423,7 @@ cksummer(void *arg) goto out; } else { /* block not previously seen */ - if (dump_record(drr, buf, drrw->drr_length, + if (dump_record(drr, buf, payload_size, &stream_cksum, outfd) != 0) goto out; } @@ -924,7 +926,7 @@ typedef struct send_dump_data { uint64_t prevsnap_obj; boolean_t seenfrom, seento, replicate, doall, fromorigin; boolean_t verbose, dryrun, parsable, progress, embed_data, std_out; - boolean_t large_block; + boolean_t large_block, compress; int outfd; boolean_t err; nvlist_t *fss; @@ -940,7 +942,7 @@ typedef struct send_dump_data { static int estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj, - boolean_t fromorigin, uint64_t *sizep) + boolean_t fromorigin, enum lzc_send_flags flags, uint64_t *sizep) { zfs_cmd_t zc = { 0 }; libzfs_handle_t *hdl = zhp->zfs_hdl; @@ -953,6 +955,7 @@ estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_ob zc.zc_sendobj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); zc.zc_fromobj = fromsnap_obj; zc.zc_guid = 1; /* estimate flag */ + zc.zc_flags = flags; if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND, &zc) != 0) { char errbuf[1024]; @@ -1192,6 +1195,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) progress_arg_t pa = { 0 }; pthread_t tid; char *thissnap; + enum lzc_send_flags flags = 0; int err; boolean_t isfromsnap, istosnap, fromorigin; boolean_t exclude = B_FALSE; @@ -1220,6 +1224,13 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) if (istosnap) sdd->seento = B_TRUE; + if (sdd->large_block) + flags |= LZC_SEND_FLAG_LARGE_BLOCK; + if (sdd->embed_data) + flags |= LZC_SEND_FLAG_EMBED_DATA; + if (sdd->compress) + flags |= LZC_SEND_FLAG_COMPRESS; + if (!sdd->doall && !isfromsnap && !istosnap) { if (sdd->replicate) { char *snapname; @@ -1266,7 +1277,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) if (sdd->verbose) { uint64_t size = 0; (void) estimate_ioctl(zhp, sdd->prevsnap_obj, - fromorigin, &size); + fromorigin, flags, &size); send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, @@ -1291,12 +1302,6 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) } } - enum lzc_send_flags flags = 0; - if (sdd->large_block) - flags |= LZC_SEND_FLAG_LARGE_BLOCK; - if (sdd->embed_data) - flags |= LZC_SEND_FLAG_EMBED_DATA; - err = dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj, fromorigin, sdd->outfd, flags, sdd->debugnv); @@ -1602,8 +1607,12 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla fromguid = 0; (void) nvlist_lookup_uint64(resume_nvl, "fromguid", &fromguid); + if (flags->largeblock || nvlist_exists(resume_nvl, "largeblockok")) + lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; if (flags->embed_data || nvlist_exists(resume_nvl, "embedok")) lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags->compress || nvlist_exists(resume_nvl, "compressok")) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; if (guid_to_name(hdl, toname, toguid, B_FALSE, name) != 0) { if (zfs_dataset_exists(hdl, toname, ZFS_TYPE_DATASET)) { @@ -1636,7 +1645,8 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla if (flags->verbose) { uint64_t size = 0; - error = lzc_send_space(zhp->zfs_name, fromname, &size); + error = lzc_send_space(zhp->zfs_name, fromname, + lzc_flags, &size); if (error == 0) size = MAX(0, (int64_t)(size - bytes)); send_print_verbose(stderr, zhp->zfs_name, fromname, @@ -1866,6 +1876,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons sdd.dryrun = flags->dryrun; sdd.large_block = flags->largeblock; sdd.embed_data = flags->embed_data; + sdd.compress = flags->compress; sdd.filter_cb = filter_func; sdd.filter_cb_arg = cb_arg; if (debugnvp) @@ -2960,11 +2971,17 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byte case DRR_WRITE: if (byteswap) { - drr->drr_u.drr_write.drr_length = - BSWAP_64(drr->drr_u.drr_write.drr_length); + drr->drr_u.drr_write.drr_logical_size = + BSWAP_64( + drr->drr_u.drr_write.drr_logical_size); + drr->drr_u.drr_write.drr_compressed_size = + BSWAP_64( + drr->drr_u.drr_write.drr_compressed_size); } + uint64_t payload_size = + DRR_WRITE_PAYLOAD_SIZE(&drr->drr_u.drr_write); (void) recv_read(hdl, fd, buf, - drr->drr_u.drr_write.drr_length, B_FALSE, NULL); + payload_size, B_FALSE, NULL); break; case DRR_SPILL: if (byteswap) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 16:21:32 2017 (r321535) @@ -534,6 +534,8 @@ lzc_send_resume(const char *snapname, const char *from fnvlist_add_boolean(args, "largeblockok"); if (flags & LZC_SEND_FLAG_EMBED_DATA) fnvlist_add_boolean(args, "embedok"); + if (flags & LZC_SEND_FLAG_COMPRESS) + fnvlist_add_boolean(args, "compressok"); if (resumeobj != 0 || resumeoff != 0) { fnvlist_add_uint64(args, "resume_object", resumeobj); fnvlist_add_uint64(args, "resume_offset", resumeoff); @@ -559,7 +561,8 @@ lzc_send_resume(const char *snapname, const char *from * an equivalent snapshot. */ int -lzc_send_space(const char *snapname, const char *from, uint64_t *spacep) +lzc_send_space(const char *snapname, const char *from, + enum lzc_send_flags flags, uint64_t *spacep) { nvlist_t *args; nvlist_t *result; @@ -568,6 +571,12 @@ lzc_send_space(const char *snapname, const char *from, args = fnvlist_alloc(); if (from != NULL) fnvlist_add_string(args, "from", from); + if (flags & LZC_SEND_FLAG_LARGE_BLOCK) + fnvlist_add_boolean(args, "largeblockok"); + if (flags & LZC_SEND_FLAG_EMBED_DATA) + fnvlist_add_boolean(args, "embedok"); + if (flags & LZC_SEND_FLAG_COMPRESS) + fnvlist_add_boolean(args, "compressok"); err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result); nvlist_free(args); if (err == 0) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Wed Jul 26 16:21:32 2017 (r321535) @@ -62,13 +62,14 @@ int lzc_get_holds(const char *, nvlist_t **); enum lzc_send_flags { LZC_SEND_FLAG_EMBED_DATA = 1 << 0, - LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1 + LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1, + LZC_SEND_FLAG_COMPRESS = 1 << 2 }; int lzc_send(const char *, const char *, int, enum lzc_send_flags); int lzc_send_resume(const char *, const char *, int, enum lzc_send_flags, uint64_t, uint64_t); -int lzc_send_space(const char *, const char *, uint64_t *); +int lzc_send_space(const char *, const char *, enum lzc_send_flags, uint64_t *); struct dmu_replay_record; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:20:19 2017 (r321534) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:21:32 2017 (r321535) @@ -77,10 +77,10 @@ * A new reference to a cache buffer can be obtained in two * ways: 1) via a hash table lookup using the DVA as a key, * or 2) via one of the ARC lists. The arc_read() interface - * uses method 1, while the internal arc algorithms for + * uses method 1, while the internal ARC algorithms for * adjusting the cache use method 2. We therefore provide two * types of locks: 1) the hash table lock array, and 2) the - * arc list locks. + * ARC list locks. * * Buffers do not have their own mutexes, rather they rely on the * hash table mutexes for the bulk of their protection (i.e. most @@ -93,21 +93,12 @@ * buf_hash_remove() expects the appropriate hash mutex to be * already held before it is invoked. * - * Each arc state also has a mutex which is used to protect the + * Each ARC state also has a mutex which is used to protect the * buffer list associated with the state. When attempting to - * obtain a hash table lock while holding an arc list lock you + * obtain a hash table lock while holding an ARC list lock you * must use: mutex_tryenter() to avoid deadlock. Also note that * the active state mutex must be held before the ghost state mutex. * - * Arc buffers may have an associated eviction callback function. - * This function will be invoked prior to removing the buffer (e.g. - * in arc_do_user_evicts()). Note however that the data associated - * with the buffer may be evicted prior to the callback. The callback - * must be made with *no locks held* (to prevent deadlock). Additionally, - * the users of callbacks must ensure that their private data is - * protected from simultaneous callbacks from arc_clear_callback() - * and arc_do_user_evicts(). - * * Note that the majority of the performance stats are manipulated * with atomic operations. * @@ -136,67 +127,81 @@ * are cached in the L1ARC. The L1ARC (l1arc_buf_hdr_t) is a structure within * the arc_buf_hdr_t that will point to the data block in memory. A block can * only be read by a consumer if it has an l1arc_buf_hdr_t. The L1ARC - * caches data in two ways -- in a list of arc buffers (arc_buf_t) and + * caches data in two ways -- in a list of ARC buffers (arc_buf_t) and * also in the arc_buf_hdr_t's private physical data block pointer (b_pdata). - * Each arc buffer (arc_buf_t) is being actively accessed by a specific ARC - * consumer, and always contains uncompressed data. The ARC will provide - * references to this data and will keep it cached until it is no longer in - * use. Typically, the arc will try to cache only the L1ARC's physical data - * block and will aggressively evict any arc_buf_t that is no longer referenced. - * The amount of memory consumed by the arc_buf_t's can be seen via the + * + * The L1ARC's data pointer may or may not be uncompressed. The ARC has the + * ability to store the physical data (b_pdata) associated with the DVA of the + * arc_buf_hdr_t. Since the b_pdata is a copy of the on-disk physical block, + * it will match its on-disk compression characteristics. This behavior can be + * disabled by setting 'zfs_compressed_arc_enabled' to B_FALSE. When the + * compressed ARC functionality is disabled, the b_pdata will point to an + * uncompressed version of the on-disk data. + * + * Data in the L1ARC is not accessed by consumers of the ARC directly. Each + * arc_buf_hdr_t can have multiple ARC buffers (arc_buf_t) which reference it. + * Each ARC buffer (arc_buf_t) is being actively accessed by a specific ARC + * consumer. The ARC will provide references to this data and will keep it + * cached until it is no longer in use. The ARC caches only the L1ARC's physical + * data block and will evict any arc_buf_t that is no longer referenced. The + * amount of memory consumed by the arc_buf_ts' data buffers can be seen via the * "overhead_size" kstat. * + * Depending on the consumer, an arc_buf_t can be requested in uncompressed or + * compressed form. The typical case is that consumers will want uncompressed + * data, and when that happens a new data buffer is allocated where the data is + * decompressed for them to use. Currently the only consumer who wants + * compressed arc_buf_t's is "zfs send", when it streams data exactly as it + * exists on disk. When this happens, the arc_buf_t's data buffer is shared + * with the arc_buf_hdr_t. * - * arc_buf_hdr_t - * +-----------+ - * | | - * | | - * | | - * +-----------+ - * l2arc_buf_hdr_t| | - * | | - * +-----------+ - * l1arc_buf_hdr_t| | - * | | arc_buf_t - * | b_buf +------------>+---------+ arc_buf_t - * | | |b_next +---->+---------+ - * | b_pdata +-+ |---------| |b_next +-->NULL - * +-----------+ | | | +---------+ - * | |b_data +-+ | | - * | +---------+ | |b_data +-+ - * +->+------+ | +---------+ | - * (potentially) | | | | - * compressed | | | | - * data +------+ | v - * +->+------+ +------+ - * uncompressed | | | | - * data | | | | - * +------+ +------+ + * Here is a diagram showing an arc_buf_hdr_t referenced by two arc_buf_t's. The + * first one is owned by a compressed send consumer (and therefore references + * the same compressed data buffer as the arc_buf_hdr_t) and the second could be + * used by any other consumer (and has its own uncompressed copy of the data + * buffer). * - * The L1ARC's data pointer, however, may or may not be uncompressed. The - * ARC has the ability to store the physical data (b_pdata) associated with - * the DVA of the arc_buf_hdr_t. Since the b_pdata is a copy of the on-disk - * physical block, it will match its on-disk compression characteristics. - * If the block on-disk is compressed, then the physical data block - * in the cache will also be compressed and vice-versa. This behavior - * can be disabled by setting 'zfs_compressed_arc_enabled' to B_FALSE. When the - * compressed ARC functionality is disabled, the b_pdata will point to an - * uncompressed version of the on-disk data. + * arc_buf_hdr_t + * +-----------+ + * | fields | + * | common to | + * | L1- and | + * | L2ARC | + * +-----------+ + * | l2arc_buf_hdr_t + * | | + * +-----------+ + * | l1arc_buf_hdr_t + * | | arc_buf_t + * | b_buf +------------>+-----------+ arc_buf_t + * | b_pdata +-+ |b_next +---->+-----------+ + * +-----------+ | |-----------| |b_next +-->NULL + * | |b_comp = T | +-----------+ + * | |b_data +-+ |b_comp = F | + * | +-----------+ | |b_data +-+ + * +->+------+ | +-----------+ | + * compressed | | | | + * data | |<--------------+ | uncompressed + * +------+ compressed, | data + * shared +-->+------+ + * data | | + * | | + * +------+ * * When a consumer reads a block, the ARC must first look to see if the - * arc_buf_hdr_t is cached. If the hdr is cached and already has an arc_buf_t, - * then an additional arc_buf_t is allocated and the uncompressed data is - * bcopied from the existing arc_buf_t. If the hdr is cached but does not - * have an arc_buf_t, then the ARC allocates a new arc_buf_t and decompresses - * the b_pdata contents into the arc_buf_t's b_data. If the arc_buf_hdr_t's - * b_pdata is not compressed, then the block is shared with the newly - * allocated arc_buf_t. This block sharing only occurs with one arc_buf_t - * in the arc buffer chain. Sharing the block reduces the memory overhead - * required when the hdr is caching uncompressed blocks or the compressed - * arc functionality has been disabled via 'zfs_compressed_arc_enabled'. + * arc_buf_hdr_t is cached. If the hdr is cached then the ARC allocates a new + * arc_buf_t and either copies uncompressed data into a new data buffer from an + * existing uncompressed arc_buf_t, decompresses the hdr's b_pdata buffer into a + * new data buffer, or shares the hdr's b_pdata buffer, depending on whether the + * hdr is compressed and the desired compression characteristics of the + * arc_buf_t consumer. If the arc_buf_t ends up sharing data with the + * arc_buf_hdr_t and both of them are uncompressed then the arc_buf_t must be + * the last buffer in the hdr's b_buf list, however a shared compressed buf can + * be anywhere in the hdr's list. * * The diagram below shows an example of an uncompressed ARC hdr that is - * sharing its data with an arc_buf_t: + * sharing its data with an arc_buf_t (note that the shared uncompressed buf is + * the last element in the buf list): * * arc_buf_hdr_t * +-----------+ @@ -225,20 +230,24 @@ * | +------+ | * +---------------------------------+ * - * Writing to the arc requires that the ARC first discard the b_pdata + * Writing to the ARC requires that the ARC first discard the hdr's b_pdata * since the physical block is about to be rewritten. The new data contents - * will be contained in the arc_buf_t (uncompressed). As the I/O pipeline - * performs the write, it may compress the data before writing it to disk. - * The ARC will be called with the transformed data and will bcopy the - * transformed on-disk block into a newly allocated b_pdata. + * will be contained in the arc_buf_t. As the I/O pipeline performs the write, + * it may compress the data before writing it to disk. The ARC will be called + * with the transformed data and will bcopy the transformed on-disk block into + * a newly allocated b_pdata. Writes are always done into buffers which have + * either been loaned (and hence are new and don't have other readers) or + * buffers which have been released (and hence have their own hdr, if there + * were originally other readers of the buf's original hdr). This ensures that + * the ARC only needs to update a single buf and its hdr after a write occurs. * * When the L2ARC is in use, it will also take advantage of the b_pdata. The * L2ARC will always write the contents of b_pdata to the L2ARC. This means - * that when compressed arc is enabled that the L2ARC blocks are identical + * that when compressed ARC is enabled that the L2ARC blocks are identical * to the on-disk block in the main data pool. This provides a significant * advantage since the ARC can leverage the bp's checksum when reading from the * L2ARC to determine if the contents are valid. However, if the compressed - * arc is disabled, then the L2ARC's block must be transformed to look + * ARC is disabled, then the L2ARC's block must be transformed to look * like the physical block in the main data pool before comparing the * checksum and determining its validity. */ @@ -910,6 +919,7 @@ struct arc_callback { void *acb_private; arc_done_func_t *acb_done; arc_buf_t *acb_buf; + boolean_t acb_compressed; zio_t *acb_zio_dummy; arc_callback_t *acb_next; }; @@ -961,7 +971,7 @@ typedef struct l1arc_buf_hdr { zio_cksum_t *b_freeze_cksum; #ifdef ZFS_DEBUG /* - * used for debugging wtih kmem_flags - by allocating and freeing + * Used for debugging with kmem_flags - by allocating and freeing * b_thawed when the buffer is thawed, we get a record of the stack * trace that thawed it. */ @@ -1172,6 +1182,8 @@ sysctl_vfs_zfs_arc_min(SYSCTL_HANDLER_ARGS) HDR_COMPRESS_OFFSET, SPA_COMPRESSBITS, (cmp)); #define ARC_BUF_LAST(buf) ((buf)->b_next == NULL) +#define ARC_BUF_SHARED(buf) ((buf)->b_flags & ARC_BUF_FLAG_SHARED) +#define ARC_BUF_COMPRESSED(buf) ((buf)->b_flags & ARC_BUF_FLAG_COMPRESSED) /* * Other sizes @@ -1332,7 +1344,7 @@ static kmutex_t l2arc_free_on_write_mtx; /* mutex for static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_hdr_t *l2rcb_hdr; /* read buffer */ + arc_buf_hdr_t *l2rcb_hdr; /* read header */ blkptr_t l2rcb_bp; /* original blkptr */ zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ @@ -1682,6 +1694,31 @@ retry: } } +/* + * This is the size that the buf occupies in memory. If the buf is compressed, + * it will correspond to the compressed size. You should use this method of + * getting the buf size unless you explicitly need the logical size. + */ +int32_t +arc_buf_size(arc_buf_t *buf) +{ + return (ARC_BUF_COMPRESSED(buf) ? + HDR_GET_PSIZE(buf->b_hdr) : HDR_GET_LSIZE(buf->b_hdr)); +} + +int32_t +arc_buf_lsize(arc_buf_t *buf) +{ + return (HDR_GET_LSIZE(buf->b_hdr)); +} + +enum zio_compress +arc_get_compression(arc_buf_t *buf) +{ + return (ARC_BUF_COMPRESSED(buf) ? + HDR_GET_COMPRESS(buf->b_hdr) : ZIO_COMPRESS_OFF); +} + #define ARC_MINTIME (hz>>4) /* 62 ms */ static inline boolean_t @@ -1690,9 +1727,21 @@ arc_buf_is_shared(arc_buf_t *buf) boolean_t shared = (buf->b_data != NULL && buf->b_data == buf->b_hdr->b_l1hdr.b_pdata); IMPLY(shared, HDR_SHARED_DATA(buf->b_hdr)); + IMPLY(shared, ARC_BUF_SHARED(buf)); + IMPLY(shared, ARC_BUF_COMPRESSED(buf) || ARC_BUF_LAST(buf)); + + /* + * It would be nice to assert arc_can_share() too, but the "hdr isn't + * already being shared" requirement prevents us from doing that. + */ + return (shared); } +/* + * Free the checksum associated with this header. If there is no checksum, this + * is a no-op. + */ static inline void arc_cksum_free(arc_buf_hdr_t *hdr) { @@ -1705,6 +1754,25 @@ arc_cksum_free(arc_buf_hdr_t *hdr) mutex_exit(&hdr->b_l1hdr.b_freeze_lock); } +/* + * Return true iff at least one of the bufs on hdr is not compressed. + */ +static boolean_t +arc_hdr_has_uncompressed_buf(arc_buf_hdr_t *hdr) +{ + for (arc_buf_t *b = hdr->b_l1hdr.b_buf; b != NULL; b = b->b_next) { + if (!ARC_BUF_COMPRESSED(b)) { + return (B_TRUE); + } + } + return (B_FALSE); +} + +/* + * If we've turned on the ZFS_DEBUG_MODIFY flag, verify that the buf's data + * matches the checksum that is stored in the hdr. If there is no checksum, + * or if the buf is compressed, this is a no-op. + */ static void arc_cksum_verify(arc_buf_t *buf) { @@ -1714,6 +1782,12 @@ arc_cksum_verify(arc_buf_t *buf) if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; + } + ASSERT(HDR_HAS_L1HDR(hdr)); mutex_enter(&hdr->b_l1hdr.b_freeze_lock); @@ -1721,7 +1795,8 @@ arc_cksum_verify(arc_buf_t *buf) mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; } - fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, &zc); + + fletcher_2_native(buf->b_data, arc_buf_size(buf), NULL, &zc); if (!ZIO_CHECKSUM_EQUAL(*hdr->b_l1hdr.b_freeze_cksum, zc)) panic("buffer modified while frozen!"); mutex_exit(&hdr->b_l1hdr.b_freeze_lock); @@ -1795,6 +1870,12 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) return (valid_cksum); } +/* + * Given a buf full of data, if ZFS_DEBUG_MODIFY is enabled this computes a + * checksum and attaches it to the buf's hdr so that we can ensure that the buf + * isn't modified later on. If buf is compressed or there is already a checksum + * on the hdr, this is a no-op (we only checksum uncompressed bufs). + */ static void arc_cksum_compute(arc_buf_t *buf) { @@ -1804,14 +1885,21 @@ arc_cksum_compute(arc_buf_t *buf) return; ASSERT(HDR_HAS_L1HDR(hdr)); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); if (hdr->b_l1hdr.b_freeze_cksum != NULL) { + ASSERT(arc_hdr_has_uncompressed_buf(hdr)); mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; + } else if (ARC_BUF_COMPRESSED(buf)) { + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); + return; } + + ASSERT(!ARC_BUF_COMPRESSED(buf)); hdr->b_l1hdr.b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP); - fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, + fletcher_2_native(buf->b_data, arc_buf_size(buf), NULL, hdr->b_l1hdr.b_freeze_cksum); mutex_exit(&hdr->b_l1hdr.b_freeze_lock); #ifdef illumos @@ -1855,7 +1943,7 @@ arc_buf_watch(arc_buf_t *buf) procctl_t ctl; ctl.cmd = PCWATCH; ctl.prwatch.pr_vaddr = (uintptr_t)buf->b_data; - ctl.prwatch.pr_size = HDR_GET_LSIZE(buf->b_hdr); + ctl.prwatch.pr_size = arc_buf_size(buf); ctl.prwatch.pr_wflags = WA_WRITE; result = write(arc_procfd, &ctl, sizeof (ctl)); ASSERT3U(result, ==, sizeof (ctl)); @@ -1877,6 +1965,12 @@ arc_buf_type(arc_buf_hdr_t *hdr) return (type); } +boolean_t +arc_is_metadata(arc_buf_t *buf) +{ + return (HDR_ISTYPE_METADATA(buf->b_hdr) != 0); +} + static uint32_t arc_bufc_to_flags(arc_buf_contents_t type) { @@ -1898,12 +1992,19 @@ arc_buf_thaw(arc_buf_t *buf) { arc_buf_hdr_t *hdr = buf->b_hdr; - if (zfs_flags & ZFS_DEBUG_MODIFY) { - if (hdr->b_l1hdr.b_state != arc_anon) - panic("modifying non-anon buffer!"); - if (HDR_IO_IN_PROGRESS(hdr)) - panic("modifying buffer while i/o in progress!"); - arc_cksum_verify(buf); + ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); + ASSERT(!HDR_IO_IN_PROGRESS(hdr)); + + arc_cksum_verify(buf); + + /* + * Compressed buffers do not manipulate the b_freeze_cksum or + * allocate b_thawed. + */ + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; } ASSERT(HDR_HAS_L1HDR(hdr)); @@ -1934,6 +2035,12 @@ arc_buf_freeze(arc_buf_t *buf) if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; + } + hash_lock = HDR_LOCK(hdr); mutex_enter(hash_lock); @@ -1942,7 +2049,6 @@ arc_buf_freeze(arc_buf_t *buf) hdr->b_l1hdr.b_state == arc_anon); arc_cksum_compute(buf); mutex_exit(hash_lock); - } /* @@ -1999,47 +2105,157 @@ arc_hdr_set_compress(arc_buf_hdr_t *hdr, enum zio_comp } } +/* + * Looks for another buf on the same hdr which has the data decompressed, copies + * from it, and returns true. If no such buf exists, returns false. + */ +static boolean_t +arc_buf_try_copy_decompressed_data(arc_buf_t *buf) +{ + arc_buf_hdr_t *hdr = buf->b_hdr; + boolean_t copied = B_FALSE; + + ASSERT(HDR_HAS_L1HDR(hdr)); + ASSERT3P(buf->b_data, !=, NULL); + ASSERT(!ARC_BUF_COMPRESSED(buf)); + + for (arc_buf_t *from = hdr->b_l1hdr.b_buf; from != NULL; + from = from->b_next) { + /* can't use our own data buffer */ + if (from == buf) { + continue; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 16:23:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35571D98B59; Wed, 26 Jul 2017 16:23:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10E7369384; Wed, 26 Jul 2017 16:23:31 +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 v6QGNVNL067866; Wed, 26 Jul 2017 16:23:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGNV9G067865; Wed, 26 Jul 2017 16:23:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261623.v6QGNV9G067865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321536 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:23:32 -0000 Author: mav Date: Wed Jul 26 16:23:30 2017 New Revision: 321536 URL: https://svnweb.freebsd.org/changeset/base/321536 Log: MFC r317507: MFV 316895 7606 dmu_objset_find_dp() takes a long time while importing pool illumos/illumos-gate@7588687e6ba67c47bf7c9805086dec4a97fcac7b https://github.com/illumos/illumos-gate/commit/7588687e6ba67c47bf7c9805086dec4a97fcac7b https://www.illumos.org/issues/7606 When importing a pool with a large number of filesystems within the same parent filesystem, we see that dmu_objset_find_dp() takes a long time. It is called from 3 places: spa_check_logs(), spa_ld_claim_log_blocks(), and spa_load_verify(). There are several ways to improve performance here: 1. We don't really need to do spa_check_logs() or spa_ld_claim_log_blocks() if the pool was closed cleanly. 2. spa_load_verify() uses dmu_objset_find_dp() to check that no datasets have too long of names. 3. dmu_objset_find_dp() is slow because it's doing zap_value_search() (which is O(N sibling datasets)) to determine the name of each dsl_dir when it's opened. In this case we actually know the name when we are opening it, so we can provide it and avoid the lookup. This change implements fix #3 from the above list; i.e. make dmu_objset_find_dp() provide the name of the dataset so that we don't have to search for it. Reviewed by: Steve Gonczi Reviewed by: George Wilson Reviewed by: Prashanth Sreenivasa Approved by: Gordon Ross Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:21:32 2017 (r321535) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:23:30 2017 (r321536) @@ -1705,6 +1705,7 @@ typedef struct dmu_objset_find_ctx { taskq_t *dc_tq; dsl_pool_t *dc_dp; uint64_t dc_ddobj; + char *dc_ddname; /* last component of ddobj's name */ int (*dc_func)(dsl_pool_t *, dsl_dataset_t *, void *); void *dc_arg; int dc_flags; @@ -1716,7 +1717,6 @@ static void dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) { dsl_pool_t *dp = dcp->dc_dp; - dmu_objset_find_ctx_t *child_dcp; dsl_dir_t *dd; dsl_dataset_t *ds; zap_cursor_t zc; @@ -1728,7 +1728,12 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) if (*dcp->dc_error != 0) goto out; - err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, NULL, FTAG, &dd); + /* + * Note: passing the name (dc_ddname) here is optional, but it + * improves performance because we don't need to call + * zap_value_search() to determine the name. + */ + err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, dcp->dc_ddname, FTAG, &dd); if (err != 0) goto out; @@ -1753,9 +1758,11 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) sizeof (uint64_t)); ASSERT3U(attr->za_num_integers, ==, 1); - child_dcp = kmem_alloc(sizeof (*child_dcp), KM_SLEEP); + dmu_objset_find_ctx_t *child_dcp = + kmem_alloc(sizeof (*child_dcp), KM_SLEEP); *child_dcp = *dcp; child_dcp->dc_ddobj = attr->za_first_integer; + child_dcp->dc_ddname = spa_strdup(attr->za_name); if (dcp->dc_tq != NULL) (void) taskq_dispatch(dcp->dc_tq, dmu_objset_find_dp_cb, child_dcp, TQ_SLEEP); @@ -1798,16 +1805,25 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) } } - dsl_dir_rele(dd, FTAG); kmem_free(attr, sizeof (zap_attribute_t)); - if (err != 0) + if (err != 0) { + dsl_dir_rele(dd, FTAG); goto out; + } /* * Apply to self. */ err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); + + /* + * Note: we hold the dir while calling dsl_dataset_hold_obj() so + * that the dir will remain cached, and we won't have to re-instantiate + * it (which could be expensive due to finding its name via + * zap_value_search()). + */ + dsl_dir_rele(dd, FTAG); if (err != 0) goto out; err = dcp->dc_func(dp, ds, dcp->dc_arg); @@ -1822,6 +1838,8 @@ out: mutex_exit(dcp->dc_error_lock); } + if (dcp->dc_ddname != NULL) + spa_strfree(dcp->dc_ddname); kmem_free(dcp, sizeof (*dcp)); } @@ -1866,6 +1884,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj, dcp->dc_tq = NULL; dcp->dc_dp = dp; dcp->dc_ddobj = ddobj; + dcp->dc_ddname = NULL; dcp->dc_func = func; dcp->dc_arg = arg; dcp->dc_flags = flags; From owner-svn-src-all@freebsd.org Wed Jul 26 16:24:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B292D98BD6; Wed, 26 Jul 2017 16:24:12 +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 7770E694CC; Wed, 26 Jul 2017 16:24:12 +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 v6QGOBtQ067946; Wed, 26 Jul 2017 16:24:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGOBu4067944; Wed, 26 Jul 2017 16:24:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261624.v6QGOBu4067944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321537 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:24:12 -0000 Author: mav Date: Wed Jul 26 16:24:11 2017 New Revision: 321537 URL: https://svnweb.freebsd.org/changeset/base/321537 Log: MFC r317511: MFV 316896 7580 ztest failure in dbuf_read_impl illumos/illumos-gate@1a01181fdc809f40c64d5c6881ae3e4521a9d9c7 https://github.com/illumos/illumos-gate/commit/1a01181fdc809f40c64d5c6881ae3e4521a9d9c7 https://www.illumos.org/issues/7580 We need to prevent any reader whenever we're about the zero out all the blkptrs. To do this we need to grab the dn_struct_rwlock as writer in dbuf_write_children_ready and free_children just prior to calling bzero. Reviewed by: Pavel Zakharov Reviewed by: Steve Gonczi Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: George Wilson Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:23:30 2017 (r321536) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:24:11 2017 (r321537) @@ -3317,13 +3317,13 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, dmu_buf_impl_t *db = vdb; dnode_t *dn; blkptr_t *bp; - uint64_t i; - int epbs; + unsigned int epbs, i; ASSERT3U(db->db_level, >, 0); DB_DNODE_ENTER(db); dn = DB_DNODE(db); epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + ASSERT3U(epbs, <, 31); /* Determine if all our children are holes */ for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) { @@ -3336,8 +3336,14 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, * we may get compressed away. */ if (i == 1 << epbs) { - /* didn't find any non-holes */ + /* + * We only found holes. Grab the rwlock to prevent + * anybody from reading the blocks we're about to + * zero out. + */ + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); + rw_exit(&dn->dn_struct_rwlock); } DB_DNODE_EXIT(db); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:23:30 2017 (r321536) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:24:11 2017 (r321537) @@ -236,8 +236,8 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint dnode_t *dn; blkptr_t *bp; dmu_buf_impl_t *subdb; - uint64_t start, end, dbstart, dbend, i; - int epbs, shift; + uint64_t start, end, dbstart, dbend; + unsigned int epbs, shift, i; /* * There is a small possibility that this block will not be cached: @@ -254,6 +254,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint DB_DNODE_ENTER(db); dn = DB_DNODE(db); epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + ASSERT3U(epbs, <, 31); shift = (db->db_level - 1) * epbs; dbstart = db->db_blkid << epbs; start = blkid >> shift; @@ -273,12 +274,12 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint FREE_VERIFY(db, start, end, tx); free_blocks(dn, bp, end-start+1, tx); } else { - for (i = start; i <= end; i++, bp++) { + for (uint64_t id = start; id <= end; id++, bp++) { if (BP_IS_HOLE(bp)) continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); VERIFY0(dbuf_hold_impl(dn, db->db_level - 1, - i, TRUE, FALSE, FTAG, &subdb)); + id, TRUE, FALSE, FTAG, &subdb)); rw_exit(&dn->dn_struct_rwlock); ASSERT3P(bp, ==, subdb->db_blkptr); @@ -293,8 +294,14 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint break; } if (i == 1 << epbs) { - /* didn't find any non-holes */ + /* + * We only found holes. Grab the rwlock to prevent + * anybody from reading the blocks we're about to + * zero out. + */ + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); + rw_exit(&dn->dn_struct_rwlock); free_blocks(dn, db->db_blkptr, 1, tx); } else { /* From owner-svn-src-all@freebsd.org Wed Jul 26 16:24:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 137D3D98C5B; Wed, 26 Jul 2017 16:24:55 +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 E150369602; Wed, 26 Jul 2017 16:24:54 +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 v6QGOs4A068023; Wed, 26 Jul 2017 16:24:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGOrBF068021; Wed, 26 Jul 2017 16:24:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261624.v6QGOrBF068021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321538 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 321538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:24:55 -0000 Author: mav Date: Wed Jul 26 16:24:53 2017 New Revision: 321538 URL: https://svnweb.freebsd.org/changeset/base/321538 Log: MFC r317522: MFV 316897 7586 remove #ifdef __lint hack from dmu.h illumos/illumos-gate@4ba5b9616327ef64e8abc737d29b3faabc6ae68c https://github.com/illumos/illumos-gate/commit/4ba5b9616327ef64e8abc737d29b3faabc6ae68c https://www.illumos.org/issues/7586 The #ifdef __lint in dmu.h is ugly, and it would be nice not to duplicate it if we add other inline functions into header files in ZFS, especially since it is difficult to make any other solution work across all compilation targets. We should switch to disabling the lint flags that are failing instead. Reviewed by: Matthew Ahrens Reviewed by: Pavel Zakharov Approved by: Dan McDonald Author: Dan Kimmel Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:24:11 2017 (r321537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:24:53 2017 (r321538) @@ -567,12 +567,7 @@ typedef struct dmu_buf_user { * NOTE: This function should only be called once on a given dmu_buf_user_t. * To allow enforcement of this, dbu must already be zeroed on entry. */ -#ifdef __lint -/* Very ugly, but it beats issuing suppression directives in many Makefiles. */ -extern void -dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, - dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp); -#else /* __lint */ +/*ARGSUSED*/ inline void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp) @@ -588,7 +583,6 @@ dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_f dbu->dbu_clear_on_evict_dbufp = clear_on_evict_dbufp; #endif } -#endif /* __lint */ /* * Attach user data to a dbuf and mark it for normal (when the dbuf's Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 16:24:11 2017 (r321537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 16:24:53 2017 (r321538) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -610,8 +611,6 @@ _NOTE(CONSTCOND) } while (0) } \ ASSERT(len < size); \ } - -#include #define BP_GET_BUFC_TYPE(bp) \ (((BP_GET_LEVEL(bp) > 0) || (DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))) ? \ From owner-svn-src-all@freebsd.org Wed Jul 26 16:25:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39D75D98CDF; Wed, 26 Jul 2017 16:25:48 +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 0335869767; Wed, 26 Jul 2017 16:25:47 +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 v6QGPlKe068114; Wed, 26 Jul 2017 16:25:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGPlUB068112; Wed, 26 Jul 2017 16:25:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261625.v6QGPlUB068112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321539 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:25:48 -0000 Author: mav Date: Wed Jul 26 16:25:46 2017 New Revision: 321539 URL: https://svnweb.freebsd.org/changeset/base/321539 Log: MFC r317527: MFV 316898 7613 ms_freetree[4] is only used in syncing context illumos/illumos-gate@5f145778012b555e084eacc858ead9e1e42bd149 https://github.com/illumos/illumos-gate/commit/5f145778012b555e084eacc858ead9e1e42bd149 https://www.illumos.org/issues/7613 metaslab_t:ms_freetree[TXG_SIZE] is only used in syncing context. We should replace it with two trees: the freeing tree (ranges that we are freeing this syncing txg) and the freed tree (ranges which have been freed this txg). Reviewed by: George Wilson Reviewed by: Alex Reece Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:24:53 2017 (r321538) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:25:46 2017 (r321539) @@ -533,7 +533,6 @@ metaslab_verify_space(metaslab_t *msp, uint64_t txg) { spa_t *spa = msp->ms_group->mg_vd->vdev_spa; uint64_t allocated = 0; - uint64_t freed = 0; uint64_t sm_free_space, msp_free_space; ASSERT(MUTEX_HELD(&msp->ms_lock)); @@ -563,10 +562,9 @@ metaslab_verify_space(metaslab_t *msp, uint64_t txg) allocated += range_tree_space(msp->ms_alloctree[(txg + t) & TXG_MASK]); } - freed = range_tree_space(msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]); msp_free_space = range_tree_space(msp->ms_tree) + allocated + - msp->ms_deferspace + freed; + msp->ms_deferspace + range_tree_space(msp->ms_freedtree); VERIFY3U(sm_free_space, ==, msp_free_space); } @@ -1499,7 +1497,7 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 /* * We create the main range tree here, but we don't create the - * alloctree and freetree until metaslab_sync_done(). This serves + * other range trees until metaslab_sync_done(). This serves * two purposes: it allows metaslab_sync_done() to detect the * addition of new space; and for debugging, it ensures that we'd * data fault on any attempt to use this metaslab before it's ready. @@ -1557,10 +1555,11 @@ metaslab_fini(metaslab_t *msp) metaslab_unload(msp); range_tree_destroy(msp->ms_tree); + range_tree_destroy(msp->ms_freeingtree); + range_tree_destroy(msp->ms_freedtree); for (int t = 0; t < TXG_SIZE; t++) { range_tree_destroy(msp->ms_alloctree[t]); - range_tree_destroy(msp->ms_freetree[t]); } for (int t = 0; t < TXG_DEFER_SIZE; t++) { @@ -2171,7 +2170,6 @@ static void metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_tx_t *tx) { spa_t *spa = msp->ms_group->mg_vd->vdev_spa; - range_tree_t *freetree = msp->ms_freetree[txg & TXG_MASK]; range_tree_t *condense_tree; space_map_t *sm = msp->ms_sm; @@ -2202,9 +2200,9 @@ metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_t /* * Remove what's been freed in this txg from the condense_tree. * Since we're in sync_pass 1, we know that all the frees from - * this txg are in the freetree. + * this txg are in the freeingtree. */ - range_tree_walk(freetree, range_tree_remove, condense_tree); + range_tree_walk(msp->ms_freeingtree, range_tree_remove, condense_tree); for (int t = 0; t < TXG_DEFER_SIZE; t++) { range_tree_walk(msp->ms_defertree[t], @@ -2260,9 +2258,6 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) spa_t *spa = vd->vdev_spa; objset_t *mos = spa_meta_objset(spa); range_tree_t *alloctree = msp->ms_alloctree[txg & TXG_MASK]; - range_tree_t **freetree = &msp->ms_freetree[txg & TXG_MASK]; - range_tree_t **freed_tree = - &msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]; dmu_tx_t *tx; uint64_t object = space_map_object(msp->ms_sm); @@ -2271,14 +2266,14 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) /* * This metaslab has just been added so there's no work to do now. */ - if (*freetree == NULL) { + if (msp->ms_freeingtree == NULL) { ASSERT3P(alloctree, ==, NULL); return; } ASSERT3P(alloctree, !=, NULL); - ASSERT3P(*freetree, !=, NULL); - ASSERT3P(*freed_tree, !=, NULL); + ASSERT3P(msp->ms_freeingtree, !=, NULL); + ASSERT3P(msp->ms_freedtree, !=, NULL); /* * Normally, we don't want to process a metaslab if there @@ -2286,14 +2281,14 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) * is being forced to condense we need to let it through. */ if (range_tree_space(alloctree) == 0 && - range_tree_space(*freetree) == 0 && + range_tree_space(msp->ms_freeingtree) == 0 && !msp->ms_condense_wanted) return; /* * The only state that can actually be changing concurrently with * metaslab_sync() is the metaslab's ms_tree. No other thread can - * be modifying this txg's alloctree, freetree, freed_tree, or + * be modifying this txg's alloctree, freeingtree, freedtree, or * space_map_phys_t. Therefore, we only hold ms_lock to satify * space map ASSERTs. We drop it whenever we call into the DMU, * because the DMU can call down to us (e.g. via zio_free()) at @@ -2330,7 +2325,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) metaslab_condense(msp, txg, tx); } else { space_map_write(msp->ms_sm, alloctree, SM_ALLOC, tx); - space_map_write(msp->ms_sm, *freetree, SM_FREE, tx); + space_map_write(msp->ms_sm, msp->ms_freeingtree, SM_FREE, tx); } if (msp->ms_loaded) { @@ -2350,7 +2345,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) * to accurately reflect all free space even if some space * is not yet available for allocation (i.e. deferred). */ - space_map_histogram_add(msp->ms_sm, *freed_tree, tx); + space_map_histogram_add(msp->ms_sm, msp->ms_freedtree, tx); /* * Add back any deferred free space that has not been @@ -2372,7 +2367,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) * then we will lose some accuracy but will correct it the next * time we load the space map. */ - space_map_histogram_add(msp->ms_sm, *freetree, tx); + space_map_histogram_add(msp->ms_sm, msp->ms_freeingtree, tx); metaslab_group_histogram_add(mg, msp); metaslab_group_histogram_verify(mg); @@ -2380,20 +2375,21 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) /* * For sync pass 1, we avoid traversing this txg's free range tree - * and instead will just swap the pointers for freetree and - * freed_tree. We can safely do this since the freed_tree is + * and instead will just swap the pointers for freeingtree and + * freedtree. We can safely do this since the freed_tree is * guaranteed to be empty on the initial pass. */ if (spa_sync_pass(spa) == 1) { - range_tree_swap(freetree, freed_tree); + range_tree_swap(&msp->ms_freeingtree, &msp->ms_freedtree); } else { - range_tree_vacate(*freetree, range_tree_add, *freed_tree); + range_tree_vacate(msp->ms_freeingtree, + range_tree_add, msp->ms_freedtree); } range_tree_vacate(alloctree, NULL, NULL); ASSERT0(range_tree_space(msp->ms_alloctree[txg & TXG_MASK])); ASSERT0(range_tree_space(msp->ms_alloctree[TXG_CLEAN(txg) & TXG_MASK])); - ASSERT0(range_tree_space(msp->ms_freetree[txg & TXG_MASK])); + ASSERT0(range_tree_space(msp->ms_freeingtree)); mutex_exit(&msp->ms_lock); @@ -2415,7 +2411,6 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) metaslab_group_t *mg = msp->ms_group; vdev_t *vd = mg->mg_vd; spa_t *spa = vd->vdev_spa; - range_tree_t **freed_tree; range_tree_t **defer_tree; int64_t alloc_delta, defer_delta; boolean_t defer_allowed = B_TRUE; @@ -2426,20 +2421,24 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) /* * If this metaslab is just becoming available, initialize its - * alloctrees, freetrees, and defertree and add its capacity to - * the vdev. + * range trees and add its capacity to the vdev. */ - if (msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK] == NULL) { + if (msp->ms_freedtree == NULL) { for (int t = 0; t < TXG_SIZE; t++) { ASSERT(msp->ms_alloctree[t] == NULL); - ASSERT(msp->ms_freetree[t] == NULL); msp->ms_alloctree[t] = range_tree_create(NULL, msp, &msp->ms_lock); - msp->ms_freetree[t] = range_tree_create(NULL, msp, - &msp->ms_lock); } + ASSERT3P(msp->ms_freeingtree, ==, NULL); + msp->ms_freeingtree = range_tree_create(NULL, msp, + &msp->ms_lock); + + ASSERT3P(msp->ms_freedtree, ==, NULL); + msp->ms_freedtree = range_tree_create(NULL, msp, + &msp->ms_lock); + for (int t = 0; t < TXG_DEFER_SIZE; t++) { ASSERT(msp->ms_defertree[t] == NULL); @@ -2450,7 +2449,6 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) vdev_space_update(vd, 0, 0, msp->ms_size); } - freed_tree = &msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]; defer_tree = &msp->ms_defertree[txg % TXG_DEFER_SIZE]; uint64_t free_space = metaslab_class_get_space(spa_normal_class(spa)) - @@ -2462,7 +2460,7 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) defer_delta = 0; alloc_delta = space_map_alloc_delta(msp->ms_sm); if (defer_allowed) { - defer_delta = range_tree_space(*freed_tree) - + defer_delta = range_tree_space(msp->ms_freedtree) - range_tree_space(*defer_tree); } else { defer_delta -= range_tree_space(*defer_tree); @@ -2470,9 +2468,6 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) vdev_space_update(vd, alloc_delta + defer_delta, defer_delta, 0); - ASSERT0(range_tree_space(msp->ms_alloctree[txg & TXG_MASK])); - ASSERT0(range_tree_space(msp->ms_freetree[txg & TXG_MASK])); - /* * If there's a metaslab_load() in progress, wait for it to complete * so that we have a consistent view of the in-core space map. @@ -2488,9 +2483,9 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) range_tree_vacate(*defer_tree, msp->ms_loaded ? range_tree_add : NULL, msp->ms_tree); if (defer_allowed) { - range_tree_swap(freed_tree, defer_tree); + range_tree_swap(&msp->ms_freedtree, defer_tree); } else { - range_tree_vacate(*freed_tree, + range_tree_vacate(msp->ms_freedtree, msp->ms_loaded ? range_tree_add : NULL, msp->ms_tree); } @@ -3250,10 +3245,10 @@ metaslab_free_dva(spa_t *spa, const dva_t *dva, uint64 range_tree_add(msp->ms_tree, offset, size); msp->ms_max_size = metaslab_block_maxsize(msp); } else { - if (range_tree_space(msp->ms_freetree[txg & TXG_MASK]) == 0) + VERIFY3U(txg, ==, spa->spa_syncing_txg); + if (range_tree_space(msp->ms_freeingtree) == 0) vdev_dirty(vd, VDD_METASLAB, msp, txg); - range_tree_add(msp->ms_freetree[txg & TXG_MASK], - offset, size); + range_tree_add(msp->ms_freeingtree, offset, size); } mutex_exit(&msp->ms_lock); @@ -3485,8 +3480,8 @@ metaslab_check_free(spa_t *spa, const blkptr_t *bp) if (msp->ms_loaded) range_tree_verify(msp->ms_tree, offset, size); - for (int j = 0; j < TXG_SIZE; j++) - range_tree_verify(msp->ms_freetree[j], offset, size); + range_tree_verify(msp->ms_freeingtree, offset, size); + range_tree_verify(msp->ms_freedtree, offset, size); for (int j = 0; j < TXG_DEFER_SIZE; j++) range_tree_verify(msp->ms_defertree[j], offset, size); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Jul 26 16:24:53 2017 (r321538) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Jul 26 16:25:46 2017 (r321539) @@ -255,21 +255,24 @@ struct metaslab_group { #define MAX_LBAS 64 /* - * Each metaslab maintains a set of in-core trees to track metaslab operations. - * The in-core free tree (ms_tree) contains the current list of free segments. - * As blocks are allocated, the allocated segment are removed from the ms_tree - * and added to a per txg allocation tree (ms_alloctree). As blocks are freed, - * they are added to the per txg free tree (ms_freetree). These per txg - * trees allow us to process all allocations and frees in syncing context - * where it is safe to update the on-disk space maps. One additional in-core - * tree is maintained to track deferred frees (ms_defertree). Once a block - * is freed it will move from the ms_freetree to the ms_defertree. A deferred - * free means that a block has been freed but cannot be used by the pool - * until TXG_DEFER_SIZE transactions groups later. For example, a block - * that is freed in txg 50 will not be available for reallocation until - * txg 52 (50 + TXG_DEFER_SIZE). This provides a safety net for uberblock - * rollback. A pool could be safely rolled back TXG_DEFERS_SIZE - * transactions groups and ensure that no block has been reallocated. + * Each metaslab maintains a set of in-core trees to track metaslab + * operations. The in-core free tree (ms_tree) contains the list of + * free segments which are eligible for allocation. As blocks are + * allocated, the allocated segments are removed from the ms_tree and + * added to a per txg allocation tree (ms_alloctree). This allows us to + * process all allocations in syncing context where it is safe to update + * the on-disk space maps. Frees are also processed in syncing context. + * Most frees are generated from syncing context, and those that are not + * are held in the spa_free_bplist for processing in syncing context. + * An additional set of in-core trees is maintained to track deferred + * frees (ms_defertree). Once a block is freed it will move from the + * ms_freedtree to the ms_defertree. A deferred free means that a block + * has been freed but cannot be used by the pool until TXG_DEFER_SIZE + * transactions groups later. For example, a block that is freed in txg + * 50 will not be available for reallocation until txg 52 (50 + + * TXG_DEFER_SIZE). This provides a safety net for uberblock rollback. + * A pool could be safely rolled back TXG_DEFERS_SIZE transactions + * groups and ensure that no block has been reallocated. * * The simplified transition diagram looks like this: * @@ -277,33 +280,34 @@ struct metaslab_group { * ALLOCATE * | * V - * free segment (ms_tree) --------> ms_alloctree ----> (write to space map) + * free segment (ms_tree) -----> ms_alloctree[4] ----> (write to space map) * ^ - * | - * | ms_freetree <--- FREE + * | ms_freeingtree <--- FREE * | | + * | v + * | ms_freedtree * | | - * | | - * +----------- ms_defertree <-------+---------> (write to space map) + * +-------- ms_defertree[2] <-------+---------> (write to space map) * * * Each metaslab's space is tracked in a single space map in the MOS, - * which is only updated in syncing context. Each time we sync a txg, - * we append the allocs and frees from that txg to the space map. - * The pool space is only updated once all metaslabs have finished syncing. + * which is only updated in syncing context. Each time we sync a txg, + * we append the allocs and frees from that txg to the space map. The + * pool space is only updated once all metaslabs have finished syncing. * - * To load the in-core free tree we read the space map from disk. - * This object contains a series of alloc and free records that are - * combined to make up the list of all free segments in this metaslab. These + * To load the in-core free tree we read the space map from disk. This + * object contains a series of alloc and free records that are combined + * to make up the list of all free segments in this metaslab. These * segments are represented in-core by the ms_tree and are stored in an * AVL tree. * * As the space map grows (as a result of the appends) it will - * eventually become space-inefficient. When the metaslab's in-core free tree - * is zfs_condense_pct/100 times the size of the minimal on-disk - * representation, we rewrite it in its minimized form. If a metaslab - * needs to condense then we must set the ms_condensing flag to ensure - * that allocations are not performed on the metaslab that is being written. + * eventually become space-inefficient. When the metaslab's in-core + * free tree is zfs_condense_pct/100 times the size of the minimal + * on-disk representation, we rewrite it in its minimized form. If a + * metaslab needs to condense then we must set the ms_condensing flag to + * ensure that allocations are not performed on the metaslab that is + * being written. */ struct metaslab { kmutex_t ms_lock; @@ -315,9 +319,16 @@ struct metaslab { uint64_t ms_fragmentation; range_tree_t *ms_alloctree[TXG_SIZE]; - range_tree_t *ms_freetree[TXG_SIZE]; - range_tree_t *ms_defertree[TXG_DEFER_SIZE]; range_tree_t *ms_tree; + + /* + * The following range trees are accessed only from syncing context. + * ms_free*tree only have entries while syncing, and are empty + * between syncs. + */ + range_tree_t *ms_freeingtree; /* to free this syncing txg */ + range_tree_t *ms_freedtree; /* already freed this syncing txg */ + range_tree_t *ms_defertree[TXG_DEFER_SIZE]; boolean_t ms_condensing; /* condensing? */ boolean_t ms_condense_wanted; From owner-svn-src-all@freebsd.org Wed Jul 26 16:26:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF920D98D8A; Wed, 26 Jul 2017 16:26: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 9902569924; Wed, 26 Jul 2017 16:26: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 v6QGQYg4068199; Wed, 26 Jul 2017 16:26:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGQYou068197; Wed, 26 Jul 2017 16:26:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261626.v6QGQYou068197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321540 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:26:35 -0000 Author: mav Date: Wed Jul 26 16:26:34 2017 New Revision: 321540 URL: https://svnweb.freebsd.org/changeset/base/321540 Log: MFC r317533: MFV 316900 7743 per-vdev-zaps have no initialize path on upgrade illumos/illumos-gate@555da5111b0f2552c42d057b211aba89c9c79f6c https://github.com/illumos/illumos-gate/commit/555da5111b0f2552c42d057b211aba89c9c79f6c https://www.illumos.org/issues/7743 When loading a pool that had been created before the existance of per-vdev zaps, on a system that knows about per-vdev zaps, the per-vdev zaps will not be allocated and initialized. This appears to be because the logic that would have done so, in spa_sync_config_object(), is not reached under normal operation. It is only reached if spa_config_dirty_list is non-empty. The fix is to add another `AVZ_ACTION_` enum that will allow this code to be reached when we detect that we're loading an old pool, even when there are no dirty configs. Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Reviewed by: George Wilson Reviewed by: Don Brady Approved by: Robert Mustacchi Author: Paul Dagnelie Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jul 26 16:25:46 2017 (r321539) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jul 26 16:26:34 2017 (r321540) @@ -2736,10 +2736,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP, &spa->spa_all_vdev_zaps); - if (error != ENOENT && error != 0) { + if (error == ENOENT) { + VERIFY(!nvlist_exists(mos_config, + ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)); + spa->spa_avz_action = AVZ_ACTION_INITIALIZE; + ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev)); + } else if (error != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } else if (error == 0 && !nvlist_exists(mos_config, - ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) { + } else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) { /* * An older version of ZFS overwrote the sentinel value, so * we have orphaned per-vdev ZAPs in the MOS. Defer their @@ -6503,6 +6507,7 @@ spa_sync_config_object(spa_t *spa, dmu_tx_t *tx) spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); ASSERT(spa->spa_avz_action == AVZ_ACTION_NONE || + spa->spa_avz_action == AVZ_ACTION_INITIALIZE || spa->spa_all_vdev_zaps != 0); if (spa->spa_avz_action == AVZ_ACTION_REBUILD) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Wed Jul 26 16:25:46 2017 (r321539) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Wed Jul 26 16:26:34 2017 (r321540) @@ -120,7 +120,8 @@ typedef struct spa_taskqs { typedef enum spa_all_vdev_zap_action { AVZ_ACTION_NONE = 0, AVZ_ACTION_DESTROY, /* Destroy all per-vdev ZAPs and the AVZ. */ - AVZ_ACTION_REBUILD /* Populate the new AVZ, see spa_avz_rebuild */ + AVZ_ACTION_REBUILD, /* Populate the new AVZ, see spa_avz_rebuild */ + AVZ_ACTION_INITIALIZE } spa_avz_action_t; struct spa { From owner-svn-src-all@freebsd.org Wed Jul 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2DCCD98DFE; Wed, 26 Jul 2017 16:27:21 +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 AEC4469A54; Wed, 26 Jul 2017 16:27:21 +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 v6QGRKtX068282; Wed, 26 Jul 2017 16:27:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGRKxT068280; Wed, 26 Jul 2017 16:27:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261627.v6QGRKxT068280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321541 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:27:21 -0000 Author: mav Date: Wed Jul 26 16:27:20 2017 New Revision: 321541 URL: https://svnweb.freebsd.org/changeset/base/321541 Log: MFC r317541: MFV 316905 7740 fix for 6513 only works in hole punching case, not truncation illumos/illumos-gate@7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553 https://github.com/illumos/illumos-gate/commit/7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553 https://www.illumos.org/issues/7740 The problem is that dbuf_findbp will return ENOENT if the block it's trying to find is beyond the end of the file. If that happens, we assume there is no birth time, and so we lose that information when we write out new blkptrs. We should teach dbuf_findbp to look for things that are beyond the current end, but not beyond the absolute end of the file. To verify, create a large file, truncate it to a short length, and then write beyond the end. Check with zdb to make sure that there are no holes with birth time zero (will appear as gaps). Reviewed by: Steve Gonczi Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Paul Dagnelie Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:26:34 2017 (r321540) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:27:20 2017 (r321541) @@ -2161,8 +2161,6 @@ static int dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, int fail_sparse, dmu_buf_impl_t **parentp, blkptr_t **bpp) { - int nlevels, epbs; - *parentp = NULL; *bpp = NULL; @@ -2181,17 +2179,35 @@ dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, in return (0); } - if (dn->dn_phys->dn_nlevels == 0) - nlevels = 1; - else - nlevels = dn->dn_phys->dn_nlevels; + int nlevels = + (dn->dn_phys->dn_nlevels == 0) ? 1 : dn->dn_phys->dn_nlevels; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - ASSERT3U(level * epbs, <, 64); ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); + /* + * This assertion shouldn't trip as long as the max indirect block size + * is less than 1M. The reason for this is that up to that point, + * the number of levels required to address an entire object with blocks + * of size SPA_MINBLOCKSIZE satisfies nlevels * epbs + 1 <= 64. In + * other words, if N * epbs + 1 > 64, then if (N-1) * epbs + 1 > 55 + * (i.e. we can address the entire object), objects will all use at most + * N-1 levels and the assertion won't overflow. However, once epbs is + * 13, 4 * 13 + 1 = 53, but 5 * 13 + 1 = 66. Then, 4 levels will not be + * enough to address an entire object, so objects will have 5 levels, + * but then this assertion will overflow. + * + * All this is to say that if we ever increase DN_MAX_INDBLKSHIFT, we + * need to redo this logic to handle overflows. + */ + ASSERT(level >= nlevels || + ((nlevels - level - 1) * epbs) + + highbit64(dn->dn_phys->dn_nblkptr) <= 64); if (level >= nlevels || - (blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs)))) { + blkid >= ((uint64_t)dn->dn_phys->dn_nblkptr << + ((nlevels - level - 1) * epbs)) || + (fail_sparse && + blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs)))) { /* the buffer has no parent yet */ return (SET_ERROR(ENOENT)); } else if (level < nlevels-1) { @@ -2209,6 +2225,8 @@ dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, in } *bpp = ((blkptr_t *)(*parentp)->db.db_data) + (blkid & ((1ULL << epbs) - 1)); + if (blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs))) + ASSERT(BP_IS_HOLE(*bpp)); return (0); } else { /* the block is referenced from the dnode */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 16:26:34 2017 (r321540) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 16:27:20 2017 (r321541) @@ -58,6 +58,12 @@ extern "C" { */ #define DNODE_SHIFT 9 /* 512 bytes */ #define DN_MIN_INDBLKSHIFT 12 /* 4k */ +/* + * If we ever increase this value beyond 20, we need to revisit all logic that + * does x << level * ebps to handle overflow. With a 1M indirect block size, + * 4 levels of indirect blocks would not be able to guarantee addressing an + * entire object, so 5 levels will be used, but 5 * (20 - 7) = 65. + */ #define DN_MAX_INDBLKSHIFT 17 /* 128k */ #define DNODE_BLOCK_SHIFT 14 /* 16k */ #define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ From owner-svn-src-all@freebsd.org Wed Jul 26 16:28:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C7B4D98E8C; Wed, 26 Jul 2017 16:28:06 +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 689F569B8F; Wed, 26 Jul 2017 16:28:06 +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 v6QGS5OH068370; Wed, 26 Jul 2017 16:28:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGS5NU068369; Wed, 26 Jul 2017 16:28:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261628.v6QGS5NU068369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321542 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:28:06 -0000 Author: mav Date: Wed Jul 26 16:28:05 2017 New Revision: 321542 URL: https://svnweb.freebsd.org/changeset/base/321542 Log: MFC r317648: Fix misport of compressed ZFS send/recv from 317414 Reported by: Michael Jung Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:27:20 2017 (r321541) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:28:05 2017 (r321542) @@ -962,7 +962,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, co flags |= ZIO_FLAG_DONT_QUEUE; zio = zio_create(pio, spa, txg, bp, NULL, size, - BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW, + size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW, flags, NULL, 0, NULL, ZIO_STAGE_OPEN, stage); return (zio); From owner-svn-src-all@freebsd.org Wed Jul 26 16:30:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D339BD98F9E; Wed, 26 Jul 2017 16:30:10 +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 9C52B69D33; Wed, 26 Jul 2017 16:30:10 +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 v6QGU90K068517; Wed, 26 Jul 2017 16:30:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGU9TN068516; Wed, 26 Jul 2017 16:30:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261630.v6QGU9TN068516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321543 - stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 321543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:30:10 -0000 Author: mav Date: Wed Jul 26 16:30:09 2017 New Revision: 321543 URL: https://svnweb.freebsd.org/changeset/base/321543 Log: MFC r318812: MFV r316860: 7545 zdb should disable reference tracking illumos/illumos-gate@4dd77f9e38ef05b39db128ff7608d926fd3218c6 https://github.com/illumos/illumos-gate/commit/4dd77f9e38ef05b39db128ff7608d926fd3218c6 https://www.illumos.org/issues/7545 When evicting from the ARC, we manipulate some refcount_t's, e.g. arcs_size. When using zdb to examine a large amount of data (e.g. zdb -bb on a large pool with small blocks), the ARC may have a large number of entries. If reference tracking is enabled, there will be ~1 reference for each block in the ARC. When evicting, we decrement the refcount and have to search all the references to find the one that we are removing, which is very slow. Since zdb is typically used to find problems with the on-disk format, and not with the code it is running, we should disable reference tracking in zdb. Reviewed by: Dan Kimmel Reviewed by: Steve Gonczi Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 26 16:28:05 2017 (r321542) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 26 16:30:09 2017 (r321543) @@ -75,10 +75,12 @@ DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES)) #ifndef lint +extern int reference_tracking_enable; extern boolean_t zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; extern int zfs_vdev_async_read_max_active; #else +int reference_tracking_enable; boolean_t zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; @@ -3695,6 +3697,11 @@ main(int argc, char **argv) * For good performance, let several of them be active at once. */ zfs_vdev_async_read_max_active = 10; + + /* + * Disable reference tracking for better performance. + */ + reference_tracking_enable = B_FALSE; kernel_init(FREAD); g_zfs = libzfs_init(); From owner-svn-src-all@freebsd.org Wed Jul 26 16:30:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DD17DA9033; Wed, 26 Jul 2017 16:30:59 +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 DE39A69EF6; Wed, 26 Jul 2017 16:30:58 +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 v6QGUwge068595; Wed, 26 Jul 2017 16:30:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGUwuV068594; Wed, 26 Jul 2017 16:30:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261630.v6QGUwuV068594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321544 - stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common X-SVN-Commit-Revision: 321544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:30:59 -0000 Author: mav Date: Wed Jul 26 16:30:57 2017 New Revision: 321544 URL: https://svnweb.freebsd.org/changeset/base/321544 Log: MFC r318814: MFC r316904: 7729 libzfs_core`lzc_rollback() leaks result nvl illumos/illumos-gate@ac428481f96be89add7a1edf43ae47dd71038553 https://github.com/illumos/illumos-gate/commit/ac428481f96be89add7a1edf43ae47dd71038553 https://www.illumos.org/issues/7729 libzfs_core`lzc_rollback() doesn't free the result nvl after lzc_ioctl() call. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Dan McDonald Author: Yuri Pankov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 16:30:09 2017 (r321543) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 16:30:57 2017 (r321544) @@ -759,6 +759,8 @@ lzc_rollback(const char *fsname, char *snapnamebuf, in const char *snapname = fnvlist_lookup_string(result, "target"); (void) strlcpy(snapnamebuf, snapname, snapnamelen); } + nvlist_free(result); + return (err); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:32:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C8BEDA9227; Wed, 26 Jul 2017 16:32:19 +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 2113C6A20A; Wed, 26 Jul 2017 16:32:19 +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 v6QGWIlu070202; Wed, 26 Jul 2017 16:32:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGWHM9070193; Wed, 26 Jul 2017 16:32:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261632.v6QGWHM9070193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321545 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:32:19 -0000 Author: mav Date: Wed Jul 26 16:32:17 2017 New Revision: 321545 URL: https://svnweb.freebsd.org/changeset/base/321545 Log: MFC r318818: MFV r316907: 1300 filename normalization doesn't work for removes illumos/illumos-gate@1c17160ac558f98048951327f4e9248d8f46acc0 https://github.com/illumos/illumos-gate/commit/1c17160ac558f98048951327f4e9248d8f46acc0 https://www.illumos.org/issues/1300 FreeBSD note: recent FreeBSD was not affected by the issue fixed as the name cache is completely bypassed when normalization is enabled. The change is imported for the sake of ZAP infrastructure modifications. Reviewed by: Yuri Pankov Reviewed by: Pavel Zakharov Reviewed by: Matt Ahrens Approved by: Dan McDonald Author: Kevin Crowe Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,15 +18,16 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2015, STRATO AG, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Nexenta Systems, Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1622,7 +1623,7 @@ dmu_snapshot_realname(objset_t *os, char *name, char * return (zap_lookup_norm(ds->ds_dir->dd_pool->dp_meta_objset, dsl_dataset_phys(ds)->ds_snapnames_zapobj, name, 8, 1, &ignored, - MT_FIRST, real, maxlen, conflict)); + MT_NORMALIZE, real, maxlen, conflict)); } int Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Wed Jul 26 16:32:17 2017 (r321545) @@ -12,8 +12,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. */ #include @@ -59,16 +61,14 @@ dsl_dataset_bmark_lookup(dsl_dataset_t *ds, const char { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; uint64_t bmark_zapobj = ds->ds_bookmarks; - matchtype_t mt; + matchtype_t mt = 0; int err; if (bmark_zapobj == 0) return (SET_ERROR(ESRCH)); if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) - mt = MT_FIRST; - else - mt = MT_EXACT; + mt = MT_NORMALIZE; err = zap_lookup_norm(mos, bmark_zapobj, shortname, sizeof (uint64_t), sizeof (*bmark_phys) / sizeof (uint64_t), bmark_phys, mt, @@ -339,12 +339,10 @@ dsl_dataset_bookmark_remove(dsl_dataset_t *ds, const c { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; uint64_t bmark_zapobj = ds->ds_bookmarks; - matchtype_t mt; + matchtype_t mt = 0; if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) - mt = MT_FIRST; - else - mt = MT_EXACT; + mt = MT_NORMALIZE; return (zap_remove_norm(mos, bmark_zapobj, name, mt, tx)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska @@ -27,6 +28,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. */ #include @@ -364,17 +366,15 @@ dsl_dataset_snap_lookup(dsl_dataset_t *ds, const char { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; - matchtype_t mt; + matchtype_t mt = 0; int err; if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) - mt = MT_FIRST; - else - mt = MT_EXACT; + mt = MT_NORMALIZE; err = zap_lookup_norm(mos, snapobj, name, 8, 1, value, mt, NULL, 0, NULL); - if (err == ENOTSUP && mt == MT_FIRST) + if (err == ENOTSUP && (mt & MT_NORMALIZE)) err = zap_lookup(mos, snapobj, name, 8, 1, value); return (err); } @@ -385,18 +385,16 @@ dsl_dataset_snap_remove(dsl_dataset_t *ds, const char { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; - matchtype_t mt; + matchtype_t mt = 0; int err; dsl_dir_snap_cmtime_update(ds->ds_dir); if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) - mt = MT_FIRST; - else - mt = MT_EXACT; + mt = MT_NORMALIZE; err = zap_remove_norm(mos, snapobj, name, mt, tx); - if (err == ENOTSUP && mt == MT_FIRST) + if (err == ENOTSUP && (mt & MT_NORMALIZE)) err = zap_remove(mos, snapobj, name, tx); if (err == 0 && adj_cnt) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Jul 26 16:32:17 2017 (r321545) @@ -18,9 +18,11 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. */ #ifndef _SYS_ZAP_H @@ -88,22 +90,15 @@ extern "C" { /* * Specifies matching criteria for ZAP lookups. + * MT_NORMALIZE Use ZAP normalization flags, which can include both + * unicode normalization and case-insensitivity. + * MT_MATCH_CASE Do case-sensitive lookups even if MT_NORMALIZE is + * specified and ZAP normalization flags include + * U8_TEXTPREP_TOUPPER. */ -typedef enum matchtype -{ - /* Only find an exact match (non-normalized) */ - MT_EXACT, - /* - * If there is an exact match, find that, otherwise find the - * first normalized match. - */ - MT_BEST, - /* - * Find the "first" normalized (case and Unicode form) match; - * the designated "first" match will not change as long as the - * set of entries with this normalization doesn't change. - */ - MT_FIRST +typedef enum matchtype { + MT_NORMALIZE = 1 << 0, + MT_MATCH_CASE = 1 << 1, } matchtype_t; typedef enum zap_flags { @@ -120,16 +115,6 @@ typedef enum zap_flags { /* * Create a new zapobj with no attributes and return its object number. - * MT_EXACT will cause the zap object to only support MT_EXACT lookups, - * otherwise any matchtype can be used for lookups. - * - * normflags specifies what normalization will be done. values are: - * 0: no normalization (legacy on-disk format, supports MT_EXACT matching - * only) - * U8_TEXTPREP_TOLOWER: case normalization will be performed. - * MT_FIRST/MT_BEST matching will find entries that match without - * regard to case (eg. looking for "foo" can find an entry "Foo"). - * Eventually, other flags will permit unicode normalization as well. */ uint64_t zap_create(objset_t *ds, dmu_object_type_t ot, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Wed Jul 26 16:32:17 2017 (r321545) @@ -18,11 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Nexenta Systems, Inc. */ #ifndef _SYS_ZAP_IMPL_H @@ -189,6 +191,7 @@ typedef struct zap_name { int zn_key_norm_numints; uint64_t zn_hash; matchtype_t zn_matchtype; + int zn_normflags; char zn_normbuf[ZAP_MAXNAMELEN]; } zap_name_t; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,9 +18,11 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. */ /* @@ -361,7 +363,7 @@ zap_leaf_array_match(zap_leaf_t *l, zap_name_t *zn, } ASSERT(zn->zn_key_intlen == 1); - if (zn->zn_matchtype == MT_FIRST) { + if (zn->zn_matchtype & MT_NORMALIZE) { char *thisname = kmem_alloc(array_numints, KM_SLEEP); boolean_t match; @@ -403,7 +405,6 @@ zap_leaf_lookup(zap_leaf_t *l, zap_name_t *zn, zap_ent ASSERT3U(zap_leaf_phys(l)->l_hdr.lh_magic, ==, ZAP_LEAF_MAGIC); -again: for (chunkp = LEAF_HASH_ENTPTR(l, zn->zn_hash); *chunkp != CHAIN_END; chunkp = &le->le_next) { uint16_t chunk = *chunkp; @@ -418,9 +419,9 @@ again: /* * NB: the entry chain is always sorted by cd on * normalized zap objects, so this will find the - * lowest-cd match for MT_FIRST. + * lowest-cd match for MT_NORMALIZE. */ - ASSERT(zn->zn_matchtype == MT_EXACT || + ASSERT((zn->zn_matchtype == 0) || (zap_leaf_phys(l)->l_hdr.lh_flags & ZLF_ENTRIES_CDSORTED)); if (zap_leaf_array_match(l, zn, le->le_name_chunk, le->le_name_numints)) { @@ -434,15 +435,6 @@ again: } } - /* - * NB: we could of course do this in one pass, but that would be - * a pain. We'll see if MT_BEST is even used much. - */ - if (zn->zn_matchtype == MT_BEST) { - zn->zn_matchtype = MT_FIRST; - goto again; - } - return (SET_ERROR(ENOENT)); } @@ -697,7 +689,7 @@ zap_entry_normalization_conflict(zap_entry_handle_t *z continue; if (zn == NULL) { - zn = zap_name_alloc(zap, name, MT_FIRST); + zn = zap_name_alloc(zap, name, MT_NORMALIZE); allocdzn = B_TRUE; } if (zap_leaf_array_match(zeh->zeh_leaf, zn, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,11 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Nexenta Systems, Inc. */ #include @@ -133,7 +135,7 @@ zap_hash(zap_name_t *zn) } static int -zap_normalize(zap_t *zap, const char *name, char *namenorm) +zap_normalize(zap_t *zap, const char *name, char *namenorm, int normflags) { size_t inlen, outlen; int err; @@ -145,8 +147,8 @@ zap_normalize(zap_t *zap, const char *name, char *name err = 0; (void) u8_textprep_str((char *)name, &inlen, namenorm, &outlen, - zap->zap_normflags | U8_TEXTPREP_IGNORE_NULL | - U8_TEXTPREP_IGNORE_INVALID, U8_UNICODE_LATEST, &err); + normflags | U8_TEXTPREP_IGNORE_NULL | U8_TEXTPREP_IGNORE_INVALID, + U8_UNICODE_LATEST, &err); return (err); } @@ -156,15 +158,15 @@ zap_match(zap_name_t *zn, const char *matchname) { ASSERT(!(zap_getflags(zn->zn_zap) & ZAP_FLAG_UINT64_KEY)); - if (zn->zn_matchtype == MT_FIRST) { + if (zn->zn_matchtype & MT_NORMALIZE) { char norm[ZAP_MAXNAMELEN]; - if (zap_normalize(zn->zn_zap, matchname, norm) != 0) + if (zap_normalize(zn->zn_zap, matchname, norm, + zn->zn_normflags) != 0) return (B_FALSE); return (strcmp(zn->zn_key_norm, norm) == 0); } else { - /* MT_BEST or MT_EXACT */ return (strcmp(zn->zn_key_orig, matchname) == 0); } } @@ -185,15 +187,30 @@ zap_name_alloc(zap_t *zap, const char *key, matchtype_ zn->zn_key_orig = key; zn->zn_key_orig_numints = strlen(zn->zn_key_orig) + 1; zn->zn_matchtype = mt; + zn->zn_normflags = zap->zap_normflags; + + /* + * If we're dealing with a case sensitive lookup on a mixed or + * insensitive fs, remove U8_TEXTPREP_TOUPPER or the lookup + * will fold case to all caps overriding the lookup request. + */ + if (mt & MT_MATCH_CASE) + zn->zn_normflags &= ~U8_TEXTPREP_TOUPPER; + if (zap->zap_normflags) { - if (zap_normalize(zap, key, zn->zn_normbuf) != 0) { + /* + * We *must* use zap_normflags because this normalization is + * what the hash is computed from. + */ + if (zap_normalize(zap, key, zn->zn_normbuf, + zap->zap_normflags) != 0) { zap_name_free(zn); return (NULL); } zn->zn_key_norm = zn->zn_normbuf; zn->zn_key_norm_numints = strlen(zn->zn_key_norm) + 1; } else { - if (mt != MT_EXACT) { + if (mt != 0) { zap_name_free(zn); return (NULL); } @@ -202,6 +219,20 @@ zap_name_alloc(zap_t *zap, const char *key, matchtype_ } zn->zn_hash = zap_hash(zn); + + if (zap->zap_normflags != zn->zn_normflags) { + /* + * We *must* use zn_normflags because this normalization is + * what the matching is based on. (Not the hash!) + */ + if (zap_normalize(zap, key, zn->zn_normbuf, + zn->zn_normflags) != 0) { + zap_name_free(zn); + return (NULL); + } + zn->zn_key_norm_numints = strlen(zn->zn_key_norm) + 1; + } + return (zn); } @@ -215,7 +246,7 @@ zap_name_alloc_uint64(zap_t *zap, const uint64_t *key, zn->zn_key_intlen = sizeof (*key); zn->zn_key_orig = zn->zn_key_norm = key; zn->zn_key_orig_numints = zn->zn_key_norm_numints = numints; - zn->zn_matchtype = MT_EXACT; + zn->zn_matchtype = 0; zn->zn_hash = zap_hash(zn); return (zn); @@ -305,7 +336,6 @@ mze_find(zap_name_t *zn) mze_tofind.mze_hash = zn->zn_hash; mze_tofind.mze_cd = 0; -again: mze = avl_find(avl, &mze_tofind, &idx); if (mze == NULL) mze = avl_nearest(avl, idx, AVL_AFTER); @@ -314,10 +344,7 @@ again: if (zap_match(zn, MZE_PHYS(zn->zn_zap, mze)->mze_name)) return (mze); } - if (zn->zn_matchtype == MT_BEST) { - zn->zn_matchtype = MT_FIRST; - goto again; - } + return (NULL); } @@ -422,8 +449,7 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db) if (mze->mze_name[0]) { zap_name_t *zn; - zn = zap_name_alloc(zap, mze->mze_name, - MT_EXACT); + zn = zap_name_alloc(zap, mze->mze_name, 0); if (mze_insert(zap, i, zn->zn_hash) == 0) zap->zap_m.zap_num_entries++; else { @@ -629,7 +655,7 @@ mzap_upgrade(zap_t **zapp, void *tag, dmu_tx_t *tx, za continue; dprintf("adding %s=%llu\n", mze->mze_name, mze->mze_value); - zn = zap_name_alloc(zap, mze->mze_name, MT_EXACT); + zn = zap_name_alloc(zap, mze->mze_name, 0); err = fzap_add_cd(zn, 8, 1, &mze->mze_value, mze->mze_cd, tag, tx); zap = zn->zn_zap; /* fzap_add_cd() may change zap */ @@ -642,6 +668,23 @@ mzap_upgrade(zap_t **zapp, void *tag, dmu_tx_t *tx, za return (err); } +/* + * The "normflags" determine the behavior of the matchtype_t which is + * passed to zap_lookup_norm(). Names which have the same normalized + * version will be stored with the same hash value, and therefore we can + * perform normalization-insensitive lookups. We can be Unicode form- + * insensitive and/or case-insensitive. The following flags are valid for + * "normflags": + * + * U8_TEXTPREP_NFC + * U8_TEXTPREP_NFD + * U8_TEXTPREP_NFKC + * U8_TEXTPREP_NFKD + * U8_TEXTPREP_TOUPPER + * + * The *_NF* (Normalization Form) flags are mutually exclusive; at most one + * of them may be supplied. + */ void mzap_create_impl(objset_t *os, uint64_t obj, int normflags, zap_flags_t flags, dmu_tx_t *tx) @@ -800,7 +843,7 @@ again: if (zn == NULL) { zn = zap_name_alloc(zap, MZE_PHYS(zap, mze)->mze_name, - MT_FIRST); + MT_NORMALIZE); allocdzn = B_TRUE; } if (zap_match(zn, MZE_PHYS(zap, other)->mze_name)) { @@ -829,7 +872,7 @@ zap_lookup(objset_t *os, uint64_t zapobj, const char * uint64_t integer_size, uint64_t num_integers, void *buf) { return (zap_lookup_norm(os, zapobj, name, integer_size, - num_integers, buf, MT_EXACT, NULL, 0, NULL)); + num_integers, buf, 0, NULL, 0, NULL)); } static int @@ -897,7 +940,7 @@ zap_lookup_by_dnode(dnode_t *dn, const char *name, uint64_t integer_size, uint64_t num_integers, void *buf) { return (zap_lookup_norm_by_dnode(dn, name, integer_size, - num_integers, buf, MT_EXACT, NULL, 0, NULL)); + num_integers, buf, 0, NULL, 0, NULL)); } int @@ -970,7 +1013,7 @@ int zap_contains(objset_t *os, uint64_t zapobj, const char *name) { int err = zap_lookup_norm(os, zapobj, name, 0, - 0, NULL, MT_EXACT, NULL, 0, NULL); + 0, NULL, 0, NULL, 0, NULL); if (err == EOVERFLOW || err == EINVAL) err = 0; /* found, but skipped reading the value */ return (err); @@ -988,7 +1031,7 @@ zap_length(objset_t *os, uint64_t zapobj, const char * err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); - zn = zap_name_alloc(zap, name, MT_EXACT); + zn = zap_name_alloc(zap, name, 0); if (zn == NULL) { zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); @@ -1091,7 +1134,7 @@ zap_add(objset_t *os, uint64_t zapobj, const char *key err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); - zn = zap_name_alloc(zap, key, MT_EXACT); + zn = zap_name_alloc(zap, key, 0); if (zn == NULL) { zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); @@ -1170,7 +1213,7 @@ zap_update(objset_t *os, uint64_t zapobj, const char * err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); - zn = zap_name_alloc(zap, name, MT_EXACT); + zn = zap_name_alloc(zap, name, 0); if (zn == NULL) { zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); @@ -1233,7 +1276,7 @@ zap_update_uint64(objset_t *os, uint64_t zapobj, const int zap_remove(objset_t *os, uint64_t zapobj, const char *name, dmu_tx_t *tx) { - return (zap_remove_norm(os, zapobj, name, MT_EXACT, tx)); + return (zap_remove_norm(os, zapobj, name, 0, tx)); } int @@ -1525,7 +1568,7 @@ zap_count_write_by_dnode(dnode_t *dn, const char *name return (err); if (!zap->zap_ismicro) { - zap_name_t *zn = zap_name_alloc(zap, name, MT_EXACT); + zap_name_t *zn = zap_name_alloc(zap, name, 0); if (zn) { err = fzap_count_write(zn, add, towrite, tooverwrite); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,9 +18,11 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. */ #include @@ -63,12 +65,11 @@ */ static int zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, - boolean_t exact, uint64_t *zoid) + matchtype_t mt, uint64_t *zoid) { int error; if (zfsvfs->z_norm) { - matchtype_t mt = exact? MT_EXACT : MT_FIRST; /* * In the non-mixed case we only expect there would ever @@ -108,7 +109,7 @@ int zfs_dirent_lookup(znode_t *dzp, const char *name, znode_t **zpp, int flag) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - boolean_t exact; + matchtype_t mt = 0; uint64_t zoid; vnode_t *vp = NULL; int error = 0; @@ -131,15 +132,39 @@ zfs_dirent_lookup(znode_t *dzp, const char *name, znod * zfsvfs->z_case and zfsvfs->z_norm fields. These choices * affect how we perform zap lookups. * - * Decide if exact matches should be requested when performing - * a zap lookup on file systems supporting case-insensitive - * access. + * When matching we may need to normalize & change case according to + * FS settings. * + * Note that a normalized match is necessary for a case insensitive + * filesystem when the lookup request is not exact because normalization + * can fold case independent of normalizing code point sequences. + * + * See the table above zfs_dropname(). + */ + if (zfsvfs->z_norm != 0) { + mt = MT_NORMALIZE; + + /* + * Determine if the match needs to honor the case specified in + * lookup, and if so keep track of that so that during + * normalization we don't fold case. + */ + if (zfsvfs->z_case == ZFS_CASE_MIXED) { + mt |= MT_MATCH_CASE; + } + } + + /* + * Only look in or update the DNLC if we are looking for the + * name on a file system that does not require normalization + * or case folding. We can also look there if we happen to be + * on a non-normalizing, mixed sensitivity file system IF we + * are looking for the exact name. + * * NB: we do not need to worry about this flag for ZFS_CASE_SENSITIVE * because in that case MT_EXACT and MT_FIRST should produce exactly * the same result. */ - exact = zfsvfs->z_case == ZFS_CASE_MIXED; if (dzp->z_unlinked && !(flag & ZXATTR)) return (ENOENT); @@ -149,7 +174,7 @@ zfs_dirent_lookup(znode_t *dzp, const char *name, znod if (error == 0) error = (zoid == 0 ? ENOENT : 0); } else { - error = zfs_match_find(zfsvfs, dzp, name, exact, &zoid); + error = zfs_match_find(zfsvfs, dzp, name, mt, &zoid); } if (error) { if (error != ENOENT || (flag & ZEXISTS)) { @@ -566,6 +591,28 @@ zfs_link_create(znode_t *dzp, const char *name, znode_ return (0); } +/* + * The match type in the code for this function should conform to: + * + * ------------------------------------------------------------------------ + * fs type | z_norm | lookup type | match type + * ---------|-------------|-------------|---------------------------------- + * CS !norm | 0 | 0 | 0 (exact) + * CS norm | formX | 0 | MT_NORMALIZE + * CI !norm | upper | !ZCIEXACT | MT_NORMALIZE + * CI !norm | upper | ZCIEXACT | MT_NORMALIZE | MT_MATCH_CASE + * CI norm | upper|formX | !ZCIEXACT | MT_NORMALIZE + * CI norm | upper|formX | ZCIEXACT | MT_NORMALIZE | MT_MATCH_CASE + * CM !norm | upper | !ZCILOOK | MT_NORMALIZE | MT_MATCH_CASE + * CM !norm | upper | ZCILOOK | MT_NORMALIZE + * CM norm | upper|formX | !ZCILOOK | MT_NORMALIZE | MT_MATCH_CASE + * CM norm | upper|formX | ZCILOOK | MT_NORMALIZE + * + * Abbreviations: + * CS = Case Sensitive, CI = Case Insensitive, CM = Case Mixed + * upper = case folding set by fs type on creation (U8_TEXTPREP_TOUPPER) + * formX = unicode normalization form set on fs creation + */ static int zfs_dropname(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, int flag) @@ -573,15 +620,16 @@ zfs_dropname(znode_t *dzp, const char *name, znode_t * int error; if (zp->z_zfsvfs->z_norm) { - if (zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) - error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, name, MT_EXACT, tx); - else - error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, name, MT_FIRST, tx); + matchtype_t mt = MT_NORMALIZE; + + if (zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) { + mt |= MT_MATCH_CASE; + } + + error = zap_remove_norm(zp->z_zfsvfs->z_os, dzp->z_id, + name, mt, tx); } else { - error = zap_remove(zp->z_zfsvfs->z_os, - dzp->z_id, name, tx); + error = zap_remove(zp->z_zfsvfs->z_os, dzp->z_id, name, tx); } return (error); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:30:57 2017 (r321544) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:32:17 2017 (r321545) @@ -18,11 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Nexenta Systems, Inc. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -1534,7 +1535,15 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru zfsvfs_t *zfsvfs = zdp->z_zfsvfs; int error = 0; - /* fast path (should be redundant with vfs namecache) */ + /* + * Fast path lookup, however we must skip DNLC lookup + * for case folding or normalizing lookups because the + * DNLC code only stores the passed in name. This means + * creating 'a' and removing 'A' on a case insensitive + * file system would work, but DNLC still thinks 'a' + * exists and won't let you create it again on the next + * pass through fast path. + */ if (!(flags & LOOKUP_XATTR)) { if (dvp->v_type != VDIR) { return (SET_ERROR(ENOTDIR)); From owner-svn-src-all@freebsd.org Wed Jul 26 16:33:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609EADA92AE; Wed, 26 Jul 2017 16:33:59 +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 3AF526A371; Wed, 26 Jul 2017 16:33:59 +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 v6QGXwXc072437; Wed, 26 Jul 2017 16:33:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGXwpi072435; Wed, 26 Jul 2017 16:33:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261633.v6QGXwpi072435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321546 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 321546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:33:59 -0000 Author: mav Date: Wed Jul 26 16:33:58 2017 New Revision: 321546 URL: https://svnweb.freebsd.org/changeset/base/321546 Log: MFC r318819: MFV r316908: 7541 zpool import/tryimport ioctl returns ENOMEM because provided buffer is too small for config illumos/illumos-gate@8b65a70b763232c90a91f31eb2010314c02ed338 https://github.com/illumos/illumos-gate/commit/8b65a70b763232c90a91f31eb2010314c02ed338 https://www.illumos.org/issues/7541 When calling zpool import, zpool does a few ioctls to ZFS. zpool allocates a buffer in userland and passes it to the kernel so that ZFS can copy info into it. ZFS will use it to put the nvlist that describes the pool configuration. If the allocated buffer is too small, ZFS will return ENOMEM and the call will have to be redone. This wastes CPU time and slows down the import process. This happens very often for the ZFS_IOC_POOL_TRYIMPORT call. Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Dan McDonald Author: Pavel Zakharov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Wed Jul 26 16:32:17 2017 (r321545) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Wed Jul 26 16:33:58 2017 (r321546) @@ -132,6 +132,8 @@ typedef enum { SHARED_SMB = 0x4 } zfs_share_type_t; +#define CONFIG_BUF_MINSIZE 65536 + int zfs_error(libzfs_handle_t *, int, const char *); int zfs_error_fmt(libzfs_handle_t *, int, const char *, ...); void zfs_error_aux(libzfs_handle_t *, const char *, ...); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Jul 26 16:32:17 2017 (r321545) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Jul 26 16:33:58 2017 (r321546) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. * Copyright 2016 Nexenta Systems, Inc. */ @@ -379,13 +379,14 @@ refresh_config(libzfs_handle_t *hdl, nvlist_t *config) { nvlist_t *nvl; zfs_cmd_t zc = { 0 }; - int err; + int err, dstbuf_size; if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0) return (NULL); - if (zcmd_alloc_dst_nvlist(hdl, &zc, - zc.zc_nvlist_conf_size * 2) != 0) { + dstbuf_size = MAX(CONFIG_BUF_MINSIZE, zc.zc_nvlist_conf_size * 4); + + if (zcmd_alloc_dst_nvlist(hdl, &zc, dstbuf_size) != 0) { zcmd_free_nvlists(&zc); return (NULL); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:35:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6BDDA9330; Wed, 26 Jul 2017 16:35:19 +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 DEF286A4C1; Wed, 26 Jul 2017 16:35:18 +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 v6QGZIPZ072551; Wed, 26 Jul 2017 16:35:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGZHOg072547; Wed, 26 Jul 2017 16:35:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261635.v6QGZHOg072547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321547 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:35:19 -0000 Author: mav Date: Wed Jul 26 16:35:17 2017 New Revision: 321547 URL: https://svnweb.freebsd.org/changeset/base/321547 Log: MFC r318821: MFV r316912: 7793 ztest fails assertion in dmu_tx_willuse_space illumos/illumos-gate@61e255ce7267b52208af9daf434b77d37fb75622 https://github.com/illumos/illumos-gate/commit/61e255ce7267b52208af9daf434b77d37 fb75622 https://www.illumos.org/issues/7793 Background information: This assertion about tx_space_* verifies that we are not dirtying more stuff than we thought we would. We “need†to know how much we will dirty so that we can check if we should fail this transaction with ENOSPC/EDQUOT, in dmu_tx_assign(). While the transaction is open (i.e. between dmu_tx_assign() and dmu_tx_commit() — typically less than a millisecond), we call dbuf_dirty() on the exact blocks that will be modified. Once this happens, the temporary accounting in tx_space_* is unnecessary, because we know exactly what blocks are newly dirtied; we call dnode_willuse_space() to track this more exact accounting. The fundamental problem causing this bug is that dmu_tx_hold_*() relies on the current state in the DMU (e.g. dn_nlevels) to predict how much will be dirtied by this transaction, but this state can change before we actually perform the transaction (i.e. call dbuf_dirty()). This bug will be fixed by removing the assertion that the tx_space_* accounting is perfectly accurate (i.e. we never dirty more than was predicted by dmu_tx_hold_*()). By removing the requirement that this accounting be perfectly accurate, we can also vastly simplify it, e.g. removing most of the logic in dmu_tx_count_*(). The new tx space accounting will be very approximate, and may be more or less than what is actually dirtied. It will still be used to determine if this transaction will put us over quota. Transactions that are marked by dmu_tx_mark_netfree() will be excepted from this check. We won’t make an attempt to determine how much space will be freed by the transaction — this was rarely accurate enough to determine if a transaction should be permitted when we are over quota, which is why dmu_tx_mark_netfree() was introduced in 2014. We also won’t attempt to give “credit†when overwriting existing blocks, if those blocks may be freed. This allows us to remove the do_free_accounting logic in dbuf_dirty(), and associated routines. This Reviewed by: Steve Gonczi Reviewed by: George Wilson Reviewed by: Pavel Zakharov Reviewed by: Brian Behlendorf Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:33:58 2017 (r321546) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:35:17 2017 (r321547) @@ -1346,41 +1346,6 @@ dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uin mutex_exit(&dn->dn_dbufs_mtx); } -static int -dbuf_block_freeable(dmu_buf_impl_t *db) -{ - dsl_dataset_t *ds = db->db_objset->os_dsl_dataset; - uint64_t birth_txg = 0; - - /* - * We don't need any locking to protect db_blkptr: - * If it's syncing, then db_last_dirty will be set - * so we'll ignore db_blkptr. - * - * This logic ensures that only block births for - * filled blocks are considered. - */ - ASSERT(MUTEX_HELD(&db->db_mtx)); - if (db->db_last_dirty && (db->db_blkptr == NULL || - !BP_IS_HOLE(db->db_blkptr))) { - birth_txg = db->db_last_dirty->dr_txg; - } else if (db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) { - birth_txg = db->db_blkptr->blk_birth; - } - - /* - * If this block don't exist or is in a snapshot, it can't be freed. - * Don't pass the bp to dsl_dataset_block_freeable() since we - * are holding the db_mtx lock and might deadlock if we are - * prefetching a dedup-ed block. - */ - if (birth_txg != 0) - return (ds == NULL || - dsl_dataset_block_freeable(ds, NULL, birth_txg)); - else - return (B_FALSE); -} - void dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx) { @@ -1430,7 +1395,7 @@ dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t * } mutex_exit(&db->db_mtx); - dnode_willuse_space(dn, size-osize, tx); + dmu_objset_willuse_space(dn->dn_objset, size - osize, tx); DB_DNODE_EXIT(db); } @@ -1480,7 +1445,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) objset_t *os; dbuf_dirty_record_t **drp, *dr; int drop_struct_lock = FALSE; - boolean_t do_free_accounting = B_FALSE; int txgoff = tx->tx_txg & TXG_MASK; ASSERT(tx->tx_txg != 0); @@ -1602,15 +1566,7 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size); if (db->db_blkid != DMU_BONUS_BLKID) { - /* - * Update the accounting. - * Note: we delay "free accounting" until after we drop - * the db_mtx. This keeps us from grabbing other locks - * (and possibly deadlocking) in bp_get_dsize() while - * also holding the db_mtx. - */ - dnode_willuse_space(dn, db->db.db_size, tx); - do_free_accounting = dbuf_block_freeable(db); + dmu_objset_willuse_space(os, db->db.db_size, tx); } /* @@ -1703,21 +1659,13 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) drop_struct_lock = TRUE; } - if (do_free_accounting) { - blkptr_t *bp = db->db_blkptr; - int64_t willfree = (bp && !BP_IS_HOLE(bp)) ? - bp_get_dsize(os->os_spa, bp) : db->db.db_size; - /* - * This is only a guess -- if the dbuf is dirty - * in a previous txg, we don't know how much - * space it will use on disk yet. We should - * really have the struct_rwlock to access - * db_blkptr, but since this is just a guess, - * it's OK if we get an odd answer. - */ - ddt_prefetch(os->os_spa, bp); - dnode_willuse_space(dn, -willfree, tx); - } + /* + * If we are overwriting a dedup BP, then unless it is snapshotted, + * when we get to syncing context we will need to decrement its + * refcount in the DDT. Prefetch the relevant DDT block so that + * syncing context won't have to wait for the i/o. + */ + ddt_prefetch(os->os_spa, db->db_blkptr); if (db->db_level == 0) { dnode_new_blkid(dn, db->db_blkid, tx, drop_struct_lock); @@ -2925,19 +2873,6 @@ void dmu_buf_user_evict_wait() { taskq_wait(dbu_evict_taskq); -} - -boolean_t -dmu_buf_freeable(dmu_buf_t *dbuf) -{ - boolean_t res = B_FALSE; - dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbuf; - - if (db->db_blkptr) - res = dsl_dataset_block_freeable(db->db_objset->os_dsl_dataset, - db->db_blkptr, db->db_blkptr->blk_birth); - - return (res); } blkptr_t * Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:33:58 2017 (r321546) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:35:17 2017 (r321547) @@ -2103,3 +2103,20 @@ dmu_fsname(const char *snapname, char *buf) (void) strlcpy(buf, snapname, atp - snapname + 1); return (0); } + +/* + * Call when we think we're going to write/free space in open context to track + * the amount of dirty data in the open txg, which is also the amount + * of memory that can not be evicted until this txg syncs. + */ +void +dmu_objset_willuse_space(objset_t *os, int64_t space, dmu_tx_t *tx) +{ + dsl_dataset_t *ds = os->os_dsl_dataset; + int64_t aspace = spa_get_worst_case_asize(os->os_spa, space); + + if (ds != NULL) { + dsl_dir_willuse_space(ds->ds_dir, aspace, tx); + dsl_pool_dirty_space(dmu_tx_pool(tx), space, tx); + } +} Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:33:58 2017 (r321546) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:35:17 2017 (r321547) @@ -30,10 +30,10 @@ #include #include #include -#include /* for dsl_dataset_block_freeable() */ -#include /* for dsl_dir_tempreserve_*() */ +#include +#include #include -#include /* for fzap_default_block_shift */ +#include #include #include #include @@ -56,10 +56,6 @@ dmu_tx_create_dd(dsl_dir_t *dd) list_create(&tx->tx_callbacks, sizeof (dmu_tx_callback_t), offsetof(dmu_tx_callback_t, dcb_node)); tx->tx_start = gethrtime(); -#ifdef ZFS_DEBUG - refcount_create(&tx->tx_space_written); - refcount_create(&tx->tx_space_freed); -#endif return (tx); } @@ -68,7 +64,6 @@ dmu_tx_create(objset_t *os) { dmu_tx_t *tx = dmu_tx_create_dd(os->os_dsl_dataset->ds_dir); tx->tx_objset = os; - tx->tx_lastsnap_txg = dsl_dataset_prev_snap_txg(os->os_dsl_dataset); return (tx); } @@ -130,16 +125,10 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, objset_t *os, ui txh->txh_tx = tx; txh->txh_dnode = dn; refcount_create(&txh->txh_space_towrite); - refcount_create(&txh->txh_space_tofree); - refcount_create(&txh->txh_space_tooverwrite); - refcount_create(&txh->txh_space_tounref); refcount_create(&txh->txh_memory_tohold); - refcount_create(&txh->txh_fudge); -#ifdef ZFS_DEBUG txh->txh_type = type; txh->txh_arg1 = arg1; txh->txh_arg2 = arg2; -#endif list_insert_tail(&tx->tx_holds, txh); return (txh); @@ -158,6 +147,34 @@ dmu_tx_add_new_object(dmu_tx_t *tx, objset_t *os, uint } } +/* + * This function reads specified data from disk. The specified data will + * be needed to perform the transaction -- i.e, it will be read after + * we do dmu_tx_assign(). There are two reasons that we read the data now + * (before dmu_tx_assign()): + * + * 1. Reading it now has potentially better performance. The transaction + * has not yet been assigned, so the TXG is not held open, and also the + * caller typically has less locks held when calling dmu_tx_hold_*() than + * after the transaction has been assigned. This reduces the lock (and txg) + * hold times, thus reducing lock contention. + * + * 2. It is easier for callers (primarily the ZPL) to handle i/o errors + * that are detected before they start making changes to the DMU state + * (i.e. now). Once the transaction has been assigned, and some DMU + * state has been changed, it can be difficult to recover from an i/o + * error (e.g. to undo the changes already made in memory at the DMU + * layer). Typically code to do so does not exist in the caller -- it + * assumes that the data has already been cached and thus i/o errors are + * not possible. + * + * It has been observed that the i/o initiated here can be a performance + * problem, and it appears to be optional, because we don't look at the + * data which is read. However, removing this read would only serve to + * move the work elsewhere (after the dmu_tx_assign()), where it may + * have a greater impact on performance (in addition to the impact on + * fault tolerance noted above). + */ static int dmu_tx_check_ioerr(zio_t *zio, dnode_t *dn, int level, uint64_t blkid) { @@ -174,259 +191,84 @@ dmu_tx_check_ioerr(zio_t *zio, dnode_t *dn, int level, return (err); } -static void -dmu_tx_count_twig(dmu_tx_hold_t *txh, dnode_t *dn, dmu_buf_impl_t *db, - int level, uint64_t blkid, boolean_t freeable, uint64_t *history) -{ - objset_t *os = dn->dn_objset; - dsl_dataset_t *ds = os->os_dsl_dataset; - int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - dmu_buf_impl_t *parent = NULL; - blkptr_t *bp = NULL; - uint64_t space; - - if (level >= dn->dn_nlevels || history[level] == blkid) - return; - - history[level] = blkid; - - space = (level == 0) ? dn->dn_datablksz : (1ULL << dn->dn_indblkshift); - - if (db == NULL || db == dn->dn_dbuf) { - ASSERT(level != 0); - db = NULL; - } else { - ASSERT(DB_DNODE(db) == dn); - ASSERT(db->db_level == level); - ASSERT(db->db.db_size == space); - ASSERT(db->db_blkid == blkid); - bp = db->db_blkptr; - parent = db->db_parent; - } - - freeable = (bp && (freeable || - dsl_dataset_block_freeable(ds, bp, bp->blk_birth))); - - if (freeable) { - (void) refcount_add_many(&txh->txh_space_tooverwrite, - space, FTAG); - } else { - (void) refcount_add_many(&txh->txh_space_towrite, - space, FTAG); - } - - if (bp) { - (void) refcount_add_many(&txh->txh_space_tounref, - bp_get_dsize(os->os_spa, bp), FTAG); - } - - dmu_tx_count_twig(txh, dn, parent, level + 1, - blkid >> epbs, freeable, history); -} - /* ARGSUSED */ static void dmu_tx_count_write(dmu_tx_hold_t *txh, uint64_t off, uint64_t len) { dnode_t *dn = txh->txh_dnode; - uint64_t start, end, i; - int min_bs, max_bs, min_ibs, max_ibs, epbs, bits; int err = 0; if (len == 0) return; - min_bs = SPA_MINBLOCKSHIFT; - max_bs = highbit64(txh->txh_tx->tx_objset->os_recordsize) - 1; - min_ibs = DN_MIN_INDBLKSHIFT; - max_ibs = DN_MAX_INDBLKSHIFT; + (void) refcount_add_many(&txh->txh_space_towrite, len, FTAG); - if (dn) { - uint64_t history[DN_MAX_LEVELS]; - int nlvls = dn->dn_nlevels; - int delta; + if (refcount_count(&txh->txh_space_towrite) > 2 * DMU_MAX_ACCESS) + err = SET_ERROR(EFBIG); - /* - * For i/o error checking, read the first and last level-0 - * blocks (if they are not aligned), and all the level-1 blocks. - */ - if (dn->dn_maxblkid == 0) { - delta = dn->dn_datablksz; - start = (off < dn->dn_datablksz) ? 0 : 1; - end = (off+len <= dn->dn_datablksz) ? 0 : 1; - if (start == 0 && (off > 0 || len < dn->dn_datablksz)) { - err = dmu_tx_check_ioerr(NULL, dn, 0, 0); - if (err) - goto out; - delta -= off; - } - } else { - zio_t *zio = zio_root(dn->dn_objset->os_spa, - NULL, NULL, ZIO_FLAG_CANFAIL); + if (dn == NULL) + return; - /* first level-0 block */ - start = off >> dn->dn_datablkshift; - if (P2PHASE(off, dn->dn_datablksz) || - len < dn->dn_datablksz) { - err = dmu_tx_check_ioerr(zio, dn, 0, start); - if (err) - goto out; + /* + * For i/o error checking, read the blocks that will be needed + * to perform the write: the first and last level-0 blocks (if + * they are not aligned, i.e. if they are partial-block writes), + * and all the level-1 blocks. + */ + if (dn->dn_maxblkid == 0) { + if (off < dn->dn_datablksz && + (off > 0 || len < dn->dn_datablksz)) { + err = dmu_tx_check_ioerr(NULL, dn, 0, 0); + if (err != 0) { + txh->txh_tx->tx_err = err; } + } + } else { + zio_t *zio = zio_root(dn->dn_objset->os_spa, + NULL, NULL, ZIO_FLAG_CANFAIL); - /* last level-0 block */ - end = (off+len-1) >> dn->dn_datablkshift; - if (end != start && end <= dn->dn_maxblkid && - P2PHASE(off+len, dn->dn_datablksz)) { - err = dmu_tx_check_ioerr(zio, dn, 0, end); - if (err) - goto out; + /* first level-0 block */ + uint64_t start = off >> dn->dn_datablkshift; + if (P2PHASE(off, dn->dn_datablksz) || len < dn->dn_datablksz) { + err = dmu_tx_check_ioerr(zio, dn, 0, start); + if (err != 0) { + txh->txh_tx->tx_err = err; } - - /* level-1 blocks */ - if (nlvls > 1) { - int shft = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - for (i = (start>>shft)+1; i < end>>shft; i++) { - err = dmu_tx_check_ioerr(zio, dn, 1, i); - if (err) - goto out; - } - } - - err = zio_wait(zio); - if (err) - goto out; - delta = P2NPHASE(off, dn->dn_datablksz); } - min_ibs = max_ibs = dn->dn_indblkshift; - if (dn->dn_maxblkid > 0) { - /* - * The blocksize can't change, - * so we can make a more precise estimate. - */ - ASSERT(dn->dn_datablkshift != 0); - min_bs = max_bs = dn->dn_datablkshift; - } else { - /* - * The blocksize can increase up to the recordsize, - * or if it is already more than the recordsize, - * up to the next power of 2. - */ - min_bs = highbit64(dn->dn_datablksz - 1); - max_bs = MAX(max_bs, highbit64(dn->dn_datablksz - 1)); - } - - /* - * If this write is not off the end of the file - * we need to account for overwrites/unref. - */ - if (start <= dn->dn_maxblkid) { - for (int l = 0; l < DN_MAX_LEVELS; l++) - history[l] = -1ULL; - } - while (start <= dn->dn_maxblkid) { - dmu_buf_impl_t *db; - - rw_enter(&dn->dn_struct_rwlock, RW_READER); - err = dbuf_hold_impl(dn, 0, start, - FALSE, FALSE, FTAG, &db); - rw_exit(&dn->dn_struct_rwlock); - - if (err) { + /* last level-0 block */ + uint64_t end = (off + len - 1) >> dn->dn_datablkshift; + if (end != start && end <= dn->dn_maxblkid && + P2PHASE(off + len, dn->dn_datablksz)) { + err = dmu_tx_check_ioerr(zio, dn, 0, end); + if (err != 0) { txh->txh_tx->tx_err = err; - return; } + } - dmu_tx_count_twig(txh, dn, db, 0, start, B_FALSE, - history); - dbuf_rele(db, FTAG); - if (++start > end) { - /* - * Account for new indirects appearing - * before this IO gets assigned into a txg. - */ - bits = 64 - min_bs; - epbs = min_ibs - SPA_BLKPTRSHIFT; - for (bits -= epbs * (nlvls - 1); - bits >= 0; bits -= epbs) { - (void) refcount_add_many( - &txh->txh_fudge, - 1ULL << max_ibs, FTAG); + /* level-1 blocks */ + if (dn->dn_nlevels > 1) { + int shft = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + for (uint64_t i = (start >> shft) + 1; + i < end >> shft; i++) { + err = dmu_tx_check_ioerr(zio, dn, 1, i); + if (err != 0) { + txh->txh_tx->tx_err = err; } - goto out; } - off += delta; - if (len >= delta) - len -= delta; - delta = dn->dn_datablksz; } - } - /* - * 'end' is the last thing we will access, not one past. - * This way we won't overflow when accessing the last byte. - */ - start = P2ALIGN(off, 1ULL << max_bs); - end = P2ROUNDUP(off + len, 1ULL << max_bs) - 1; - (void) refcount_add_many(&txh->txh_space_towrite, - end - start + 1, FTAG); - - start >>= min_bs; - end >>= min_bs; - - epbs = min_ibs - SPA_BLKPTRSHIFT; - - /* - * The object contains at most 2^(64 - min_bs) blocks, - * and each indirect level maps 2^epbs. - */ - for (bits = 64 - min_bs; bits >= 0; bits -= epbs) { - start >>= epbs; - end >>= epbs; - ASSERT3U(end, >=, start); - (void) refcount_add_many(&txh->txh_space_towrite, - (end - start + 1) << max_ibs, FTAG); - if (start != 0) { - /* - * We also need a new blkid=0 indirect block - * to reference any existing file data. - */ - (void) refcount_add_many(&txh->txh_space_towrite, - 1ULL << max_ibs, FTAG); + err = zio_wait(zio); + if (err != 0) { + txh->txh_tx->tx_err = err; } } - -out: - if (refcount_count(&txh->txh_space_towrite) + - refcount_count(&txh->txh_space_tooverwrite) > - 2 * DMU_MAX_ACCESS) - err = SET_ERROR(EFBIG); - - if (err) - txh->txh_tx->tx_err = err; } static void dmu_tx_count_dnode(dmu_tx_hold_t *txh) { - dnode_t *dn = txh->txh_dnode; - dnode_t *mdn = DMU_META_DNODE(txh->txh_tx->tx_objset); - uint64_t space = mdn->dn_datablksz + - ((mdn->dn_nlevels-1) << mdn->dn_indblkshift); - - if (dn && dn->dn_dbuf->db_blkptr && - dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset, - dn->dn_dbuf->db_blkptr, dn->dn_dbuf->db_blkptr->blk_birth)) { - (void) refcount_add_many(&txh->txh_space_tooverwrite, - space, FTAG); - (void) refcount_add_many(&txh->txh_space_tounref, space, FTAG); - } else { - (void) refcount_add_many(&txh->txh_space_towrite, space, FTAG); - if (dn && dn->dn_dbuf->db_blkptr) { - (void) refcount_add_many(&txh->txh_space_tounref, - space, FTAG); - } - } + (void) refcount_add_many(&txh->txh_space_towrite, DNODE_SIZE, FTAG); } void @@ -434,8 +276,8 @@ dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint6 { dmu_tx_hold_t *txh; - ASSERT(tx->tx_txg == 0); - ASSERT(len < DMU_MAX_ACCESS); + ASSERT0(tx->tx_txg); + ASSERT3U(len, <=, DMU_MAX_ACCESS); ASSERT(len == 0 || UINT64_MAX - off >= len - 1); txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, @@ -447,179 +289,6 @@ dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint6 dmu_tx_count_dnode(txh); } -static void -dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, uint64_t len) -{ - uint64_t blkid, nblks, lastblk; - uint64_t space = 0, unref = 0, skipped = 0; - dnode_t *dn = txh->txh_dnode; - dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; - spa_t *spa = txh->txh_tx->tx_pool->dp_spa; - int epbs; - uint64_t l0span = 0, nl1blks = 0; - - if (dn->dn_nlevels == 0) - return; - - /* - * The struct_rwlock protects us against dn_nlevels - * changing, in case (against all odds) we manage to dirty & - * sync out the changes after we check for being dirty. - * Also, dbuf_hold_impl() wants us to have the struct_rwlock. - */ - rw_enter(&dn->dn_struct_rwlock, RW_READER); - epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - if (dn->dn_maxblkid == 0) { - if (off == 0 && len >= dn->dn_datablksz) { - blkid = 0; - nblks = 1; - } else { - rw_exit(&dn->dn_struct_rwlock); - return; - } - } else { - blkid = off >> dn->dn_datablkshift; - nblks = (len + dn->dn_datablksz - 1) >> dn->dn_datablkshift; - - if (blkid > dn->dn_maxblkid) { - rw_exit(&dn->dn_struct_rwlock); - return; - } - if (blkid + nblks > dn->dn_maxblkid) - nblks = dn->dn_maxblkid - blkid + 1; - - } - l0span = nblks; /* save for later use to calc level > 1 overhead */ - if (dn->dn_nlevels == 1) { - int i; - for (i = 0; i < nblks; i++) { - blkptr_t *bp = dn->dn_phys->dn_blkptr; - ASSERT3U(blkid + i, <, dn->dn_nblkptr); - bp += blkid + i; - if (dsl_dataset_block_freeable(ds, bp, bp->blk_birth)) { - dprintf_bp(bp, "can free old%s", ""); - space += bp_get_dsize(spa, bp); - } - unref += BP_GET_ASIZE(bp); - } - nl1blks = 1; - nblks = 0; - } - - lastblk = blkid + nblks - 1; - while (nblks) { - dmu_buf_impl_t *dbuf; - uint64_t ibyte, new_blkid; - int epb = 1 << epbs; - int err, i, blkoff, tochk; - blkptr_t *bp; - - ibyte = blkid << dn->dn_datablkshift; - err = dnode_next_offset(dn, - DNODE_FIND_HAVELOCK, &ibyte, 2, 1, 0); - new_blkid = ibyte >> dn->dn_datablkshift; - if (err == ESRCH) { - skipped += (lastblk >> epbs) - (blkid >> epbs) + 1; - break; - } - if (err) { - txh->txh_tx->tx_err = err; - break; - } - if (new_blkid > lastblk) { - skipped += (lastblk >> epbs) - (blkid >> epbs) + 1; - break; - } - - if (new_blkid > blkid) { - ASSERT((new_blkid >> epbs) > (blkid >> epbs)); - skipped += (new_blkid >> epbs) - (blkid >> epbs) - 1; - nblks -= new_blkid - blkid; - blkid = new_blkid; - } - blkoff = P2PHASE(blkid, epb); - tochk = MIN(epb - blkoff, nblks); - - err = dbuf_hold_impl(dn, 1, blkid >> epbs, - FALSE, FALSE, FTAG, &dbuf); - if (err) { - txh->txh_tx->tx_err = err; - break; - } - - (void) refcount_add_many(&txh->txh_memory_tohold, - dbuf->db.db_size, FTAG); - - /* - * We don't check memory_tohold against DMU_MAX_ACCESS because - * memory_tohold is an over-estimation (especially the >L1 - * indirect blocks), so it could fail. Callers should have - * already verified that they will not be holding too much - * memory. - */ - - err = dbuf_read(dbuf, NULL, DB_RF_HAVESTRUCT | DB_RF_CANFAIL); - if (err != 0) { - txh->txh_tx->tx_err = err; - dbuf_rele(dbuf, FTAG); - break; - } - - bp = dbuf->db.db_data; - bp += blkoff; - - for (i = 0; i < tochk; i++) { - if (dsl_dataset_block_freeable(ds, &bp[i], - bp[i].blk_birth)) { - dprintf_bp(&bp[i], "can free old%s", ""); - space += bp_get_dsize(spa, &bp[i]); - } - unref += BP_GET_ASIZE(bp); - } - dbuf_rele(dbuf, FTAG); - - ++nl1blks; - blkid += tochk; - nblks -= tochk; - } - rw_exit(&dn->dn_struct_rwlock); - - /* - * Add in memory requirements of higher-level indirects. - * This assumes a worst-possible scenario for dn_nlevels and a - * worst-possible distribution of l1-blocks over the region to free. - */ - { - uint64_t blkcnt = 1 + ((l0span >> epbs) >> epbs); - int level = 2; - /* - * Here we don't use DN_MAX_LEVEL, but calculate it with the - * given datablkshift and indblkshift. This makes the - * difference between 19 and 8 on large files. - */ - int maxlevel = 2 + (DN_MAX_OFFSET_SHIFT - dn->dn_datablkshift) / - (dn->dn_indblkshift - SPA_BLKPTRSHIFT); - - while (level++ < maxlevel) { - (void) refcount_add_many(&txh->txh_memory_tohold, - MAX(MIN(blkcnt, nl1blks), 1) << dn->dn_indblkshift, - FTAG); - blkcnt = 1 + (blkcnt >> epbs); - } - } - - /* account for new level 1 indirect blocks that might show up */ - if (skipped > 0) { - (void) refcount_add_many(&txh->txh_fudge, - skipped << dn->dn_indblkshift, FTAG); - skipped = MIN(skipped, DMU_MAX_DELETEBLKCNT >> epbs); - (void) refcount_add_many(&txh->txh_memory_tohold, - skipped << dn->dn_indblkshift, FTAG); - } - (void) refcount_add_many(&txh->txh_space_tofree, space, FTAG); - (void) refcount_add_many(&txh->txh_space_tounref, unref, FTAG); -} - /* * This function marks the transaction as being a "net free". The end * result is that refquotas will be disabled for this transaction, and @@ -631,45 +300,27 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, ui void dmu_tx_mark_netfree(dmu_tx_t *tx) { - dmu_tx_hold_t *txh; - - txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, - DMU_NEW_OBJECT, THT_FREE, 0, 0); - - /* - * Pretend that this operation will free 1GB of space. This - * should be large enough to cancel out the largest write. - * We don't want to use something like UINT64_MAX, because that would - * cause overflows when doing math with these values (e.g. in - * dmu_tx_try_assign()). - */ - (void) refcount_add_many(&txh->txh_space_tofree, - 1024 * 1024 * 1024, FTAG); - (void) refcount_add_many(&txh->txh_space_tounref, - 1024 * 1024 * 1024, FTAG); + tx->tx_netfree = B_TRUE; } void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) { - dmu_tx_hold_t *txh; - dnode_t *dn; int err; - zio_t *zio; ASSERT(tx->tx_txg == 0); - txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + dmu_tx_hold_t *txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object, THT_FREE, off, len); if (txh == NULL) return; - dn = txh->txh_dnode; + dnode_t *dn = txh->txh_dnode; dmu_tx_count_dnode(txh); - if (off >= (dn->dn_maxblkid+1) * dn->dn_datablksz) + if (off >= (dn->dn_maxblkid + 1) * dn->dn_datablksz) return; if (len == DMU_OBJECT_END) - len = (dn->dn_maxblkid+1) * dn->dn_datablksz - off; + len = (dn->dn_maxblkid + 1) * dn->dn_datablksz - off; /* @@ -690,7 +341,7 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64 dmu_tx_count_write(txh, off, 1); /* last block will be modified if it is not aligned */ if (!IS_P2ALIGNED(off + len, 1 << dn->dn_datablkshift)) - dmu_tx_count_write(txh, off+len, 1); + dmu_tx_count_write(txh, off + len, 1); } /* @@ -712,7 +363,7 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64 if (dn->dn_datablkshift == 0) start = end = 0; - zio = zio_root(tx->tx_pool->dp_spa, + zio_t *zio = zio_root(tx->tx_pool->dp_spa, NULL, NULL, ZIO_FLAG_CANFAIL); for (uint64_t i = start; i <= end; i++) { uint64_t ibyte = i << shift; @@ -720,129 +371,82 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64 i = ibyte >> shift; if (err == ESRCH || i > end) break; - if (err) { + if (err != 0) { tx->tx_err = err; + (void) zio_wait(zio); return; } + (void) refcount_add_many(&txh->txh_memory_tohold, + 1 << dn->dn_indblkshift, FTAG); + err = dmu_tx_check_ioerr(zio, dn, 1, i); - if (err) { + if (err != 0) { tx->tx_err = err; + (void) zio_wait(zio); return; } } err = zio_wait(zio); - if (err) { + if (err != 0) { tx->tx_err = err; return; } } - - dmu_tx_count_free(txh, off, len); } void dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name) { - dmu_tx_hold_t *txh; - dnode_t *dn; int err; ASSERT(tx->tx_txg == 0); - txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + dmu_tx_hold_t *txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object, THT_ZAP, add, (uintptr_t)name); if (txh == NULL) return; - dn = txh->txh_dnode; + dnode_t *dn = txh->txh_dnode; dmu_tx_count_dnode(txh); - if (dn == NULL) { - /* - * We will be able to fit a new object's entries into one leaf - * block. So there will be at most 2 blocks total, - * including the header block. - */ - dmu_tx_count_write(txh, 0, 2 << fzap_default_block_shift); + /* + * Modifying a almost-full microzap is around the worst case (128KB) + * + * If it is a fat zap, the worst case would be 7*16KB=112KB: + * - 3 blocks overwritten: target leaf, ptrtbl block, header block + * - 4 new blocks written if adding: + * - 2 blocks for possibly split leaves, + * - 2 grown ptrtbl blocks + */ + (void) refcount_add_many(&txh->txh_space_towrite, + MZAP_MAX_BLKSZ, FTAG); + + if (dn == NULL) return; - } ASSERT3P(DMU_OT_BYTESWAP(dn->dn_type), ==, DMU_BSWAP_ZAP); - if (dn->dn_maxblkid == 0 && !add) { - blkptr_t *bp; - + if (dn->dn_maxblkid == 0 || name == NULL) { /* - * If there is only one block (i.e. this is a micro-zap) - * and we are not adding anything, the accounting is simple. + * This is a microzap (only one block), or we don't know + * the name. Check the first block for i/o errors. */ err = dmu_tx_check_ioerr(NULL, dn, 0, 0); - if (err) { + if (err != 0) { tx->tx_err = err; - return; } - + } else { /* - * Use max block size here, since we don't know how much - * the size will change between now and the dbuf dirty call. + * Access the name so that we'll check for i/o errors to + * the leaf blocks, etc. We ignore ENOENT, as this name + * may not yet exist. */ - bp = &dn->dn_phys->dn_blkptr[0]; - if (dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset, - bp, bp->blk_birth)) { - (void) refcount_add_many(&txh->txh_space_tooverwrite, - MZAP_MAX_BLKSZ, FTAG); - } else { - (void) refcount_add_many(&txh->txh_space_towrite, - MZAP_MAX_BLKSZ, FTAG); - } - if (!BP_IS_HOLE(bp)) { - (void) refcount_add_many(&txh->txh_space_tounref, - MZAP_MAX_BLKSZ, FTAG); - } - return; - } - - if (dn->dn_maxblkid > 0 && name) { - /* - * access the name in this fat-zap so that we'll check - * for i/o errors to the leaf blocks, etc. - */ err = zap_lookup_by_dnode(dn, name, 8, 0, NULL); - if (err == EIO) { + if (err == EIO || err == ECKSUM || err == ENXIO) { tx->tx_err = err; - return; } } - - err = zap_count_write_by_dnode(dn, name, add, - &txh->txh_space_towrite, &txh->txh_space_tooverwrite); - - /* - * If the modified blocks are scattered to the four winds, - * we'll have to modify an indirect twig for each. We can make - * modifications at up to 3 locations: - * - header block at the beginning of the object - * - target leaf block - * - end of the object, where we might need to write: - * - a new leaf block if the target block needs to be split - * - the new pointer table, if it is growing - * - the new cookie table, if it is growing - */ - int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - dsl_dataset_phys_t *ds_phys = - dsl_dataset_phys(dn->dn_objset->os_dsl_dataset); - for (int lvl = 1; lvl < dn->dn_nlevels; lvl++) { - uint64_t num_indirects = 1 + (dn->dn_maxblkid >> (epbs * lvl)); - uint64_t spc = MIN(3, num_indirects) << dn->dn_indblkshift; - if (ds_phys->ds_prev_snap_obj != 0) { - (void) refcount_add_many(&txh->txh_space_towrite, - spc, FTAG); - } else { - (void) refcount_add_many(&txh->txh_space_tooverwrite, - spc, FTAG); - } - } } void @@ -870,42 +474,15 @@ dmu_tx_hold_space(dmu_tx_t *tx, uint64_t space) (void) refcount_add_many(&txh->txh_space_towrite, space, FTAG); } -int -dmu_tx_holds(dmu_tx_t *tx, uint64_t object) -{ - dmu_tx_hold_t *txh; - int holds = 0; - - /* - * By asserting that the tx is assigned, we're counting the - * number of dn_tx_holds, which is the same as the number of - * dn_holds. Otherwise, we'd be counting dn_holds, but - * dn_tx_holds could be 0. - */ - ASSERT(tx->tx_txg != 0); - - /* if (tx->tx_anyobj == TRUE) */ - /* return (0); */ - - for (txh = list_head(&tx->tx_holds); txh; - txh = list_next(&tx->tx_holds, txh)) { - if (txh->txh_dnode && txh->txh_dnode->dn_object == object) - holds++; - } - - return (holds); -} - #ifdef ZFS_DEBUG void dmu_tx_dirty_buf(dmu_tx_t *tx, dmu_buf_impl_t *db) { - dmu_tx_hold_t *txh; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 16:42:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A97EDA956E; Wed, 26 Jul 2017 16:42:33 +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 60B556A91A; Wed, 26 Jul 2017 16:42:33 +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 v6QGgWwS076542; Wed, 26 Jul 2017 16:42:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGgWg3076540; Wed, 26 Jul 2017 16:42:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261642.v6QGgWg3076540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321548 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:42:33 -0000 Author: mav Date: Wed Jul 26 16:42:32 2017 New Revision: 321548 URL: https://svnweb.freebsd.org/changeset/base/321548 Log: MFC r318822: MFC r316913: 7869 panic in bpobj_space(): null pointer dereference illumos/illumos-gate@a3905a45920de250d181b66ac0b6b71bd200d9ef https://github.com/illumos/illumos-gate/commit/a3905a45920de250d181b66ac0b6b71bd200d9ef https://www.illumos.org/issues/7869 The issue fixed by this patch is a race condition in the deadlist code. A thread executing an administrative command that uses `dsl_deadlist_space_range()` holds the lock of the whole `deadlist_t` to protect the access of all its entries that the deadlist contains in an avl tree. Sync threads trying to insert a new entry in the deadlist (through `dsl_deadlist_insert()` -> `dle_enqueue()`) do not hold the deadlist lock at that moment. If the `dle_bpobj` is the empty bpobj (our sentinel value), we close and reopen it. Between these two operations, it is possible for the `dsl_deadlist_space_range()` thread to dereference that bpobj which is `NULL` during that window. Threads should hold the a deadlist's `dl_lock` when they manipulate its internal data so scenarios like the one above are avoided. In addition, threads should also hold the bpobj lock whenever they are allocating the subobj list of a bpobj, and not just when they actually insert the subobj to the list. This way we can avoid potential memory leaks. Reviewed by: Matt Ahrens Reviewed by: Dan Kimmel Reviewed by: Steve Gonczi Reviewed by: John Kennedy Reviewed by: George Melikov Reviewed by: Brian Behlendorf Approved by: Dan McDonald Author: Serapheim Dimitropoulos Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Wed Jul 26 16:35:17 2017 (r321547) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Wed Jul 26 16:42:32 2017 (r321548) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -395,6 +395,7 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dm return; } + mutex_enter(&bpo->bpo_lock); dmu_buf_will_dirty(bpo->bpo_dbuf, tx); if (bpo->bpo_phys->bpo_subobjs == 0) { bpo->bpo_phys->bpo_subobjs = dmu_object_alloc(bpo->bpo_os, @@ -406,7 +407,6 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dm ASSERT0(dmu_object_info(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs, &doi)); ASSERT3U(doi.doi_type, ==, DMU_OT_BPOBJ_SUBOBJ); - mutex_enter(&bpo->bpo_lock); dmu_write(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs, bpo->bpo_phys->bpo_num_subobjs * sizeof (subobj), sizeof (subobj), &subobj, tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c Wed Jul 26 16:35:17 2017 (r321547) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c Wed Jul 26 16:42:32 2017 (r321548) @@ -72,6 +72,8 @@ dsl_deadlist_load_tree(dsl_deadlist_t *dl) zap_cursor_t zc; zap_attribute_t za; + ASSERT(MUTEX_HELD(&dl->dl_lock)); + ASSERT(!dl->dl_oldfmt); if (dl->dl_havetree) return; @@ -182,6 +184,7 @@ static void dle_enqueue(dsl_deadlist_t *dl, dsl_deadlist_entry_t *dle, const blkptr_t *bp, dmu_tx_t *tx) { + ASSERT(MUTEX_HELD(&dl->dl_lock)); if (dle->dle_bpobj.bpo_object == dmu_objset_pool(dl->dl_os)->dp_empty_bpobj) { uint64_t obj = bpobj_alloc(dl->dl_os, SPA_OLD_MAXBLOCKSIZE, tx); @@ -198,6 +201,7 @@ static void dle_enqueue_subobj(dsl_deadlist_t *dl, dsl_deadlist_entry_t *dle, uint64_t obj, dmu_tx_t *tx) { + ASSERT(MUTEX_HELD(&dl->dl_lock)); if (dle->dle_bpobj.bpo_object != dmu_objset_pool(dl->dl_os)->dp_empty_bpobj) { bpobj_enqueue_subobj(&dle->dle_bpobj, obj, tx); @@ -222,15 +226,14 @@ dsl_deadlist_insert(dsl_deadlist_t *dl, const blkptr_t return; } + mutex_enter(&dl->dl_lock); dsl_deadlist_load_tree(dl); dmu_buf_will_dirty(dl->dl_dbuf, tx); - mutex_enter(&dl->dl_lock); dl->dl_phys->dl_used += bp_get_dsize_sync(dmu_objset_spa(dl->dl_os), bp); dl->dl_phys->dl_comp += BP_GET_PSIZE(bp); dl->dl_phys->dl_uncomp += BP_GET_UCSIZE(bp); - mutex_exit(&dl->dl_lock); dle_tofind.dle_mintxg = bp->blk_birth; dle = avl_find(&dl->dl_tree, &dle_tofind, &where); @@ -239,6 +242,7 @@ dsl_deadlist_insert(dsl_deadlist_t *dl, const blkptr_t else dle = AVL_PREV(&dl->dl_tree, dle); dle_enqueue(dl, dle, bp, tx); + mutex_exit(&dl->dl_lock); } /* @@ -254,16 +258,19 @@ dsl_deadlist_add_key(dsl_deadlist_t *dl, uint64_t mint if (dl->dl_oldfmt) return; - dsl_deadlist_load_tree(dl); - dle = kmem_alloc(sizeof (*dle), KM_SLEEP); dle->dle_mintxg = mintxg; + + mutex_enter(&dl->dl_lock); + dsl_deadlist_load_tree(dl); + obj = bpobj_alloc_empty(dl->dl_os, SPA_OLD_MAXBLOCKSIZE, tx); VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, obj)); avl_add(&dl->dl_tree, dle); VERIFY3U(0, ==, zap_add_int_key(dl->dl_os, dl->dl_object, mintxg, obj, tx)); + mutex_exit(&dl->dl_lock); } /* @@ -278,6 +285,7 @@ dsl_deadlist_remove_key(dsl_deadlist_t *dl, uint64_t m if (dl->dl_oldfmt) return; + mutex_enter(&dl->dl_lock); dsl_deadlist_load_tree(dl); dle_tofind.dle_mintxg = mintxg; @@ -291,6 +299,7 @@ dsl_deadlist_remove_key(dsl_deadlist_t *dl, uint64_t m kmem_free(dle, sizeof (*dle)); VERIFY3U(0, ==, zap_remove_int(dl->dl_os, dl->dl_object, mintxg, tx)); + mutex_exit(&dl->dl_lock); } /* @@ -334,6 +343,7 @@ dsl_deadlist_clone(dsl_deadlist_t *dl, uint64_t maxtxg return (newobj); } + mutex_enter(&dl->dl_lock); dsl_deadlist_load_tree(dl); for (dle = avl_first(&dl->dl_tree); dle; @@ -347,6 +357,7 @@ dsl_deadlist_clone(dsl_deadlist_t *dl, uint64_t maxtxg VERIFY3U(0, ==, zap_add_int_key(dl->dl_os, newobj, dle->dle_mintxg, obj, tx)); } + mutex_exit(&dl->dl_lock); return (newobj); } @@ -424,6 +435,8 @@ dsl_deadlist_insert_bpobj(dsl_deadlist_t *dl, uint64_t uint64_t used, comp, uncomp; bpobj_t bpo; + ASSERT(MUTEX_HELD(&dl->dl_lock)); + VERIFY3U(0, ==, bpobj_open(&bpo, dl->dl_os, obj)); VERIFY3U(0, ==, bpobj_space(&bpo, &used, &comp, &uncomp)); bpobj_close(&bpo); @@ -431,11 +444,9 @@ dsl_deadlist_insert_bpobj(dsl_deadlist_t *dl, uint64_t dsl_deadlist_load_tree(dl); dmu_buf_will_dirty(dl->dl_dbuf, tx); - mutex_enter(&dl->dl_lock); dl->dl_phys->dl_used += used; dl->dl_phys->dl_comp += comp; dl->dl_phys->dl_uncomp += uncomp; - mutex_exit(&dl->dl_lock); dle_tofind.dle_mintxg = birth; dle = avl_find(&dl->dl_tree, &dle_tofind, &where); @@ -475,6 +486,7 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, d return; } + mutex_enter(&dl->dl_lock); for (zap_cursor_init(&zc, dl->dl_os, obj); zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { @@ -489,6 +501,7 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, d dmu_buf_will_dirty(bonus, tx); bzero(dlp, sizeof (*dlp)); dmu_buf_rele(bonus, FTAG); + mutex_exit(&dl->dl_lock); } /* @@ -503,6 +516,8 @@ dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *b avl_index_t where; ASSERT(!dl->dl_oldfmt); + + mutex_enter(&dl->dl_lock); dmu_buf_will_dirty(dl->dl_dbuf, tx); dsl_deadlist_load_tree(dl); @@ -518,14 +533,12 @@ dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *b VERIFY3U(0, ==, bpobj_space(&dle->dle_bpobj, &used, &comp, &uncomp)); - mutex_enter(&dl->dl_lock); ASSERT3U(dl->dl_phys->dl_used, >=, used); ASSERT3U(dl->dl_phys->dl_comp, >=, comp); ASSERT3U(dl->dl_phys->dl_uncomp, >=, uncomp); dl->dl_phys->dl_used -= used; dl->dl_phys->dl_comp -= comp; dl->dl_phys->dl_uncomp -= uncomp; - mutex_exit(&dl->dl_lock); VERIFY3U(0, ==, zap_remove_int(dl->dl_os, dl->dl_object, dle->dle_mintxg, tx)); @@ -536,4 +549,5 @@ dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *b kmem_free(dle, sizeof (*dle)); dle = dle_next; } + mutex_exit(&dl->dl_lock); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:43:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B20E3DA962B; Wed, 26 Jul 2017 16:43:22 +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 7AAED6AA5C; Wed, 26 Jul 2017 16:43:22 +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 v6QGhLtl076633; Wed, 26 Jul 2017 16:43:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGhL3M076625; Wed, 26 Jul 2017 16:43:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261643.v6QGhL3M076625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321549 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:43:22 -0000 Author: mav Date: Wed Jul 26 16:43:20 2017 New Revision: 321549 URL: https://svnweb.freebsd.org/changeset/base/321549 Log: MFC r318823: MFC r316914: 7801 add more by-dnode routines illumos/illumos-gate@b0c42cd4706ba01ce158bd2bb1004f7e59eca5fe https://github.com/illumos/illumos-gate/commit/b0c42cd4706ba01ce158bd2bb1004f7e59eca5fe https://www.illumos.org/issues/7801 Add *_by_dnode() routines for accessing objects given their dnode_t *, this is more efficient than accessing the object by (objset_t *, uint64_t object). This change converts some but not all of the existing consumers. As performance-sensitive code paths are discovered they should be converted to use these routines. Ported from: https://github.com/zfsonlinux/zfs/commit/0eef1bde31d67091d3deed23fe2394f5a8bf2276 Reviewed by: Matthew Ahrens Reviewed by: Brian Behlendorf Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: bzzz77 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 16:43:20 2017 (r321549) @@ -871,18 +871,13 @@ dmu_free_range(objset_t *os, uint64_t object, uint64_t return (0); } -int -dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, +static int +dmu_read_impl(dnode_t *dn, uint64_t offset, uint64_t size, void *buf, uint32_t flags) { - dnode_t *dn; dmu_buf_t **dbp; - int numbufs, err; + int numbufs, err = 0; - err = dnode_hold(os, object, FTAG, &dn); - if (err) - return (err); - /* * Deal with odd block sizes, where there can't be data past the first * block. If we ever do the tail block optimization, we will need to @@ -926,23 +921,38 @@ dmu_read(objset_t *os, uint64_t object, uint64_t offse } dmu_buf_rele_array(dbp, numbufs, FTAG); } - dnode_rele(dn, FTAG); return (err); } -void -dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, - const void *buf, dmu_tx_t *tx) +int +dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + void *buf, uint32_t flags) { - dmu_buf_t **dbp; - int numbufs, i; + dnode_t *dn; + int err; - if (size == 0) - return; + err = dnode_hold(os, object, FTAG, &dn); + if (err != 0) + return (err); - VERIFY(0 == dmu_buf_hold_array(os, object, offset, size, - FALSE, FTAG, &numbufs, &dbp)); + err = dmu_read_impl(dn, offset, size, buf, flags); + dnode_rele(dn, FTAG); + return (err); +} +int +dmu_read_by_dnode(dnode_t *dn, uint64_t offset, uint64_t size, void *buf, + uint32_t flags) +{ + return (dmu_read_impl(dn, offset, size, buf, flags)); +} + +static void +dmu_write_impl(dmu_buf_t **dbp, int numbufs, uint64_t offset, uint64_t size, + const void *buf, dmu_tx_t *tx) +{ + int i; + for (i = 0; i < numbufs; i++) { int tocpy; int bufoff; @@ -969,6 +979,37 @@ dmu_write(objset_t *os, uint64_t object, uint64_t offs size -= tocpy; buf = (char *)buf + tocpy; } +} + +void +dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + const void *buf, dmu_tx_t *tx) +{ + dmu_buf_t **dbp; + int numbufs; + + if (size == 0) + return; + + VERIFY0(dmu_buf_hold_array(os, object, offset, size, + FALSE, FTAG, &numbufs, &dbp)); + dmu_write_impl(dbp, numbufs, offset, size, buf, tx); + dmu_buf_rele_array(dbp, numbufs, FTAG); +} + +void +dmu_write_by_dnode(dnode_t *dn, uint64_t offset, uint64_t size, + const void *buf, dmu_tx_t *tx) +{ + dmu_buf_t **dbp; + int numbufs; + + if (size == 0) + return; + + VERIFY0(dmu_buf_hold_array_by_dnode(dn, offset, size, + FALSE, FTAG, &numbufs, &dbp, DMU_READ_PREFETCH)); + dmu_write_impl(dbp, numbufs, offset, size, buf, tx); dmu_buf_rele_array(dbp, numbufs, FTAG); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Jul 26 16:43:20 2017 (r321549) @@ -93,11 +93,11 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, i } dnode_allocate(dn, ot, blocksize, 0, bonustype, bonuslen, tx); - dnode_rele(dn, FTAG); - mutex_exit(&os->os_obj_lock); - dmu_tx_add_new_object(tx, os, object); + dmu_tx_add_new_object(tx, dn); + dnode_rele(dn, FTAG); + return (object); } @@ -115,9 +115,10 @@ dmu_object_claim(objset_t *os, uint64_t object, dmu_ob if (err) return (err); dnode_allocate(dn, ot, blocksize, 0, bonustype, bonuslen, tx); + dmu_tx_add_new_object(tx, dn); + dnode_rele(dn, FTAG); - dmu_tx_add_new_object(tx, os, object); return (0); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:43:20 2017 (r321549) @@ -93,21 +93,14 @@ dmu_tx_private_ok(dmu_tx_t *tx) } static dmu_tx_hold_t * -dmu_tx_hold_object_impl(dmu_tx_t *tx, objset_t *os, uint64_t object, - enum dmu_tx_hold_type type, uint64_t arg1, uint64_t arg2) +dmu_tx_hold_dnode_impl(dmu_tx_t *tx, dnode_t *dn, enum dmu_tx_hold_type type, + uint64_t arg1, uint64_t arg2) { dmu_tx_hold_t *txh; - dnode_t *dn = NULL; - int err; - if (object != DMU_NEW_OBJECT) { - err = dnode_hold(os, object, tx, &dn); - if (err) { - tx->tx_err = err; - return (NULL); - } - - if (err == 0 && tx->tx_txg != 0) { + if (dn != NULL) { + (void) refcount_add(&dn->dn_holds, tx); + if (tx->tx_txg != 0) { mutex_enter(&dn->dn_mtx); /* * dn->dn_assigned_txg == tx->tx_txg doesn't pose a @@ -134,17 +127,36 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, objset_t *os, ui return (txh); } +static dmu_tx_hold_t * +dmu_tx_hold_object_impl(dmu_tx_t *tx, objset_t *os, uint64_t object, + enum dmu_tx_hold_type type, uint64_t arg1, uint64_t arg2) +{ + dnode_t *dn = NULL; + dmu_tx_hold_t *txh; + int err; + + if (object != DMU_NEW_OBJECT) { + err = dnode_hold(os, object, FTAG, &dn); + if (err != 0) { + tx->tx_err = err; + return (NULL); + } + } + txh = dmu_tx_hold_dnode_impl(tx, dn, type, arg1, arg2); + if (dn != NULL) + dnode_rele(dn, FTAG); + return (txh); +} + void -dmu_tx_add_new_object(dmu_tx_t *tx, objset_t *os, uint64_t object) +dmu_tx_add_new_object(dmu_tx_t *tx, dnode_t *dn) { /* * If we're syncing, they can manipulate any object anyhow, and * the hold on the dnode_t can cause problems. */ - if (!dmu_tx_is_syncing(tx)) { - (void) dmu_tx_hold_object_impl(tx, os, - object, THT_NEWOBJECT, 0, 0); - } + if (!dmu_tx_is_syncing(tx)) + (void) dmu_tx_hold_dnode_impl(tx, dn, THT_NEWOBJECT, 0, 0); } /* @@ -282,11 +294,26 @@ dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint6 txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object, THT_WRITE, off, len); - if (txh == NULL) - return; + if (txh != NULL) { + dmu_tx_count_write(txh, off, len); + dmu_tx_count_dnode(txh); + } +} - dmu_tx_count_write(txh, off, len); - dmu_tx_count_dnode(txh); +void +dmu_tx_hold_write_by_dnode(dmu_tx_t *tx, dnode_t *dn, uint64_t off, int len) +{ + dmu_tx_hold_t *txh; + + ASSERT0(tx->tx_txg); + ASSERT3U(len, <=, DMU_MAX_ACCESS); + ASSERT(len == 0 || UINT64_MAX - off >= len - 1); + + txh = dmu_tx_hold_dnode_impl(tx, dn, THT_WRITE, off, len); + if (txh != NULL) { + dmu_tx_count_write(txh, off, len); + dmu_tx_count_dnode(txh); + } } /* @@ -303,18 +330,18 @@ dmu_tx_mark_netfree(dmu_tx_t *tx) tx->tx_netfree = B_TRUE; } -void -dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) +static void +dmu_tx_hold_free_impl(dmu_tx_hold_t *txh, uint64_t off, uint64_t len) { + dmu_tx_t *tx; + dnode_t *dn; int err; + zio_t *zio; + tx = txh->txh_tx; ASSERT(tx->tx_txg == 0); - dmu_tx_hold_t *txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, - object, THT_FREE, off, len); - if (txh == NULL) - return; - dnode_t *dn = txh->txh_dnode; + dn = txh->txh_dnode; dmu_tx_count_dnode(txh); if (off >= (dn->dn_maxblkid + 1) * dn->dn_datablksz) @@ -396,17 +423,36 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64 } void -dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name) +dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) { + dmu_tx_hold_t *txh; + + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + object, THT_FREE, off, len); + if (txh != NULL) + (void) dmu_tx_hold_free_impl(txh, off, len); +} + +void +dmu_tx_hold_free_by_dnode(dmu_tx_t *tx, dnode_t *dn, uint64_t off, uint64_t len) +{ + dmu_tx_hold_t *txh; + + txh = dmu_tx_hold_dnode_impl(tx, dn, THT_FREE, off, len); + if (txh != NULL) + (void) dmu_tx_hold_free_impl(txh, off, len); +} + +static void +dmu_tx_hold_zap_impl(dmu_tx_hold_t *txh, int add, const char *name) +{ + dmu_tx_t *tx = txh->txh_tx; + dnode_t *dn; int err; ASSERT(tx->tx_txg == 0); - dmu_tx_hold_t *txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, - object, THT_ZAP, add, (uintptr_t)name); - if (txh == NULL) - return; - dnode_t *dn = txh->txh_dnode; + dn = txh->txh_dnode; dmu_tx_count_dnode(txh); @@ -450,6 +496,32 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add } void +dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name) +{ + dmu_tx_hold_t *txh; + + ASSERT0(tx->tx_txg); + + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + object, THT_ZAP, add, (uintptr_t)name); + if (txh != NULL) + dmu_tx_hold_zap_impl(txh, add, name); +} + +void +dmu_tx_hold_zap_by_dnode(dmu_tx_t *tx, dnode_t *dn, int add, const char *name) +{ + dmu_tx_hold_t *txh; + + ASSERT0(tx->tx_txg); + ASSERT(dn != NULL); + + txh = dmu_tx_hold_dnode_impl(tx, dn, THT_ZAP, add, (uintptr_t)name); + if (txh != NULL) + dmu_tx_hold_zap_impl(txh, add, name); +} + +void dmu_tx_hold_bonus(dmu_tx_t *tx, uint64_t object) { dmu_tx_hold_t *txh; @@ -458,6 +530,18 @@ dmu_tx_hold_bonus(dmu_tx_t *tx, uint64_t object) txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object, THT_BONUS, 0, 0); + if (txh) + dmu_tx_count_dnode(txh); +} + +void +dmu_tx_hold_bonus_by_dnode(dmu_tx_t *tx, dnode_t *dn) +{ + dmu_tx_hold_t *txh; + + ASSERT0(tx->tx_txg); + + txh = dmu_tx_hold_dnode_impl(tx, dn, THT_BONUS, 0, 0); if (txh) dmu_tx_count_dnode(txh); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 16:43:20 2017 (r321549) @@ -669,10 +669,17 @@ void dmu_buf_will_dirty(dmu_buf_t *db, dmu_tx_t *tx); dmu_tx_t *dmu_tx_create(objset_t *os); void dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint64_t off, int len); +void dmu_tx_hold_write_by_dnode(dmu_tx_t *tx, dnode_t *dn, uint64_t off, + int len); void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len); +void dmu_tx_hold_free_by_dnode(dmu_tx_t *tx, dnode_t *dn, uint64_t off, + uint64_t len); void dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name); +void dmu_tx_hold_zap_by_dnode(dmu_tx_t *tx, dnode_t *dn, int add, + const char *name); void dmu_tx_hold_bonus(dmu_tx_t *tx, uint64_t object); +void dmu_tx_hold_bonus_by_dnode(dmu_tx_t *tx, dnode_t *dn); void dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t object); void dmu_tx_hold_sa(dmu_tx_t *tx, struct sa_handle *hdl, boolean_t may_grow); void dmu_tx_hold_sa_create(dmu_tx_t *tx, int total_size); @@ -722,8 +729,12 @@ int dmu_free_long_object(objset_t *os, uint64_t object #define DMU_READ_NO_PREFETCH 1 /* don't prefetch */ int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, void *buf, uint32_t flags); +int dmu_read_by_dnode(dnode_t *dn, uint64_t offset, uint64_t size, void *buf, + uint32_t flags); void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, const void *buf, dmu_tx_t *tx); +void dmu_write_by_dnode(dnode_t *dn, uint64_t offset, uint64_t size, + const void *buf, dmu_tx_t *tx); void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx); int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Wed Jul 26 16:43:20 2017 (r321549) @@ -135,7 +135,7 @@ extern dmu_tx_t *dmu_tx_create_assigned(struct dsl_poo dmu_tx_t *dmu_tx_create_dd(dsl_dir_t *dd); int dmu_tx_is_syncing(dmu_tx_t *tx); int dmu_tx_private_ok(dmu_tx_t *tx); -void dmu_tx_add_new_object(dmu_tx_t *tx, objset_t *os, uint64_t object); +void dmu_tx_add_new_object(dmu_tx_t *tx, dnode_t *dn); void dmu_tx_dirty_buf(dmu_tx_t *tx, struct dmu_buf_impl *db); void dmu_tx_hold_space(dmu_tx_t *tx, uint64_t space); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Jul 26 16:43:20 2017 (r321549) @@ -220,6 +220,9 @@ int zap_count_write_by_dnode(dnode_t *dn, const char * int zap_add(objset_t *ds, uint64_t zapobj, const char *key, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx); +int zap_add_by_dnode(dnode_t *dn, const char *key, + int integer_size, uint64_t num_integers, + const void *val, dmu_tx_t *tx); int zap_add_uint64(objset_t *ds, uint64_t zapobj, const uint64_t *key, int key_numints, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx); @@ -259,6 +262,7 @@ int zap_length_uint64(objset_t *os, uint64_t zapobj, c int zap_remove(objset_t *ds, uint64_t zapobj, const char *name, dmu_tx_t *tx); int zap_remove_norm(objset_t *ds, uint64_t zapobj, const char *name, matchtype_t mt, dmu_tx_t *tx); +int zap_remove_by_dnode(dnode_t *dn, const char *name, dmu_tx_t *tx); int zap_remove_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, dmu_tx_t *tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 16:42:32 2017 (r321548) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Jul 26 16:43:20 2017 (r321549) @@ -1120,34 +1120,30 @@ again: ASSERT(!"out of entries!"); } -int -zap_add(objset_t *os, uint64_t zapobj, const char *key, +static int +zap_add_impl(zap_t *zap, const char *key, int integer_size, uint64_t num_integers, - const void *val, dmu_tx_t *tx) + const void *val, dmu_tx_t *tx, void *tag) { - zap_t *zap; - int err; + int err = 0; mzap_ent_t *mze; const uint64_t *intval = val; zap_name_t *zn; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); - if (err) - return (err); zn = zap_name_alloc(zap, key, 0); if (zn == NULL) { - zap_unlockdir(zap, FTAG); + zap_unlockdir(zap, tag); return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { - err = fzap_add(zn, integer_size, num_integers, val, FTAG, tx); + err = fzap_add(zn, integer_size, num_integers, val, tag, tx); zap = zn->zn_zap; /* fzap_add() may change zap */ } else if (integer_size != 8 || num_integers != 1 || strlen(key) >= MZAP_NAME_LEN) { - err = mzap_upgrade(&zn->zn_zap, FTAG, tx, 0); + err = mzap_upgrade(&zn->zn_zap, tag, tx, 0); if (err == 0) { err = fzap_add(zn, integer_size, num_integers, val, - FTAG, tx); + tag, tx); } zap = zn->zn_zap; /* fzap_add() may change zap */ } else { @@ -1161,11 +1157,43 @@ zap_add(objset_t *os, uint64_t zapobj, const char *key ASSERT(zap == zn->zn_zap); zap_name_free(zn); if (zap != NULL) /* may be NULL if fzap_add() failed */ - zap_unlockdir(zap, FTAG); + zap_unlockdir(zap, tag); return (err); } int +zap_add(objset_t *os, uint64_t zapobj, const char *key, + int integer_size, uint64_t num_integers, + const void *val, dmu_tx_t *tx) +{ + zap_t *zap; + int err; + + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); + if (err != 0) + return (err); + err = zap_add_impl(zap, key, integer_size, num_integers, val, tx, FTAG); + /* zap_add_impl() calls zap_unlockdir() */ + return (err); +} + +int +zap_add_by_dnode(dnode_t *dn, const char *key, + int integer_size, uint64_t num_integers, + const void *val, dmu_tx_t *tx) +{ + zap_t *zap; + int err; + + err = zap_lockdir_by_dnode(dn, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); + if (err != 0) + return (err); + err = zap_add_impl(zap, key, integer_size, num_integers, val, tx, FTAG); + /* zap_add_impl() calls zap_unlockdir() */ + return (err); +} + +int zap_add_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) @@ -1279,23 +1307,17 @@ zap_remove(objset_t *os, uint64_t zapobj, const char * return (zap_remove_norm(os, zapobj, name, 0, tx)); } -int -zap_remove_norm(objset_t *os, uint64_t zapobj, const char *name, +static int +zap_remove_impl(zap_t *zap, const char *name, matchtype_t mt, dmu_tx_t *tx) { - zap_t *zap; - int err; mzap_ent_t *mze; zap_name_t *zn; + int err = 0; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, FTAG, &zap); - if (err) - return (err); zn = zap_name_alloc(zap, name, mt); - if (zn == NULL) { - zap_unlockdir(zap, FTAG); + if (zn == NULL) return (SET_ERROR(ENOTSUP)); - } if (!zap->zap_ismicro) { err = fzap_remove(zn, tx); } else { @@ -1310,6 +1332,34 @@ zap_remove_norm(objset_t *os, uint64_t zapobj, const c } } zap_name_free(zn); + return (err); +} + +int +zap_remove_norm(objset_t *os, uint64_t zapobj, const char *name, + matchtype_t mt, dmu_tx_t *tx) +{ + zap_t *zap; + int err; + + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, FTAG, &zap); + if (err) + return (err); + err = zap_remove_impl(zap, name, mt, tx); + zap_unlockdir(zap, FTAG); + return (err); +} + +int +zap_remove_by_dnode(dnode_t *dn, const char *name, dmu_tx_t *tx) +{ + zap_t *zap; + int err; + + err = zap_lockdir_by_dnode(dn, tx, RW_WRITER, TRUE, FALSE, FTAG, &zap); + if (err) + return (err); + err = zap_remove_impl(zap, name, 0, tx); zap_unlockdir(zap, FTAG); return (err); } From owner-svn-src-all@freebsd.org Wed Jul 26 16:44:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67A90DA96EB; Wed, 26 Jul 2017 16:44:09 +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 342216ABB4; Wed, 26 Jul 2017 16:44:09 +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 v6QGi8Ux076733; Wed, 26 Jul 2017 16:44:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGi8Nq076732; Wed, 26 Jul 2017 16:44:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261644.v6QGi8Nq076732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321550 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:44:09 -0000 Author: mav Date: Wed Jul 26 16:44:08 2017 New Revision: 321550 URL: https://svnweb.freebsd.org/changeset/base/321550 Log: MFC r318824: MFV r316915: 7801 add more by-dnode routines (lint) illumos/illumos-gate@411be58a6e030a3b606f1afcc7f2e2459ffda844 https://github.com/illumos/illumos-gate/commit/411be58a6e030a3b606f1afcc7f2e2459ffda844 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:43:20 2017 (r321549) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 16:44:08 2017 (r321550) @@ -336,7 +336,6 @@ dmu_tx_hold_free_impl(dmu_tx_hold_t *txh, uint64_t off dmu_tx_t *tx; dnode_t *dn; int err; - zio_t *zio; tx = txh->txh_tx; ASSERT(tx->tx_txg == 0); @@ -444,7 +443,7 @@ dmu_tx_hold_free_by_dnode(dmu_tx_t *tx, dnode_t *dn, u } static void -dmu_tx_hold_zap_impl(dmu_tx_hold_t *txh, int add, const char *name) +dmu_tx_hold_zap_impl(dmu_tx_hold_t *txh, const char *name) { dmu_tx_t *tx = txh->txh_tx; dnode_t *dn; @@ -505,7 +504,7 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object, THT_ZAP, add, (uintptr_t)name); if (txh != NULL) - dmu_tx_hold_zap_impl(txh, add, name); + dmu_tx_hold_zap_impl(txh, name); } void @@ -518,7 +517,7 @@ dmu_tx_hold_zap_by_dnode(dmu_tx_t *tx, dnode_t *dn, in txh = dmu_tx_hold_dnode_impl(tx, dn, THT_ZAP, add, (uintptr_t)name); if (txh != NULL) - dmu_tx_hold_zap_impl(txh, add, name); + dmu_tx_hold_zap_impl(txh, name); } void From owner-svn-src-all@freebsd.org Wed Jul 26 16:44:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B112DA9882; Wed, 26 Jul 2017 16:44:54 +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 F249B6AEF2; Wed, 26 Jul 2017 16:44:53 +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 v6QGirPq077055; Wed, 26 Jul 2017 16:44:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGiqtG077048; Wed, 26 Jul 2017 16:44:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261644.v6QGiqtG077048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321552 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:44:54 -0000 Author: mav Date: Wed Jul 26 16:44:52 2017 New Revision: 321552 URL: https://svnweb.freebsd.org/changeset/base/321552 Log: MFC r318827: MFV r316916: 7970 zfs_arc_num_sublists_per_state should be common to all multilists illumos/illumos-gate@10fbdecb05f411234920f8d3c92c148d39106d7e https://github.com/illumos/illumos-gate/commit/10fbdecb05f411234920f8d3c92c148d39106d7e https://www.illumos.org/issues/7970 The global tunable zfs_arc_num_sublists_per_state is used by the ARC and the dbuf cache, and other users are planned. We should change this tunable to be common to all multilists. Reviewed by: Pavel Zakharov Reviewed by: Brad Lewis Reviewed by: Saso Kiselkov Reviewed by: Brian Behlendorf Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:44:24 2017 (r321551) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:44:52 2017 (r321552) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ @@ -304,13 +304,6 @@ uint_t arc_reduce_dnlc_percent = 3; */ int zfs_arc_evict_batch_limit = 10; -/* - * The number of sublists used for each of the arc state lists. If this - * is not set to a suitable value by the user, it will be configured to - * the number of CPUs on the system in arc_init(). - */ -int zfs_arc_num_sublists_per_state = 0; - /* number of seconds before growing cache again */ static int arc_grow_retry = 60; @@ -6219,43 +6212,43 @@ arc_state_init(void) multilist_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mru->arcs_list[ARC_BUFC_DATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), - zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + arc_state_multilist_index_func); refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); @@ -6411,9 +6404,6 @@ arc_init(void) if (zfs_arc_p_min_shift > 0) arc_p_min_shift = zfs_arc_p_min_shift; - - if (zfs_arc_num_sublists_per_state < 1) - zfs_arc_num_sublists_per_state = MAX(max_ncpus, 1); /* if kmem_flags are set, lets try to use less memory */ if (kmem_debugging()) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:44:24 2017 (r321551) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:44:52 2017 (r321552) @@ -623,7 +623,6 @@ retry: multilist_create(&dbuf_cache, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_cache_link), - zfs_arc_num_sublists_per_state, dbuf_cache_multilist_index_func); refcount_create(&dbuf_cache_size); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Wed Jul 26 16:44:24 2017 (r321551) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Wed Jul 26 16:44:52 2017 (r321552) @@ -13,7 +13,7 @@ * CDDL HEADER END */ /* - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright (c) 2013, 2017 by Delphix. All rights reserved. */ #include @@ -23,6 +23,12 @@ #include /* + * This overrides the number of sublists in each multilist_t, which defaults + * to the number of CPUs in the system (see multilist_create()). + */ +int zfs_multilist_num_sublists = 0; + +/* * Given the object contained on the list, return a pointer to the * object's multilist_node_t structure it contains. */ @@ -59,9 +65,9 @@ multilist_d2l(multilist_t *ml, void *obj) * requirement, but a general rule of thumb in order to garner the * best multi-threaded performance out of the data structure. */ -void -multilist_create(multilist_t *ml, size_t size, size_t offset, unsigned int num, - multilist_sublist_index_func_t *index_func) +static void +multilist_create_impl(multilist_t *ml, size_t size, size_t offset, + unsigned int num, multilist_sublist_index_func_t *index_func) { ASSERT3P(ml, !=, NULL); ASSERT3U(size, >, 0); @@ -83,6 +89,26 @@ multilist_create(multilist_t *ml, size_t size, size_t mutex_init(&mls->mls_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&mls->mls_list, size, offset); } +} + +/* + * Initialize a new sublist, using the default number of sublists + * (the number of CPUs, or at least 4, or the tunable + * zfs_multilist_num_sublists). + */ +void +multilist_create(multilist_t *ml, size_t size, size_t offset, + multilist_sublist_index_func_t *index_func) +{ + int num_sublists; + + if (zfs_multilist_num_sublists > 0) { + num_sublists = zfs_multilist_num_sublists; + } else { + num_sublists = MAX(max_ncpus, 4); + } + + multilist_create_impl(ml, size, offset, num_sublists, index_func); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Wed Jul 26 16:44:24 2017 (r321551) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Wed Jul 26 16:44:52 2017 (r321552) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -63,8 +63,6 @@ typedef void arc_done_func_t(zio_t *zio, arc_buf_t *bu /* generic arc_done_func_t's which you can use */ arc_done_func_t arc_bcopy_func; arc_done_func_t arc_getbuf_func; - -extern int zfs_arc_num_sublists_per_state; typedef enum arc_flags { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Wed Jul 26 16:44:24 2017 (r321551) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Wed Jul 26 16:44:52 2017 (r321552) @@ -13,7 +13,7 @@ * CDDL HEADER END */ /* - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright (c) 2013, 2017 by Delphix. All rights reserved. */ #ifndef _SYS_MULTILIST_H @@ -73,7 +73,7 @@ struct multilist { }; void multilist_destroy(multilist_t *); -void multilist_create(multilist_t *, size_t, size_t, unsigned int, +void multilist_create(multilist_t *, size_t, size_t, multilist_sublist_index_func_t *); void multilist_insert(multilist_t *, void *); From owner-svn-src-all@freebsd.org Wed Jul 26 16:45:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A4DBDA9975; Wed, 26 Jul 2017 16:45: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 036D56B109; Wed, 26 Jul 2017 16:45: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 v6QGjfwL077161; Wed, 26 Jul 2017 16:45:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGjdjl077144; Wed, 26 Jul 2017 16:45:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261645.v6QGjdjl077144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321553 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:45:42 -0000 Author: mav Date: Wed Jul 26 16:45:39 2017 New Revision: 321553 URL: https://svnweb.freebsd.org/changeset/base/321553 Log: MFC r318828: MFV r316917: 7968 multi-threaded spa_sync() illumos/illumos-gate@94c2d0eb22e9624151ee84a7edbf7178e1bf4087 https://github.com/illumos/illumos-gate/commit/94c2d0eb22e9624151ee84a7edbf7178e1bf4087 https://www.illumos.org/issues/7968 spa_sync() iterates over all the dirty dnodes and processes each of them by calling dnode_sync(). If there are many dirty dnodes (e.g. because we created or removed a lot of files), the single thread of spa_sync() calling dnode_sync() can become a bottleneck. Additionally, if many dnodes are dirtied concurrently in open context (e.g. due to concurrent file creation), the os_lock will experience lock contention via dnode_setdirty(). The solution is to track dirty dnodes on a multilist_t, and for spa_sync() to use separate threads to process each of the sublists in the multilist. On the concurrent file creation microbenchmark, the performance improvement from dnode_setdirty() is up to 7%. Additionally, the wall clock time spent in spa_sync() is reduced to 15%-40% of the single-threaded case. In terms of cost/ reward, once the other bottlenecks are addressed, fixing this bug will provide a medium-large performance gain and require a medium amount of effort to implement. Reviewed by: Pavel Zakharov Reviewed by: Brad Lewis Reviewed by: Saso Kiselkov Reviewed by: Brian Behlendorf Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:45:39 2017 (r321553) @@ -473,7 +473,7 @@ typedef struct arc_state { /* * list of evictable buffers */ - multilist_t arcs_list[ARC_BUFC_NUMTYPES]; + multilist_t *arcs_list[ARC_BUFC_NUMTYPES]; /* * total amount of evictable data in this state */ @@ -2359,7 +2359,7 @@ add_reference(arc_buf_hdr_t *hdr, void *tag) (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { - multilist_remove(&state->arcs_list[arc_buf_type(hdr)], + multilist_remove(state->arcs_list[arc_buf_type(hdr)], hdr); arc_evictable_space_decrement(hdr, state); } @@ -2389,7 +2389,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lo */ if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { - multilist_insert(&state->arcs_list[arc_buf_type(hdr)], hdr); + multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0); arc_evictable_space_increment(hdr, state); } @@ -2442,7 +2442,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (refcnt == 0) { if (old_state != arc_anon && old_state != arc_l2c_only) { ASSERT(HDR_HAS_L1HDR(hdr)); - multilist_remove(&old_state->arcs_list[buftype], hdr); + multilist_remove(old_state->arcs_list[buftype], hdr); if (GHOST_STATE(old_state)) { ASSERT0(bufcnt); @@ -2460,7 +2460,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * beforehand. */ ASSERT(HDR_HAS_L1HDR(hdr)); - multilist_insert(&new_state->arcs_list[buftype], hdr); + multilist_insert(new_state->arcs_list[buftype], hdr); if (GHOST_STATE(new_state)) { ASSERT0(bufcnt); @@ -2586,8 +2586,8 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * L2 headers should never be on the L2 state list since they don't * have L1 headers allocated. */ - ASSERT(multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && - multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); + ASSERT(multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && + multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); } void @@ -3671,7 +3671,7 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int6 arc_buf_contents_t type) { uint64_t total_evicted = 0; - multilist_t *ml = &state->arcs_list[type]; + multilist_t *ml = state->arcs_list[type]; int num_sublists; arc_buf_hdr_t **markers; @@ -3875,8 +3875,8 @@ arc_adjust_meta(void) static arc_buf_contents_t arc_adjust_type(arc_state_t *state) { - multilist_t *data_ml = &state->arcs_list[ARC_BUFC_DATA]; - multilist_t *meta_ml = &state->arcs_list[ARC_BUFC_METADATA]; + multilist_t *data_ml = state->arcs_list[ARC_BUFC_DATA]; + multilist_t *meta_ml = state->arcs_list[ARC_BUFC_METADATA]; int data_idx = multilist_get_random_index(data_ml); int meta_idx = multilist_get_random_index(meta_ml); multilist_sublist_t *data_mls; @@ -6209,44 +6209,44 @@ arc_state_init(void) arc_mfu_ghost = &ARC_mfu_ghost; arc_l2c_only = &ARC_l2c_only; - multilist_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), + arc_mru->arcs_list[ARC_BUFC_METADATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mru->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), + arc_mru->arcs_list[ARC_BUFC_DATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), + arc_mru_ghost->arcs_list[ARC_BUFC_METADATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), + arc_mru_ghost->arcs_list[ARC_BUFC_DATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), + arc_mfu->arcs_list[ARC_BUFC_METADATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), + arc_mfu->arcs_list[ARC_BUFC_DATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), + arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), + arc_mfu_ghost->arcs_list[ARC_BUFC_DATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), + arc_l2c_only->arcs_list[ARC_BUFC_METADATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), + arc_l2c_only->arcs_list[ARC_BUFC_DATA] = + multilist_create(sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); @@ -6294,14 +6294,14 @@ arc_state_fini(void) refcount_destroy(&arc_mfu_ghost->arcs_size); refcount_destroy(&arc_l2c_only->arcs_size); - multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(arc_mru->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); } uint64_t @@ -7098,16 +7098,16 @@ l2arc_sublist_lock(int list_num) switch (list_num) { case 0: - ml = &arc_mfu->arcs_list[ARC_BUFC_METADATA]; + ml = arc_mfu->arcs_list[ARC_BUFC_METADATA]; break; case 1: - ml = &arc_mru->arcs_list[ARC_BUFC_METADATA]; + ml = arc_mru->arcs_list[ARC_BUFC_METADATA]; break; case 2: - ml = &arc_mfu->arcs_list[ARC_BUFC_DATA]; + ml = arc_mfu->arcs_list[ARC_BUFC_DATA]; break; case 3: - ml = &arc_mru->arcs_list[ARC_BUFC_DATA]; + ml = arc_mru->arcs_list[ARC_BUFC_DATA]; break; } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:45:39 2017 (r321553) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -80,7 +80,7 @@ static boolean_t dbuf_evict_thread_exit; * Dbufs that are aged out of the cache will be immediately destroyed and * become eligible for arc eviction. */ -static multilist_t dbuf_cache; +static multilist_t *dbuf_cache; static refcount_t dbuf_cache_size; uint64_t dbuf_cache_max_bytes = 100 * 1024 * 1024; @@ -454,8 +454,8 @@ dbuf_cache_above_lowater(void) static void dbuf_evict_one(void) { - int idx = multilist_get_random_index(&dbuf_cache); - multilist_sublist_t *mls = multilist_sublist_lock(&dbuf_cache, idx); + int idx = multilist_get_random_index(dbuf_cache); + multilist_sublist_t *mls = multilist_sublist_lock(dbuf_cache, idx); ASSERT(!MUTEX_HELD(&dbuf_evict_lock)); @@ -621,7 +621,7 @@ retry: */ dbu_evict_taskq = taskq_create("dbu_evict", 1, minclsyspri, 0, 0, 0); - multilist_create(&dbuf_cache, sizeof (dmu_buf_impl_t), + dbuf_cache = multilist_create(sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_cache_link), dbuf_cache_multilist_index_func); refcount_create(&dbuf_cache_size); @@ -659,7 +659,7 @@ dbuf_fini(void) cv_destroy(&dbuf_evict_cv); refcount_destroy(&dbuf_cache_size); - multilist_destroy(&dbuf_cache); + multilist_destroy(dbuf_cache); } /* @@ -2029,7 +2029,7 @@ dbuf_destroy(dmu_buf_impl_t *db) dbuf_clear_data(db); if (multilist_link_active(&db->db_cache_link)) { - multilist_remove(&dbuf_cache, db); + multilist_remove(dbuf_cache, db); (void) refcount_remove_many(&dbuf_cache_size, db->db.db_size, db); } @@ -2577,7 +2577,7 @@ top: if (multilist_link_active(&db->db_cache_link)) { ASSERT(refcount_is_zero(&db->db_holds)); - multilist_remove(&dbuf_cache, db); + multilist_remove(dbuf_cache, db); (void) refcount_remove_many(&dbuf_cache_size, db->db.db_size, db); } @@ -2796,7 +2796,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag) db->db_pending_evict) { dbuf_destroy(db); } else if (!multilist_link_active(&db->db_cache_link)) { - multilist_insert(&dbuf_cache, db); + multilist_insert(dbuf_cache, db); (void) refcount_add_many(&dbuf_cache_size, db->db.db_size, db); mutex_exit(&db->db_mtx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 16:45:39 2017 (r321553) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -303,6 +303,42 @@ dmu_objset_byteswap(void *buf, size_t size) } } +/* + * The hash is a CRC-based hash of the objset_t pointer and the object number. + */ +static uint64_t +dnode_hash(const objset_t *os, uint64_t obj) +{ + uintptr_t osv = (uintptr_t)os; + uint64_t crc = -1ULL; + + ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); + /* + * The low 6 bits of the pointer don't have much entropy, because + * the objset_t is larger than 2^6 bytes long. + */ + crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (osv >> 6)) & 0xFF]; + crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 0)) & 0xFF]; + crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 8)) & 0xFF]; + crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 16)) & 0xFF]; + + crc ^= (osv>>14) ^ (obj>>24); + + return (crc); +} + +unsigned int +dnode_multilist_index_func(multilist_t *ml, void *obj) +{ + dnode_t *dn = obj; + return (dnode_hash(dn->dn_objset, dn->dn_object) % + multilist_get_num_sublists(ml)); +} + +/* + * Instantiates the objset_t in-memory structure corresponding to the + * objset_phys_t that's pointed to by the specified blkptr_t. + */ int dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, objset_t **osp) @@ -454,10 +490,9 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl os->os_zil = zil_alloc(os, &os->os_zil_header); for (i = 0; i < TXG_SIZE; i++) { - list_create(&os->os_dirty_dnodes[i], sizeof (dnode_t), - offsetof(dnode_t, dn_dirty_link[i])); - list_create(&os->os_free_dnodes[i], sizeof (dnode_t), - offsetof(dnode_t, dn_dirty_link[i])); + os->os_dirty_dnodes[i] = multilist_create(sizeof (dnode_t), + offsetof(dnode_t, dn_dirty_link[i]), + dnode_multilist_index_func); } list_create(&os->os_dnodes, sizeof (dnode_t), offsetof(dnode_t, dn_link)); @@ -465,6 +500,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl offsetof(dmu_buf_impl_t, db_link)); mutex_init(&os->os_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&os->os_userused_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL); @@ -748,8 +784,12 @@ dmu_objset_evict_done(objset_t *os) rw_exit(&os_lock); mutex_destroy(&os->os_lock); + mutex_destroy(&os->os_userused_lock); mutex_destroy(&os->os_obj_lock); mutex_destroy(&os->os_user_ptr_lock); + for (int i = 0; i < TXG_SIZE; i++) { + multilist_destroy(os->os_dirty_dnodes[i]); + } spa_evicting_os_deregister(os->os_spa, os); kmem_free(os, sizeof (objset_t)); } @@ -1027,11 +1067,11 @@ dmu_objset_snapshot_one(const char *fsname, const char } static void -dmu_objset_sync_dnodes(list_t *list, list_t *newlist, dmu_tx_t *tx) +dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_tx_t *tx) { dnode_t *dn; - while (dn = list_head(list)) { + while ((dn = multilist_sublist_head(list)) != NULL) { ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT); ASSERT(dn->dn_dbuf->db_data_pending); /* @@ -1042,11 +1082,12 @@ dmu_objset_sync_dnodes(list_t *list, list_t *newlist, ASSERT(dn->dn_zio); ASSERT3U(dn->dn_nlevels, <=, DN_MAX_LEVELS); - list_remove(list, dn); + multilist_sublist_remove(list, dn); - if (newlist) { + multilist_t *newlist = dn->dn_objset->os_synced_dnodes; + if (newlist != NULL) { (void) dnode_add_ref(dn, newlist); - list_insert_tail(newlist, dn); + multilist_insert(newlist, dn); } dnode_sync(dn, tx); @@ -1101,6 +1142,29 @@ dmu_objset_write_done(zio_t *zio, arc_buf_t *abuf, voi kmem_free(bp, sizeof (*bp)); } +typedef struct sync_dnodes_arg { + multilist_t *sda_list; + int sda_sublist_idx; + multilist_t *sda_newlist; + dmu_tx_t *sda_tx; +} sync_dnodes_arg_t; + +static void +sync_dnodes_task(void *arg) +{ + sync_dnodes_arg_t *sda = arg; + + multilist_sublist_t *ms = + multilist_sublist_lock(sda->sda_list, sda->sda_sublist_idx); + + dmu_objset_sync_dnodes(ms, sda->sda_tx); + + multilist_sublist_unlock(ms); + + kmem_free(sda, sizeof (*sda)); +} + + /* called from dsl */ void dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) @@ -1110,7 +1174,6 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx zio_prop_t zp; zio_t *zio; list_t *list; - list_t *newlist = NULL; dbuf_dirty_record_t *dr; blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP); *blkptr_copy = *os->os_rootbp; @@ -1164,20 +1227,36 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx txgoff = tx->tx_txg & TXG_MASK; if (dmu_objset_userused_enabled(os)) { - newlist = &os->os_synced_dnodes; /* * We must create the list here because it uses the - * dn_dirty_link[] of this txg. + * dn_dirty_link[] of this txg. But it may already + * exist because we call dsl_dataset_sync() twice per txg. */ - list_create(newlist, sizeof (dnode_t), - offsetof(dnode_t, dn_dirty_link[txgoff])); + if (os->os_synced_dnodes == NULL) { + os->os_synced_dnodes = + multilist_create(sizeof (dnode_t), + offsetof(dnode_t, dn_dirty_link[txgoff]), + dnode_multilist_index_func); + } else { + ASSERT3U(os->os_synced_dnodes->ml_offset, ==, + offsetof(dnode_t, dn_dirty_link[txgoff])); + } } - dmu_objset_sync_dnodes(&os->os_free_dnodes[txgoff], newlist, tx); - dmu_objset_sync_dnodes(&os->os_dirty_dnodes[txgoff], newlist, tx); + for (int i = 0; + i < multilist_get_num_sublists(os->os_dirty_dnodes[txgoff]); i++) { + sync_dnodes_arg_t *sda = kmem_alloc(sizeof (*sda), KM_SLEEP); + sda->sda_list = os->os_dirty_dnodes[txgoff]; + sda->sda_sublist_idx = i; + sda->sda_tx = tx; + (void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq, + sync_dnodes_task, sda, 0); + /* callback frees sda */ + } + taskq_wait(dmu_objset_pool(os)->dp_sync_taskq); list = &DMU_META_DNODE(os)->dn_dirty_records[txgoff]; - while (dr = list_head(list)) { + while ((dr = list_head(list)) != NULL) { ASSERT0(dr->dr_dbuf->db_level); list_remove(list, dr); if (dr->dr_zio) @@ -1201,8 +1280,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx boolean_t dmu_objset_is_dirty(objset_t *os, uint64_t txg) { - return (!list_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]) || - !list_is_empty(&os->os_free_dnodes[txg & TXG_MASK])); + return (!multilist_is_empty(os->os_dirty_dnodes[txg & TXG_MASK])); } static objset_used_cb_t *used_cbs[DMU_OST_NUMTYPES]; @@ -1256,8 +1334,15 @@ do_userquota_cacheflush(objset_t *os, userquota_cache_ cookie = NULL; while ((uqn = avl_destroy_nodes(&cache->uqc_user_deltas, &cookie)) != NULL) { + /* + * os_userused_lock protects against concurrent calls to + * zap_increment_int(). It's needed because zap_increment_int() + * is not thread-safe (i.e. not atomic). + */ + mutex_enter(&os->os_userused_lock); VERIFY0(zap_increment_int(os, DMU_USERUSED_OBJECT, uqn->uqn_id, uqn->uqn_delta, tx)); + mutex_exit(&os->os_userused_lock); kmem_free(uqn, sizeof (*uqn)); } avl_destroy(&cache->uqc_user_deltas); @@ -1265,8 +1350,10 @@ do_userquota_cacheflush(objset_t *os, userquota_cache_ cookie = NULL; while ((uqn = avl_destroy_nodes(&cache->uqc_group_deltas, &cookie)) != NULL) { + mutex_enter(&os->os_userused_lock); VERIFY0(zap_increment_int(os, DMU_GROUPUSED_OBJECT, uqn->uqn_id, uqn->uqn_delta, tx)); + mutex_exit(&os->os_userused_lock); kmem_free(uqn, sizeof (*uqn)); } avl_destroy(&cache->uqc_group_deltas); @@ -1301,37 +1388,38 @@ do_userquota_update(userquota_cache_t *cache, uint64_t } } -void -dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx) +typedef struct userquota_updates_arg { + objset_t *uua_os; + int uua_sublist_idx; + dmu_tx_t *uua_tx; +} userquota_updates_arg_t; + +static void +userquota_updates_task(void *arg) { + userquota_updates_arg_t *uua = arg; + objset_t *os = uua->uua_os; + dmu_tx_t *tx = uua->uua_tx; dnode_t *dn; - list_t *list = &os->os_synced_dnodes; userquota_cache_t cache = { 0 }; - ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os)); + multilist_sublist_t *list = + multilist_sublist_lock(os->os_synced_dnodes, uua->uua_sublist_idx); + ASSERT(multilist_sublist_head(list) == NULL || + dmu_objset_userused_enabled(os)); avl_create(&cache.uqc_user_deltas, userquota_compare, sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); avl_create(&cache.uqc_group_deltas, userquota_compare, sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); - while (dn = list_head(list)) { + while ((dn = multilist_sublist_head(list)) != NULL) { int flags; ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object)); ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE || dn->dn_phys->dn_flags & DNODE_FLAG_USERUSED_ACCOUNTED); - /* Allocate the user/groupused objects if necessary. */ - if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) { - VERIFY0(zap_create_claim(os, - DMU_USERUSED_OBJECT, - DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); - VERIFY0(zap_create_claim(os, - DMU_GROUPUSED_OBJECT, - DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); - } - flags = dn->dn_id_flags; ASSERT(flags); if (flags & DN_ID_OLD_EXIST) { @@ -1361,10 +1449,42 @@ dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t dn->dn_id_flags &= ~(DN_ID_NEW_EXIST); mutex_exit(&dn->dn_mtx); - list_remove(list, dn); - dnode_rele(dn, list); + multilist_sublist_remove(list, dn); + dnode_rele(dn, os->os_synced_dnodes); } do_userquota_cacheflush(os, &cache, tx); + multilist_sublist_unlock(list); + kmem_free(uua, sizeof (*uua)); +} + +void +dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx) +{ + if (!dmu_objset_userused_enabled(os)) + return; + + /* Allocate the user/groupused objects if necessary. */ + if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) { + VERIFY0(zap_create_claim(os, + DMU_USERUSED_OBJECT, + DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); + VERIFY0(zap_create_claim(os, + DMU_GROUPUSED_OBJECT, + DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); + } + + for (int i = 0; + i < multilist_get_num_sublists(os->os_synced_dnodes); i++) { + userquota_updates_arg_t *uua = + kmem_alloc(sizeof (*uua), KM_SLEEP); + uua->uua_os = os; + uua->uua_sublist_idx = i; + uua->uua_tx = tx; + /* note: caller does taskq_wait() */ + (void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq, + userquota_updates_task, uua, 0); + /* callback frees uua */ + } } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -1287,13 +1287,14 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) */ dmu_objset_userquota_get_ids(dn, B_TRUE, tx); - mutex_enter(&os->os_lock); + multilist_t *dirtylist = os->os_dirty_dnodes[txg & TXG_MASK]; + multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn); /* * If we are already marked dirty, we're done. */ if (list_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { - mutex_exit(&os->os_lock); + multilist_sublist_unlock(mls); return; } @@ -1307,13 +1308,9 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", dn->dn_object, txg); - if (dn->dn_free_txg > 0 && dn->dn_free_txg <= txg) { - list_insert_tail(&os->os_free_dnodes[txg&TXG_MASK], dn); - } else { - list_insert_tail(&os->os_dirty_dnodes[txg&TXG_MASK], dn); - } + multilist_sublist_insert_head(mls, dn); - mutex_exit(&os->os_lock); + multilist_sublist_unlock(mls); /* * The dnode maintains a hold on its containing dbuf as @@ -1334,13 +1331,6 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) void dnode_free(dnode_t *dn, dmu_tx_t *tx) { - int txgoff = tx->tx_txg & TXG_MASK; - - dprintf("dn=%p txg=%llu\n", dn, tx->tx_txg); - - /* we should be the only holder... hopefully */ - /* ASSERT3U(refcount_count(&dn->dn_holds), ==, 1); */ - mutex_enter(&dn->dn_mtx); if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg) { mutex_exit(&dn->dn_mtx); @@ -1349,19 +1339,7 @@ dnode_free(dnode_t *dn, dmu_tx_t *tx) dn->dn_free_txg = tx->tx_txg; mutex_exit(&dn->dn_mtx); - /* - * If the dnode is already dirty, it needs to be moved from - * the dirty list to the free list. - */ - mutex_enter(&dn->dn_objset->os_lock); - if (list_link_active(&dn->dn_dirty_link[txgoff])) { - list_remove(&dn->dn_objset->os_dirty_dnodes[txgoff], dn); - list_insert_tail(&dn->dn_objset->os_free_dnodes[txgoff], dn); - mutex_exit(&dn->dn_objset->os_lock); - } else { - mutex_exit(&dn->dn_objset->os_lock); - dnode_setdirty(dn, tx); - } + dnode_setdirty(dn, tx); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Wed Jul 26 16:45:39 2017 (r321553) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Jul 26 16:45:39 2017 (r321553) @@ -1740,6 +1740,11 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) bplist_iterate(&ds->ds_pending_deadlist, deadlist_enqueue_cb, &ds->ds_deadlist, tx); + if (os->os_synced_dnodes != NULL) { + multilist_destroy(os->os_synced_dnodes); + os->os_synced_dnodes = NULL; + } + ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx))); dmu_buf_rele(ds->ds_dbuf, ds); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -132,6 +132,10 @@ int zfs_delay_min_dirty_percent = 60; */ uint64_t zfs_delay_scale = 1000 * 1000 * 1000 / 2000; +/* + * This determines the number of threads used by the dp_sync_taskq. + */ +int zfs_sync_taskq_batch_pct = 75; #if defined(__FreeBSD__) && defined(_KERNEL) @@ -264,6 +268,10 @@ dsl_pool_open_impl(spa_t *spa, uint64_t txg) txg_list_create(&dp->dp_sync_tasks, offsetof(dsl_sync_task_t, dst_node)); + dp->dp_sync_taskq = taskq_create("dp_sync_taskq", + zfs_sync_taskq_batch_pct, minclsyspri, 1, INT_MAX, + TASKQ_THREADS_CPU_PCT); + mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL); @@ -414,6 +422,8 @@ dsl_pool_close(dsl_pool_t *dp) txg_list_destroy(&dp->dp_sync_tasks); txg_list_destroy(&dp->dp_dirty_dirs); + taskq_destroy(dp->dp_sync_taskq); + /* * We can't set retry to TRUE since we're explicitly specifying * a spa to flush. This is good enough; any missed buffers for @@ -602,12 +612,15 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg) /* * After the data blocks have been written (ensured by the zio_wait() - * above), update the user/group space accounting. + * above), update the user/group space accounting. This happens + * in tasks dispatched to dp_sync_taskq, so wait for them before + * continuing. */ for (ds = list_head(&synced_datasets); ds != NULL; ds = list_next(&synced_datasets, ds)) { dmu_objset_do_userquota_updates(ds->ds_objset, tx); } + taskq_wait(dp->dp_sync_taskq); /* * Sync the datasets again to push out the changes due to @@ -654,8 +667,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg) dp->dp_mos_uncompressed_delta = 0; } - if (list_head(&mos->os_dirty_dnodes[txg & TXG_MASK]) != NULL || - list_head(&mos->os_free_dnodes[txg & TXG_MASK]) != NULL) { + if (!multilist_is_empty(mos->os_dirty_dnodes[txg & TXG_MASK])) { dsl_pool_sync_mos(dp, tx); } @@ -713,7 +725,8 @@ int dsl_pool_sync_context(dsl_pool_t *dp) { return (curthread == dp->dp_tx.tx_sync_thread || - spa_is_initializing(dp->dp_spa)); + spa_is_initializing(dp->dp_spa) || + taskq_member(dp->dp_sync_taskq, curthread)); } uint64_t Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Wed Jul 26 16:45:39 2017 (r321553) @@ -65,16 +65,16 @@ multilist_d2l(multilist_t *ml, void *obj) * requirement, but a general rule of thumb in order to garner the * best multi-threaded performance out of the data structure. */ -static void -multilist_create_impl(multilist_t *ml, size_t size, size_t offset, +static multilist_t * +multilist_create_impl(size_t size, size_t offset, unsigned int num, multilist_sublist_index_func_t *index_func) { - ASSERT3P(ml, !=, NULL); ASSERT3U(size, >, 0); ASSERT3U(size, >=, offset + sizeof (multilist_node_t)); ASSERT3U(num, >, 0); ASSERT3P(index_func, !=, NULL); + multilist_t *ml = kmem_alloc(sizeof (*ml), KM_SLEEP); ml->ml_offset = offset; ml->ml_num_sublists = num; ml->ml_index_func = index_func; @@ -89,15 +89,16 @@ multilist_create_impl(multilist_t *ml, size_t size, si mutex_init(&mls->mls_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&mls->mls_list, size, offset); } + return (ml); } /* - * Initialize a new sublist, using the default number of sublists + * Allocate a new multilist, using the default number of sublists * (the number of CPUs, or at least 4, or the tunable * zfs_multilist_num_sublists). */ -void -multilist_create(multilist_t *ml, size_t size, size_t offset, +multilist_t * +multilist_create(size_t size, size_t offset, multilist_sublist_index_func_t *index_func) { int num_sublists; @@ -108,7 +109,7 @@ multilist_create(multilist_t *ml, size_t size, size_t num_sublists = MAX(max_ncpus, 4); } - multilist_create_impl(ml, size, offset, num_sublists, index_func); + return (multilist_create_impl(size, offset, num_sublists, index_func)); } /* @@ -134,6 +135,7 @@ multilist_destroy(multilist_t *ml) ml->ml_num_sublists = 0; ml->ml_offset = 0; + kmem_free(ml, sizeof (multilist_t)); } /* @@ -283,6 +285,13 @@ multilist_sublist_lock(multilist_t *ml, unsigned int s mutex_enter(&mls->mls_lock); return (mls); +} + +/* Lock and return the sublist that would be used to store the specified obj */ +multilist_sublist_t * +multilist_sublist_lock_obj(multilist_t *ml, void *obj) +{ + return (multilist_sublist_lock(ml, ml->ml_index_func(ml, obj))); } void Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -744,7 +744,7 @@ spa_add(const char *name, nvlist_t *config, const char spa_active_count++; } - avl_create(&spa->spa_alloc_tree, zio_timestamp_compare, + avl_create(&spa->spa_alloc_tree, zio_bookmark_compare, sizeof (zio_t), offsetof(zio_t, io_alloc_node)); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -110,7 +110,7 @@ struct objset { /* no lock needed: */ struct dmu_tx *os_synctx; /* XXX sketchy */ zil_header_t os_zil_header; - list_t os_synced_dnodes; + multilist_t *os_synced_dnodes; uint64_t os_flags; uint64_t os_freed_dnodes; boolean_t os_rescan_dnodes; @@ -121,10 +121,12 @@ struct objset { /* Protected by os_lock */ kmutex_t os_lock; - list_t os_dirty_dnodes[TXG_SIZE]; - list_t os_free_dnodes[TXG_SIZE]; + multilist_t *os_dirty_dnodes[TXG_SIZE]; list_t os_dnodes; list_t os_downgraded_dbufs; + + /* Protects changes to DMU_{USER,GROUP}USED_OBJECT */ + kmutex_t os_userused_lock; /* stuff we store for the user */ kmutex_t os_user_ptr_lock; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -203,7 +204,7 @@ struct dnode { uint32_t dn_dbufs_count; /* count of dn_dbufs */ /* protected by os_lock: */ - list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */ + multilist_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */ /* protected by dn_mtx: */ kmutex_t dn_mtx; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Wed Jul 26 16:45:39 2017 (r321553) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2017 by Delphix. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ @@ -121,6 +121,7 @@ typedef struct dsl_pool { txg_list_t dp_dirty_zilogs; txg_list_t dp_dirty_dirs; txg_list_t dp_sync_tasks; + taskq_t *dp_sync_taskq; /* * Protects administrative changes (properties, namespace) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Wed Jul 26 16:45:39 2017 (r321553) @@ -73,8 +73,7 @@ struct multilist { }; void multilist_destroy(multilist_t *); -void multilist_create(multilist_t *, size_t, size_t, - multilist_sublist_index_func_t *); +multilist_t *multilist_create(size_t, size_t, multilist_sublist_index_func_t *); void multilist_insert(multilist_t *, void *); void multilist_remove(multilist_t *, void *); @@ -84,6 +83,7 @@ unsigned int multilist_get_num_sublists(multilist_t *) unsigned int multilist_get_random_index(multilist_t *); multilist_sublist_t *multilist_sublist_lock(multilist_t *, unsigned int); +multilist_sublist_t *multilist_sublist_lock_obj(multilist_t *, void *); void multilist_sublist_unlock(multilist_sublist_t *); void multilist_sublist_insert_head(multilist_sublist_t *, void *); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Wed Jul 26 16:45:39 2017 (r321553) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -484,7 +484,7 @@ struct zio { list_node_t io_trim_link; }; -extern int zio_timestamp_compare(const void *, const void *); +extern int zio_bookmark_compare(const void *, const void *); extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, zio_done_func_t *done, void *priv, enum zio_flag flags); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:44:52 2017 (r321552) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Jul 26 16:45:39 2017 (r321553) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 16:46:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19F6EDA9A3B; Wed, 26 Jul 2017 16:46:40 +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 CEA356B28A; Wed, 26 Jul 2017 16:46:39 +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 v6QGkdI8077252; Wed, 26 Jul 2017 16:46:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGkckN077247; Wed, 26 Jul 2017 16:46:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261646.v6QGkckN077247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321554 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:46:40 -0000 Author: mav Date: Wed Jul 26 16:46:38 2017 New Revision: 321554 URL: https://svnweb.freebsd.org/changeset/base/321554 Log: MFC r318829: MFV r316920: 8023 Panic destroying a metaslab deferred range tree illumos/illumos-gate@3991b535a8e990c0369be677746a87c259b13e9f https://github.com/illumos/illumos-gate/commit/3991b535a8e990c0369be677746a87c259b13e9f https://www.illumos.org/issues/8023 $C ffffff0011bc0970 vpanic() ffffff0011bc0a00 strlog() ffffff0011bc0a30 range_tree_destroy+0x72(ffffff043769ad00) ffffff0011bc0a70 metaslab_fini+0xd5(ffffff0449acf380) ffffff0011bc0ab0 vdev_metaslab_fini+0x56(ffffff0462bae800) ffffff0011bc0af0 spa_unload+0x9b(ffffff03e3dac000) ffffff0011bc0b70 spa_export_common+0x115(ffffff047f4b4000, 2, 0, 0, 0) ffffff0011bc0b90 spa_destroy+0x1d(ffffff047f4b4000) ffffff0011bc0bd0 zfs_ioc_pool_destroy+0x20(ffffff047f4b4000) ffffff0011bc0c80 zfsdev_ioctl+0x4d7(11400000000, 5a01, 8040190, 100003, ffffff03e1956b10, ffffff0011bc0e68) ffffff0011bc0cc0 cdev_ioctl+0x39(11400000000, 5a01, 8040190, 100003, ffffff03e1956b10, ffffff0011bc0e68) ffffff0011bc0d10 spec_ioctl+0x60(ffffff03d9153b00, 5a01, 8040190, 100003, ffffff03e1956b10, ffffff0011bc0e68, 0) ffffff0011bc0da0 fop_ioctl+0x55(ffffff03d9153b00, 5a01, 8040190, 100003, ffffff03e1956b10, ffffff0011bc0e68, 0) ffffff0011bc0ec0 ioctl+0x9b(3, 5a01, 8040190) ffffff0011bc0f10 _sys_sysenter_post_swapgs+0x149() Reviewed by: Brad Lewis Reviewed by: Matt Ahrens Reviewed by: Dan Kimmel Reviewed by: Saso Kiselkov Approved by: Dan McDonald Author: George Wilson Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:45:39 2017 (r321553) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:46:38 2017 (r321554) @@ -1552,6 +1552,7 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) * this assertion only if we're not already dirty. */ os = dn->dn_objset; + VERIFY3U(tx->tx_txg, <=, spa_final_dirty_txg(os->os_spa)); #ifdef DEBUG if (dn->dn_objset->os_dsl_dataset != NULL) rrw_enter(&os->os_dsl_dataset->ds_bp_rwlock, RW_READER, FTAG); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:45:39 2017 (r321553) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Jul 26 16:46:38 2017 (r321554) @@ -1652,11 +1652,19 @@ metaslab_set_fragmentation(metaslab_t *msp) uint64_t txg = spa_syncing_txg(spa); vdev_t *vd = msp->ms_group->mg_vd; - if (spa_writeable(spa)) { + /* + * If we've reached the final dirty txg, then we must + * be shutting down the pool. We don't want to dirty + * any data past this point so skip setting the condense + * flag. We can retry this action the next time the pool + * is imported. + */ + if (spa_writeable(spa) && txg < spa_final_dirty_txg(spa)) { msp->ms_condense_wanted = B_TRUE; vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); spa_dbgmsg(spa, "txg %llu, requesting force condense: " - "msp %p, vd %p", txg, msp, vd); + "ms_id %llu, vdev_id %llu", txg, msp->ms_id, + vd->vdev_id); } msp->ms_fragmentation = ZFS_FRAG_INVALID; return; @@ -2278,12 +2286,16 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) /* * Normally, we don't want to process a metaslab if there * are no allocations or frees to perform. However, if the metaslab - * is being forced to condense we need to let it through. + * is being forced to condense and it's loaded, we need to let it + * through. */ if (range_tree_space(alloctree) == 0 && range_tree_space(msp->ms_freeingtree) == 0 && - !msp->ms_condense_wanted) + !(msp->ms_loaded && msp->ms_condense_wanted)) return; + + + VERIFY(txg <= spa_final_dirty_txg(spa)); /* * The only state that can actually be changing concurrently with Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jul 26 16:45:39 2017 (r321553) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jul 26 16:46:38 2017 (r321554) @@ -1741,6 +1741,16 @@ spa_syncing_txg(spa_t *spa) return (spa->spa_syncing_txg); } +/* + * Return the last txg where data can be dirtied. The final txgs + * will be used to just clear out any deferred frees that remain. + */ +uint64_t +spa_final_dirty_txg(spa_t *spa) +{ + return (spa->spa_final_txg - TXG_DEFER_SIZE); +} + pool_state_t spa_state(spa_t *spa) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Jul 26 16:45:39 2017 (r321553) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Jul 26 16:46:38 2017 (r321554) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. */ #include @@ -407,6 +407,7 @@ space_map_truncate(space_map_t *sm, dmu_tx_t *tx) ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); ASSERT(dmu_tx_is_syncing(tx)); + VERIFY3U(dmu_tx_get_txg(tx), <=, spa_final_dirty_txg(spa)); dmu_object_info_from_db(sm->sm_dbuf, &doi); @@ -421,9 +422,10 @@ space_map_truncate(space_map_t *sm, dmu_tx_t *tx) if ((spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM) && doi.doi_bonus_size != sizeof (space_map_phys_t)) || doi.doi_data_block_size != space_map_blksz) { - zfs_dbgmsg("txg %llu, spa %s, reallocating: " - "old bonus %u, old blocksz %u", dmu_tx_get_txg(tx), - spa_name(spa), doi.doi_bonus_size, doi.doi_data_block_size); + zfs_dbgmsg("txg %llu, spa %s, sm %p, reallocating " + "object[%llu]: old bonus %u, old blocksz %u", + dmu_tx_get_txg(tx), spa_name(spa), sm, sm->sm_object, + doi.doi_bonus_size, doi.doi_data_block_size); space_map_free(sm, tx); dmu_buf_rele(sm->sm_dbuf, sm); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 16:45:39 2017 (r321553) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 16:46:38 2017 (r321554) @@ -791,6 +791,7 @@ extern uint64_t spa_load_guid(spa_t *spa); extern uint64_t spa_last_synced_txg(spa_t *spa); extern uint64_t spa_first_txg(spa_t *spa); extern uint64_t spa_syncing_txg(spa_t *spa); +extern uint64_t spa_final_dirty_txg(spa_t *spa); extern uint64_t spa_version(spa_t *spa); extern pool_state_t spa_state(spa_t *spa); extern spa_load_state_t spa_load_state(spa_t *spa); From owner-svn-src-all@freebsd.org Wed Jul 26 16:47:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4182DA9AC9; Wed, 26 Jul 2017 16:47: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 A0F8E6B3E3; Wed, 26 Jul 2017 16:47: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 v6QGlXbX077342; Wed, 26 Jul 2017 16:47:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGlXCC077341; Wed, 26 Jul 2017 16:47:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261647.v6QGlXCC077341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321555 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 321555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:47:34 -0000 Author: mav Date: Wed Jul 26 16:47:33 2017 New Revision: 321555 URL: https://svnweb.freebsd.org/changeset/base/321555 Log: MFC r318831: MFV r316922: 5380 receive of a send -p stream doesn't need to try renaming snapshots illumos/illumos-gate@471a88e499c660844f4590487ce7c4d5a7090294 https://github.com/illumos/illumos-gate/commit/471a88e499c660844f4590487ce7c4d5a7090294 https://www.illumos.org/issues/5380 A stream created with zfs send -p -I contains properties of all snapshots of a given dataset as opposed to only properties of snapshots in a given range. Not only this is suboptimal but the receive code also does not filter properties by the range. So, properties of earlier snapshots would be updated even though the snapshots themselves are not in the stream (just their properties). Given that modifying the snapshot properties requires a TXG sync and that the snapshots are updated one by one the described behavior may lead to a sever performance penalty. Reviewed by: Paul Dagnelie Reviewed by: Matt Ahrens Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jul 26 16:46:38 2017 (r321554) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jul 26 16:47:33 2017 (r321555) @@ -2800,7 +2800,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, cons goto out; } - if (fromsnap != NULL) { + if (fromsnap != NULL && recursive) { nvlist_t *renamed = NULL; nvpair_t *pair = NULL; @@ -2827,7 +2827,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, cons *strchr(tofs, '@') = '\0'; } - if (recursive && !flags->dryrun && !flags->nomount) { + if (!flags->dryrun && !flags->nomount) { VERIFY(0 == nvlist_alloc(&renamed, NV_UNIQUE_NAME, 0)); } @@ -2896,7 +2896,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, cons anyerr |= error; } while (error == 0); - if (drr->drr_payloadlen != 0 && fromsnap != NULL) { + if (drr->drr_payloadlen != 0 && recursive && fromsnap != NULL) { /* * Now that we have the fs's they sent us, try the * renames again. From owner-svn-src-all@freebsd.org Wed Jul 26 16:48:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDBF6DA9B77; Wed, 26 Jul 2017 16:48: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 99D766B520; Wed, 26 Jul 2017 16:48: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 v6QGmYXd077430; Wed, 26 Jul 2017 16:48:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGmY6I077428; Wed, 26 Jul 2017 16:48:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261648.v6QGmY6I077428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321556 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:48:35 -0000 Author: mav Date: Wed Jul 26 16:48:34 2017 New Revision: 321556 URL: https://svnweb.freebsd.org/changeset/base/321556 Log: MFC r318833: MFV r316925: 6101 attempt to lzc_create() a filesystem under a volume results in a panic illumos/illumos-gate@b127fe3c059af7adf772735498680b4f2e1405ef https://github.com/illumos/illumos-gate/commit/b127fe3c059af7adf772735498680b4f2e1405ef https://www.illumos.org/issues/6101 lzc_create(), or more correctly, zfs_ioc_create() does not reject an attempt to create a filesystem as a child of a volume, instead it proceeds to a crash. A crash stack obtained on FreeBSD: page fault while in kernel mode zap_leaf_lookup() fzap_lookup() zap_lookup_norm() zap_lookup() zfs_get_zplprop() zfs_fill_zplprops_impl() zfs_ioc_create() zfsdev_ioctl() devfs_ioctl_f() kern_ioctl() sys_ioctl() This crash happened with a kernel without debugging assertions. The immediate cause of crash appears to an attempt to interpret a zvol object as a zap object. For filesystems: #define MASTER_NODE_OBJ 1 For zvols: #define ZVOL_OBJ 1ULL #define ZVOL_ZAP_OBJ 2ULL So, I see two problems here: 1. an attempt to create a filesystem under a zvol should be rejected as early as possible, maybe in zfs_fill_zplprops() 2. maybe zap_lookup / zap_lockdir should reject objects that are not of one of the zap object types Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jul 26 16:47:33 2017 (r321555) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jul 26 16:48:34 2017 (r321556) @@ -3092,6 +3092,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver, ASSERT(zplprops != NULL); + if (os != NULL && os->os_phys->os_type != DMU_OST_ZFS) + return (SET_ERROR(EINVAL)); + /* * Pull out creator prop choices, if any. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Jul 26 16:47:33 2017 (r321555) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Jul 26 16:48:34 2017 (r321556) @@ -2459,8 +2459,10 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_ else pname = zfs_prop_to_name(prop); - if (os != NULL) + if (os != NULL) { + ASSERT3U(os->os_phys->os_type, ==, DMU_OST_ZFS); error = zap_lookup(os, MASTER_NODE_OBJ, pname, 8, 1, value); + } if (error == ENOENT) { /* No value set, use the default value */ From owner-svn-src-all@freebsd.org Wed Jul 26 16:49:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C26A9DA9BE4; Wed, 26 Jul 2017 16:49:28 +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 8FF706B65A; Wed, 26 Jul 2017 16:49:28 +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 v6QGnR34077512; Wed, 26 Jul 2017 16:49:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGnRF2077511; Wed, 26 Jul 2017 16:49:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261649.v6QGnRF2077511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321557 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 321557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:49:28 -0000 Author: mav Date: Wed Jul 26 16:49:27 2017 New Revision: 321557 URL: https://svnweb.freebsd.org/changeset/base/321557 Log: MFC r318834: MFV r316930: 5814 bpobj_iterate_impl(): Close a refcount leak iterating on a sublist. illumos/illumos-gate@b67dde11a73a9455d641403cbbb65ec2add41b41 https://github.com/illumos/illumos-gate/commit/b67dde11a73a9455d641403cbbb65ec2add41b41 https://www.illumos.org/issues/5814 Lets pull in this patch from freebsd: http://svnweb.freebsd.org/base?view=revision&revision=271781 bpobj_iterate_impl(): Close a refcount leak iterating on a sublist. If bpobj_space() returned non-zero here, the sublist would have been left open, along with the bonus buffer hold it requires. This call does not invoke any calls to bpobj_close() itself. This bug doesn't have any known vector, but was found on inspection. MFC after: 1 week Sponsored by: Spectra Logic Affects: All ZFS versions starting 21 May 2010 (illumos cde58dbc) MFSpectraBSD: r1050998 on 2014/03/26 Fix bpobj_iterate_impl() to properly call bpobj_close() if bpobj_space() returns an error. Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Simon Klinkert Approved by: Gordon Ross Author: Will Andrews FreeBSD note: this is a "record-only" commit as the actual change was directly committed to FreeBSD by (or on behalf of) the author. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Wed Jul 26 16:50:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9433DA9D35; Wed, 26 Jul 2017 16:50:16 +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 A54126B85C; Wed, 26 Jul 2017 16:50:16 +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 v6QGoF3Q077620; Wed, 26 Jul 2017 16:50:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGoFUN077619; Wed, 26 Jul 2017 16:50:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261650.v6QGoFUN077619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321558 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:50:17 -0000 Author: mav Date: Wed Jul 26 16:50:15 2017 New Revision: 321558 URL: https://svnweb.freebsd.org/changeset/base/321558 Log: MFC r318920: MFV r316924: 8061 sa_find_idx_tab can be declared more type-safely illumos/illumos-gate@7f0bdb4257bb4f1f76390b72665961e411da24c6 https://github.com/illumos/illumos-gate/commit/7f0bdb4257bb4f1f76390b72665961e411da24c6 https://www.illumos.org/issues/8061 sa_find_idx_tab() is declared as taking and returning "void *" parameters. These can be declared to be the specific types. Reviewed by: George Wilson Reviewed by: Chris Williamson Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Wed Jul 26 16:49:27 2017 (r321557) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Wed Jul 26 16:50:15 2017 (r321558) @@ -22,7 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 iXsystems, Inc - * Copyright (c) 2013, 2016 by Delphix. All rights reserved. + * Copyright (c) 2013, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -131,8 +131,8 @@ typedef void (sa_iterfunc_t)(void *hdr, void *addr, sa static int sa_build_index(sa_handle_t *hdl, sa_buf_type_t buftype); static void sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab); -static void *sa_find_idx_tab(objset_t *os, dmu_object_type_t bonustype, - void *data); +static sa_idx_tab_t *sa_find_idx_tab(objset_t *os, dmu_object_type_t bonustype, + sa_hdr_phys_t *hdr); static void sa_idx_tab_rele(objset_t *os, void *arg); static void sa_copy_data(sa_data_locator_t *func, void *start, void *target, int buflen); @@ -1486,11 +1486,10 @@ sa_lookup_uio(sa_handle_t *hdl, sa_attr_type_t attr, u } #endif -void * -sa_find_idx_tab(objset_t *os, dmu_object_type_t bonustype, void *data) +static sa_idx_tab_t * +sa_find_idx_tab(objset_t *os, dmu_object_type_t bonustype, sa_hdr_phys_t *hdr) { sa_idx_tab_t *idx_tab; - sa_hdr_phys_t *hdr = (sa_hdr_phys_t *)data; sa_os_t *sa = os->os_sa; sa_lot_t *tb, search; avl_index_t loc; From owner-svn-src-all@freebsd.org Wed Jul 26 16:50:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D112DA9DAD; Wed, 26 Jul 2017 16:50:56 +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 195FF6B9CB; Wed, 26 Jul 2017 16:50:56 +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 v6QGotX2078356; Wed, 26 Jul 2017 16:50:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGotMx078355; Wed, 26 Jul 2017 16:50:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261650.v6QGotMx078355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321559 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:50:56 -0000 Author: mav Date: Wed Jul 26 16:50:55 2017 New Revision: 321559 URL: https://svnweb.freebsd.org/changeset/base/321559 Log: MFC r318921: MFV r316928: 7256 low probability race in zfs_get_data illumos/illumos-gate@0c94e1af6784c69a1dea25e0e35dd13b2b91e2e5 https://github.com/illumos/illumos-gate/commit/0c94e1af6784c69a1dea25e0e35dd13b2b91e2e5 https://www.illumos.org/issues/7256 error = dmu_sync(zio, lr->lr_common.lrc_txg, zfs_get_done, zgd); ASSERT(error || lr->lr_length <= zp->z_blksz); It's possible, although extremely rare, that the zfs_get_done() callback is executed before dmu_sync() returns. In that case the znode's range lock is dropped and the znode is unreferenced. Thus, the assertion can access some invalid or wrong data via the zp pointer. size variable caches the correct value of z_blksz and can be safely used here. Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:50:15 2017 (r321558) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:50:55 2017 (r321559) @@ -1385,7 +1385,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio error = dmu_sync(zio, lr->lr_common.lrc_txg, zfs_get_done, zgd); - ASSERT(error || lr->lr_length <= zp->z_blksz); + ASSERT(error || lr->lr_length <= size); /* * On success, we need to wait for the write I/O From owner-svn-src-all@freebsd.org Wed Jul 26 16:52:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66518DA9FC6; Wed, 26 Jul 2017 16:52: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 35C9B6BD66; Wed, 26 Jul 2017 16:52: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 v6QGqOp3080580; Wed, 26 Jul 2017 16:52:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGqOSe080579; Wed, 26 Jul 2017 16:52:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261652.v6QGqOSe080579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321560 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 321560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:52:25 -0000 Author: mav Date: Wed Jul 26 16:52:24 2017 New Revision: 321560 URL: https://svnweb.freebsd.org/changeset/base/321560 Log: MFC r318922: MFV r316927: 5379 modifying a mmap()-ed file does not update its timestamps FreeBSD note: this is a record-only merge as the FreeBSD putpages code is quite different from the upstream. illumos/illumos-gate@80e10fd0d22bbf0d18bfdae035e06f44c68ae8e6 https://github.com/illumos/illumos-gate/commit/80e10fd0d22bbf0d18bfdae035e06f44c68ae8e6 https://www.illumos.org/issues/5379 The following is based on a review of the illumos code and on a similar problem reported for FreeBSD where the relevant code is different. Looking at this block of code http://src.illumos.org/source/xref/illumos-gate/ usr/src/uts/common/fs/zfs/zfs_vnops.c#4187 I see code to set up an sa_bulk_attr_t object, I see code to set up mtime and ctime values, but I do not see code to actually apply the attributes... I would expect there to be a call to sa_bulk_update(), there is such a call in zfs_write() for instance. mmap_write.c [Magnifier] - demo (1.42 KB) Andriy Gapon, 2015-11-11 01:53 PM Reviewed by: Matthew Ahrens Reviewed by: Prashanth Sreenivasa Reviewed by: Dan McDonald Approved by: Gordon Ross Author: Andriy Gapon Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Wed Jul 26 16:53:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F43DDAA0F5; Wed, 26 Jul 2017 16:53:41 +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 1B8836BFB0; Wed, 26 Jul 2017 16:53: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 v6QGre04081399; Wed, 26 Jul 2017 16:53:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGrepS081398; Wed, 26 Jul 2017 16:53:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261653.v6QGrepS081398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321561 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:53:41 -0000 Author: mav Date: Wed Jul 26 16:53:39 2017 New Revision: 321561 URL: https://svnweb.freebsd.org/changeset/base/321561 Log: MFC r318923: zfs_putpages: assert that sa_bulk_update() must succeed Same as the upstream does in r316927. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:52:24 2017 (r321560) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 16:53:39 2017 (r321561) @@ -4757,7 +4757,8 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t l &zp->z_pflags, 8); zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime, B_TRUE); - (void)sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); + err = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); + ASSERT0(err); zfs_log_write(zfsvfs->z_log, tx, TX_WRITE, zp, off, len, 0); zfs_vmobject_wlock(object); From owner-svn-src-all@freebsd.org Wed Jul 26 16:55:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70346DAA236; Wed, 26 Jul 2017 16:55:08 +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 4B1706C114; Wed, 26 Jul 2017 16:55:08 +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 v6QGt7ds081523; Wed, 26 Jul 2017 16:55:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGt7ZZ081522; Wed, 26 Jul 2017 16:55:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261655.v6QGt7ZZ081522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321562 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:55:08 -0000 Author: mav Date: Wed Jul 26 16:55:07 2017 New Revision: 321562 URL: https://svnweb.freebsd.org/changeset/base/321562 Log: MFC r318924 (by avg): arc_init: make code closer to upstream by introducing 'allmem' variable All the differences in calculations are kept. A comment about arc_max being 1/2 of all memory is fixed to reflect the actual code that uses 5/8 as a factor. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:53:39 2017 (r321561) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:55:07 2017 (r321562) @@ -6315,6 +6315,20 @@ arc_init(void) { int i, prefetch_tunable_set = 0; + /* + * allmem is "all memory that we could possibly use". + */ +#ifdef illumos +#ifdef _KERNEL + uint64_t allmem = ptob(physmem - swapfs_minfree); +#else + uint64_t allmem = (physmem * PAGESIZE) / 2; +#endif +#else + uint64_t allmem = kmem_size(); +#endif + + mutex_init(&arc_reclaim_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arc_reclaim_thread_cv, NULL, CV_DEFAULT, NULL); cv_init(&arc_reclaim_waiters_cv, NULL, CV_DEFAULT, NULL); @@ -6326,7 +6340,7 @@ arc_init(void) arc_min_prefetch_lifespan = 1 * hz; /* Start out with 1/8 of all memory */ - arc_c = kmem_size() / 8; + arc_c = allmem / 8; #ifdef illumos #ifdef _KERNEL @@ -6339,13 +6353,13 @@ arc_init(void) #endif #endif /* illumos */ /* set min cache to 1/32 of all memory, or arc_abs_min, whichever is more */ - arc_c_min = MAX(arc_c / 4, arc_abs_min); - /* set max to 1/2 of all memory, or all but 1GB, whichever is more */ - if (arc_c * 8 >= 1 << 30) - arc_c_max = (arc_c * 8) - (1 << 30); + arc_c_min = MAX(allmem / 32, arc_abs_min); + /* set max to 5/8 of all memory, or all but 1GB, whichever is more */ + if (allmem >= 1 << 30) + arc_c_max = allmem - (1 << 30); else arc_c_max = arc_c_min; - arc_c_max = MAX(arc_c * 5, arc_c_max); + arc_c_max = MAX(allmem * 5 / 8, arc_c_max); /* * In userland, there's only the memory pressure that we artificially @@ -6362,7 +6376,7 @@ 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 < allmem) { arc_c_max = zfs_arc_max; arc_c_min = MIN(arc_c_min, arc_c_max); } @@ -6485,7 +6499,7 @@ arc_init(void) printf("ZFS WARNING: Recommended minimum RAM size is 512MB; " "expect unstable behavior.\n"); } - if (kmem_size() < 512 * (1 << 20)) { + if (allmem < 512 * (1 << 20)) { printf("ZFS WARNING: Recommended minimum kmem_size is 512MB; " "expect unstable behavior.\n"); printf(" Consider tuning vm.kmem_size and " From owner-svn-src-all@freebsd.org Wed Jul 26 16:57:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14013DAA2FC; Wed, 26 Jul 2017 16:57:19 +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 898376C293; Wed, 26 Jul 2017 16:57:18 +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 v6QGvH0H081644; Wed, 26 Jul 2017 16:57:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGvHiK081643; Wed, 26 Jul 2017 16:57:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261657.v6QGvHiK081643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321563 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:57:19 -0000 Author: mav Date: Wed Jul 26 16:57:17 2017 New Revision: 321563 URL: https://svnweb.freebsd.org/changeset/base/321563 Log: MFC r318925: MFV r316929: 6914 kernel virtual memory fragmentation leads to hang illumos/illumos-gate@af868f46a5b794687741d5424de9e3a2d684a84a https://github.com/illumos/illumos-gate/commit/af868f46a5b794687741d5424de9e3a2d684a84a https://www.illumos.org/issues/6914 FreeBSD note: only a ZFS part of the change is merged, changes to the VM subsystem are not ported (obviously). Also, now that FreeBSD has vmem(9) we don't have to ifdef-out the code that uses it. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:55:07 2017 (r321562) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 16:57:17 2017 (r321563) @@ -6339,19 +6339,6 @@ arc_init(void) /* Convert seconds to clock ticks */ arc_min_prefetch_lifespan = 1 * hz; - /* Start out with 1/8 of all memory */ - arc_c = allmem / 8; - -#ifdef illumos -#ifdef _KERNEL - /* - * On architectures where the physical memory can be larger - * than the addressable space (intel in 32-bit mode), we may - * need to limit the cache to 1/8 of VM size. - */ - arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); -#endif -#endif /* illumos */ /* set min cache to 1/32 of all memory, or arc_abs_min, whichever is more */ arc_c_min = MAX(allmem / 32, arc_abs_min); /* set max to 5/8 of all memory, or all but 1GB, whichever is more */ @@ -6390,6 +6377,15 @@ arc_init(void) /* limit meta-data to 1/4 of the arc capacity */ arc_meta_limit = arc_c_max / 4; + +#ifdef _KERNEL + /* + * Metadata is stored in the kernel's heap. Don't let us + * use more than half the heap for the ARC. + */ + arc_meta_limit = MIN(arc_meta_limit, + vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 2); +#endif /* Allow the tunable to override if it is reasonable */ if (zfs_arc_meta_limit > 0 && zfs_arc_meta_limit <= arc_c_max) From owner-svn-src-all@freebsd.org Wed Jul 26 16:58:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E054DAA368; Wed, 26 Jul 2017 16:58:02 +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 1D3596C3BC; Wed, 26 Jul 2017 16:58:02 +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 v6QGw1fM081725; Wed, 26 Jul 2017 16:58:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QGw1G1081724; Wed, 26 Jul 2017 16:58:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261658.v6QGw1G1081724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 16:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321564 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 321564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 16:58:02 -0000 Author: mav Date: Wed Jul 26 16:58:01 2017 New Revision: 321564 URL: https://svnweb.freebsd.org/changeset/base/321564 Log: MFC r318926: MFV r316919: 7885 zpool list can report 16.0e for expandsz FreeBSD note: this is a record-only change, the actual change was directly committed by smh. illumos/illumos-gate@c040c10cdd1e4eab0fc88203758367dd81e057b7 https://github.com/illumos/illumos-gate/commit/c040c10cdd1e4eab0fc88203758367dd81e057b7 https://www.illumos.org/issues/7885 When a member of a RAIDZ has been replaced with a device smaller than the original, then the top level vdev can report its expand size as 16.0E. The reduced child asize causes the RAIDZ to have a vdev_asize lower than its vdev_max_asize which then results in an underflow during the calculation of the parents expand size. Also for RAIDZ vdevs the sum of their child vdev_min_asize could be smaller than the parents vdev_min_size. Fixed by: https://github.com/openzfs/openzfs/pull/296 Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Gordon Ross Author: Steven Hartland Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Wed Jul 26 17:12:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2DDEDAAD6A; Wed, 26 Jul 2017 17:12:54 +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 8C5626D1E4; Wed, 26 Jul 2017 17:12:54 +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 v6QHCrJ3090467; Wed, 26 Jul 2017 17:12:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHCrkg090466; Wed, 26 Jul 2017 17:12:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261712.v6QHCrkg090466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321565 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:12:54 -0000 Author: mav Date: Wed Jul 26 17:12:53 2017 New Revision: 321565 URL: https://svnweb.freebsd.org/changeset/base/321565 Log: MFC r318928: MFV r318927: 8025 dbuf_read() creates unnecessary zio_root() for bonus buf illumos/illumos-gate@def4fac5882b4ca67bd0f4a53509b6d1fa8ae14e https://github.com/illumos/illumos-gate/commit/def4fac5882b4ca67bd0f4a53509b6d1fa8ae14e https://www.illumos.org/issues/8025 dbuf_read() creates a zio_root() to track and wait for all the zio's that may happen as part of this call. However, if the blkptr_t for this buffer is NULL or a hole, we will not create any more zio's, so this zio_root() is unnecessary. This is always the case when calling dbuf_read() on a bonus buffer, because it has no blkptr (it's part of the containing dnode). For workloads that read a lot of bonus buffers (e.g. file creation and removal), creating and destroying these unnecessary zio's can decrease performance by around 3%. Reviewed by: Dan Kimmel Reviewed by: Pavel Zakharov Reviewed by: Prashanth Sreenivasa Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 16:58:01 2017 (r321564) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:12:53 2017 (r321565) @@ -1088,7 +1088,6 @@ int dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) { int err = 0; - boolean_t havepzio = (zio != NULL); boolean_t prefetch; dnode_t *dn; @@ -1132,9 +1131,13 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t fla DB_DNODE_EXIT(db); } else if (db->db_state == DB_UNCACHED) { spa_t *spa = dn->dn_objset->os_spa; + boolean_t need_wait = B_FALSE; - if (zio == NULL) + if (zio == NULL && + db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) { zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); + need_wait = B_TRUE; + } dbuf_read_impl(db, zio, flags); /* dbuf_read_impl has dropped db_mtx for us */ @@ -1146,7 +1149,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t fla rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); - if (!havepzio) + if (need_wait) err = zio_wait(zio); } else { /* @@ -1181,7 +1184,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t fla mutex_exit(&db->db_mtx); } - ASSERT(err || havepzio || db->db_state == DB_CACHED); return (err); } From owner-svn-src-all@freebsd.org Wed Jul 26 17:35:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14AA9DAB48D; Wed, 26 Jul 2017 17:35:05 +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 E26066DF07; Wed, 26 Jul 2017 17:35:04 +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 v6QHZ4Q9098726; Wed, 26 Jul 2017 17:35:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHZ4YX098725; Wed, 26 Jul 2017 17:35:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261735.v6QHZ4YX098725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321566 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:35:05 -0000 Author: mav Date: Wed Jul 26 17:35:03 2017 New Revision: 321566 URL: https://svnweb.freebsd.org/changeset/base/321566 Log: MFC r318930: MFV r318929: 7786 zfs`vdev_online() needs better notification about state changes illumos/illumos-gate@5f368aef86387d6ef4eda84030ae9b402313ee4c https://github.com/illumos/illumos-gate/commit/5f368aef86387d6ef4eda84030ae9b402313ee4c https://www.illumos.org/issues/7786 Currently, vdev_online() will only post sysevent if previous state was "offline". It should also post the event when the state changes from "removed" or "faulted" to "healthy" or "degraded". This will fix the following scenario: - pull disk from slot A - check that hotspare has taken its place (if available) - insert disk into slot B - check that hotspare moved back to "avail" state (if spare was used) The problem here is that we don't get any ESC_ZFS_VDEV_* notification and fail to update the vdev FRU. Reviewed by: Matthew Ahrens mahrens@delphix.com Reviewed by: George Wilson george.wilson@delphix.com Approved by: Albert Lee Author: Yuri Pankov Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jul 26 17:12:53 2017 (r321565) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jul 26 17:35:03 2017 (r321566) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. * Copyright 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -2597,7 +2597,8 @@ int vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate) { vdev_t *vd, *tvd, *pvd, *rvd = spa->spa_root_vdev; - boolean_t postevent = B_FALSE; + boolean_t wasoffline; + vdev_state_t oldstate; spa_vdev_state_enter(spa, SCL_NONE); @@ -2607,9 +2608,8 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, if (!vd->vdev_ops->vdev_op_leaf) return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); - postevent = - (vd->vdev_offline == B_TRUE || vd->vdev_tmpoffline == B_TRUE) ? - B_TRUE : B_FALSE; + wasoffline = (vd->vdev_offline || vd->vdev_tmpoffline); + oldstate = vd->vdev_state; tvd = vd->vdev_top; vd->vdev_offline = B_FALSE; @@ -2647,7 +2647,9 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); } - if (postevent) + if (wasoffline || + (oldstate < VDEV_STATE_DEGRADED && + vd->vdev_state >= VDEV_STATE_DEGRADED)) spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE); return (spa_vdev_state_exit(spa, vd, 0)); From owner-svn-src-all@freebsd.org Wed Jul 26 17:35:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE314DAB52F; Wed, 26 Jul 2017 17:35:53 +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 B94B36E0D9; Wed, 26 Jul 2017 17:35:53 +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 v6QHZqC9098814; Wed, 26 Jul 2017 17:35:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHZqWx098806; Wed, 26 Jul 2017 17:35:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261735.v6QHZqWx098806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321567 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:35:54 -0000 Author: mav Date: Wed Jul 26 17:35:52 2017 New Revision: 321567 URL: https://svnweb.freebsd.org/changeset/base/321567 Log: MFC r318932: MFV r318931: 8063 verify that we do not attempt to access inactive txg illumos/illumos-gate@b7b2590dd9f11b12a0b4878db3886068cce176af https://github.com/illumos/illumos-gate/commit/b7b2590dd9f11b12a0b4878db3886068cce176af https://www.illumos.org/issues/8063 A standard practice in ZFS is to keep track of "per-txg" state. Any of the 3 active TXG's (open, quiescing, syncing) can have different values for this state. We should assert that we do not attempt to modify other (inactive) TXG's. Reviewed by: Serapheim Dimitropoulos Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 26 17:35:52 2017 (r321567) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -72,7 +72,7 @@ dmu_tx_create_assigned(struct dsl_pool *dp, uint64_t t { dmu_tx_t *tx = dmu_tx_create_dd(NULL); - ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg); + txg_verify(dp->dp_spa, txg); tx->tx_pool = dp; tx->tx_txg = txg; tx->tx_anyobj = TRUE; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 17:35:52 2017 (r321567) @@ -259,13 +259,13 @@ dsl_pool_open_impl(spa_t *spa, uint64_t txg) rrw_init(&dp->dp_config_rwlock, B_TRUE); txg_init(dp, txg); - txg_list_create(&dp->dp_dirty_datasets, + txg_list_create(&dp->dp_dirty_datasets, spa, offsetof(dsl_dataset_t, ds_dirty_link)); - txg_list_create(&dp->dp_dirty_zilogs, + txg_list_create(&dp->dp_dirty_zilogs, spa, offsetof(zilog_t, zl_dirty_link)); - txg_list_create(&dp->dp_dirty_dirs, + txg_list_create(&dp->dp_dirty_dirs, spa, offsetof(dsl_dir_t, dd_dirty_link)); - txg_list_create(&dp->dp_sync_tasks, + txg_list_create(&dp->dp_sync_tasks, spa, offsetof(dsl_sync_task_t, dst_node)); dp->dp_sync_taskq = taskq_create("dp_sync_taskq", Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jul 26 17:35:52 2017 (r321567) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -1141,7 +1141,7 @@ spa_activate(spa_t *spa, int mode) list_create(&spa->spa_state_dirty_list, sizeof (vdev_t), offsetof(vdev_t, vdev_state_dirty_node)); - txg_list_create(&spa->spa_vdev_txg_list, + txg_list_create(&spa->spa_vdev_txg_list, spa, offsetof(struct vdev, vdev_txg_node)); avl_create(&spa->spa_errlist_scrub, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Wed Jul 26 17:35:52 2017 (r321567) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. */ #ifndef _SYS_TXG_H @@ -60,6 +60,7 @@ typedef struct txg_node { typedef struct txg_list { kmutex_t tl_lock; size_t tl_offset; + spa_t *tl_spa; txg_node_t *tl_head[TXG_SIZE]; } txg_list_t; @@ -103,13 +104,15 @@ extern boolean_t txg_stalled(struct dsl_pool *dp); /* returns TRUE if someone is waiting for the next txg to sync */ extern boolean_t txg_sync_waiting(struct dsl_pool *dp); +extern void txg_verify(spa_t *spa, uint64_t txg); + /* * Per-txg object lists. */ #define TXG_CLEAN(txg) ((txg) - 1) -extern void txg_list_create(txg_list_t *tl, size_t offset); +extern void txg_list_create(txg_list_t *tl, spa_t *spa, size_t offset); extern void txg_list_destroy(txg_list_t *tl); extern boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg); extern boolean_t txg_all_lists_empty(txg_list_t *tl); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Wed Jul 26 17:35:52 2017 (r321567) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -94,6 +94,15 @@ typedef struct zil_chain { } zil_chain_t; #define ZIL_MIN_BLKSZ 4096ULL + +/* + * ziltest is by and large an ugly hack, but very useful in + * checking replay without tedious work. + * When running ziltest we want to keep all itx's and so maintain + * a single list in the zl_itxg[] that uses a high txg: ZILTEST_TXG + * We subtract TXG_CONCURRENT_STATES to allow for common code. + */ +#define ZILTEST_TXG (UINT64_MAX - TXG_CONCURRENT_STATES) /* * The words of a log block checksum. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Wed Jul 26 17:35:52 2017 (r321567) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 Martin Matuska - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. */ #include @@ -30,6 +30,7 @@ #include #include #include +#include #include /* @@ -693,16 +694,32 @@ txg_sync_waiting(dsl_pool_t *dp) } /* + * Verify that this txg is active (open, quiescing, syncing). Non-active + * txg's should not be manipulated. + */ +void +txg_verify(spa_t *spa, uint64_t txg) +{ + dsl_pool_t *dp = spa_get_dsl(spa); + if (txg <= TXG_INITIAL || txg == ZILTEST_TXG) + return; + ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg); + ASSERT3U(txg, >=, dp->dp_tx.tx_synced_txg); + ASSERT3U(txg, >=, dp->dp_tx.tx_open_txg - TXG_CONCURRENT_STATES); +} + +/* * Per-txg object lists. */ void -txg_list_create(txg_list_t *tl, size_t offset) +txg_list_create(txg_list_t *tl, spa_t *spa, size_t offset) { int t; mutex_init(&tl->tl_lock, NULL, MUTEX_DEFAULT, NULL); tl->tl_offset = offset; + tl->tl_spa = spa; for (t = 0; t < TXG_SIZE; t++) tl->tl_head[t] = NULL; @@ -722,15 +739,16 @@ txg_list_destroy(txg_list_t *tl) boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg) { + txg_verify(tl->tl_spa, txg); return (tl->tl_head[txg & TXG_MASK] == NULL); } /* * Returns true if all txg lists are empty. * - * Warning: this is inherently racy (an item could be added immediately after this - * function returns). We don't bother with the lock because it wouldn't change the - * semantics. + * Warning: this is inherently racy (an item could be added immediately + * after this function returns). We don't bother with the lock because + * it wouldn't change the semantics. */ boolean_t txg_all_lists_empty(txg_list_t *tl) @@ -754,6 +772,7 @@ txg_list_add(txg_list_t *tl, void *p, uint64_t txg) txg_node_t *tn = (txg_node_t *)((char *)p + tl->tl_offset); boolean_t add; + txg_verify(tl->tl_spa, txg); mutex_enter(&tl->tl_lock); add = (tn->tn_member[t] == 0); if (add) { @@ -778,6 +797,7 @@ txg_list_add_tail(txg_list_t *tl, void *p, uint64_t tx txg_node_t *tn = (txg_node_t *)((char *)p + tl->tl_offset); boolean_t add; + txg_verify(tl->tl_spa, txg); mutex_enter(&tl->tl_lock); add = (tn->tn_member[t] == 0); if (add) { @@ -805,6 +825,7 @@ txg_list_remove(txg_list_t *tl, uint64_t txg) txg_node_t *tn; void *p = NULL; + txg_verify(tl->tl_spa, txg); mutex_enter(&tl->tl_lock); if ((tn = tl->tl_head[t]) != NULL) { p = (char *)tn - tl->tl_offset; @@ -826,6 +847,7 @@ txg_list_remove_this(txg_list_t *tl, void *p, uint64_t int t = txg & TXG_MASK; txg_node_t *tn, **tp; + txg_verify(tl->tl_spa, txg); mutex_enter(&tl->tl_lock); for (tp = &tl->tl_head[t]; (tn = *tp) != NULL; tp = &tn->tn_next[t]) { @@ -849,6 +871,7 @@ txg_list_member(txg_list_t *tl, void *p, uint64_t txg) int t = txg & TXG_MASK; txg_node_t *tn = (txg_node_t *)((char *)p + tl->tl_offset); + txg_verify(tl->tl_spa, txg); return (tn->tn_member[t] != 0); } @@ -861,6 +884,7 @@ txg_list_head(txg_list_t *tl, uint64_t txg) int t = txg & TXG_MASK; txg_node_t *tn = tl->tl_head[t]; + txg_verify(tl->tl_spa, txg); return (tn == NULL ? NULL : (char *)tn - tl->tl_offset); } @@ -870,6 +894,7 @@ txg_list_next(txg_list_t *tl, void *p, uint64_t txg) int t = txg & TXG_MASK; txg_node_t *tn = (txg_node_t *)((char *)p + tl->tl_offset); + txg_verify(tl->tl_spa, txg); tn = tn->tn_next[t]; return (tn == NULL ? NULL : (char *)tn - tl->tl_offset); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jul 26 17:35:52 2017 (r321567) @@ -447,9 +447,9 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid vd->vdev_dtl[t] = range_tree_create(NULL, NULL, &vd->vdev_dtl_lock); } - txg_list_create(&vd->vdev_ms_list, + txg_list_create(&vd->vdev_ms_list, spa, offsetof(struct metaslab, ms_txg_node)); - txg_list_create(&vd->vdev_dtl_list, + txg_list_create(&vd->vdev_dtl_list, spa, offsetof(struct vdev, vdev_dtl_node)); vd->vdev_stat.vs_timestamp = gethrtime(); vdev_queue_init(vd); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Jul 26 17:35:03 2017 (r321566) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Jul 26 17:35:52 2017 (r321567) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -100,16 +100,6 @@ static kmem_cache_t *zil_lwb_cache; #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused)) - - -/* - * ziltest is by and large an ugly hack, but very useful in - * checking replay without tedious work. - * When running ziltest we want to keep all itx's and so maintain - * a single list in the zl_itxg[] that uses a high txg: ZILTEST_TXG - * We subtract TXG_CONCURRENT_STATES to allow for common code. - */ -#define ZILTEST_TXG (UINT64_MAX - TXG_CONCURRENT_STATES) static int zil_bp_compare(const void *x1, const void *x2) From owner-svn-src-all@freebsd.org Wed Jul 26 17:36:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32246DAB5CD; Wed, 26 Jul 2017 17:36:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C5376E241; Wed, 26 Jul 2017 17:36:31 +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 v6QHaVN7098910; Wed, 26 Jul 2017 17:36:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHaViP098908; Wed, 26 Jul 2017 17:36:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261736.v6QHaViP098908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321568 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:36:32 -0000 Author: mav Date: Wed Jul 26 17:36:30 2017 New Revision: 321568 URL: https://svnweb.freebsd.org/changeset/base/321568 Log: MFC r318935: MFV r318934: 8070 Add some ZFS comments illumos/illumos-gate@40713f2b249d289022c715107b3951055a63aef0 https://github.com/illumos/illumos-gate/commit/40713f2b249d289022c715107b3951055a63aef0 https://www.illumos.org/issues/8070 Add some ZFS comments left by various developers at different times Reviewed by: Yuri Pankov Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Alan Somers Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:35:52 2017 (r321567) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:36:30 2017 (r321568) @@ -1219,6 +1219,11 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) uint64_t txg = dr->dr_txg; ASSERT(MUTEX_HELD(&db->db_mtx)); + /* + * This assert is valid because dmu_sync() expects to be called by + * a zilog's get_data while holding a range lock. This call only + * comes from dbuf_dirty() callers who must also hold a range lock. + */ ASSERT(dr->dt.dl.dr_override_state != DR_IN_DMU_SYNC); ASSERT(db->db_level == 0); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jul 26 17:35:52 2017 (r321567) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jul 26 17:36:30 2017 (r321568) @@ -807,7 +807,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t return; /* - * If dsl_scan_ddt() has aready visited this block, it will have + * If dsl_scan_ddt() has already visited this block, it will have * already done any translations or scrubbing, so don't call the * callback again. */ @@ -1474,6 +1474,7 @@ dsl_scan_active(dsl_scan_t *scn) return (used != 0); } +/* Called whenever a txg syncs. */ void dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) { @@ -1892,6 +1893,7 @@ dsl_scan_scrub_cb(dsl_pool_t *dp, return (0); } +/* Called by the ZFS_IOC_POOL_SCAN ioctl to start a scrub or resilver */ int dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) { From owner-svn-src-all@freebsd.org Wed Jul 26 17:36:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 876F2DAB641; Wed, 26 Jul 2017 17:36:59 +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 5405B6E377; Wed, 26 Jul 2017 17:36:59 +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 v6QHawHp098993; Wed, 26 Jul 2017 17:36:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHawfv098992; Wed, 26 Jul 2017 17:36:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707261736.v6QHawfv098992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jul 2017 17:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321569 - stable/11/usr.sbin/crashinfo X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.sbin/crashinfo X-SVN-Commit-Revision: 321569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:36:59 -0000 Author: markj Date: Wed Jul 26 17:36:58 2017 New Revision: 321569 URL: https://svnweb.freebsd.org/changeset/base/321569 Log: MFC r321228: Allow matches of truncated version strings. Modified: stable/11/usr.sbin/crashinfo/crashinfo.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- stable/11/usr.sbin/crashinfo/crashinfo.sh Wed Jul 26 17:36:30 2017 (r321568) +++ stable/11/usr.sbin/crashinfo/crashinfo.sh Wed Jul 26 17:36:58 2017 (r321569) @@ -69,10 +69,12 @@ find_kernel() } }' $INFO) - # Look for a matching kernel version. + # Look for a matching kernel version, handling possible truncation + # of the version string recovered from the dump. for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do - kvers=$(gdb_command $k 'printf " Version String: %s", version' \ - 2>/dev/null) + kvers=$(gdb_command $k 'printf " Version String: %s", version' | \ + awk "{line=line\$0\"\n\"} END{print substr(line,1,${#ivers})}" \ + 2>/dev/null) if [ "$ivers" = "$kvers" ]; then KERNEL=$k break From owner-svn-src-all@freebsd.org Wed Jul 26 17:38:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60C22DAB736; Wed, 26 Jul 2017 17:38:30 +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 2E9E56E520; Wed, 26 Jul 2017 17:38:30 +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 v6QHcT4m099099; Wed, 26 Jul 2017 17:38:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHcT23099098; Wed, 26 Jul 2017 17:38:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261738.v6QHcT23099098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321570 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 321570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:38:30 -0000 Author: mav Date: Wed Jul 26 17:38:29 2017 New Revision: 321570 URL: https://svnweb.freebsd.org/changeset/base/321570 Log: MFC r318945: MFV r318944: 8265 Reserve send stream flag for large dnode feature illumos/illumos-gate@bc83969fdbd1cb0d97ba00218c0a3de5c89fba92 https://github.com/illumos/illumos-gate/commit/bc83969fdbd1cb0d97ba00218c0a3de5c 89fba92 https://www.illumos.org/issues/8265 Reserve bit 23 in the zfs send stream flags for the large dnode feature which has been implemented for Linux. Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Brian Behlendorf Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Jul 26 17:36:58 2017 (r321569) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Jul 26 17:38:29 2017 (r321570) @@ -93,6 +93,7 @@ typedef enum drr_headertype { #define DMU_BACKUP_FEATURE_RESUMING (1 << 20) /* flag #21 is reserved for a Delphix feature */ #define DMU_BACKUP_FEATURE_COMPRESSED (1 << 22) +/* flag #23 is reserved for the large dnode feature */ /* * Mask of all supported backup features From owner-svn-src-all@freebsd.org Wed Jul 26 17:39:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D9F7DAB7BF; Wed, 26 Jul 2017 17:39:12 +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 DB6536E652; Wed, 26 Jul 2017 17:39:11 +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 v6QHdBYp099181; Wed, 26 Jul 2017 17:39:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHdBJ3099180; Wed, 26 Jul 2017 17:39:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201707261739.v6QHdBJ3099180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Jul 2017 17:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321571 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 321571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:39:12 -0000 Author: andrew Date: Wed Jul 26 17:39:10 2017 New Revision: 321571 URL: https://svnweb.freebsd.org/changeset/base/321571 Log: Pass the last exception trap frame to kdb_trap. This allows show registers in ddb to show the traps registers, and not the registers from within the panic call. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Jul 26 17:38:29 2017 (r321570) +++ head/sys/arm64/arm64/trap.c Wed Jul 26 17:39:10 2017 (r321571) @@ -265,6 +265,7 @@ print_registers(struct trapframe *frame) void do_el1h_sync(struct thread *td, struct trapframe *frame) { + struct trapframe *oframe; uint32_t exception; uint64_t esr, far; @@ -281,6 +282,18 @@ do_el1h_sync(struct thread *td, struct trapframe *fram "do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, frame->tf_elr, frame); + oframe = td->td_frame; + + switch (exception) { + case EXCP_BRK: + case EXCP_WATCHPT_EL1: + case EXCP_SOFTSTP_EL1: + break; + default: + td->td_frame = frame; + break; + } + switch(exception) { case EXCP_FP_SIMD: case EXCP_TRAP_FP: @@ -313,7 +326,8 @@ do_el1h_sync(struct thread *td, struct trapframe *fram case EXCP_WATCHPT_EL1: case EXCP_SOFTSTP_EL1: #ifdef KDB - kdb_trap(exception, 0, frame); + kdb_trap(exception, 0, + (td->td_frame != NULL) ? td->td_frame : frame); #else panic("No debugger in kernel.\n"); #endif @@ -323,6 +337,8 @@ do_el1h_sync(struct thread *td, struct trapframe *fram panic("Unknown kernel exception %x esr_el1 %lx\n", exception, esr); } + + td->td_frame = oframe; } /* From owner-svn-src-all@freebsd.org Wed Jul 26 17:40:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4877EDAB877; Wed, 26 Jul 2017 17:40:15 +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 160876E7F1; Wed, 26 Jul 2017 17:40:15 +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 v6QHeEGC099294; Wed, 26 Jul 2017 17:40:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHeErd099293; Wed, 26 Jul 2017 17:40:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261740.v6QHeErd099293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321572 - stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 321572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:40:15 -0000 Author: mav Date: Wed Jul 26 17:40:13 2017 New Revision: 321572 URL: https://svnweb.freebsd.org/changeset/base/321572 Log: MFC r319672 (by allanjude): New sentences start on new lines, fix two violations Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jul 26 17:39:10 2017 (r321571) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jul 26 17:40:13 2017 (r321572) @@ -48,13 +48,15 @@ to send file systems between pools. Since most features can be enabled independently of each other the on\-disk format of the pool is specified by the set of all features marked as .Sy active -on the pool. If the pool was created by another software version this set may +on the pool. +If the pool was created by another software version this set may include unsupported features. .Ss Identifying features Every feature has a guid of the form .Sy com.example:feature_name . The reverse DNS name ensures that the feature's guid is unique across all ZFS -implementations. When unsupported features are encountered on a pool they will +implementations. +When unsupported features are encountered on a pool they will be identified by their guids. Refer to the documentation for the ZFS implementation that created the pool for information about those features. @@ -283,7 +285,8 @@ configuration. .El .Pp This features allows ZFS to maintain more information about how free space -is organized within the pool. If this feature is +is organized within the pool. +If this feature is .Sy enabled , ZFS will set this feature to @@ -337,7 +340,8 @@ All bookmarks in the pool can be listed by running .El .Pp Once this feature is enabled ZFS records the transaction group number -in which new features are enabled. This has no user-visible impact, +in which new features are enabled. +This has no user-visible impact, but other features may depend on this feature. .Pp This feature becomes From owner-svn-src-all@freebsd.org Wed Jul 26 17:42:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C6AEDABAB5; Wed, 26 Jul 2017 17:42:45 +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 5631E6EBCF; Wed, 26 Jul 2017 17:42:45 +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 v6QHgiwH003066; Wed, 26 Jul 2017 17:42:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHgiKU003061; Wed, 26 Jul 2017 17:42:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261742.v6QHgiKU003061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321573 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:42:45 -0000 Author: mav Date: Wed Jul 26 17:42:43 2017 New Revision: 321573 URL: https://svnweb.freebsd.org/changeset/base/321573 Log: MFC r319748: MFV r319738: 8155 simplify dmu_write_policy handling of pre-compressed buffers illumos/illumos-gate@adaec86ad212d9fd756bee322934fa54d1258605 https://github.com/illumos/illumos-gate/commit/adaec86ad212d9fd756bee322934fa54d1258605 https://www.illumos.org/issues/8155 When writing pre-compressed buffers, arc_write() requires that the compression algorithm used to compress the buffer matches the compression algorithm requested by the zio_prop_t, which is set by dmu_write_policy(). This makes dmu_write_policy() and its callers a bit more complicated. We can simplify this by making arc_write() trust the caller to supply the type of pre-compressed buffer that it wants to write, and override the compression setting in the zio_prop_t. Reviewed by: Dan Kimmel Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 17:40:13 2017 (r321572) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 26 17:42:43 2017 (r321573) @@ -5937,6 +5937,7 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; zio_t *zio; + zio_prop_t localprop = *zp; ASSERT3P(ready, !=, NULL); ASSERT3P(done, !=, NULL); @@ -5947,7 +5948,13 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr if (l2arc) arc_hdr_set_flags(hdr, ARC_FLAG_L2CACHE); if (ARC_BUF_COMPRESSED(buf)) { - ASSERT3U(zp->zp_compress, !=, ZIO_COMPRESS_OFF); + /* + * We're writing a pre-compressed buffer. Make the + * compression algorithm requested by the zio_prop_t match + * the pre-compressed buffer's compression algorithm. + */ + localprop.zp_compress = HDR_GET_COMPRESS(hdr); + ASSERT3U(HDR_GET_LSIZE(hdr), !=, arc_buf_size(buf)); zio_flags |= ZIO_FLAG_RAW; } @@ -5982,7 +5989,7 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr ASSERT3P(hdr->b_l1hdr.b_pdata, ==, NULL); zio = zio_write(pio, spa, txg, bp, buf->b_data, - HDR_GET_LSIZE(hdr), arc_buf_size(buf), zp, arc_write_ready, + HDR_GET_LSIZE(hdr), arc_buf_size(buf), &localprop, arc_write_ready, (children_ready != NULL) ? arc_write_children_ready : NULL, arc_write_physdone, arc_write_done, callback, priority, zio_flags, zb); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:40:13 2017 (r321572) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:42:43 2017 (r321573) @@ -3536,9 +3536,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, d wp_flag = WP_SPILL; wp_flag |= (db->db_state == DB_NOFILL) ? WP_NOFILL : 0; - dmu_write_policy(os, dn, db->db_level, wp_flag, - (data != NULL && arc_get_compression(data) != ZIO_COMPRESS_OFF) ? - arc_get_compression(data) : ZIO_COMPRESS_INHERIT, &zp); + dmu_write_policy(os, dn, db->db_level, wp_flag, &zp); DB_DNODE_EXIT(db); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 17:40:13 2017 (r321572) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 26 17:42:43 2017 (r321573) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -1794,8 +1794,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done DB_DNODE_ENTER(db); dn = DB_DNODE(db); - dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC, - ZIO_COMPRESS_INHERIT, &zp); + dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC, &zp); DB_DNODE_EXIT(db); /* @@ -1967,8 +1966,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG int zfs_redundant_metadata_most_ditto_level = 2; void -dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, - enum zio_compress override_compress, zio_prop_t *zp) +dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) { dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET; boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) || @@ -1980,11 +1978,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, boolean_t nopwrite = B_FALSE; boolean_t dedup_verify = os->os_dedup_verify; int copies = os->os_copies; - boolean_t lz4_ac = spa_feature_is_active(os->os_spa, - SPA_FEATURE_LZ4_COMPRESS); - IMPLY(override_compress == ZIO_COMPRESS_LZ4, lz4_ac); - /* * We maintain different write policies for each of the following * types of data: @@ -2071,14 +2065,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, } zp->zp_checksum = checksum; - - /* - * If we're writing a pre-compressed buffer, the compression type we use - * must match the data. If it hasn't been compressed yet, then we should - * use the value dictated by the policies above. - */ - zp->zp_compress = override_compress != ZIO_COMPRESS_INHERIT - ? override_compress : compress; + zp->zp_compress = compress; ASSERT3U(zp->zp_compress, !=, ZIO_COMPRESS_INHERIT); zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 17:40:13 2017 (r321572) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Jul 26 17:42:43 2017 (r321573) @@ -1201,7 +1201,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); arc_release(os->os_phys_buf, &os->os_phys_buf); - dmu_write_policy(os, NULL, 0, 0, ZIO_COMPRESS_INHERIT, &zp); + dmu_write_policy(os, NULL, 0, 0, &zp); zio = arc_write(pio, os->os_spa, tx->tx_txg, blkptr_copy, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 17:40:13 2017 (r321572) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 26 17:42:43 2017 (r321573) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. @@ -422,7 +422,7 @@ dmu_write_embedded(objset_t *os, uint64_t object, uint #define WP_SPILL 0x4 void dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, - enum zio_compress compress_override, struct zio_prop *zp); + struct zio_prop *zp); /* * The bonus data is accessed more or less like a regular buffer. * You must dmu_bonus_hold() to get the buffer, which will give you a From owner-svn-src-all@freebsd.org Wed Jul 26 17:44:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CB47DABB57; Wed, 26 Jul 2017 17:44:23 +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 499496ED65; Wed, 26 Jul 2017 17:44:23 +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 v6QHiMZi003191; Wed, 26 Jul 2017 17:44:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHiMVE003190; Wed, 26 Jul 2017 17:44:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261744.v6QHiMVE003190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321574 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:44:23 -0000 Author: mav Date: Wed Jul 26 17:44:22 2017 New Revision: 321574 URL: https://svnweb.freebsd.org/changeset/base/321574 Log: MFC r319749: MFV r319739: 8005 poor performance of 1MB writes on certain RAID-Z configuration s illumos/illumos-gate@5b062782532a1d5961c4a4b655906e1238c7c908 https://github.com/illumos/illumos-gate/commit/5b062782532a1d5961c4a4b655906e123 8c7c908 https://www.illumos.org/issues/8005 RAID-Z requires that space be allocated in multiples of P+1 sectors, because this is the minimum size block that can have the required amount of parity. Thus blocks on RAIDZ1 must be allocated in a multiple of 2 sectors; on RAIDZ2 multiple of 3; and on RAIDZ3 multiple of 4. A sector is a unit of 2^ashift bytes, typically 512B or 4KB. To satisfy this constraint, the allocation size is rounded up to the proper multiple, resulting in up to 3 "pad sectors" at the end of some blocks. The contents of these pad sectors are not used, so we do not need to read or write these sectors. However, some storage hardware performs much worse (around 1/2 as fast) on mostly-contiguous writes when there are small gaps of non-overwritten data between the writes. Therefore, ZFS creates "optional" zio's when writing RAID-Z blocks that include pad sectors. If writing a pad sector will fill the gap between two (required) writes, we will issue the optional zio, thus doubling performance. The gap-filling performance improvement was introduced in July 2009. Writing the optional zio is done by the io aggregation code in vdev_queue.c. The problem is that it is also subject to the limit on the size of aggregate writes, zfs_vdev_aggregation_limit, which is by default 128KB. For a given block, if the amount of data plus padding written to a leaf device exceeds zfs_vdev_aggregation_limit, the optional zio will not be written, resulting in a ~2x performance degradation. The problem occurs only for certain values of ashift, compressed block size, and RAID-Z configuration (number of parity and data disks). It cannot occur with the default recordsize=128KB. If compression is enabled, all configurations with recordsize=1MB or larger will be impacted to some degree. The problem notably occurs with recordsize=1MB, compression=off, with 10 disks in a RAIDZ2 or RAIDZ3 group (with 512B or 4KB sectors). Therefore Reviewed by: Saso Kiselkov Reviewed by: George Wilson Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Wed Jul 26 17:42:43 2017 (r321573) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Wed Jul 26 17:44:22 2017 (r321574) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -681,7 +681,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) /* * Walk backwards through sufficiently contiguous I/Os - * recording the last non-option I/O. + * recording the last non-optional I/O. */ flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT; t = vdev_queue_type_tree(vq, zio->io_type); @@ -704,10 +704,14 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) /* * Walk forward through sufficiently contiguous I/Os. + * The aggregation limit does not apply to optional i/os, so that + * we can issue contiguous writes even if they are larger than the + * aggregation limit. */ while ((dio = AVL_NEXT(t, last)) != NULL && (dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags && - IO_SPAN(first, dio) <= zfs_vdev_aggregation_limit && + (IO_SPAN(first, dio) <= zfs_vdev_aggregation_limit || + (dio->io_flags & ZIO_FLAG_OPTIONAL)) && IO_GAP(last, dio) <= maxgap) { last = dio; if (!(last->io_flags & ZIO_FLAG_OPTIONAL)) @@ -739,10 +743,16 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) } if (stretch) { - /* This may be a no-op. */ + /* + * We are going to include an optional io in our aggregated + * span, thus closing the write gap. Only mandatory i/os can + * start aggregated spans, so make sure that the next i/o + * after our span is mandatory. + */ dio = AVL_NEXT(t, last); dio->io_flags &= ~ZIO_FLAG_OPTIONAL; } else { + /* do not include the optional i/o */ while (last != mandatory && last != first) { ASSERT(last->io_flags & ZIO_FLAG_OPTIONAL); last = AVL_PREV(t, last); @@ -754,7 +764,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) return (NULL); size = IO_SPAN(first, last); - ASSERT3U(size, <=, zfs_vdev_aggregation_limit); + ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); abuf = zio_buf_alloc_nowait(size); if (abuf == NULL) From owner-svn-src-all@freebsd.org Wed Jul 26 17:45:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4623DABBF8; Wed, 26 Jul 2017 17:45:10 +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 A066D6EEB1; Wed, 26 Jul 2017 17:45:10 +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 v6QHj9Br003282; Wed, 26 Jul 2017 17:45:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHj9sA003281; Wed, 26 Jul 2017 17:45:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261745.v6QHj9sA003281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321575 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:45:10 -0000 Author: mav Date: Wed Jul 26 17:45:09 2017 New Revision: 321575 URL: https://svnweb.freebsd.org/changeset/base/321575 Log: MFC r319750: MFV r319741: 8156 dbuf_evict_notify() does not need dbuf_evict_lock illumos/illumos-gate@dbfd9f930004c390a2ce2cf850c71b4f880eef9c https://github.com/illumos/illumos-gate/commit/dbfd9f930004c390a2ce2cf850c71b4f880eef9c https://www.illumos.org/issues/8156 dbuf_evict_notify() holds the dbuf_evict_lock while checking if it should do the eviction itself (because the evict thread is not able to keep up). This can result in massive lock contention. It isn't necessary to hold the lock, because if we make the wrong choice occasionally, nothing bad will happen. Reviewed by: Dan Kimmel Reviewed by: Paul Dagnelie Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:44:22 2017 (r321574) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jul 26 17:45:09 2017 (r321575) @@ -560,19 +560,15 @@ dbuf_evict_notify(void) if (tsd_get(zfs_dbuf_evict_key) != NULL) return; + /* + * We check if we should evict without holding the dbuf_evict_lock, + * because it's OK to occasionally make the wrong decision here, + * and grabbing the lock results in massive lock contention. + */ if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) { - boolean_t evict_now = B_FALSE; - - mutex_enter(&dbuf_evict_lock); - if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) { - evict_now = dbuf_cache_above_hiwater(); - cv_signal(&dbuf_evict_cv); - } - mutex_exit(&dbuf_evict_lock); - - if (evict_now) { + if (dbuf_cache_above_hiwater()) dbuf_evict_one(); - } + cv_signal(&dbuf_evict_cv); } } From owner-svn-src-all@freebsd.org Wed Jul 26 17:46:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F8D3DABC70; Wed, 26 Jul 2017 17:46:07 +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 467F36EFF3; Wed, 26 Jul 2017 17:46:07 +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 v6QHk61h003373; Wed, 26 Jul 2017 17:46:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHk6vQ003372; Wed, 26 Jul 2017 17:46:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261746.v6QHk6vQ003372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321576 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 321576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:46:07 -0000 Author: mav Date: Wed Jul 26 17:46:06 2017 New Revision: 321576 URL: https://svnweb.freebsd.org/changeset/base/321576 Log: MFC r319751: MFV r319740: 8168 NULL pointer dereference in zfs_create() illumos/illumos-gate@690031d326342fa4ea28b5e80f1ad6a16281519d https://github.com/illumos/illumos-gate/commit/690031d326342fa4ea28b5e80f1ad6a16281519d https://www.illumos.org/issues/8168 If we manage to export the pool on which we are creating a dataset (filesystem or zvol) between entering libzfs`zfs_create() and libzfs`zpool_open() call (for which we never check the return value) we end up dereferencing a NULL pointer in libzfs`zpool_close(). This was discovered on ZFS on Linux. The same issue can be reproduced on Illumos running in parallel: while :; do zpool import -d /tmp testpool ; zpool export testpool ; done while :; do zfs create testpool/fs; zfs destroy testpool/fs ; done Eventually this will result in several core dumps like this one: [root@52-54-00-d3-7a-01 /cores]# mdb core.zfs.4244 Loading modules: [ libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 ld.so.1 ] > ::stack libzfs.so.1`zpool_close+0x17(0, 0, 0, 8047450) libzfs.so.1`zfs_create+0x1bb(8090548, 8047e6f, 1, 808cba8) zfs_do_create+0x545(2, 8047d74, 80778a0, 801, 0, 3) main+0x22c(8047d2c, fef5c6e8, 8047d64, 8055a17, 3, 8047d70) _start+0x83(3, 8047e64, 8047e68, 8047e6f, 0, 8047e7b) > Fix and reproducer (systemtap): https://github.com/zfsonlinux/zfs/pull/6096 Reviewed by: Matt Ahrens Approved by: Robert Mustacchi Author: loli10K Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 17:45:09 2017 (r321575) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 17:46:06 2017 (r321576) @@ -3316,6 +3316,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs char errbuf[1024]; uint64_t zoned; enum lzc_dataset_type ost; + zpool_handle_t *zpool_handle; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot create '%s'"), path); @@ -3355,7 +3356,8 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs if (p != NULL) *p = '\0'; - zpool_handle_t *zpool_handle = zpool_open(hdl, pool_path); + if ((zpool_handle = zpool_open(hdl, pool_path)) == NULL) + return (-1); if (props && (props = zfs_valid_proplist(hdl, type, props, zoned, NULL, zpool_handle, errbuf)) == 0) { From owner-svn-src-all@freebsd.org Wed Jul 26 17:47:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7163DABD40; Wed, 26 Jul 2017 17:47:33 +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 90F0E6F21C; Wed, 26 Jul 2017 17:47:33 +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 v6QHlW8k003476; Wed, 26 Jul 2017 17:47:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHlWXg003472; Wed, 26 Jul 2017 17:47:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261747.v6QHlWXg003472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321577 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:47:33 -0000 Author: mav Date: Wed Jul 26 17:47:32 2017 New Revision: 321577 URL: https://svnweb.freebsd.org/changeset/base/321577 Log: MFC r319947: MFV r319945,r319946: 8264 want support for promoting datasets in libzfs_core illumos/illumos-gate@a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://github.com/illumos/illumos-gate/commit/a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://www.illumos.org/issues/8264 Oddly there is a lzc_clone function, but no lzc_promote function. Reviewed by: Andriy Gapon Reviewed by: Matthew Ahrens Reviewed by: Dan McDonald Approved by: Dan McDonald Author: Andrew Stormont Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 17:46:06 2017 (r321576) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Jul 26 17:47:32 2017 (r321577) @@ -30,6 +30,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 RackTop Systems. */ #include @@ -3675,8 +3676,7 @@ int zfs_promote(zfs_handle_t *zhp) { libzfs_handle_t *hdl = zhp->zfs_hdl; - zfs_cmd_t zc = { 0 }; - char parent[MAXPATHLEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; int ret; char errbuf[1024]; @@ -3689,31 +3689,25 @@ zfs_promote(zfs_handle_t *zhp) return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } - (void) strlcpy(parent, zhp->zfs_dmustats.dds_origin, sizeof (parent)); - if (parent[0] == '\0') { + if (zhp->zfs_dmustats.dds_origin[0] == '\0') { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "not a cloned filesystem")); return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } - (void) strlcpy(zc.zc_value, zhp->zfs_dmustats.dds_origin, - sizeof (zc.zc_value)); - (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); - ret = zfs_ioctl(hdl, ZFS_IOC_PROMOTE, &zc); + ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname)); if (ret != 0) { - int save_errno = errno; - - switch (save_errno) { + switch (ret) { case EEXIST: /* There is a conflicting snapshot name. */ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "conflicting snapshot '%s' from parent '%s'"), - zc.zc_string, parent); + snapname, zhp->zfs_dmustats.dds_origin); return (zfs_error(hdl, EZFS_EXISTS, errbuf)); default: - return (zfs_standard_error(hdl, save_errno, errbuf)); + return (zfs_standard_error(hdl, ret, errbuf)); } } return (ret); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 17:46:06 2017 (r321576) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Jul 26 17:47:32 2017 (r321577) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ /* @@ -244,6 +245,28 @@ lzc_clone(const char *fsname, const char *origin, return (error); } +int +lzc_promote(const char *fsname, char *snapnamebuf, int snapnamelen) +{ + /* + * The promote ioctl is still legacy, so we need to construct our + * own zfs_cmd_t rather than using lzc_ioctl(). + */ + zfs_cmd_t zc = { 0 }; + + ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); + + (void) strlcpy(zc.zc_name, fsname, sizeof (zc.zc_name)); + if (ioctl(g_fd, ZFS_IOC_PROMOTE, &zc) != 0) { + int error = errno; + if (error == EEXIST && snapnamebuf != NULL) + (void) strlcpy(snapnamebuf, zc.zc_string, snapnamelen); + return (error); + } + return (0); +} + /* * Creates snapshots. * @@ -371,7 +394,7 @@ lzc_exists(const char *dataset) { /* * The objset_stats ioctl is still legacy, so we need to construct our - * own zfs_cmd_t rather than using zfsc_ioctl(). + * own zfs_cmd_t rather than using lzc_ioctl(). */ zfs_cmd_t zc = { 0 }; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Wed Jul 26 17:46:06 2017 (r321576) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Wed Jul 26 17:47:32 2017 (r321577) @@ -22,6 +22,7 @@ /* * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Martin Matuska . All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _LIBZFS_CORE_H @@ -49,6 +50,7 @@ enum lzc_dataset_type { int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **); int lzc_create(const char *, enum lzc_dataset_type, nvlist_t *); int lzc_clone(const char *, const char *, nvlist_t *); +int lzc_promote(const char *, char *, int); int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **); int lzc_bookmark(nvlist_t *, nvlist_t **); int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jul 26 17:46:06 2017 (r321576) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jul 26 17:47:32 2017 (r321577) @@ -31,6 +31,7 @@ * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ /* @@ -4893,7 +4894,6 @@ zfs_ioc_pool_reopen(zfs_cmd_t *zc) /* * inputs: * zc_name name of filesystem - * zc_value name of origin snapshot * * outputs: * zc_string name of conflicting snapshot, if there is one @@ -4901,16 +4901,49 @@ zfs_ioc_pool_reopen(zfs_cmd_t *zc) static int zfs_ioc_promote(zfs_cmd_t *zc) { + dsl_pool_t *dp; + dsl_dataset_t *ds, *ods; + char origin[ZFS_MAX_DATASET_NAME_LEN]; char *cp; + int error; + error = dsl_pool_hold(zc->zc_name, FTAG, &dp); + if (error != 0) + return (error); + + error = dsl_dataset_hold(dp, zc->zc_name, FTAG, &ds); + if (error != 0) { + dsl_pool_rele(dp, FTAG); + return (error); + } + + if (!dsl_dir_is_clone(ds->ds_dir)) { + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + return (SET_ERROR(EINVAL)); + } + + error = dsl_dataset_hold_obj(dp, + dsl_dir_phys(ds->ds_dir)->dd_origin_obj, FTAG, &ods); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + return (error); + } + + dsl_dataset_name(ods, origin); + dsl_dataset_rele(ods, FTAG); + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + /* * We don't need to unmount *all* the origin fs's snapshots, but * it's easier. */ - cp = strchr(zc->zc_value, '@'); + cp = strchr(origin, '@'); if (cp) *cp = '\0'; - (void) dmu_objset_find(zc->zc_value, + (void) dmu_objset_find(origin, zfs_unmount_snap_cb, NULL, DS_FIND_SNAPSHOTS); return (dsl_dataset_promote(zc->zc_name, zc->zc_string)); } From owner-svn-src-all@freebsd.org Wed Jul 26 17:48:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9896DABDD2; Wed, 26 Jul 2017 17:48:38 +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 B36976F35F; Wed, 26 Jul 2017 17:48:38 +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 v6QHmbXj003575; Wed, 26 Jul 2017 17:48:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QHmbk0003569; Wed, 26 Jul 2017 17:48:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261748.v6QHmbk0003569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 17:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321578 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 17:48:39 -0000 Author: mav Date: Wed Jul 26 17:48:37 2017 New Revision: 321578 URL: https://svnweb.freebsd.org/changeset/base/321578 Log: MFC r319949: MFV r319948: 5428 provide fts(), reallocarray(), and strtonum() illumos/illumos-gate@4585130b259133a26efae68275dbe56b08366deb https://github.com/illumos/illumos-gate/commit/4585130b259133a26efae68275dbe56b08366deb https://www.illumos.org/issues/5428 Most of the upstream change is not applicable to FreeBSD. Only the renaming of strtonum to zfs_strtonum is relevant to us. And we already had it partially done. Reviewed by: Robert Mustacchi Approved by: Joshua M. Clulow Author: Yuri Pankov Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c Wed Jul 26 17:48:37 2017 (r321578) @@ -85,7 +85,7 @@ dsl_deadlist_load_tree(dsl_deadlist_t *dl) zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { dsl_deadlist_entry_t *dle = kmem_alloc(sizeof (*dle), KM_SLEEP); - dle->dle_mintxg = strtonum(za.za_name, NULL); + dle->dle_mintxg = zfs_strtonum(za.za_name, NULL); VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, za.za_first_integer)); avl_add(&dl->dl_tree, dle); @@ -490,7 +490,7 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, d for (zap_cursor_init(&zc, dl->dl_os, obj); zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { - uint64_t mintxg = strtonum(za.za_name, NULL); + uint64_t mintxg = zfs_strtonum(za.za_name, NULL); dsl_deadlist_insert_bpobj(dl, za.za_first_integer, mintxg, tx); VERIFY3U(0, ==, zap_remove_int(dl->dl_os, obj, mintxg, tx)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jul 26 17:48:37 2017 (r321578) @@ -1389,7 +1389,7 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx) dsl_dataset_t *ds; uint64_t dsobj; - dsobj = strtonum(za.za_name, NULL); + dsobj = zfs_strtonum(za.za_name, NULL); VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, dsobj, tx)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Wed Jul 26 17:48:37 2017 (r321578) @@ -340,7 +340,7 @@ static int dsl_dataset_hold_obj_string(dsl_pool_t *dp, const char *dsobj, void *tag, dsl_dataset_t **dsp) { - return (dsl_dataset_hold_obj(dp, strtonum(dsobj, NULL), tag, dsp)); + return (dsl_dataset_hold_obj(dp, zfs_strtonum(dsobj, NULL), tag, dsp)); } static int Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c Wed Jul 26 17:48:37 2017 (r321578) @@ -73,13 +73,13 @@ bookmark_to_name(zbookmark_phys_t *zb, char *buf, size static void name_to_bookmark(char *buf, zbookmark_phys_t *zb) { - zb->zb_objset = strtonum(buf, &buf); + zb->zb_objset = zfs_strtonum(buf, &buf); ASSERT(*buf == ':'); - zb->zb_object = strtonum(buf + 1, &buf); + zb->zb_object = zfs_strtonum(buf + 1, &buf); ASSERT(*buf == ':'); - zb->zb_level = (int)strtonum(buf + 1, &buf); + zb->zb_level = (int)zfs_strtonum(buf + 1, &buf); ASSERT(*buf == ':'); - zb->zb_blkid = strtonum(buf + 1, &buf); + zb->zb_blkid = zfs_strtonum(buf + 1, &buf); ASSERT(*buf == '\0'); } #endif Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Jul 26 17:48:37 2017 (r321578) @@ -848,7 +848,6 @@ extern void zfs_blkptr_verify(spa_t *spa, const blkptr extern int spa_mode(spa_t *spa); extern uint64_t zfs_strtonum(const char *str, char **nptr); -#define strtonum(str, nptr) zfs_strtonum((str), (nptr)) extern char *spa_his_ievent_table[]; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Jul 26 17:47:32 2017 (r321577) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Jul 26 17:48:37 2017 (r321578) @@ -630,7 +630,7 @@ fuidstr_to_sid(zfsvfs_t *zfsvfs, const char *fuidstr, uint64_t fuid; const char *domain; - fuid = strtonum(fuidstr, NULL); + fuid = zfs_strtonum(fuidstr, NULL); domain = zfs_fuid_find_by_idx(zfsvfs, FUID_INDEX(fuid)); if (domain) From owner-svn-src-all@freebsd.org Wed Jul 26 18:24:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B95C8DAD470 for ; Wed, 26 Jul 2017 18:24:23 +0000 (UTC) (envelope-from annie@editorialpr.co.uk) Received: from hpqp.05.momoney.info (hpqp.05.momoney.info [91.134.179.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6020A71B57 for ; Wed, 26 Jul 2017 18:24:22 +0000 (UTC) (envelope-from annie@editorialpr.co.uk) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; s=default; d=editorialpr.co.uk; h=Message-Id:Mime-Version:From:To:Subject:Date:Content-Type:Content-Transfer-Encoding; i=annie@editorialpr.co.uk; bh=5DidAvEczpLi5ZcPpROBjCpn4kTBdF9pe8wt6euSqlI=; b=d3h1Vy/YBu/gL6bVNPuxUvD9aSEUxumQ/VCbht6s+egCXqRr2duAX3T1iKmEBjDV7v+T65iVJAVq ss+OmLgSeMbI15LRqNhPsQF3BxH/Y2UOZ9IElyTtuXzN++ahZeclxSrHEqAOC2/ZvmN/q0HcN9iP Z5gXRMZlo+i3iyh9n7E= Message-Id: Mime-Version: 1.0 From: Annie Mai To: "," Subject: Advertising Opportunities Date: Wed, 26 Jul 2017 18:54:12 +0100 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 18:24:23 -0000 Hello I hope you don't mind me emailing you=2E My name is Annie and I am the Edi= torial lead at EditorialPR=2Ecom in the UK=2E We have a client at the momen= t that's interested in being featured on your website=2E Do you have any editorial advertising opportunities on the site that we cou= ld work together on?=20 Please note; I am on a tight deadline for July and need to get my placement= s for the month agreed as soon as possible=2E So if you are interested plea= se get back to me as soon as possible so I can supply you with the full det= ails of the project=2E Also if you have more than one site, it would be gr= eat if you let me know so we can see if it's suitable for any of our other = campaigns=2E Many thanks Annie Mai Annie Mai Editorial Lead Editorialpr=2Ecom This e-mail message (and its attachments) may contain confidential, proprie= tary or legally privileged information and is intended only for the individ= ual named addressee=2E You should not review, disseminate, distribute or co= py this e-mail=2E Please notify the sender immediately by e-mail if you hav= e received this e-mail by mistake and delete this e-mail from your system= =2E E-mail transmissions cannot be guaranteed to be secure or error-free as= information could be intercepted, corrupted, lost, destroyed, arrive late,= incomplete or contain viruses=2E The sender, therefore, does not accept li= ability for any errors or omissions in the contents of the message=2E From owner-svn-src-all@freebsd.org Wed Jul 26 19:01:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B17FDADE1E; Wed, 26 Jul 2017 19:01:16 +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 6522072E4D; Wed, 26 Jul 2017 19:01:16 +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 v6QJ1Fn4035599; Wed, 26 Jul 2017 19:01:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QJ1FcN035597; Wed, 26 Jul 2017 19:01:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707261901.v6QJ1FcN035597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jul 2017 19:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321579 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 19:01:16 -0000 Author: mav Date: Wed Jul 26 19:01:15 2017 New Revision: 321579 URL: https://svnweb.freebsd.org/changeset/base/321579 Log: MFC r319953: MFV r319951: 8311 ZFS_READONLY is a little too strict illumos/illumos-gate@2889ec41c05e9ffe1890b529b3111354da325aeb https://github.com/illumos/illumos-gate/commit/2889ec41c05e9ffe1890b529b3111354d a325aeb https://www.illumos.org/issues/8311 Description: There was a misunderstanding about the enforcement details of the "Read-only" flag introduced for SMB/CIFS compatibility, way back in 2007 in the Sun PSARC 2007/315 case. The original authors thought enforcement of the READONLY flag should work similarly as the IMMUTABLE flag. Unfortunately, that enforcement is incompatible with the expectations of Windows applications using this feature through the SMB service. Applications assume (and the MS File System Algorithm s MS-FSA confirms they should) that an SMB client can: (a) Open an SMB handle on a file with read/write access, (b) Set the DOS attributes to include the READONLY flag, (c) continue to have write access via that handle. This access model is essentially the same as a Unix/POSIX application that creates a file (with read/write access), uses fchmod() to change the file mode to something not granting write access (i.e. 0444), and then continues to writ e that file using the open handle it got before the mode change. Currently, the SMB server works-around this problem in a way that will become difficult to maintain as we implement support for SMB3 persistent handles, so SMB depends on this fix. I've written a test program that can be used to demonstrate this problem, and added it to zfs-tests (tests/functional/acl/cifs/cifs_attr_004_pos). It currently fails, but will pass when this problem fixed. Steps to Reproduce: Run the test program on a ZFS file system. Expected Results: Pass Actual Results: Fail. Reviewed by: Sanjay Nadkarni Reviewed by: Yuri Pankov Reviewed by: Andrew Stormont Reviewed by: Matt Ahrens Reviewed by: John Kennedy Approved by: Prakash Surya Author: Gordon Ross Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Jul 26 17:48:37 2017 (r321578) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Jul 26 19:01:15 2017 (r321579) @@ -20,8 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ #include @@ -2017,13 +2017,11 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mod } /* - * Only check for READONLY on non-directories. + * Intentionally allow ZFS_READONLY through here. + * See zfs_zaccess_common(). */ if ((v4_mode & WRITE_MASK_DATA) && - (((ZTOV(zp)->v_type != VDIR) && - (zp->z_pflags & (ZFS_READONLY | ZFS_IMMUTABLE))) || - (ZTOV(zp)->v_type == VDIR && - (zp->z_pflags & ZFS_IMMUTABLE)))) { + (zp->z_pflags & ZFS_IMMUTABLE)) { return (SET_ERROR(EPERM)); } @@ -2246,6 +2244,24 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint if (skipaclchk) { *working_mode = 0; return (0); + } + + /* + * Note: ZFS_READONLY represents the "DOS R/O" attribute. + * When that flag is set, we should behave as if write access + * were not granted by anything in the ACL. In particular: + * We _must_ allow writes after opening the file r/w, then + * setting the DOS R/O attribute, and writing some more. + * (Similar to how you can write after fchmod(fd, 0444).) + * + * Therefore ZFS_READONLY is ignored in the dataset check + * above, and checked here as if part of the ACL check. + * Also note: DOS R/O is ignored for directories. + */ + if ((v4_mode & WRITE_MASK_DATA) && + (ZTOV(zp)->v_type != VDIR) && + (zp->z_pflags & ZFS_READONLY)) { + return (SET_ERROR(EPERM)); } return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 17:48:37 2017 (r321578) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 26 19:01:15 2017 (r321579) @@ -904,9 +904,11 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t } /* - * If immutable or not appending then return EPERM + * If immutable or not appending then return EPERM. + * Intentionally allow ZFS_READONLY through here. + * See zfs_zaccess_common() */ - if ((zp->z_pflags & (ZFS_IMMUTABLE | ZFS_READONLY)) || + if ((zp->z_pflags & ZFS_IMMUTABLE) || ((zp->z_pflags & ZFS_APPENDONLY) && !(ioflag & FAPPEND) && (uio->uio_loffset < zp->z_size))) { ZFS_EXIT(zfsvfs); @@ -2945,10 +2947,9 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred return (SET_ERROR(EPERM)); } - if ((mask & AT_SIZE) && (zp->z_pflags & ZFS_READONLY)) { - ZFS_EXIT(zfsvfs); - return (SET_ERROR(EPERM)); - } + /* + * Note: ZFS_READONLY is handled in zfs_zaccess_common. + */ /* * Verify timestamps doesn't overflow 32 bits. From owner-svn-src-all@freebsd.org Wed Jul 26 20:01:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE170DAF199; Wed, 26 Jul 2017 20:01:32 +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 BB38E74B07; Wed, 26 Jul 2017 20:01:32 +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 v6QK1VJX062070; Wed, 26 Jul 2017 20:01:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QK1VOI062069; Wed, 26 Jul 2017 20:01:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707262001.v6QK1VOI062069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jul 2017 20:01:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321580 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 321580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 20:01:33 -0000 Author: kib Date: Wed Jul 26 20:01:31 2017 New Revision: 321580 URL: https://svnweb.freebsd.org/changeset/base/321580 Log: Move rtvals initialization out of the region protected by NFS node lock. Noted by: alc Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D11697 Modified: head/sys/fs/nfsclient/nfs_clbio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed Jul 26 19:01:15 2017 (r321579) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed Jul 26 20:01:31 2017 (r321580) @@ -306,10 +306,6 @@ ncl_putpages(struct vop_putpages_args *ap) printf("ncl_putpages: called on noncache-able vnode\n"); mtx_lock(&np->n_mtx); } - - for (i = 0; i < npages; i++) - rtvals[i] = VM_PAGER_ERROR; - /* * When putting pages, do not extend file past EOF. */ @@ -319,6 +315,9 @@ ncl_putpages(struct vop_putpages_args *ap) count = 0; } mtx_unlock(&np->n_mtx); + + for (i = 0; i < npages; i++) + rtvals[i] = VM_PAGER_ERROR; VM_CNT_INC(v_vnodeout); VM_CNT_ADD(v_vnodepgsout, count); From owner-svn-src-all@freebsd.org Wed Jul 26 20:07:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2C12DAF27C; Wed, 26 Jul 2017 20:07:06 +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 B3E8374E96; Wed, 26 Jul 2017 20:07:06 +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 v6QK75mQ062955; Wed, 26 Jul 2017 20:07:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QK752X062951; Wed, 26 Jul 2017 20:07:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707262007.v6QK752X062951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jul 2017 20:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321581 - in head/sys: fs/nfsclient fs/smbfs vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: fs/nfsclient fs/smbfs vm X-SVN-Commit-Revision: 321581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 20:07:07 -0000 Author: kib Date: Wed Jul 26 20:07:05 2017 New Revision: 321581 URL: https://svnweb.freebsd.org/changeset/base/321581 Log: Mark pages after EOF as clean after pageout. Suppose that a file on NFS has partially filled last page, and this page is dirty. NFS VOP_PAGEOUT() method only marks the the page clean up to the block of the last written byte, leaving other blocks dirty. Also any page which erronously exists in the vnode vm_object past EOF is also left marked as dirty. With the introduction of the buf-cache coherent pager, each pass of syncer over the object with such page results in creation of B_DELWRI buffer due to VOP_WRITE() call. This buffer is noted on next syncer pass, which results e.g. a visible manifestation of shutdown never finishing vnode sync. Note that before buf-cache coherency commit, a dirty page might left never synced to server if a partial writes occur. Fix this by clearing dirty bits after EOF. Only blocks of the partial page which are completely after EOF are marked clean, to avoid possible user data loss. Reported by: mav Reviewed by: alc, markj Tested by: mav, pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11697 Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/smbfs/smbfs_io.c head/sys/vm/vnode_pager.c head/sys/vm/vnode_pager.h Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed Jul 26 20:01:31 2017 (r321580) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed Jul 26 20:07:05 2017 (r321581) @@ -336,8 +336,10 @@ ncl_putpages(struct vop_putpages_args *ap) cred); crfree(cred); - if (error == 0 || !nfs_keep_dirty_on_error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + if (error == 0 || !nfs_keep_dirty_on_error) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + np->n_size - offset, npages * PAGE_SIZE); + } return (rtvals[0]); } Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Wed Jul 26 20:01:31 2017 (r321580) +++ head/sys/fs/smbfs/smbfs_io.c Wed Jul 26 20:07:05 2017 (r321581) @@ -621,9 +621,11 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (!error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); - return rtvals[0]; + if (error == 0) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + npages * PAGE_SIZE, npages * PAGE_SIZE); + } + return (rtvals[0]); #endif /* SMBFS_RWGENERIC */ } Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Jul 26 20:01:31 2017 (r321580) +++ head/sys/vm/vnode_pager.c Wed Jul 26 20:07:05 2017 (r321581) @@ -1315,13 +1315,24 @@ vnode_pager_putpages_ioflags(int pager_flags) return (ioflags); } +/* + * vnode_pager_undirty_pages(). + * + * A helper to mark pages as clean after pageout that was possibly + * done with a short write. The lpos argument specifies the page run + * length in bytes, and the written argument specifies how many bytes + * were actually written. eof is the offset past the last valid byte + * in the vnode using the absolute file position of the first byte in + * the run as the base from which it is computed. + */ void -vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, + int lpos) { vm_object_t obj; - int i, pos; + int i, pos, pos_devb; - if (written == 0) + if (written == 0 && eof >= lpos) return; obj = ma[0]->object; VM_OBJECT_WLOCK(obj); @@ -1335,6 +1346,37 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); } } + if (eof >= lpos) /* avoid truncation */ + goto done; + for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { + if (pos != trunc_page(pos)) { + /* + * The page contains the last valid byte in + * the vnode, mark the rest of the page as + * clean, potentially making the whole page + * clean. + */ + pos_devb = roundup2(pos & PAGE_MASK, DEV_BSIZE); + vm_page_clear_dirty(ma[i], pos_devb, PAGE_SIZE - + pos_devb); + + /* + * If the page was cleaned, report the pageout + * on it as successful. msync() no longer + * needs to write out the page, endlessly + * creating write requests and dirty buffers. + */ + if (ma[i]->dirty == 0) + rtvals[i] = VM_PAGER_OK; + + pos = round_page(pos); + } else { + /* vm_pageout_flush() clears dirty */ + rtvals[i] = VM_PAGER_BAD; + pos += PAGE_SIZE; + } + } +done: VM_OBJECT_WUNLOCK(obj); } Modified: head/sys/vm/vnode_pager.h ============================================================================== --- head/sys/vm/vnode_pager.h Wed Jul 26 20:01:31 2017 (r321580) +++ head/sys/vm/vnode_pager.h Wed Jul 26 20:07:05 2017 (r321581) @@ -50,7 +50,8 @@ int vnode_pager_local_getpages_async(struct vop_getpag int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, + off_t eof, int lpos); void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); From owner-svn-src-all@freebsd.org Wed Jul 26 20:20:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C605CDAF6C2; Wed, 26 Jul 2017 20:20:59 +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 908BF7575D; Wed, 26 Jul 2017 20:20:59 +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 v6QKKwum067705; Wed, 26 Jul 2017 20:20:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QKKwgj067702; Wed, 26 Jul 2017 20:20:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201707262020.v6QKKwgj067702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 26 Jul 2017 20:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321582 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 321582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 20:20:59 -0000 Author: np Date: Wed Jul 26 20:20:58 2017 New Revision: 321582 URL: https://svnweb.freebsd.org/changeset/base/321582 Log: cxgbe(4): Some updates to the common code. - Updated register ranges. - Helper routines for access to TP registers. - Updated routine to read flash parameters. Obtained from: Chelsio Communications MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: 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 Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Wed Jul 26 20:07:05 2017 (r321581) +++ head/sys/dev/cxgbe/common/common.h Wed Jul 26 20:20:58 2017 (r321582) @@ -587,7 +587,7 @@ 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); int t4_init_sge_params(struct adapter *adapter); -int t4_init_tp_params(struct adapter *adap); +int t4_init_tp_params(struct adapter *adap, bool sleep_ok); int t4_filter_field_shift(const struct adapter *adap, int filter_sel); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id); void t4_fatal_err(struct adapter *adapter); @@ -605,20 +605,21 @@ int t4_config_vi_rss(struct adapter *adapter, int mbox unsigned int flags, unsigned int defq, unsigned int skeyidx, unsigned int skey); int t4_read_rss(struct adapter *adapter, u16 *entries); -void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, - unsigned int start_index, unsigned int rw); -void t4_read_rss_key(struct adapter *adapter, u32 *key); -void t4_write_rss_key(struct adapter *adap, u32 *key, int idx); -void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); -void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); +void t4_read_rss_key(struct adapter *adapter, u32 *key, bool sleep_ok); +void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx, + bool sleep_ok); +void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, + u32 *valp, bool sleep_ok); +void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, + u32 val, bool sleep_ok); void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 *vfl, u32 *vfh); + u32 *vfl, u32 *vfh, bool sleep_ok); void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 vfl, u32 vfh); -u32 t4_read_rss_pf_map(struct adapter *adapter); -void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap); -u32 t4_read_rss_pf_mask(struct adapter *adapter); -void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask); + u32 vfl, u32 vfh, bool sleep_ok); +u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok); +void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok); +u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok); +void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok); int t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); @@ -664,19 +665,24 @@ void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); void t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]); void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, - unsigned int *ipg); + unsigned int *ipg, bool sleep_ok); void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, unsigned int mask, unsigned int val); void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); -void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st); -void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st); -void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st); -void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st); +void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, + bool sleep_ok); +void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, + bool sleep_ok); +void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, + bool sleep_ok); +void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, + bool sleep_ok); +void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok); void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); + struct tp_tcp_stats *v6, bool sleep_ok); void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, - struct tp_fcoe_stats *st); + struct tp_fcoe_stats *st, bool sleep_ok); void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, const unsigned short *alpha, const unsigned short *beta); @@ -687,7 +693,8 @@ int t4_set_sched_ipg(struct adapter *adap, int sched, int t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, unsigned int start, unsigned int n); void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); -int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map); +int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map, + bool sleep_ok); void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); void t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); @@ -801,6 +808,15 @@ int t4_config_watchdog(struct adapter *adapter, unsign 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); + +void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); static inline int t4vf_query_params(struct adapter *adapter, unsigned int nparams, const u32 *params, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Jul 26 20:07:05 2017 (r321581) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Jul 26 20:20:58 2017 (r321582) @@ -469,7 +469,7 @@ static int t4_edc_err_read(struct adapter *adap, int i CH_WARN(adap, "%s: T4 NOT supported.\n", __func__); return 0; } - if (idx != 0 && idx != 1) { + if (idx != MEM_EDC0 && idx != MEM_EDC1) { CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx); return 0; } @@ -886,7 +886,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0xd010, 0xd03c, 0xdfc0, 0xdfe0, 0xe000, 0xea7c, - 0xf000, 0x11190, + 0xf000, 0x11110, + 0x11118, 0x11190, 0x19040, 0x1906c, 0x19078, 0x19080, 0x1908c, 0x190e4, @@ -1424,8 +1425,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x1ff00, 0x1ff84, 0x1ffc0, 0x1ffc8, 0x30000, 0x30030, - 0x30038, 0x30038, - 0x30040, 0x30040, 0x30100, 0x30144, 0x30190, 0x301a0, 0x301a8, 0x301b8, @@ -1536,8 +1535,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x33c3c, 0x33c50, 0x33cf0, 0x33cfc, 0x34000, 0x34030, - 0x34038, 0x34038, - 0x34040, 0x34040, 0x34100, 0x34144, 0x34190, 0x341a0, 0x341a8, 0x341b8, @@ -1648,8 +1645,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x37c3c, 0x37c50, 0x37cf0, 0x37cfc, 0x38000, 0x38030, - 0x38038, 0x38038, - 0x38040, 0x38040, 0x38100, 0x38144, 0x38190, 0x381a0, 0x381a8, 0x381b8, @@ -1760,8 +1755,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x3bc3c, 0x3bc50, 0x3bcf0, 0x3bcfc, 0x3c000, 0x3c030, - 0x3c038, 0x3c038, - 0x3c040, 0x3c040, 0x3c100, 0x3c144, 0x3c190, 0x3c1a0, 0x3c1a8, 0x3c1b8, @@ -2254,13 +2247,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x1ff00, 0x1ff84, 0x1ffc0, 0x1ffc8, 0x30000, 0x30030, - 0x30038, 0x30038, - 0x30040, 0x30040, - 0x30048, 0x30048, - 0x30050, 0x30050, - 0x3005c, 0x30060, - 0x30068, 0x30068, - 0x30070, 0x30070, 0x30100, 0x30168, 0x30190, 0x301a0, 0x301a8, 0x301b8, @@ -2323,13 +2309,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x326a8, 0x326a8, 0x326ec, 0x326ec, 0x32a00, 0x32abc, - 0x32b00, 0x32b38, + 0x32b00, 0x32b18, + 0x32b20, 0x32b38, 0x32b40, 0x32b58, 0x32b60, 0x32b78, 0x32c00, 0x32c00, 0x32c08, 0x32c3c, - 0x32e00, 0x32e2c, - 0x32f00, 0x32f2c, 0x33000, 0x3302c, 0x33034, 0x33050, 0x33058, 0x33058, @@ -2394,13 +2379,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x33c38, 0x33c50, 0x33cf0, 0x33cfc, 0x34000, 0x34030, - 0x34038, 0x34038, - 0x34040, 0x34040, - 0x34048, 0x34048, - 0x34050, 0x34050, - 0x3405c, 0x34060, - 0x34068, 0x34068, - 0x34070, 0x34070, 0x34100, 0x34168, 0x34190, 0x341a0, 0x341a8, 0x341b8, @@ -2463,13 +2441,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x366a8, 0x366a8, 0x366ec, 0x366ec, 0x36a00, 0x36abc, - 0x36b00, 0x36b38, + 0x36b00, 0x36b18, + 0x36b20, 0x36b38, 0x36b40, 0x36b58, 0x36b60, 0x36b78, 0x36c00, 0x36c00, 0x36c08, 0x36c3c, - 0x36e00, 0x36e2c, - 0x36f00, 0x36f2c, 0x37000, 0x3702c, 0x37034, 0x37050, 0x37058, 0x37058, @@ -2700,6 +2677,7 @@ struct t4_vpd_hdr { #define EEPROM_MAX_POLL 5000 /* x 5000 == 50ms */ #define EEPROM_STAT_ADDR 0x7bfc +#define VPD_SIZE 0x800 #define VPD_BASE 0x400 #define VPD_BASE_OLD 0 #define VPD_LEN 1024 @@ -3040,13 +3018,13 @@ enum { SF_ATTEMPTS = 10, /* max retries for SF operations */ /* flash command opcodes */ - SF_PROG_PAGE = 2, /* program page */ + SF_PROG_PAGE = 2, /* program 256B page */ SF_WR_DISABLE = 4, /* disable writes */ SF_RD_STATUS = 5, /* read status register */ SF_WR_ENABLE = 6, /* enable writes */ SF_RD_DATA_FAST = 0xb, /* read flash */ SF_RD_ID = 0x9f, /* read ID */ - SF_ERASE_SECTOR = 0xd8, /* erase sector */ + SF_ERASE_SECTOR = 0xd8, /* erase 64KB sector */ }; /** @@ -3994,6 +3972,9 @@ static void sge_intr_handler(struct adapter *adapter) "SGE too many priority ingress contexts", -1, 0 }, { F_INGRESS_SIZE_ERR, "SGE illegal ingress QID", -1, 0 }, { F_EGRESS_SIZE_ERR, "SGE illegal egress QID", -1, 0 }, + { F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1 | + F_ERR_PCIE_ERROR2 | F_ERR_PCIE_ERROR3, + "SGE PCIe error for a DBP thread", -1, 0 }, { 0 } }; @@ -4009,8 +3990,6 @@ static void sge_intr_handler(struct adapter *adapter) * For now, treat below interrupts as fatal so that we disable SGE and * get better debug */ static const struct intr_info t6_sge_intr_info[] = { - { F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1, - "SGE PCIe error for a DBP thread", -1, 1 }, { F_FATAL_WRE_LEN, "SGE Actual WRE packet is less than advertized length", -1, 1 }, @@ -4065,6 +4044,7 @@ static void cim_intr_handler(struct adapter *adapter) { F_MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 }, { F_TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 }, { F_TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, + { F_TIMER0INT, "CIM TIMER0 interrupt", -1, 1 }, { 0 } }; static const struct intr_info cim_upintr_info[] = { @@ -4098,11 +4078,26 @@ static void cim_intr_handler(struct adapter *adapter) { F_TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 }, { 0 } }; + u32 val, fw_err; int fat; - if (t4_read_reg(adapter, A_PCIE_FW) & F_PCIE_FW_ERR) + fw_err = t4_read_reg(adapter, A_PCIE_FW); + if (fw_err & F_PCIE_FW_ERR) t4_report_fw_error(adapter); + /* When the Firmware detects an internal error which normally wouldn't + * raise a Host Interrupt, it forces a CIM Timer0 interrupt in order + * to make sure the Host sees the Firmware Crash. So if we have a + * Timer0 interrupt and don't see a Firmware Crash, ignore the Timer0 + * interrupt. + */ + val = t4_read_reg(adapter, A_CIM_HOST_INT_CAUSE); + if (val & F_TIMER0INT) + if (!(fw_err & F_PCIE_FW_ERR) || + (G_PCIE_FW_EVAL(fw_err) != PCIE_FW_EVAL_CRASH)) + t4_write_reg(adapter, A_CIM_HOST_INT_CAUSE, + F_TIMER0INT); + fat = t4_handle_intr_status(adapter, A_CIM_HOST_INT_CAUSE, cim_intr_info) + t4_handle_intr_status(adapter, A_CIM_HOST_UPACC_INT_CAUSE, @@ -4850,55 +4845,177 @@ int t4_read_rss(struct adapter *adapter, u16 *map) } /** - * t4_fw_tp_pio_rw - Access TP PIO through LDST - * @adap: the adapter - * @vals: where the indirect register values are stored/written - * @nregs: how many indirect registers to read/write - * @start_idx: index of first indirect register to read/write - * @rw: Read (1) or Write (0) + * t4_tp_fw_ldst_rw - Access TP indirect register through LDST + * @adap: the adapter + * @cmd: TP fw ldst address space type + * @vals: where the indirect register values are stored/written + * @nregs: how many indirect registers to read/write + * @start_idx: index of first indirect register to read/write + * @rw: Read (1) or Write (0) + * @sleep_ok: if true we may sleep while awaiting command completion * - * Access TP PIO registers through LDST - */ -void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, - unsigned int start_index, unsigned int rw) + * Access TP indirect registers through LDST + **/ +static int t4_tp_fw_ldst_rw(struct adapter *adap, int cmd, u32 *vals, + unsigned int nregs, unsigned int start_index, + unsigned int rw, bool sleep_ok) { - int ret, i; - int cmd = FW_LDST_ADDRSPC_TP_PIO; + int ret = 0; + unsigned int i; struct fw_ldst_cmd c; - for (i = 0 ; i < nregs; i++) { + for (i = 0; i < nregs; i++) { memset(&c, 0, sizeof(c)); c.op_to_addrspace = cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | (rw ? F_FW_CMD_READ : - F_FW_CMD_WRITE) | + F_FW_CMD_WRITE) | V_FW_LDST_CMD_ADDRSPACE(cmd)); c.cycles_to_len16 = cpu_to_be32(FW_LEN16(c)); c.u.addrval.addr = cpu_to_be32(start_index + i); c.u.addrval.val = rw ? 0 : cpu_to_be32(vals[i]); - ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); - if (ret == 0) { - if (rw) - vals[i] = be32_to_cpu(c.u.addrval.val); - } + ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, + sleep_ok); + if (ret) + return ret; + + if (rw) + vals[i] = be32_to_cpu(c.u.addrval.val); } + return 0; } /** + * t4_tp_indirect_rw - Read/Write TP indirect register through LDST or backdoor + * @adap: the adapter + * @reg_addr: Address Register + * @reg_data: Data register + * @buff: where the indirect register values are stored/written + * @nregs: how many indirect registers to read/write + * @start_index: index of first indirect register to read/write + * @rw: READ(1) or WRITE(0) + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read/Write TP indirect registers through LDST if possible. + * Else, use backdoor access + **/ +static void t4_tp_indirect_rw(struct adapter *adap, u32 reg_addr, u32 reg_data, + u32 *buff, u32 nregs, u32 start_index, int rw, + bool sleep_ok) +{ + int rc = -EINVAL; + int cmd; + + switch (reg_addr) { + case A_TP_PIO_ADDR: + cmd = FW_LDST_ADDRSPC_TP_PIO; + break; + case A_TP_TM_PIO_ADDR: + cmd = FW_LDST_ADDRSPC_TP_TM_PIO; + break; + case A_TP_MIB_INDEX: + cmd = FW_LDST_ADDRSPC_TP_MIB; + break; + default: + goto indirect_access; + } + + if (t4_use_ldst(adap)) + rc = t4_tp_fw_ldst_rw(adap, cmd, buff, nregs, start_index, rw, + sleep_ok); + +indirect_access: + + if (rc) { + if (rw) + t4_read_indirect(adap, reg_addr, reg_data, buff, nregs, + start_index); + else + t4_write_indirect(adap, reg_addr, reg_data, buff, nregs, + start_index); + } +} + +/** + * t4_tp_pio_read - Read TP PIO registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP PIO Registers + **/ +void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, buff, nregs, + start_index, 1, sleep_ok); +} + +/** + * t4_tp_pio_write - Write TP PIO registers + * @adap: the adapter + * @buff: where the indirect register values are stored + * @nregs: how many indirect registers to write + * @start_index: index of first indirect register to write + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Write TP PIO Registers + **/ +void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, + __DECONST(u32 *, buff), nregs, start_index, 0, sleep_ok); +} + +/** + * t4_tp_tm_pio_read - Read TP TM PIO registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP TM PIO Registers + **/ +void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_TM_PIO_ADDR, A_TP_TM_PIO_DATA, buff, + nregs, start_index, 1, sleep_ok); +} + +/** + * t4_tp_mib_read - Read TP MIB registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP MIB Registers + **/ +void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index, + bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, buff, nregs, + start_index, 1, sleep_ok); +} + +/** * t4_read_rss_key - read the global RSS key * @adap: the adapter * @key: 10-entry array holding the 320-bit RSS key + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the global 320-bit RSS key. */ -void t4_read_rss_key(struct adapter *adap, u32 *key) +void t4_read_rss_key(struct adapter *adap, u32 *key, bool sleep_ok) { - if (t4_use_ldst(adap)) - t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 1); - else - t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10, - A_TP_RSS_SECRET_KEY0); + t4_tp_pio_read(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok); } /** @@ -4906,12 +5023,14 @@ void t4_read_rss_key(struct adapter *adap, u32 *key) * @adap: the adapter * @key: 10-entry array holding the 320-bit RSS key * @idx: which RSS key to write + * @sleep_ok: if true we may sleep while awaiting command completion * * Writes one of the RSS keys with the given 320-bit value. If @idx is * 0..15 the corresponding entry in the RSS key table is written, * otherwise the global RSS key is written. */ -void t4_write_rss_key(struct adapter *adap, u32 *key, int idx) +void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx, + bool sleep_ok) { u8 rss_key_addr_cnt = 16; u32 vrt = t4_read_reg(adap, A_TP_RSS_CONFIG_VRT); @@ -4925,11 +5044,7 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, (vrt & F_KEYEXTEND) && (G_KEYMODE(vrt) == 3)) rss_key_addr_cnt = 32; - if (t4_use_ldst(adap)) - t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 0); - else - t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10, - A_TP_RSS_SECRET_KEY0); + t4_tp_pio_write(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok); if (idx >= 0 && idx < rss_key_addr_cnt) { if (rss_key_addr_cnt > 16) @@ -4947,19 +5062,15 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, * @adapter: the adapter * @index: the entry in the PF RSS table to read * @valp: where to store the returned value + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Configuration Table at the specified index and returns * the value found there. */ void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, - u32 *valp) + u32 *valp, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, valp, 1, - A_TP_RSS_PF0_CONFIG + index, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - valp, 1, A_TP_RSS_PF0_CONFIG + index); + t4_tp_pio_read(adapter, valp, 1, A_TP_RSS_PF0_CONFIG + index, sleep_ok); } /** @@ -4967,19 +5078,16 @@ void t4_read_rss_pf_config(struct adapter *adapter, un * @adapter: the adapter * @index: the entry in the VF RSS table to read * @val: the value to store + * @sleep_ok: if true we may sleep while awaiting command completion * * Writes the PF RSS Configuration Table at the specified index with the * specified value. */ void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, - u32 val) + u32 val, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &val, 1, - A_TP_RSS_PF0_CONFIG + index, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &val, 1, A_TP_RSS_PF0_CONFIG + index); + t4_tp_pio_write(adapter, &val, 1, A_TP_RSS_PF0_CONFIG + index, + sleep_ok); } /** @@ -4988,12 +5096,13 @@ void t4_write_rss_pf_config(struct adapter *adapter, u * @index: the entry in the VF RSS table to read * @vfl: where to store the returned VFL * @vfh: where to store the returned VFH + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the VF RSS Configuration Table at the specified index and returns * the (VFL, VFH) values found there. */ void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 *vfl, u32 *vfh) + u32 *vfl, u32 *vfh, bool sleep_ok) { u32 vrt, mask, data; @@ -5015,15 +5124,8 @@ void t4_read_rss_vf_config(struct adapter *adapter, un /* * Grab the VFL/VFH values ... */ - if (t4_use_ldst(adapter)) { - t4_fw_tp_pio_rw(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, 1); - t4_fw_tp_pio_rw(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, 1); - } else { - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - vfl, 1, A_TP_RSS_VFL_CONFIG); - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - vfh, 1, A_TP_RSS_VFH_CONFIG); - } + t4_tp_pio_read(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok); + t4_tp_pio_read(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok); } /** @@ -5038,7 +5140,7 @@ void t4_read_rss_vf_config(struct adapter *adapter, un * specified (VFL, VFH) values. */ void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 vfl, u32 vfh) + u32 vfl, u32 vfh, bool sleep_ok) { u32 vrt, mask, data; @@ -5053,15 +5155,8 @@ void t4_write_rss_vf_config(struct adapter *adapter, u /* * Load up VFL/VFH with the values to be written ... */ - if (t4_use_ldst(adapter)) { - t4_fw_tp_pio_rw(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, 0); - t4_fw_tp_pio_rw(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, 0); - } else { - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &vfl, 1, A_TP_RSS_VFL_CONFIG); - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &vfh, 1, A_TP_RSS_VFH_CONFIG); - } + t4_tp_pio_write(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok); + t4_tp_pio_write(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok); /* * Write the VFL/VFH into the VF Table at index'th location. @@ -5075,18 +5170,16 @@ void t4_write_rss_vf_config(struct adapter *adapter, u /** * t4_read_rss_pf_map - read PF RSS Map * @adapter: the adapter + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Map register and returns its value. */ -u32 t4_read_rss_pf_map(struct adapter *adapter) +u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok) { u32 pfmap; - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmap, 1, A_TP_RSS_PF_MAP); + t4_tp_pio_read(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok); + return pfmap; } @@ -5097,30 +5190,24 @@ u32 t4_read_rss_pf_map(struct adapter *adapter) * * Writes the specified value to the PF RSS Map register. */ -void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap) +void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmap, 1, A_TP_RSS_PF_MAP); + t4_tp_pio_write(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok); } /** * t4_read_rss_pf_mask - read PF RSS Mask * @adapter: the adapter + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Mask register and returns its value. */ -u32 t4_read_rss_pf_mask(struct adapter *adapter) +u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok) { u32 pfmask; - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmask, 1, A_TP_RSS_PF_MSK); + t4_tp_pio_read(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok); + return pfmask; } @@ -5131,13 +5218,9 @@ u32 t4_read_rss_pf_mask(struct adapter *adapter) * * Writes the specified value to the PF RSS Mask register. */ -void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask) +void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmask, 1, A_TP_RSS_PF_MSK); + t4_tp_pio_write(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok); } /** @@ -5145,12 +5228,13 @@ void t4_write_rss_pf_mask(struct adapter *adapter, u32 * @adap: the adapter * @v4: holds the TCP/IP counter values * @v6: holds the TCP/IPv6 counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. * Either @v4 or @v6 may be %NULL to skip the corresponding stats. */ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) + struct tp_tcp_stats *v6, bool sleep_ok) { u32 val[A_TP_MIB_TCP_RXT_SEG_LO - A_TP_MIB_TCP_OUT_RST + 1]; @@ -5159,16 +5243,16 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct #define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) if (v4) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - ARRAY_SIZE(val), A_TP_MIB_TCP_OUT_RST); + t4_tp_mib_read(adap, val, ARRAY_SIZE(val), + A_TP_MIB_TCP_OUT_RST, sleep_ok); v4->tcp_out_rsts = STAT(OUT_RST); v4->tcp_in_segs = STAT64(IN_SEG); v4->tcp_out_segs = STAT64(OUT_SEG); v4->tcp_retrans_segs = STAT64(RXT_SEG); } if (v6) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - ARRAY_SIZE(val), A_TP_MIB_TCP_V6OUT_RST); + t4_tp_mib_read(adap, val, ARRAY_SIZE(val), + A_TP_MIB_TCP_V6OUT_RST, sleep_ok); v6->tcp_out_rsts = STAT(OUT_RST); v6->tcp_in_segs = STAT64(IN_SEG); v6->tcp_out_segs = STAT64(OUT_SEG); @@ -5183,32 +5267,41 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct * t4_tp_get_err_stats - read TP's error MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's error counters. */ -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) +void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->hdr_in_errs, nchan, A_TP_MIB_HDR_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tcp_in_errs, nchan, A_TP_MIB_TCP_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tnl_cong_drops, nchan, A_TP_MIB_TNL_CNG_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->ofld_chan_drops, nchan, A_TP_MIB_OFD_CHN_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tnl_tx_drops, nchan, A_TP_MIB_TNL_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->ofld_vlan_drops, nchan, A_TP_MIB_OFD_VLN_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tcp6_in_errs, nchan, A_TP_MIB_TCP_V6IN_ERR_0); + t4_tp_mib_read(adap, st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0, + sleep_ok); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - &st->ofld_no_neigh, 2, A_TP_MIB_OFD_ARP_DROP); + t4_tp_mib_read(adap, st->hdr_in_errs, nchan, A_TP_MIB_HDR_IN_ERR_0, + sleep_ok); + + t4_tp_mib_read(adap, st->tcp_in_errs, nchan, A_TP_MIB_TCP_IN_ERR_0, + sleep_ok); + + t4_tp_mib_read(adap, st->tnl_cong_drops, nchan, + A_TP_MIB_TNL_CNG_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->ofld_chan_drops, nchan, + A_TP_MIB_OFD_CHN_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->tnl_tx_drops, nchan, A_TP_MIB_TNL_DROP_0, + sleep_ok); + + t4_tp_mib_read(adap, st->ofld_vlan_drops, nchan, + A_TP_MIB_OFD_VLN_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->tcp6_in_errs, nchan, + A_TP_MIB_TCP_V6IN_ERR_0, sleep_ok); + + t4_tp_mib_read(adap, &st->ofld_no_neigh, 2, A_TP_MIB_OFD_ARP_DROP, + sleep_ok); } /** @@ -5218,29 +5311,30 @@ void t4_tp_get_err_stats(struct adapter *adap, struct * * Returns the values of TP's proxy counters. */ -void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st) +void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->proxy, - nchan, A_TP_MIB_TNL_LPBK_0); + t4_tp_mib_read(adap, st->proxy, nchan, A_TP_MIB_TNL_LPBK_0, sleep_ok); } /** * t4_tp_get_cpl_stats - read TP's CPL MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's CPL counters. */ -void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st) +void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->req, - nchan, A_TP_MIB_CPL_IN_REQ_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->rsp, - nchan, A_TP_MIB_CPL_OUT_RSP_0); + t4_tp_mib_read(adap, st->req, nchan, A_TP_MIB_CPL_IN_REQ_0, sleep_ok); + + t4_tp_mib_read(adap, st->rsp, nchan, A_TP_MIB_CPL_OUT_RSP_0, sleep_ok); } /** @@ -5250,10 +5344,11 @@ void t4_tp_get_cpl_stats(struct adapter *adap, struct * * Returns the values of TP's RDMA counters. */ -void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st) +void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, + bool sleep_ok) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->rqe_dfr_pkt, - 2, A_TP_MIB_RQE_DFR_PKT); + t4_tp_mib_read(adap, &st->rqe_dfr_pkt, 2, A_TP_MIB_RQE_DFR_PKT, + sleep_ok); } /** @@ -5261,20 +5356,24 @@ void t4_tp_get_rdma_stats(struct adapter *adap, struct * @adap: the adapter * @idx: the port index * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's FCoE counters for the selected port. */ void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, - struct tp_fcoe_stats *st) + struct tp_fcoe_stats *st, bool sleep_ok) { u32 val[2]; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->frames_ddp, - 1, A_TP_MIB_FCOE_DDP_0 + idx); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->frames_drop, - 1, A_TP_MIB_FCOE_DROP_0 + idx); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - 2, A_TP_MIB_FCOE_BYTE_0_HI + 2 * idx); + t4_tp_mib_read(adap, &st->frames_ddp, 1, A_TP_MIB_FCOE_DDP_0 + idx, + sleep_ok); + + t4_tp_mib_read(adap, &st->frames_drop, 1, + A_TP_MIB_FCOE_DROP_0 + idx, sleep_ok); + + t4_tp_mib_read(adap, val, 2, A_TP_MIB_FCOE_BYTE_0_HI + 2 * idx, + sleep_ok); + st->octets_ddp = ((u64)val[0] << 32) | val[1]; } @@ -5282,15 +5381,17 @@ void t4_get_fcoe_stats(struct adapter *adap, unsigned * t4_get_usm_stats - read TP's non-TCP DDP MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's counters for non-TCP directly-placed packets. */ -void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st) +void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok) { u32 val[4]; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, 4, - A_TP_MIB_USM_PKTS); + t4_tp_mib_read(adap, val, 4, A_TP_MIB_USM_PKTS, sleep_ok); + st->frames = val[0]; st->drops = val[1]; st->octets = ((u64)val[2] << 32) | val[3]; @@ -5869,7 +5970,7 @@ void t4_get_port_stats_offset(struct adapter *adap, in void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { u32 bgmap = t4_get_mps_bg_map(adap, idx); - u32 stat_ctl; + u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -5877,8 +5978,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, T5_PORT_REG(idx, A_MPS_PORT_STAT_##name##_L))) #define GET_STAT_COM(name) t4_read_reg64(adap, A_MPS_STAT_##name##_L) - stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); - p->tx_pause = GET_STAT(TX_PORT_PAUSE); p->tx_octets = GET_STAT(TX_PORT_BYTES); p->tx_frames = GET_STAT(TX_PORT_FRAMES); @@ -7676,51 +7775,120 @@ struct flash_desc { int t4_get_flash_params(struct adapter *adapter) { /* - * Table for non-Numonix supported flash parts. Numonix parts are left - * to the preexisting well-tested code. All flash parts have 64KB - * sectors. + * Table for non-standard supported Flash parts. Note, all Flash + * parts must have 64KB sectors. */ static struct flash_desc supported_flash[] = { - { 0x150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ + { 0x00150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ }; int ret; - u32 info = 0; + u32 flashid = 0; + unsigned int part, manufacturer; + unsigned int density, size; + + /* + * Issue a Read ID Command to the Flash part. We decode supported + * Flash parts and their sizes from this. There's a newer Query + * Command which can retrieve detailed geometry information but many + * Flash parts don't support it. + */ ret = sf1_write(adapter, 1, 1, 0, SF_RD_ID); if (!ret) - ret = sf1_read(adapter, 3, 0, 1, &info); + ret = sf1_read(adapter, 3, 0, 1, &flashid); t4_write_reg(adapter, A_SF_OP, 0); /* unlock SF */ if (ret < 0) return ret; - for (ret = 0; ret < ARRAY_SIZE(supported_flash); ++ret) - if (supported_flash[ret].vendor_and_model_id == info) { - adapter->params.sf_size = supported_flash[ret].size_mb; + /* + * Check to see if it's one of our non-standard supported Flash parts. + */ + for (part = 0; part < ARRAY_SIZE(supported_flash); part++) + if (supported_flash[part].vendor_and_model_id == flashid) { + adapter->params.sf_size = + supported_flash[part].size_mb; adapter->params.sf_nsec = adapter->params.sf_size / SF_SEC_SIZE; - return 0; + goto found; } - if ((info & 0xff) != 0x20) /* not a Numonix flash */ + /* + * Decode Flash part size. The code below looks repetative with + * common encodings, but that's not guaranteed in the JEDEC + * specification for the Read JADEC ID command. The only thing that + * we're guaranteed by the JADEC specification is where the + * Manufacturer ID is in the returned result. After that each + * Manufacturer ~could~ encode things completely differently. + * Note, all Flash parts must have 64KB sectors. + */ + manufacturer = flashid & 0xff; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 26 20:40:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C1BDDAFEBA; Wed, 26 Jul 2017 20:40:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63284761E9; Wed, 26 Jul 2017 20:40:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QKeOiN075762; Wed, 26 Jul 2017 20:40:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QKeOJl075760; Wed, 26 Jul 2017 20:40:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707262040.v6QKeOJl075760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 26 Jul 2017 20:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321583 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 321583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 20:40:25 -0000 Author: ian Date: Wed Jul 26 20:40:24 2017 New Revision: 321583 URL: https://svnweb.freebsd.org/changeset/base/321583 Log: Add a pair of convenience routines for doing simple "register" read/writes on i2c devices, where the "register" can be any length. Many (perhaps most) common i2c devices are organized as a collection of (usually 1-byte-wide) registers, and are accessed by first writing a 1-byte register index/offset number, then by reading or writing the data. Generally there is an auto-increment feature so the when multiple bytes are read or written, multiple contiguous registers are accessed. Most existing slave device drivers allocate an array of iic_msg structures, fill in all the transfer info, and invoke iicbus_transfer(). These new functions commonize all that and reduce register access to a simple call with a few arguments. Modified: head/sys/dev/iicbus/iiconf.c head/sys/dev/iicbus/iiconf.h Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Wed Jul 26 20:20:58 2017 (r321582) +++ head/sys/dev/iicbus/iiconf.c Wed Jul 26 20:40:24 2017 (r321583) @@ -470,3 +470,55 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs iicbus_stop(bus); return (error); } + +int +iicdev_readfrom(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with a repeat-start between them; first we + * write the address-within-device, then we read from the device. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); +} + +int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with no stop or start between them; first + * we write the address then we write the data to that address, all in a + * single transfer from two scattered buffers. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); +} Modified: head/sys/dev/iicbus/iiconf.h ============================================================================== --- head/sys/dev/iicbus/iiconf.h Wed Jul 26 20:20:58 2017 (r321582) +++ head/sys/dev/iicbus/iiconf.h Wed Jul 26 20:40:24 2017 (r321583) @@ -133,6 +133,16 @@ int iicbus_transfer_excl(device_t bus, struct iic_msg int how); int iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs); +/* + * Simple register read/write routines, but the "register" can be any size. + * The transfers are done with iicbus_transfer_excl(). Reads use a repeat-start + * between sending the address and reading; writes use a single start/stop. + */ +int iicdev_readfrom(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); +int iicdev_writeto(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); + #define IICBUS_MODVER 1 #define IICBUS_MINVER 1 #define IICBUS_MAXVER 1 From owner-svn-src-all@freebsd.org Wed Jul 26 21:06:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3914CDB04D4; Wed, 26 Jul 2017 21:06:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DA9276D7E; Wed, 26 Jul 2017 21:06:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QL6RCt087704; Wed, 26 Jul 2017 21:06:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QL6RaR087702; Wed, 26 Jul 2017 21:06:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707262106.v6QL6RaR087702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 26 Jul 2017 21:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321584 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 321584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 21:06:28 -0000 Author: ian Date: Wed Jul 26 21:06:26 2017 New Revision: 321584 URL: https://svnweb.freebsd.org/changeset/base/321584 Log: Add support for tracking nested calls to iicbus_request/release_bus(). Usually it is sufficient to use iicbus_transfer_excl(), or one of the higher-level convenience functions that use it, to reserve the bus for the duration of each register access. Occasionally it is important that a series of accesses or read-modify-write operations must be done without any other intervening access to the device, to prevent corrupting state. Without support for nested request/release, slave device drivers would have to stop using high-level convenience functions and resort to working with arrays of iic_msg structs just for a few operations (often involving one-time device setup or infrequent configuration changes). The changes here appear large from a glance at the diff, but in fact they're nearly trivial, and the large diff is because of changes in indentation and the re-wrapping of comments caused by that. One notable change is that iicbus_release_bus() now ignores the IICBUS_CALLBACK(IIC_RELEASE_BUS) return value. The old error handling left the bus in a kind of limbo state where it was still owned at the iicbus layer, but drivers rarely check the return of the release call, and it's unclear what they would do to recover from an error return anyway. No existing low-level drivers return any kind of error from IIC_RELEASE_BUS except one EINVAL for "you don't own the bus", to which the right response is probably to carry on with the process of releasing the reference to the bus anyway. Modified: head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Wed Jul 26 20:40:24 2017 (r321583) +++ head/sys/dev/iicbus/iicbus.h Wed Jul 26 21:06:26 2017 (r321584) @@ -39,6 +39,7 @@ struct iicbus_softc { device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ + u_int owncount; /* iicbus ownership nesting count */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ u_char strict; /* deny operations that violate the Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Wed Jul 26 20:40:24 2017 (r321583) +++ head/sys/dev/iicbus/iiconf.c Wed Jul 26 21:06:26 2017 (r321584) @@ -113,26 +113,30 @@ iicbus_request_bus(device_t bus, device_t dev, int how IICBUS_LOCK(sc); - while ((error == 0) && (sc->owner != NULL)) + while (error == 0 && sc->owner != NULL && sc->owner != dev) error = iicbus_poll(sc, how); if (error == 0) { - sc->owner = dev; - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the request is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), - IIC_REQUEST_BUS, (caddr_t)&how); - IICBUS_LOCK(sc); - - if (error != 0) { - sc->owner = NULL; - wakeup_one(sc); + ++sc->owncount; + if (sc->owner == NULL) { + sc->owner = dev; + /* + * Drop the lock around the call to the bus driver, it + * should be allowed to sleep in the IIC_WAIT case. + * Drivers might also need to grab locks that would + * cause a LOR if our lock is held. + */ + IICBUS_UNLOCK(sc); + /* Ask the underlying layers if the request is ok */ + error = IICBUS_CALLBACK(device_get_parent(bus), + IIC_REQUEST_BUS, (caddr_t)&how); + IICBUS_LOCK(sc); + + if (error != 0) { + sc->owner = NULL; + sc->owncount = 0; + wakeup_one(sc); + } } } @@ -150,7 +154,6 @@ int iicbus_release_bus(device_t bus, device_t dev) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - int error; IICBUS_LOCK(sc); @@ -159,26 +162,16 @@ iicbus_release_bus(device_t bus, device_t dev) return (IIC_EBUSBSY); } - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the release is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); - - if (error == 0) { + if (--sc->owncount == 0) { + /* Drop the lock while informing the low-level driver. */ + IICBUS_UNLOCK(sc); + IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); IICBUS_LOCK(sc); sc->owner = NULL; - - /* wakeup a waiting thread */ wakeup_one(sc); - IICBUS_UNLOCK(sc); } - - return (error); + IICBUS_UNLOCK(sc); + return (0); } /* From owner-svn-src-all@freebsd.org Wed Jul 26 21:20:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D1EBDB08A3; Wed, 26 Jul 2017 21:20:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED32F774AF; Wed, 26 Jul 2017 21:20:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QLKwGk092977; Wed, 26 Jul 2017 21:20:58 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QLKwZA092976; Wed, 26 Jul 2017 21:20:58 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707262120.v6QLKwZA092976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 26 Jul 2017 21:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321586 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 321586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 21:20:59 -0000 Author: ian Date: Wed Jul 26 21:20:57 2017 New Revision: 321586 URL: https://svnweb.freebsd.org/changeset/base/321586 Log: Add a debug sysctl that lets you see i2c bus traffic through this device. Modified: head/sys/arm/freescale/imx/imx_i2c.c Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Wed Jul 26 21:09:10 2017 (r321585) +++ head/sys/arm/freescale/imx/imx_i2c.c Wed Jul 26 21:20:57 2017 (r321586) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -138,8 +139,18 @@ struct i2c_softc { int rb_pinctl_idx; gpio_pin_t rb_sclpin; gpio_pin_t rb_sdapin; + u_int debug; + u_int slave; }; +#define DEVICE_DEBUGF(sc, lvl, fmt, args...) \ + if ((lvl) <= (sc)->debug) \ + device_printf((sc)->dev, fmt, ##args) + +#define DEBUGF(sc, lvl, fmt, args...) \ + if ((lvl) <= (sc)->debug) \ + printf(fmt, ##args) + static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); @@ -383,6 +394,12 @@ i2c_attach(device_t dev) return (ENXIO); } + /* Set up debug-enable sysctl. */ + SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), + OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->debug, 0, + "Enable debug; 1=reads/writes, 2=add starts/stops"); + /* * Set up for bus recovery using gpio pins, if the pinctrl and gpio * properties are present. This is optional. If all the config data is @@ -450,6 +467,8 @@ i2c_repeated_start(device_t dev, u_char slave, int tim DELAY(1); i2c_write_reg(sc, I2C_STATUS_REG, 0x0); i2c_write_reg(sc, I2C_DATA_REG, slave); + sc->slave = slave; + DEVICE_DEBUGF(sc, 2, "rstart 0x%02x\n", sc->slave); error = wait_for_xfer(sc, true); return (i2c_error_handler(sc, error)); } @@ -472,6 +491,8 @@ i2c_start_ll(device_t dev, u_char slave, int timeout) return (i2c_error_handler(sc, error)); i2c_write_reg(sc, I2C_STATUS_REG, 0); i2c_write_reg(sc, I2C_DATA_REG, slave); + sc->slave = slave; + DEVICE_DEBUGF(sc, 2, "start 0x%02x\n", sc->slave); error = wait_for_xfer(sc, true); return (i2c_error_handler(sc, error)); } @@ -511,6 +532,7 @@ i2c_stop(device_t dev) i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); wait_for_busbusy(sc, false); i2c_write_reg(sc, I2C_CONTROL_REG, 0); + DEVICE_DEBUGF(sc, 2, "stop 0x%02x\n", sc->slave); return (IIC_NOERR); } @@ -522,6 +544,8 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_c sc = device_get_softc(dev); + DEVICE_DEBUGF(sc, 1, "reset\n"); + /* * Look up the divisor that gives the nearest speed that doesn't exceed * the configured value for the bus. @@ -567,6 +591,7 @@ i2c_read(device_t dev, char *buf, int len, int *read, sc = device_get_softc(dev); *read = 0; + DEVICE_DEBUGF(sc, 1, "read 0x%02x len %d: ", sc->slave, len); if (len) { if (len == 1) i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | @@ -598,9 +623,11 @@ i2c_read(device_t dev, char *buf, int len, int *read, } } reg = i2c_read_reg(sc, I2C_DATA_REG); + DEBUGF(sc, 1, "0x%02x ", reg); *buf++ = reg; (*read)++; } + DEBUGF(sc, 1, "\n"); return (i2c_error_handler(sc, error)); } @@ -615,13 +642,15 @@ i2c_write(device_t dev, const char *buf, int len, int error = 0; *sent = 0; + DEVICE_DEBUGF(sc, 1, "write 0x%02x len %d: ", sc->slave, len); while (*sent < len) { + DEBUGF(sc, 1, "0x%02x ", *buf); i2c_write_reg(sc, I2C_STATUS_REG, 0x0); i2c_write_reg(sc, I2C_DATA_REG, *buf++); if ((error = wait_for_xfer(sc, true)) != IIC_NOERR) break; (*sent)++; } - + DEBUGF(sc, 1, "\n"); return (i2c_error_handler(sc, error)); } From owner-svn-src-all@freebsd.org Wed Jul 26 21:23:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 134BDDB0B1E; Wed, 26 Jul 2017 21:23: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 D6F51778B6; Wed, 26 Jul 2017 21:23:10 +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 v6QLN9dm096101; Wed, 26 Jul 2017 21:23:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QLN9Fu096100; Wed, 26 Jul 2017 21:23:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262123.v6QLN9Fu096100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 21:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321587 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 321587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 21:23:11 -0000 Author: emaste Date: Wed Jul 26 21:23:09 2017 New Revision: 321587 URL: https://svnweb.freebsd.org/changeset/base/321587 Log: cc_cubic: restore braces around if-condition block r307901 was reverted in r321480, restoring an incorrect block delimitation bug present in the original cc_cubic commit. Restore only the bugfix (brace addition) from r307901. CID: 1090182 Approved by: sbruno Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Wed Jul 26 21:20:57 2017 (r321586) +++ head/sys/netinet/cc/cc_cubic.c Wed Jul 26 21:23:09 2017 (r321587) @@ -261,9 +261,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) + if (CCV(ccv, t_rxtshift) >= 2) { cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; + } break; } } From owner-svn-src-all@freebsd.org Wed Jul 26 21:59:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 481A6DB19A7; Wed, 26 Jul 2017 21:59:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 179387CDA1; Wed, 26 Jul 2017 21:59:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6QLxbOF008682; Wed, 26 Jul 2017 21:59:37 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QLxb6F008681; Wed, 26 Jul 2017 21:59:37 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707262159.v6QLxb6F008681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 26 Jul 2017 21:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321588 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 321588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 21:59:38 -0000 Author: marius Date: Wed Jul 26 21:59:37 2017 New Revision: 321588 URL: https://svnweb.freebsd.org/changeset/base/321588 Log: Correctly use the size of a pointer rather than that of a pointer to a pointer. Reported by: Coverity CID: 1378432 Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Wed Jul 26 21:23:09 2017 (r321587) +++ head/sys/dev/mmc/mmc.c Wed Jul 26 21:59:37 2017 (r321588) @@ -1892,7 +1892,7 @@ child_common: if (child != NULL) { device_set_ivars(child, ivar); sc->child_list = realloc(sc->child_list, - sizeof(device_t *) * sc->child_count + 1, + sizeof(device_t) * sc->child_count + 1, M_DEVBUF, M_WAITOK); sc->child_list[sc->child_count++] = child; } else @@ -1934,7 +1934,7 @@ mmc_update_child_list(struct mmc_softc *sc) if (i != j) sc->child_list[i] = child; } - sc->child_list = realloc(sc->child_list, sizeof(device_t *) * + sc->child_list = realloc(sc->child_list, sizeof(device_t) * sc->child_count, M_DEVBUF, M_WAITOK); } From owner-svn-src-all@freebsd.org Wed Jul 26 22:04:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DACCFDB1C74; Wed, 26 Jul 2017 22:04:24 +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 97F227D1E3; Wed, 26 Jul 2017 22:04:24 +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 v6QM4Nbn012614; Wed, 26 Jul 2017 22:04:23 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QM4Nto012610; Wed, 26 Jul 2017 22:04:23 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707262204.v6QM4Nto012610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 26 Jul 2017 22:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321589 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 321589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 22:04:25 -0000 Author: marius Date: Wed Jul 26 22:04:23 2017 New Revision: 321589 URL: https://svnweb.freebsd.org/changeset/base/321589 Log: - Check the slot type capability, set SDHCI_SLOT_{EMBEDDED,NON_REMOVABLE} for embedded slots. Fail in the sdhci(4) initialization for slot type shared, which is completely unsupported by this driver at the moment. [1] For Intel eMMC controllers, taking the embedded slot type into account obsoltes setting SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE so remove these quirk entries. - Hide the 1.8 V VDD capability when the slot is detected as non-embedded, as the SDHCI specification explicitly states that 1.8 V VDD is applicable to embedded slots only. [2] - Define some easy bits of the SDHCI specification v4.20. [3] - Don't leak bus_dma(9) resources in failure paths of sdhci_init_slot(). Obtained from: DragonFlyBSD 65704a46 [1], 7ba10b88 [2], 0df14648 [3] Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_acpi.c head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Wed Jul 26 21:59:37 2017 (r321588) +++ head/sys/dev/sdhci/sdhci.c Wed Jul 26 22:04:23 2017 (r321589) @@ -742,6 +742,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, BUS_DMA_NOWAIT, &slot->dmamap); if (err != 0) { device_printf(dev, "Can't alloc DMA memory\n"); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); return (err); } @@ -751,6 +752,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, sdhci_getaddr, &slot->paddr, 0); if (err != 0 || slot->paddr == 0) { device_printf(dev, "Can't load DMA memory\n"); + bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); if (err) return (err); @@ -770,6 +773,22 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, else caps2 = 0; } + if (slot->version >= SDHCI_SPEC_300) { + if ((caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_REMOVABLE && + (caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_EMBEDDED) { + device_printf(dev, + "Driver doesn't support shared bus slots\n"); + bus_dmamap_unload(slot->dmatag, slot->dmamap); + bus_dmamem_free(slot->dmatag, slot->dmamem, + slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); + SDHCI_LOCK_DESTROY(slot); + return (ENXIO); + } else if ((caps & SDHCI_SLOTTYPE_MASK) == + SDHCI_SLOTTYPE_EMBEDDED) { + slot->opt |= SDHCI_SLOT_EMBEDDED | SDHCI_NON_REMOVABLE; + } + } /* Calculate base clock frequency. */ if (slot->version >= SDHCI_SPEC_300) freq = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> @@ -819,7 +838,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - if (caps & SDHCI_CAN_VDD_180) + /* 1.8V VDD is not supposed to be used for removable cards. */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { device_printf(dev, "Hardware doesn't report any " @@ -966,20 +986,24 @@ no_tuning: if (bootverbose || sdhci_debug) { slot_printf(slot, - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s\n", + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", - (caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "", + ((caps & SDHCI_CAN_VDD_180) && + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO"); + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : + "removable"); if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) slot_printf(slot, "eMMC:%s%s%s%s\n", Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Wed Jul 26 21:59:37 2017 (r321588) +++ head/sys/dev/sdhci/sdhci.h Wed Jul 26 22:04:23 2017 (r321589) @@ -237,6 +237,11 @@ #define SDHCI_HOST_CONTROL2 0x3E #define SDHCI_CTRL2_PRESET_VALUE 0x8000 #define SDHCI_CTRL2_ASYNC_INTR 0x4000 +#define SDHCI_CTRL2_64BIT_ENABLE 0x2000 +#define SDHCI_CTRL2_HOST_V4_ENABLE 0x1000 +#define SDHCI_CTRL2_CMD23_ENABLE 0x0800 +#define SDHCI_CTRL2_ADMA2_LENGTH_MODE 0x0400 +#define SDHCI_CTRL2_UHS2_IFACE_ENABLE 0x0100 #define SDHCI_CTRL2_SAMPLING_CLOCK 0x0080 #define SDHCI_CTRL2_EXEC_TUNING 0x0040 #define SDHCI_CTRL2_DRIVER_TYPE_MASK 0x0030 @@ -321,6 +326,8 @@ #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 #define SDHCI_SPEC_400 3 +#define SDHCI_SPEC_410 4 +#define SDHCI_SPEC_420 5 SYSCTL_DECL(_hw_sdhci); @@ -342,6 +349,7 @@ struct sdhci_slot { #define SDHCI_TUNING_SUPPORTED 0x08 #define SDHCI_TUNING_ENABLED 0x10 #define SDHCI_SDR50_NEEDS_TUNING 0x20 +#define SDHCI_SLOT_EMBEDDED 0x40 u_char version; int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ Modified: head/sys/dev/sdhci/sdhci_acpi.c ============================================================================== --- head/sys/dev/sdhci/sdhci_acpi.c Wed Jul 26 21:59:37 2017 (r321588) +++ head/sys/dev/sdhci/sdhci_acpi.c Wed Jul 26 22:04:23 2017 (r321589) @@ -58,7 +58,6 @@ static const struct sdhci_acpi_device { u_int quirks; } sdhci_acpi_devices[] = { { "80860F14", 1, "Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -76,7 +75,6 @@ static const struct sdhci_acpi_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { "80865ACC", 0, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | Modified: head/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- head/sys/dev/sdhci/sdhci_pci.c Wed Jul 26 21:59:37 2017 (r321588) +++ head/sys/dev/sdhci/sdhci_pci.c Wed Jul 26 22:04:23 2017 (r321589) @@ -106,7 +106,6 @@ static const struct sdhci_device { { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, { 0x0f148086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -116,14 +115,12 @@ static const struct sdhci_device { SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x0f508086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x22948086, 0xffff, "Intel Braswell eMMC 4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_DATA_TIMEOUT_1MHZ | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | @@ -139,7 +136,6 @@ static const struct sdhci_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x5acc8086, 0xffff, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | From owner-svn-src-all@freebsd.org Wed Jul 26 23:03:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A85ADB2CB0; Wed, 26 Jul 2017 23:03:23 +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 DCC247F136; Wed, 26 Jul 2017 23:03:22 +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 v6QN3MEr036660; Wed, 26 Jul 2017 23:03:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QN3Mr7036659; Wed, 26 Jul 2017 23:03:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262303.v6QN3Mr7036659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:03:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321591 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:03:23 -0000 Author: emaste Date: Wed Jul 26 23:03:21 2017 New Revision: 321591 URL: https://svnweb.freebsd.org/changeset/base/321591 Log: MFC r321218: zfs: Fix a typo in the delay_min_dirty_percent sysctl description The description is FreeBSD-specific and was added in r266497 to fix PR189865. PR: 220825 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 22:32:57 2017 (r321590) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 23:03:21 2017 (r321591) @@ -167,7 +167,7 @@ static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_H SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_min_dirty_percent, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int), sysctl_zfs_delay_min_dirty_percent, "I", - "The limit of outstanding dirty data before transations are delayed"); + "The limit of outstanding dirty data before transactions are delayed"); static int sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS); /* No zfs_delay_scale tunable due to limit requirements */ From owner-svn-src-all@freebsd.org Wed Jul 26 23:05:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31433DB2E16; Wed, 26 Jul 2017 23:05: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 F41AC7F400; Wed, 26 Jul 2017 23:05:26 +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 v6QN5QEf036962; Wed, 26 Jul 2017 23:05:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QN5QYE036961; Wed, 26 Jul 2017 23:05:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262305.v6QN5QYE036961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321592 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:05:27 -0000 Author: emaste Date: Wed Jul 26 23:05:25 2017 New Revision: 321592 URL: https://svnweb.freebsd.org/changeset/base/321592 Log: MFC r321218: zfs: Fix a typo in the delay_min_dirty_percent sysctl description The description is FreeBSD-specific and was added in r266497 to fix PR189865. PR: 220825 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 23:03:21 2017 (r321591) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jul 26 23:05:25 2017 (r321592) @@ -166,7 +166,7 @@ static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_H SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_min_dirty_percent, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int), sysctl_zfs_delay_min_dirty_percent, "I", - "The limit of outstanding dirty data before transations are delayed"); + "The limit of outstanding dirty data before transactions are delayed"); static int sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS); /* No zfs_delay_scale tunable due to limit requirements */ From owner-svn-src-all@freebsd.org Wed Jul 26 23:14:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 112A1DB3192; Wed, 26 Jul 2017 23:14:23 +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 D118E7FB1E; Wed, 26 Jul 2017 23:14:22 +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 v6QNEMiw041503; Wed, 26 Jul 2017 23:14:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QNEMmV041502; Wed, 26 Jul 2017 23:14:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262314.v6QNEMmV041502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321593 - stable/11/sys/libkern/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/libkern/arm64 X-SVN-Commit-Revision: 321593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:14:23 -0000 Author: emaste Date: Wed Jul 26 23:14:21 2017 New Revision: 321593 URL: https://svnweb.freebsd.org/changeset/base/321593 Log: MFC r319718: arm64: add ".arch armv8-a+crc" to allow use of crc instructions With Clang 5.0 the .arch directive is required, otherwise Clang complains "error: instruction requires: crc". This was reported in D10499 but not added initially, because clang 3.8 available on a ref machine reported unknown directive. Clang 4.0 allows but does not require the directive. Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/libkern/arm64/crc32c_armv8.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/libkern/arm64/crc32c_armv8.S ============================================================================== --- stable/11/sys/libkern/arm64/crc32c_armv8.S Wed Jul 26 23:05:25 2017 (r321592) +++ stable/11/sys/libkern/arm64/crc32c_armv8.S Wed Jul 26 23:14:21 2017 (r321593) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +.arch armv8-a+crc /* * uint32_t From owner-svn-src-all@freebsd.org Wed Jul 26 23:18:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABD77DB32BD; Wed, 26 Jul 2017 23:18:15 +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 72A727FD39; Wed, 26 Jul 2017 23:18:15 +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 v6QNIEsJ041685; Wed, 26 Jul 2017 23:18:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QNIEJ5041684; Wed, 26 Jul 2017 23:18:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262318.v6QNIEJ5041684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321594 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 321594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:18:15 -0000 Author: emaste Date: Wed Jul 26 23:18:14 2017 New Revision: 321594 URL: https://svnweb.freebsd.org/changeset/base/321594 Log: MFC r312857: Use cross-NM (XNM) in compat32 build An attempt to build mips64 using external toolchain failed as it tried to use the host amd64 nm. Modified: stable/11/Makefile.libcompat Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.libcompat ============================================================================== --- stable/11/Makefile.libcompat Wed Jul 26 23:14:21 2017 (r321593) +++ stable/11/Makefile.libcompat Wed Jul 26 23:18:14 2017 (r321594) @@ -34,6 +34,8 @@ LIB32WMAKEFLAGS= \ OBJCOPY="${XOBJCOPY}" .endif +LIB32WMAKEFLAGS+= NM="${XNM}" + LIB32CFLAGS= -m32 -DCOMPAT_32BIT LIB32DTRACE= ${DTRACE} -32 From owner-svn-src-all@freebsd.org Wed Jul 26 23:21:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BA8FDB346B; Wed, 26 Jul 2017 23:21:30 +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 0A70E80048; Wed, 26 Jul 2017 23:21:29 +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 v6QNLT2D043369; Wed, 26 Jul 2017 23:21:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QNLTRO043354; Wed, 26 Jul 2017 23:21:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262321.v6QNLTRO043354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321595 - stable/11/usr.sbin/makefs X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/makefs X-SVN-Commit-Revision: 321595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:21:30 -0000 Author: emaste Date: Wed Jul 26 23:21:28 2017 New Revision: 321595 URL: https://svnweb.freebsd.org/changeset/base/321595 Log: MFC r316055: makefs: sort roundup with the other off_t members in fsinfo_t Modified: stable/11/usr.sbin/makefs/makefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/makefs/makefs.h ============================================================================== --- stable/11/usr.sbin/makefs/makefs.h Wed Jul 26 23:18:14 2017 (r321594) +++ stable/11/usr.sbin/makefs/makefs.h Wed Jul 26 23:21:28 2017 (r321595) @@ -124,13 +124,13 @@ typedef struct { off_t minsize; /* minimum size image should be */ off_t maxsize; /* maximum size image can be */ off_t freefiles; /* free file entries to leave */ - int freefilepc; /* free file % */ off_t freeblocks; /* free blocks to leave */ + off_t roundup; /* round image size up to this value */ + int freefilepc; /* free file % */ int freeblockpc; /* free block % */ int needswap; /* non-zero if byte swapping needed */ int sectorsize; /* sector size */ int sparse; /* sparse image, don't fill it with zeros */ - off_t roundup; /* round image size up to this value */ void *fs_specific; /* File system specific additions. */ } fsinfo_t; From owner-svn-src-all@freebsd.org Wed Jul 26 23:23:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22720DB350F; Wed, 26 Jul 2017 23:23:35 +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 E4A51802AA; Wed, 26 Jul 2017 23:23:34 +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 v6QNNXjh045503; Wed, 26 Jul 2017 23:23:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6QNNXix045501; Wed, 26 Jul 2017 23:23:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707262323.v6QNNXix045501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Jul 2017 23:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321596 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 321596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 23:23:35 -0000 Author: emaste Date: Wed Jul 26 23:23:33 2017 New Revision: 321596 URL: https://svnweb.freebsd.org/changeset/base/321596 Log: MFC r319513: linux vdso: pass -fPIC to the assembler, not linker -fPIC has no effect on linking although it seems to be ignored by GNU ld.bfd. However, it causes ld.lld to terminate with an invalid argument error. This is equivalent to r296057 but for the kernel (not modules) case. Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Wed Jul 26 23:21:28 2017 (r321595) +++ stable/11/sys/conf/files.amd64 Wed Jul 26 23:23:33 2017 (r321596) @@ -46,7 +46,7 @@ linux32_assym.h optional compat_linux32 \ # linux32_locore.o optional compat_linux32 \ dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.s" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux32_locore.o" # Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Wed Jul 26 23:21:28 2017 (r321595) +++ stable/11/sys/conf/files.i386 Wed Jul 26 23:23:33 2017 (r321596) @@ -33,7 +33,7 @@ linux_assym.h optional compat_linux \ # linux_locore.o optional compat_linux \ dependency "linux_assym.h $S/i386/linux/linux_locore.s" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux_locore.o" # From owner-svn-src-all@freebsd.org Thu Jul 27 00:04:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDFECDB444E; Thu, 27 Jul 2017 00:04:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3232816A5; Thu, 27 Jul 2017 00:04:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6R049Fg061625; Thu, 27 Jul 2017 00:04:09 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R049ee061624; Thu, 27 Jul 2017 00:04:09 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707270004.v6R049ee061624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jul 2017 00:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321597 - stable/10/usr.sbin/nfsd X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/10/usr.sbin/nfsd X-SVN-Commit-Revision: 321597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 00:04:11 -0000 Author: rmacklem Date: Thu Jul 27 00:04:09 2017 New Revision: 321597 URL: https://svnweb.freebsd.org/changeset/base/321597 Log: MFC: r321248 Update the nfsv4 man page to reflect recent changes to support the newer RFCs (5661 and 7530). The main man changes are for the case of "numbers in strings" for user/groups that RFC7530 allows and avoids use of nfsuserd(8). This is a content change. Modified: stable/10/usr.sbin/nfsd/nfsv4.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/nfsd/nfsv4.4 ============================================================================== --- stable/10/usr.sbin/nfsd/nfsv4.4 Wed Jul 26 23:23:33 2017 (r321596) +++ stable/10/usr.sbin/nfsd/nfsv4.4 Thu Jul 27 00:04:09 2017 (r321597) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2013 +.Dd July 19, 2017 .Dt NFSV4 4 .Os .Sh NAME @@ -34,7 +34,8 @@ The NFS client and server provides support for the .Tn NFSv4 specification; see -.%T "Network File System (NFS) Version 4 Protocol RFC 3530" . +.%T "Network File System (NFS) Version 4 Protocol RFC 7530" and +.%T "Network File System (NFS) Version 4 Minor Version 1 Protocol RFC 5661" . The protocol is somewhat similar to NFS Version 3, but differs in significant ways. It uses a single compound RPC that concatenates operations to-gether. @@ -74,6 +75,7 @@ It provides several optional features not present in N - Referrals, which redirect subtrees to other servers (not yet implemented) - Delegations, which allow a client to operate on a file locally +- pNFS, where I/O operations are separated from Metadata operations .Ed .Pp The @@ -115,8 +117,8 @@ multiple server file systems, although not all clients this. .Pp .Nm -uses names for users and groups instead of numbers. -On the wire, they +uses strings for users and groups instead of numbers. +On the wire, these strings can either have the numbers in the string or take the form: .sp .Bd -literal -offset indent -compact @@ -136,15 +138,37 @@ Under FreeBSD, the mapping daemon is called .Xr nfsuserd 8 and has a command line option that overrides the domain component of the machine's hostname. -For use of +For use of this form of string on .Nm , either client or server, this daemon must be running. -If this ``'' is not set correctly or the daemon is not running, ``ls -l'' will typically +.Pp +The form where the numbers are in the strings can only be used for AUTH_SYS. +To configure your systems this way, the +.Xr nfsuserd 8 +daemon does not need to be running on the server, but the following sysctls need to be +set to 1 on the server. +.sp +.Bd -literal -offset indent -compact +vfs.nfs.enable_uidtostring +vfs.nfsd.enable_stringtouid +.Ed +.sp +On the client, the sysctl +.sp +.Bd -literal -offset indent -compact +vfs.nfs.enable_uidtostring +.Ed +.sp +must be set to 1 and the +.Xr nfsuserd 8 +daemon does not need to be running. +.Pp +If these strings are not configured correctly, ``ls -l'' will typically report a lot of ``nobody'' and ``nogroup'' ownerships. .Pp Although uid/gid numbers are no longer used in the .Nm -protocol, they will still be in the RPC authentication fields when +protocol except optionally in the above strings, they will still be in the RPC authentication fields when using AUTH_SYS (sec=sys), which is the default. As such, in this case both the user/group name and number spaces must be consistent between the client and server. @@ -156,24 +180,24 @@ will go on the wire. .Sh SERVER SETUP To set up the NFS server that supports .Nm , -you will need to either set the variables in +you will need to set the variables in .Xr rc.conf 5 as follows: .sp .Bd -literal -offset indent -compact nfs_server_enable="YES" nfsv4_server_enable="YES" +.Ed +.sp +plus +.sp +.Bd -literal -offset indent -compact nfsuserd_enable="YES" .Ed .sp -or start -.Xr mountd 8 -and -.Xr nfsd 8 -without the ``-o'' option, which would force use of the old server. -The -.Xr nfsuserd 8 -daemon must also be running. +if the server is using the ``@'' form of user/group strings or +is using the ``-manage-gids'' option for +.Xr nfsuserd 8 . .Pp You will also need to add at least one ``V4:'' line to the .Xr exports 5 @@ -232,7 +256,7 @@ plus set ``tcp'' and .Pp The .Xr nfsuserd 8 -must be running, as above. +must be running if name<->uid/gid mapping is being used, as above. Also, since an .Nm mount uses the host uuid to identify the client uniquely to the server, @@ -255,7 +279,7 @@ daemon to handle client side callbacks. This will occur if .sp .Bd -literal -offset indent -compact -nfsuserd_enable="YES" +nfsuserd_enable="YES" <-- If name<->uid/gid mapping is being used. nfscbd_enable="YES" .Ed .sp @@ -265,7 +289,7 @@ are set in Without a functioning callback path, a server will never issue Delegations to a client. .sp -By default, the callback address will be set to the IP address acquired via +For NFSv4.0, by default, the callback address will be set to the IP address acquired via rtalloc() in the kernel and port# 7745. To override the default port#, a command line option for .Xr nfscbd 8 @@ -281,6 +305,10 @@ N.N.N.N.N.N .sp where the first 4 Ns are the host IP address and the last two are the port# in network byte order (all decimal #s in the range 0-255). +.Pp +For NFSv4.1, the callback path (called a backchannel) uses the same TCP connection as the mount, +so none of the above applies and should work through gateways without +any issues. .Pp To build a kernel with the client that supports .Nm From owner-svn-src-all@freebsd.org Thu Jul 27 00:14:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE208DB4736; Thu, 27 Jul 2017 00:14:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A56381AB0; Thu, 27 Jul 2017 00:14:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6R0E86t065519; Thu, 27 Jul 2017 00:14:08 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R0E8DP065518; Thu, 27 Jul 2017 00:14:08 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707270014.v6R0E8DP065518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jul 2017 00:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321598 - stable/11/usr.sbin/nfsd X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/usr.sbin/nfsd X-SVN-Commit-Revision: 321598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 00:14:09 -0000 Author: rmacklem Date: Thu Jul 27 00:14:08 2017 New Revision: 321598 URL: https://svnweb.freebsd.org/changeset/base/321598 Log: MFC: r321248 Update the nfsv4 man page to reflect recent changes to support the newer RFCs (5661 and 7530). The main man changes are for the case of "numbers in strings" for user/groups that RFC7530 allows and avoids use of nfsuserd(8). This is a content change. Modified: stable/11/usr.sbin/nfsd/nfsv4.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nfsd/nfsv4.4 ============================================================================== --- stable/11/usr.sbin/nfsd/nfsv4.4 Thu Jul 27 00:04:09 2017 (r321597) +++ stable/11/usr.sbin/nfsd/nfsv4.4 Thu Jul 27 00:14:08 2017 (r321598) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2013 +.Dd July 19, 2017 .Dt NFSV4 4 .Os .Sh NAME @@ -34,7 +34,8 @@ The NFS client and server provides support for the .Tn NFSv4 specification; see -.%T "Network File System (NFS) Version 4 Protocol RFC 3530" . +.%T "Network File System (NFS) Version 4 Protocol RFC 7530" and +.%T "Network File System (NFS) Version 4 Minor Version 1 Protocol RFC 5661" . The protocol is somewhat similar to NFS Version 3, but differs in significant ways. It uses a single compound RPC that concatenates operations to-gether. @@ -74,6 +75,7 @@ It provides several optional features not present in N - Referrals, which redirect subtrees to other servers (not yet implemented) - Delegations, which allow a client to operate on a file locally +- pNFS, where I/O operations are separated from Metadata operations .Ed .Pp The @@ -115,8 +117,8 @@ multiple server file systems, although not all clients this. .Pp .Nm -uses names for users and groups instead of numbers. -On the wire, they +uses strings for users and groups instead of numbers. +On the wire, these strings can either have the numbers in the string or take the form: .sp .Bd -literal -offset indent -compact @@ -136,15 +138,37 @@ Under FreeBSD, the mapping daemon is called .Xr nfsuserd 8 and has a command line option that overrides the domain component of the machine's hostname. -For use of +For use of this form of string on .Nm , either client or server, this daemon must be running. -If this ``'' is not set correctly or the daemon is not running, ``ls -l'' will typically +.Pp +The form where the numbers are in the strings can only be used for AUTH_SYS. +To configure your systems this way, the +.Xr nfsuserd 8 +daemon does not need to be running on the server, but the following sysctls need to be +set to 1 on the server. +.sp +.Bd -literal -offset indent -compact +vfs.nfs.enable_uidtostring +vfs.nfsd.enable_stringtouid +.Ed +.sp +On the client, the sysctl +.sp +.Bd -literal -offset indent -compact +vfs.nfs.enable_uidtostring +.Ed +.sp +must be set to 1 and the +.Xr nfsuserd 8 +daemon does not need to be running. +.Pp +If these strings are not configured correctly, ``ls -l'' will typically report a lot of ``nobody'' and ``nogroup'' ownerships. .Pp Although uid/gid numbers are no longer used in the .Nm -protocol, they will still be in the RPC authentication fields when +protocol except optionally in the above strings, they will still be in the RPC authentication fields when using AUTH_SYS (sec=sys), which is the default. As such, in this case both the user/group name and number spaces must be consistent between the client and server. @@ -156,24 +180,24 @@ will go on the wire. .Sh SERVER SETUP To set up the NFS server that supports .Nm , -you will need to either set the variables in +you will need to set the variables in .Xr rc.conf 5 as follows: .sp .Bd -literal -offset indent -compact nfs_server_enable="YES" nfsv4_server_enable="YES" +.Ed +.sp +plus +.sp +.Bd -literal -offset indent -compact nfsuserd_enable="YES" .Ed .sp -or start -.Xr mountd 8 -and -.Xr nfsd 8 -without the ``-o'' option, which would force use of the old server. -The -.Xr nfsuserd 8 -daemon must also be running. +if the server is using the ``@'' form of user/group strings or +is using the ``-manage-gids'' option for +.Xr nfsuserd 8 . .Pp You will also need to add at least one ``V4:'' line to the .Xr exports 5 @@ -232,7 +256,7 @@ plus set ``tcp'' and .Pp The .Xr nfsuserd 8 -must be running, as above. +must be running if name<->uid/gid mapping is being used, as above. Also, since an .Nm mount uses the host uuid to identify the client uniquely to the server, @@ -255,7 +279,7 @@ daemon to handle client side callbacks. This will occur if .sp .Bd -literal -offset indent -compact -nfsuserd_enable="YES" +nfsuserd_enable="YES" <-- If name<->uid/gid mapping is being used. nfscbd_enable="YES" .Ed .sp @@ -265,7 +289,7 @@ are set in Without a functioning callback path, a server will never issue Delegations to a client. .sp -By default, the callback address will be set to the IP address acquired via +For NFSv4.0, by default, the callback address will be set to the IP address acquired via rtalloc() in the kernel and port# 7745. To override the default port#, a command line option for .Xr nfscbd 8 @@ -281,6 +305,10 @@ N.N.N.N.N.N .sp where the first 4 Ns are the host IP address and the last two are the port# in network byte order (all decimal #s in the range 0-255). +.Pp +For NFSv4.1, the callback path (called a backchannel) uses the same TCP connection as the mount, +so none of the above applies and should work through gateways without +any issues. .Pp To build a kernel with the client that supports .Nm From owner-svn-src-all@freebsd.org Thu Jul 27 00:25:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4526DB4A8C; Thu, 27 Jul 2017 00:25:53 +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 93314820DA; Thu, 27 Jul 2017 00:25:53 +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 v6R0PqM7069989; Thu, 27 Jul 2017 00:25:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R0Pqp5069988; Thu, 27 Jul 2017 00:25:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707270025.v6R0Pqp5069988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 00:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321599 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 321599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 00:25:53 -0000 Author: emaste Date: Thu Jul 27 00:25:52 2017 New Revision: 321599 URL: https://svnweb.freebsd.org/changeset/base/321599 Log: MFC r321302: add arm64 objcopy output target for embedfs PR: 220877 Submitted by: David NewHamlet Modified: stable/11/sys/conf/kern.pre.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/kern.pre.mk ============================================================================== --- stable/11/sys/conf/kern.pre.mk Thu Jul 27 00:14:08 2017 (r321598) +++ stable/11/sys/conf/kern.pre.mk Thu Jul 27 00:25:52 2017 (r321599) @@ -237,6 +237,7 @@ EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/ EMBEDFS_FORMAT.arm?= elf32-littlearm EMBEDFS_FORMAT.armv6?= elf32-littlearm +EMBEDFS_FORMAT.aarch64?= elf64-littleaarch64 EMBEDFS_FORMAT.mips?= elf32-tradbigmips EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips EMBEDFS_FORMAT.mips64?= elf64-tradbigmips From owner-svn-src-all@freebsd.org Thu Jul 27 00:29:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2C9BDB4B8E; Thu, 27 Jul 2017 00:29:04 +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 BE2CC8225B; Thu, 27 Jul 2017 00:29:04 +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 v6R0T3T2070157; Thu, 27 Jul 2017 00:29:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R0T32S070156; Thu, 27 Jul 2017 00:29:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707270029.v6R0T32S070156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 00:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321600 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 321600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 00:29:05 -0000 Author: emaste Date: Thu Jul 27 00:29:03 2017 New Revision: 321600 URL: https://svnweb.freebsd.org/changeset/base/321600 Log: MFC r321294: acpidump: use C99 designated initializers Submitted by: Guangyuan Yang Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 00:25:52 2017 (r321599) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 00:29:03 2017 (r321600) @@ -388,16 +388,25 @@ acpi_print_local_nmi(u_int lint, uint16_t mps_flags) acpi_print_mps_flags(mps_flags); } -static const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override", - "NMI", "Local APIC NMI", - "Local APIC Override", "IO SAPIC", - "Local SAPIC", "Platform Interrupt", - "Local X2APIC", "Local X2APIC NMI", - "GIC CPU Interface Structure", - "GIC Distributor Structure", - "GICv2m MSI Frame", - "GIC Redistributor Structure", - "GIC ITS Structure" }; +static const char *apic_types[] = { + [ACPI_MADT_TYPE_LOCAL_APIC] = "Local APIC", + [ACPI_MADT_TYPE_IO_APIC] = "IO APIC", + [ACPI_MADT_TYPE_INTERRUPT_OVERRIDE] = "INT Override", + [ACPI_MADT_TYPE_NMI_SOURCE] = "NMI", + [ACPI_MADT_TYPE_LOCAL_APIC_NMI] = "Local APIC NMI", + [ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE] = "Local APIC Override", + [ACPI_MADT_TYPE_IO_SAPIC] = "IO SAPIC", + [ACPI_MADT_TYPE_LOCAL_SAPIC] = "Local SAPIC", + [ACPI_MADT_TYPE_INTERRUPT_SOURCE] = "Platform Interrupt", + [ACPI_MADT_TYPE_LOCAL_X2APIC] = "Local X2APIC", + [ACPI_MADT_TYPE_LOCAL_X2APIC_NMI] = "Local X2APIC NMI", + [ACPI_MADT_TYPE_GENERIC_INTERRUPT] = "GIC CPU Interface Structure", + [ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR] = "GIC Distributor Structure", + [ACPI_MADT_TYPE_GENERIC_MSI_FRAME] = "GICv2m MSI Frame", + [ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR] = "GIC Redistributor Structure", + [ACPI_MADT_TYPE_GENERIC_TRANSLATOR] = "GIC ITS Structure" +}; + static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT", "Corrected Platform Error" }; @@ -1072,7 +1081,12 @@ acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp) printf("\tProximity Domain=%d\n", mp->ProximityDomain); } -static const char *srat_types[] = { "CPU", "Memory", "X2APIC", "GICC" }; +static const char *srat_types[] = { + [ACPI_SRAT_TYPE_CPU_AFFINITY] = "CPU", + [ACPI_SRAT_TYPE_MEMORY_AFFINITY] = "Memory", + [ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY] = "X2APIC", + [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC" +}; static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat) From owner-svn-src-all@freebsd.org Thu Jul 27 00:30:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93B6DDB4C16; Thu, 27 Jul 2017 00:30:14 +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 62C4C82390; Thu, 27 Jul 2017 00:30:14 +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 v6R0UD1I070272; Thu, 27 Jul 2017 00:30:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R0UDhZ070271; Thu, 27 Jul 2017 00:30:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707270030.v6R0UDhZ070271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 00:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321601 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 321601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 00:30:14 -0000 Author: emaste Date: Thu Jul 27 00:30:13 2017 New Revision: 321601 URL: https://svnweb.freebsd.org/changeset/base/321601 Log: MFC r321299: acpidump: add GIC ITS srat type From ACPI 6.2, 5.2.16.5 Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 00:29:03 2017 (r321600) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 00:30:13 2017 (r321601) @@ -1085,7 +1085,8 @@ static const char *srat_types[] = { [ACPI_SRAT_TYPE_CPU_AFFINITY] = "CPU", [ACPI_SRAT_TYPE_MEMORY_AFFINITY] = "Memory", [ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY] = "X2APIC", - [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC" + [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC", + [ACPI_SRAT_TYPE_GIC_ITS_AFFINITY] = "GIC ITS", }; static void From owner-svn-src-all@freebsd.org Thu Jul 27 02:38:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 044F2DBEDB8; Thu, 27 Jul 2017 02:38:55 +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 BC48E632B9; Thu, 27 Jul 2017 02:38:54 +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 v6R2crpd023017; Thu, 27 Jul 2017 02:38:53 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R2crwW023015; Thu, 27 Jul 2017 02:38:53 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201707270238.v6R2crwW023015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 27 Jul 2017 02:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321602 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/dev/etherswitch/e6000sw X-SVN-Commit-Revision: 321602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 02:38:55 -0000 Author: loos Date: Thu Jul 27 02:38:53 2017 New Revision: 321602 URL: https://svnweb.freebsd.org/changeset/base/321602 Log: Fix the port vlan support in e6000 based switches. Reduce the use of local copies of switch register data. The switch now works with the upstream dsa node (i.e. the upstream DTS). Tested on: ClearFog Pro (88E6176), SG-3100 (88E6141) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c head/sys/dev/etherswitch/e6000sw/e6000swreg.h Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Thu Jul 27 00:30:13 2017 (r321601) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Thu Jul 27 02:38:53 2017 (r321602) @@ -72,6 +72,7 @@ typedef struct e6000sw_softc { struct proc *kproc; uint32_t swid; + uint32_t vlan_mode; uint32_t cpuports_mask; uint32_t fixed_mask; uint32_t fixed25_mask; @@ -80,15 +81,11 @@ typedef struct e6000sw_softc { int sw_addr; int num_ports; boolean_t multi_chip; - - int vid[E6000SW_NUM_VGROUPS]; - int members[E6000SW_NUM_VGROUPS]; - int vgroup[E6000SW_MAX_PORTS]; } e6000sw_softc_t; static etherswitch_info_t etherswitch_info = { .es_nports = 0, - .es_nvlangroups = E6000SW_NUM_VGROUPS, + .es_nvlangroups = 0, .es_vlan_caps = ETHERSWITCH_VLAN_PORT, .es_name = "Marvell 6000 series switch" }; @@ -263,15 +260,14 @@ e6000sw_probe(device_t dev) } static int -e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport, - int *pvlangroup) +e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport) { char *name, *portlabel; int speed; phandle_t fixed_link; - uint32_t port, vlangroup; + uint32_t port; - if (pport == NULL || pvlangroup == NULL) + if (pport == NULL) return (ENXIO); if (OF_getencprop(child, "reg", (void *)&port, sizeof(port)) < 0) @@ -280,15 +276,6 @@ e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t return (ENXIO); *pport = port; - if (OF_getencprop(child, "vlangroup", (void *)&vlangroup, - sizeof(vlangroup)) > 0) { - if (vlangroup >= E6000SW_NUM_VGROUPS) - return (ENXIO); - *pvlangroup = vlangroup; - } else { - *pvlangroup = -1; - } - if (OF_getprop_alloc(child, "label", 1, (void **)&portlabel) > 0) { if (strncmp(portlabel, "cpu", 3) == 0) { device_printf(sc->dev, "CPU port at %d\n", port); @@ -364,11 +351,9 @@ e6000sw_attach_miibus(e6000sw_softc_t *sc, int port) static int e6000sw_attach(device_t dev) { - etherswitch_vlangroup_t vg; e6000sw_softc_t *sc; phandle_t child; - int err, port, vlangroup; - int member_ports[E6000SW_NUM_VGROUPS]; + int err, port; uint32_t reg; err = 0; @@ -383,18 +368,14 @@ e6000sw_attach(device_t dev) E6000SW_LOCK(sc); e6000sw_setup(dev, sc); - bzero(member_ports, sizeof(member_ports)); for (child = OF_child(sc->node); child != 0; child = OF_peer(child)) { - err = e6000sw_parse_child_fdt(sc, child, &port, &vlangroup); + err = e6000sw_parse_child_fdt(sc, child, &port); if (err != 0) { device_printf(sc->dev, "failed to parse DTS\n"); goto out_fail; } - if (vlangroup != -1) - member_ports[vlangroup] |= (1 << port); - /* Port is in use. */ sc->ports_mask |= (1 << port); @@ -440,21 +421,9 @@ e6000sw_attach(device_t dev) } etherswitch_info.es_nports = sc->num_ports; - for (port = 0; port < sc->num_ports; port++) - sc->vgroup[port] = E6000SW_PORT_NO_VGROUP; - /* Set VLAN configuration */ + /* Default to port vlan. */ e6000sw_port_vlan_conf(sc); - - /* Set vlangroups */ - for (vlangroup = 0; vlangroup < E6000SW_NUM_VGROUPS; vlangroup++) - if (member_ports[vlangroup] != 0) { - vg.es_vlangroup = vg.es_vid = vlangroup; - vg.es_member_ports = vg.es_untagged_ports = - member_ports[vlangroup]; - e6000sw_setvgroup(dev, &vg); - } - E6000SW_UNLOCK(sc); bus_generic_probe(dev); @@ -597,12 +566,14 @@ e6000sw_getinfo(device_t dev) } static int -e6000sw_getconf(device_t dev __unused, etherswitch_conf_t *conf) +e6000sw_getconf(device_t dev, etherswitch_conf_t *conf) { + struct e6000sw_softc *sc; /* Return the VLAN mode. */ + sc = device_get_softc(dev); conf->cmd = ETHERSWITCH_CONF_VLAN_MODE; - conf->vlan_mode = ETHERSWITCH_VLAN_PORT; + conf->vlan_mode = sc->vlan_mode; return (0); } @@ -808,67 +779,79 @@ e6000sw_getvgroup_wrapper(device_t dev, etherswitch_vl } static __inline void -e6000sw_flush_port(e6000sw_softc_t *sc, int port) +e6000sw_port_vlan_assign(e6000sw_softc_t *sc, int port, uint32_t fid, + uint32_t members) { uint32_t reg; reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); reg &= ~PORT_VLAN_MAP_TABLE_MASK; reg &= ~PORT_VLAN_MAP_FID_MASK; + reg |= members & PORT_VLAN_MAP_TABLE_MASK & ~(1 << port); + reg |= (fid << PORT_VLAN_MAP_FID) & PORT_VLAN_MAP_FID_MASK; e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg); - if (sc->vgroup[port] != E6000SW_PORT_NO_VGROUP) { - /* - * If port belonged somewhere, owner-group - * should have its entry removed. - */ - sc->members[sc->vgroup[port]] &= ~(1 << port); - sc->vgroup[port] = E6000SW_PORT_NO_VGROUP; - } + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL_1); + reg &= ~PORT_CONTROL_1_FID_MASK; + reg |= (fid >> 4) & PORT_CONTROL_1_FID_MASK; + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL_1, reg); } -static __inline void -e6000sw_port_assign_vgroup(e6000sw_softc_t *sc, int port, int fid, int vgroup, - int members) +static int +e6000sw_set_port_vlan(e6000sw_softc_t *sc, etherswitch_vlangroup_t *vg) { - uint32_t reg; + uint32_t port; - reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); - reg &= ~PORT_VLAN_MAP_TABLE_MASK; - reg &= ~PORT_VLAN_MAP_FID_MASK; - reg |= members & ~(1 << port); - reg |= (fid << PORT_VLAN_MAP_FID) & PORT_VLAN_MAP_FID_MASK; - e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg); - sc->vgroup[port] = vgroup; + port = vg->es_vlangroup; + if (port > sc->num_ports) + return (EINVAL); + + if (vg->es_member_ports != vg->es_untagged_ports) { + device_printf(sc->dev, "Tagged ports not supported.\n"); + return (EINVAL); + } + + e6000sw_port_vlan_assign(sc, port, port + 1, vg->es_untagged_ports); + vg->es_vid = port | ETHERSWITCH_VID_VALID; + + return (0); } static int e6000sw_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) { e6000sw_softc_t *sc; - int port, fid; sc = device_get_softc(dev); E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - if (vg->es_vlangroup >= E6000SW_NUM_VGROUPS) + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) + return (e6000sw_set_port_vlan(sc, vg)); + + return (EINVAL); +} + +static int +e6000sw_get_port_vlan(e6000sw_softc_t *sc, etherswitch_vlangroup_t *vg) +{ + uint32_t port, reg; + + port = vg->es_vlangroup; + if (port > sc->num_ports) return (EINVAL); - if (vg->es_member_ports != vg->es_untagged_ports) { - device_printf(dev, "Tagged ports not supported.\n"); - return (EINVAL); - } - vg->es_untagged_ports &= PORT_VLAN_MAP_TABLE_MASK; - fid = vg->es_vlangroup + 1; - for (port = 0; port < sc->num_ports; port++) { - if ((sc->members[sc->vgroup[port]] & (1 << port))) - e6000sw_flush_port(sc, port); - if (vg->es_untagged_ports & (1 << port)) - e6000sw_port_assign_vgroup(sc, port, fid, - vg->es_vlangroup, vg->es_untagged_ports); + if (!e6000sw_is_portenabled(sc, port)) { + vg->es_vid = port; + return (0); } - sc->vid[vg->es_vlangroup] = vg->es_vid; - sc->members[vg->es_vlangroup] = vg->es_untagged_ports; + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); + vg->es_untagged_ports = vg->es_member_ports = + reg & PORT_VLAN_MAP_TABLE_MASK; + vg->es_vid = port | ETHERSWITCH_VID_VALID; + vg->es_fid = (reg & PORT_VLAN_MAP_FID_MASK) >> PORT_VLAN_MAP_FID; + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL_1); + vg->es_fid |= (reg & PORT_CONTROL_1_FID_MASK) << 4; + return (0); } @@ -880,14 +863,10 @@ e6000sw_getvgroup(device_t dev, etherswitch_vlangroup_ sc = device_get_softc(dev); E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - if (vg->es_vlangroup >= E6000SW_NUM_VGROUPS) - return (EINVAL); - vg->es_untagged_ports = vg->es_member_ports = - sc->members[vg->es_vlangroup]; - if (vg->es_untagged_ports != 0) - vg->es_vid = ETHERSWITCH_VID_VALID; + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) + return (e6000sw_get_port_vlan(sc, vg)); - return (0); + return (EINVAL); } static __inline struct mii_data* @@ -1172,10 +1151,9 @@ e6000sw_setup(device_t dev, e6000sw_softc_t *sc) static void e6000sw_port_vlan_conf(e6000sw_softc_t *sc) { - int port, ret; - device_t dev; + int i, port, ret; + uint32_t members; - dev = sc->dev; /* Disable all ports */ for (port = 0; port < sc->num_ports; port++) { ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); @@ -1207,8 +1185,23 @@ e6000sw_port_vlan_conf(e6000sw_softc_t *sc) if (!e6000sw_is_portenabled(sc, port)) continue; ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); - e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, (ret | - PORT_CONTROL_ENABLE)); + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, + (ret | PORT_CONTROL_ENABLE)); + } + + /* Set VLAN mode. */ + sc->vlan_mode = ETHERSWITCH_VLAN_PORT; + etherswitch_info.es_nvlangroups = sc->num_ports; + for (port = 0; port < sc->num_ports; port++) { + members = 0; + if (e6000sw_is_portenabled(sc, port)) { + for (i = 0; i < sc->num_ports; i++) { + if (i == port || !e6000sw_is_portenabled(sc, i)) + continue; + members |= (1 << i); + } + } + e6000sw_port_vlan_assign(sc, port, port + 1, members); } } Modified: head/sys/dev/etherswitch/e6000sw/e6000swreg.h ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000swreg.h Thu Jul 27 00:30:13 2017 (r321601) +++ head/sys/dev/etherswitch/e6000sw/e6000swreg.h Thu Jul 27 02:38:53 2017 (r321602) @@ -87,6 +87,7 @@ struct atu_opt { #define SWITCH_ID 0x3 #define PORT_CONTROL 0x4 #define PORT_CONTROL_1 0x5 +#define PORT_CONTROL_1_FID_MASK 0xf #define PORT_VLAN_MAP 0x6 #define PORT_VID 0x7 #define PORT_ASSOCIATION_VECTOR 0xb @@ -104,6 +105,7 @@ struct atu_opt { #define PORT_VLAN_MAP_TABLE_MASK 0x7f #define PORT_VLAN_MAP_FID 12 #define PORT_VLAN_MAP_FID_MASK 0xf000 + /* * Switch Global Register 1 accessed via REG_GLOBAL_ADDR */ @@ -201,9 +203,7 @@ struct atu_opt { #define SCR_AND_MISC_DATA_CFG_MASK 0xf0 #define E6000SW_NUM_PHY_REGS 29 -#define E6000SW_NUM_VGROUPS 8 -#define E6000SW_MAX_PORTS 10 -#define E6000SW_PORT_NO_VGROUP -1 +#define E6000SW_MAX_PORTS 8 #define E6000SW_DEFAULT_AGETIME 20 #define E6000SW_RETRIES 100 #define E6000SW_SMI_TIMEOUT 16 From owner-svn-src-all@freebsd.org Thu Jul 27 02:53:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87949DBF43D; Thu, 27 Jul 2017 02:53:19 +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 5658363B3C; Thu, 27 Jul 2017 02:53:19 +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 v6R2rIEU031084; Thu, 27 Jul 2017 02:53:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R2rIrD031083; Thu, 27 Jul 2017 02:53:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707270253.v6R2rIrD031083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 02:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321603 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 321603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 02:53:19 -0000 Author: emaste Date: Thu Jul 27 02:53:18 2017 New Revision: 321603 URL: https://svnweb.freebsd.org/changeset/base/321603 Log: uart: add AX99100 chipset support PR: 215837 Submitted by: joe@thrallingpenguin.com MFC after: 2 weeks Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Thu Jul 27 02:38:53 2017 (r321602) +++ head/sys/dev/uart/uart_bus_pci.c Thu Jul 27 02:53:18 2017 (r321603) @@ -88,6 +88,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x103c, 0x3301, 0xffff, 0, "HP iLO serial port", 0x10 }, { 0x11c1, 0x0480, 0xffff, 0, "Agere Systems Venus Modem (V90, 56KFlex)", 0x14 }, { 0x115d, 0x0103, 0xffff, 0, "Xircom Cardbus Ethernet + 56k Modem", 0x10 }, +{ 0x125b, 0x9100, 0xa000, 0x1000, + "ASIX AX99100 PCIe 1/2/3/4-port RS-232/422/485", 0x10 }, { 0x1282, 0x6585, 0xffff, 0, "Davicom 56PDV PCI Modem", 0x10 }, { 0x12b9, 0x1008, 0xffff, 0, "3Com 56K FaxModem Model 5610", 0x10 }, { 0x131f, 0x1000, 0xffff, 0, "Siig CyberSerial (1-port) 16550", 0x18 }, From owner-svn-src-all@freebsd.org Thu Jul 27 05:31:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00C54DC21BC; Thu, 27 Jul 2017 05:31:50 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2843679D1; Thu, 27 Jul 2017 05:31:49 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6R5Vmcv095835; Thu, 27 Jul 2017 05:31:48 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R5Vmg2095834; Thu, 27 Jul 2017 05:31:48 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201707270531.v6R5Vmg2095834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 27 Jul 2017 05:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321604 - head/usr.sbin/mpsutil X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/mpsutil X-SVN-Commit-Revision: 321604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 05:31:50 -0000 Author: scottl Date: Thu Jul 27 05:31:48 2017 New Revision: 321604 URL: https://svnweb.freebsd.org/changeset/base/321604 Log: Fix some broken logic used in obtaining the certain config pages. I'm surprised that this even pretended to work. PR: 215793 Submitted by: longwitz@incore.de Modified: head/usr.sbin/mpsutil/mps_cmd.c Modified: head/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- head/usr.sbin/mpsutil/mps_cmd.c Thu Jul 27 02:53:18 2017 (r321603) +++ head/usr.sbin/mpsutil/mps_cmd.c Thu Jul 27 05:31:48 2017 (r321604) @@ -365,8 +365,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumbe req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; req.PageAddress = PageAddress; req.Header = header; - req.Header.PageLength = reply.Header.PageLength; - if (reply.Header.PageLength == 0) + if (req.Header.PageLength == 0) req.Header.PageLength = 4; len = req.Header.PageLength * 4; From owner-svn-src-all@freebsd.org Thu Jul 27 06:26:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E846CDC31BE; Thu, 27 Jul 2017 06:26:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B77026932A; Thu, 27 Jul 2017 06:26:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6R6QFcw016945; Thu, 27 Jul 2017 06:26:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R6QFpx016943; Thu, 27 Jul 2017 06:26:15 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201707270626.v6R6QFpx016943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jul 2017 06:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321605 - head/contrib/ipfilter X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter X-SVN-Commit-Revision: 321605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 06:26:17 -0000 Author: cy Date: Thu Jul 27 06:26:15 2017 New Revision: 321605 URL: https://svnweb.freebsd.org/changeset/base/321605 Log: As in r315225, discard 3072 bytes of RC4 bytestream instead of 1024. PR: 217920 Submitted by: codarren@hackers.mu Reviewed by: emaste, cem Approved by: so (implicit, in r315225) MFC after: 1 week Differential Revision: D11747 Patterned after: r315225 Modified: head/contrib/ipfilter/arc4random.c Modified: head/contrib/ipfilter/arc4random.c ============================================================================== --- head/contrib/ipfilter/arc4random.c Thu Jul 27 05:31:48 2017 (r321604) +++ head/contrib/ipfilter/arc4random.c Thu Jul 27 06:26:15 2017 (r321605) @@ -109,9 +109,9 @@ arc4_randomstir (void) /* * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. (N = 256 in our case.) + * by Fluher, Mantin, and Shamir. (N = 768 in our case.) */ - for (n = 0; n < 256*4; n++) + for (n = 0; n < 768*4; n++) arc4_randbyte(); MUTEX_EXIT(&arc4_mtx); } From owner-svn-src-all@freebsd.org Thu Jul 27 07:28:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FF45DC400F; Thu, 27 Jul 2017 07:28:30 +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 3D7746AA74; Thu, 27 Jul 2017 07:28:30 +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 v6R7STj7040977; Thu, 27 Jul 2017 07:28:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R7STBK040976; Thu, 27 Jul 2017 07:28:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707270728.v6R7STBK040976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 07:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321606 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 321606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 07:28:30 -0000 Author: mav Date: Thu Jul 27 07:28:29 2017 New Revision: 321606 URL: https://svnweb.freebsd.org/changeset/base/321606 Log: adaasync(): Set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHE The attached patch lets adaasync() set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHE instead of ADA_FLAG_CAN_RAHEAD. This fixes a regression introduced in r300207 which changed the flag names. PR: 220948 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Jul 27 06:26:15 2017 (r321605) +++ head/sys/cam/ata/ata_da.c Thu Jul 27 07:28:29 2017 (r321606) @@ -1320,7 +1320,7 @@ adaasync(void *callback_arg, u_int32_t code, xpt_action((union ccb *)&cgd); if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) softc->state = ADA_STATE_RAHEAD; - else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) + else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) softc->state = ADA_STATE_WCACHE; else if ((softc->flags & ADA_FLAG_CAN_LOG) && (softc->zone_mode != ADA_ZONE_NONE)) From owner-svn-src-all@freebsd.org Thu Jul 27 08:33:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4FA7DC50EA; Thu, 27 Jul 2017 08:33:32 +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 A25236C622; Thu, 27 Jul 2017 08:33:32 +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 v6R8XVAb069509; Thu, 27 Jul 2017 08:33:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R8XVHc069508; Thu, 27 Jul 2017 08:33:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707270833.v6R8XVHc069508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Jul 2017 08:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321607 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 321607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 08:33:32 -0000 Author: kib Date: Thu Jul 27 08:33:31 2017 New Revision: 321607 URL: https://svnweb.freebsd.org/changeset/base/321607 Log: Allow to specify targets by absolute paths in libmap.conf. Submitted by: Tatu Kilappa PR: 221032 MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Jul 27 07:28:29 2017 (r321606) +++ head/libexec/rtld-elf/rtld.c Thu Jul 27 08:33:31 2017 (r321607) @@ -1590,19 +1590,20 @@ find_library(const char *xname, const Obj_Entry *refob bool nodeflib, objgiven; objgiven = refobj != NULL; - if (strchr(xname, '/') != NULL) { /* Hard coded pathname */ - if (xname[0] != '/' && !trust) { + + if (libmap_disable || !objgiven || + (name = lm_find(refobj->path, xname)) == NULL) + name = (char *)xname; + + if (strchr(name, '/') != NULL) { /* Hard coded pathname */ + if (name[0] != '/' && !trust) { _rtld_error("Absolute pathname required for shared object \"%s\"", - xname); - return NULL; + name); + return (NULL); } return (origin_subst(__DECONST(Obj_Entry *, refobj), - __DECONST(char *, xname))); + __DECONST(char *, name))); } - - if (libmap_disable || !objgiven || - (name = lm_find(refobj->path, xname)) == NULL) - name = (char *)xname; dbg(" Searching for \"%s\"", name); From owner-svn-src-all@freebsd.org Thu Jul 27 08:37:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31C9EDC51D2; Thu, 27 Jul 2017 08:37: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 0DB616C817; Thu, 27 Jul 2017 08:37:08 +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 v6R8b8DZ069684; Thu, 27 Jul 2017 08:37:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6R8b81e069683; Thu, 27 Jul 2017 08:37:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707270837.v6R8b81e069683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Jul 2017 08:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321608 - head/lib/libc/x86/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/x86/sys X-SVN-Commit-Revision: 321608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 08:37:09 -0000 Author: kib Date: Thu Jul 27 08:37:07 2017 New Revision: 321608 URL: https://svnweb.freebsd.org/changeset/base/321608 Log: Use MFENCE to serialize RDTSC on non-Intel CPUs. Kernel already used the stronger barrier instruction for AMDs, correct the userspace fast gettimeofday() implementation as well. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D11728 Modified: head/lib/libc/x86/sys/__vdso_gettc.c Modified: head/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- head/lib/libc/x86/sys/__vdso_gettc.c Thu Jul 27 08:33:31 2017 (r321607) +++ head/lib/libc/x86/sys/__vdso_gettc.c Thu Jul 27 08:37:07 2017 (r321608) @@ -52,57 +52,108 @@ __FBSDID("$FreeBSD$"); #endif #include "libc_private.h" +static enum LMB { + LMB_UNKNOWN, + LMB_NONE, + LMB_MFENCE, + LMB_LFENCE +} lfence_works = LMB_UNKNOWN; + static void -lfence_mb(void) +cpuidp(u_int leaf, u_int p[4]) { + + __asm __volatile( #if defined(__i386__) - static int lfence_works = -1; + " pushl %%ebx\n" +#endif + " cpuid\n" +#if defined(__i386__) + " movl %%ebx,%1\n" + " popl %%ebx" +#endif + : "=a" (p[0]), +#if defined(__i386__) + "=r" (p[1]), +#elif defined(__amd64__) + "=b" (p[1]), +#else +#error "Arch" +#endif + "=c" (p[2]), "=d" (p[3]) + : "0" (leaf)); +} + +static enum LMB +select_lmb(void) +{ + u_int p[4]; + static const char intel_id[] = "GenuntelineI"; + + cpuidp(0, p); + return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? + LMB_LFENCE : LMB_MFENCE); +} + +static void +init_fence(void) +{ +#if defined(__i386__) u_int cpuid_supported, p[4]; - if (lfence_works == -1) { - __asm __volatile( - " pushfl\n" - " popl %%eax\n" - " movl %%eax,%%ecx\n" - " xorl $0x200000,%%eax\n" - " pushl %%eax\n" - " popfl\n" - " pushfl\n" - " popl %%eax\n" - " xorl %%eax,%%ecx\n" - " je 1f\n" - " movl $1,%0\n" - " jmp 2f\n" - "1: movl $0,%0\n" - "2:\n" - : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); - if (cpuid_supported) { - __asm __volatile( - " pushl %%ebx\n" - " cpuid\n" - " movl %%ebx,%1\n" - " popl %%ebx\n" - : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (0x1)); - lfence_works = (p[3] & CPUID_SSE2) != 0; - } else - lfence_works = 0; - } - if (lfence_works == 1) - lfence(); + __asm __volatile( + " pushfl\n" + " popl %%eax\n" + " movl %%eax,%%ecx\n" + " xorl $0x200000,%%eax\n" + " pushl %%eax\n" + " popfl\n" + " pushfl\n" + " popl %%eax\n" + " xorl %%eax,%%ecx\n" + " je 1f\n" + " movl $1,%0\n" + " jmp 2f\n" + "1: movl $0,%0\n" + "2:\n" + : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); + if (cpuid_supported) { + cpuidp(0x1, p); + if ((p[3] & CPUID_SSE2) != 0) + lfence_works = select_lmb(); + } else + lfence_works = LMB_NONE; #elif defined(__amd64__) - lfence(); + lfence_works = select_lmb(); #else -#error "arch" +#error "Arch" #endif } +static void +rdtsc_mb(void) +{ + +again: + if (__predict_true(lfence_works == LMB_LFENCE)) { + lfence(); + return; + } else if (lfence_works == LMB_MFENCE) { + mfence(); + return; + } else if (lfence_works == LMB_NONE) { + return; + } + init_fence(); + goto again; +} + static u_int __vdso_gettc_rdtsc_low(const struct vdso_timehands *th) { u_int rv; - lfence_mb(); + rdtsc_mb(); __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); return (rv); @@ -112,7 +163,7 @@ static u_int __vdso_rdtsc32(void) { - lfence_mb(); + rdtsc_mb(); return (rdtsc32()); } @@ -212,7 +263,7 @@ __vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int scale = tsc_ref->tsc_scale; ofs = tsc_ref->tsc_ofs; - lfence_mb(); + rdtsc_mb(); tsc = rdtsc(); /* ret = ((tsc * scale) >> 64) + ofs */ From owner-svn-src-all@freebsd.org Thu Jul 27 10:19:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BFC1DC6D75; Thu, 27 Jul 2017 10:19:15 +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 4709E6FC13; Thu, 27 Jul 2017 10:19:15 +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 v6RAJEJI011611; Thu, 27 Jul 2017 10:19:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAJE2M011608; Thu, 27 Jul 2017 10:19:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271019.v6RAJE2M011608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321609 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:19:15 -0000 Author: mav Date: Thu Jul 27 10:19:13 2017 New Revision: 321609 URL: https://svnweb.freebsd.org/changeset/base/321609 Log: MFC r320153: revert r315852 which introduced zio_buf_alloc_nowait for use in vdev_queue_aggregate I think that the change is still good, but reconciling it with a planned merge of the ARC buf data scatter-ization is a bit more tedious than I can handle. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jul 27 08:37:07 2017 (r321608) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jul 27 10:19:13 2017 (r321609) @@ -554,7 +554,6 @@ extern zio_t *zio_unique_parent(zio_t *cio); extern void zio_add_child(zio_t *pio, zio_t *cio); extern void *zio_buf_alloc(size_t size); -extern void *zio_buf_alloc_nowait(size_t size); extern void zio_buf_free(void *buf, size_t size); extern void *zio_data_buf_alloc(size_t size); extern void zio_data_buf_free(void *buf, size_t size); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Thu Jul 27 08:37:07 2017 (r321608) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Thu Jul 27 10:19:13 2017 (r321609) @@ -647,7 +647,6 @@ static zio_t * vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) { zio_t *first, *last, *aio, *dio, *mandatory, *nio; - void *abuf; uint64_t maxgap = 0; uint64_t size; boolean_t stretch; @@ -766,12 +765,8 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) size = IO_SPAN(first, last); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); - abuf = zio_buf_alloc_nowait(size); - if (abuf == NULL) - return (NULL); - aio = zio_vdev_delegated_io(first->io_vd, first->io_offset, - abuf, size, first->io_type, zio->io_priority, + zio_buf_alloc(size), size, first->io_type, zio->io_priority, flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE, vdev_queue_agg_io_done, NULL); aio->io_timestamp = first->io_timestamp; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jul 27 08:37:07 2017 (r321608) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jul 27 10:19:13 2017 (r321609) @@ -272,33 +272,18 @@ zio_fini(void) * useful to inspect ZFS metadata, but if possible, we should avoid keeping * excess / transient data in-core during a crashdump. */ -static void * -zio_buf_alloc_impl(size_t size, boolean_t canwait) +void * +zio_buf_alloc(size_t size) { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; int flags = zio_exclude_metadata ? KM_NODEBUG : 0; VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); - if (zio_use_uma) { - return (kmem_cache_alloc(zio_buf_cache[c], - canwait ? KM_PUSHPAGE : KM_NOSLEEP)); - } else { - return (kmem_alloc(size, - (canwait ? KM_SLEEP : KM_NOSLEEP) | flags)); - } -} - -void * -zio_buf_alloc(size_t size) -{ - return (zio_buf_alloc_impl(size, B_TRUE)); -} - -void * -zio_buf_alloc_nowait(size_t size) -{ - return (zio_buf_alloc_impl(size, B_FALSE)); + if (zio_use_uma) + return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); + else + return (kmem_alloc(size, KM_SLEEP|flags)); } /* From owner-svn-src-all@freebsd.org Thu Jul 27 10:25:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FF3CDC7135; Thu, 27 Jul 2017 10:25:20 +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 DB3B870173; Thu, 27 Jul 2017 10:25:19 +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 v6RAPJ5T015428; Thu, 27 Jul 2017 10:25:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAPIAj015418; Thu, 27 Jul 2017 10:25:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271025.v6RAPIAj015418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321610 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/c... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/co... X-SVN-Commit-Revision: 321610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:25:20 -0000 Author: mav Date: Thu Jul 27 10:25:18 2017 New Revision: 321610 URL: https://svnweb.freebsd.org/changeset/base/321610 Log: MFC r320156, r320185, r320186, r320262, r320452, r321111: MFV r318946: 8021 ARC buf data scatter-ization illumos/illumos-gate@770499e185d15678ccb0be57ebc626ad18d93383 https://github.com/illumos/illumos-gate/commit/770499e185d15678ccb0be57ebc626ad1 8d93383 https://www.illumos.org/issues/8021 The ARC buf data project (known simply as "ABD" since its genesis in the ZoL community) changes the way the ARC allocates `b_pdata` memory from using linea r `void *` buffers to using scatter/gather lists of fixed-size 1KB chunks. This improves ZFS's performance by helping to defragment the address space occupied by the ARC, in particular for cases where compressed ARC is enabled. It could also ease future work to allocate pages directly from `segkpm` for minimal- overhead memory allocations, bypassing the `kmem` subsystem. This is essentially the same change as the one which recently landed in ZFS on Linux, although they made some platform-specific changes while adapting this work to their codebase: 1. Implemented the equivalent of the `segkpm` suggestion for future work mentioned above to bypass issues that they've had with the Linux kernel memory allocator. 2. Changed the internal representation of the ABD's scatter/gather list so it could be used to pass I/O directly into Linux block device drivers. (This feature is not available in the illumos block device interface yet.) FreeBSD notes: - the actual (default) chunk size is 4KB (despite the text above saying 1KB) - we can try to reimplement ABDs, so that they are not permanently mapped into the KVA unless explicitly requested, especially on platforms with scarce KVA - we can try to use unmapped I/O and avoid intermediate allocation of a linear, virtual memory mapped buffer - we can try to avoid extra data copying by referring to chunks / pages in the original ABD Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: John Kennedy Reviewed by: Prakash Surya Reviewed by: Prashanth Sreenivasa Reviewed by: Pavel Zakharov Reviewed by: Chris Williamson Approved by: Richard Lowe Author: Dan Kimmel Added: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c - copied unchanged from r320156, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h - copied unchanged from r320156, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.h stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/edonr_zfs.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/skein_zfs.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c stable/11/sys/conf/files Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jul 27 10:25:18 2017 (r321610) @@ -59,6 +59,7 @@ #include #include #include +#include #include #undef verify #include @@ -2410,7 +2411,7 @@ zdb_blkptr_done(zio_t *zio) zdb_cb_t *zcb = zio->io_private; zbookmark_phys_t *zb = &zio->io_bookmark; - zio_data_buf_free(zio->io_data, zio->io_size); + abd_free(zio->io_abd); mutex_enter(&spa->spa_scrub_lock); spa->spa_scrub_inflight--; @@ -2477,7 +2478,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr if (!BP_IS_EMBEDDED(bp) && (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata))) { size_t size = BP_GET_PSIZE(bp); - void *data = zio_data_buf_alloc(size); + abd_t *abd = abd_alloc(size, B_FALSE); int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW; /* If it's an intent log block, failure is expected. */ @@ -2490,7 +2491,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr spa->spa_scrub_inflight++; mutex_exit(&spa->spa_scrub_lock); - zio_nowait(zio_read(NULL, spa, bp, data, size, + zio_nowait(zio_read(NULL, spa, bp, abd, size, zdb_blkptr_done, zcb, ZIO_PRIORITY_ASYNC_READ, flags, zb)); } @@ -3270,6 +3271,13 @@ name: return (NULL); } +/* ARGSUSED */ +static int +random_get_pseudo_bytes_cb(void *buf, size_t len, void *unused) +{ + return (random_get_pseudo_bytes(buf, len)); +} + /* * Read a block from a pool and print it out. The syntax of the * block descriptor is: @@ -3301,7 +3309,8 @@ zdb_read_block(char *thing, spa_t *spa) uint64_t offset = 0, size = 0, psize = 0, lsize = 0, blkptr_offset = 0; zio_t *zio; vdev_t *vd; - void *pbuf, *lbuf, *buf; + abd_t *pabd; + void *lbuf, *buf; char *s, *p, *dup, *vdev, *flagstr; int i, error; @@ -3373,7 +3382,7 @@ zdb_read_block(char *thing, spa_t *spa) psize = size; lsize = size; - pbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); + pabd = abd_alloc_linear(SPA_MAXBLOCKSIZE, B_FALSE); lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); BP_ZERO(bp); @@ -3401,15 +3410,15 @@ zdb_read_block(char *thing, spa_t *spa) /* * Treat this as a normal block read. */ - zio_nowait(zio_read(zio, spa, bp, pbuf, psize, NULL, NULL, + zio_nowait(zio_read(zio, spa, bp, pabd, psize, NULL, NULL, ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL)); } else { /* * Treat this as a vdev child I/O. */ - zio_nowait(zio_vdev_child_io(zio, bp, vd, offset, pbuf, psize, - ZIO_TYPE_READ, ZIO_PRIORITY_SYNC_READ, + zio_nowait(zio_vdev_child_io(zio, bp, vd, offset, pabd, + psize, ZIO_TYPE_READ, ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY | ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL, NULL)); @@ -3432,21 +3441,21 @@ zdb_read_block(char *thing, spa_t *spa) void *pbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); void *lbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); - bcopy(pbuf, pbuf2, psize); + abd_copy_to_buf(pbuf2, pabd, psize); - VERIFY(random_get_pseudo_bytes((uint8_t *)pbuf + psize, - SPA_MAXBLOCKSIZE - psize) == 0); + VERIFY0(abd_iterate_func(pabd, psize, SPA_MAXBLOCKSIZE - psize, + random_get_pseudo_bytes_cb, NULL)); - VERIFY(random_get_pseudo_bytes((uint8_t *)pbuf2 + psize, - SPA_MAXBLOCKSIZE - psize) == 0); + VERIFY0(random_get_pseudo_bytes((uint8_t *)pbuf2 + psize, + SPA_MAXBLOCKSIZE - psize)); for (lsize = SPA_MAXBLOCKSIZE; lsize > psize; lsize -= SPA_MINBLOCKSIZE) { for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) { - if (zio_decompress_data(c, pbuf, lbuf, - psize, lsize) == 0 && - zio_decompress_data(c, pbuf2, lbuf2, - psize, lsize) == 0 && + if (zio_decompress_data(c, pabd, + lbuf, psize, lsize) == 0 && + zio_decompress_data_buf(c, pbuf2, + lbuf2, psize, lsize) == 0 && bcmp(lbuf, lbuf2, lsize) == 0) break; } @@ -3465,7 +3474,7 @@ zdb_read_block(char *thing, spa_t *spa) buf = lbuf; size = lsize; } else { - buf = pbuf; + buf = abd_to_buf(pabd); size = psize; } @@ -3483,7 +3492,7 @@ zdb_read_block(char *thing, spa_t *spa) zdb_dump_block(thing, buf, size, flags); out: - umem_free(pbuf, SPA_MAXBLOCKSIZE); + abd_free(pabd); umem_free(lbuf, SPA_MAXBLOCKSIZE); free(dup); } Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Jul 27 10:25:18 2017 (r321610) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. */ /* @@ -41,6 +41,7 @@ #include #include #include +#include extern uint8_t dump_opt[256]; @@ -117,13 +118,27 @@ zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rena } /* ARGSUSED */ +static int +zil_prt_rec_write_cb(void *data, size_t len, void *unused) +{ + char *cdata = data; + for (int i = 0; i < len; i++) { + if (isprint(*cdata)) + (void) printf("%c ", *cdata); + else + (void) printf("%2X", *cdata); + cdata++; + } + return (0); +} + +/* ARGSUSED */ static void zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) { - char *data, *dlimit; + abd_t *data; blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; - char buf[SPA_MAXBLOCKSIZE]; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; @@ -144,7 +159,6 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - bzero(buf, sizeof (buf)); (void) printf("%s\n", prefix); return; } @@ -157,28 +171,26 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write lr->lr_foid, ZB_ZIL_LEVEL, lr->lr_offset / BP_GET_LSIZE(bp)); + data = abd_alloc(BP_GET_LSIZE(bp), B_FALSE); error = zio_wait(zio_read(NULL, zilog->zl_spa, - bp, buf, BP_GET_LSIZE(bp), NULL, NULL, + bp, data, BP_GET_LSIZE(bp), NULL, NULL, ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL, &zb)); if (error) - return; - data = buf; + goto out; } else { - data = (char *)(lr + 1); + /* data is stored after the end of the lr_write record */ + data = abd_alloc(lr->lr_length, B_FALSE); + abd_copy_from_buf(data, lr + 1, lr->lr_length); } - dlimit = data + MIN(lr->lr_length, - (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)); - (void) printf("%s", prefix); - while (data < dlimit) { - if (isprint(*data)) - (void) printf("%c ", *data); - else - (void) printf("%2X", *data); - data++; - } + (void) abd_iterate_func(data, + 0, MIN(lr->lr_length, (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)), + zil_prt_rec_write_cb, NULL); (void) printf("\n"); + +out: + abd_free(data); } /* ARGSUSED */ Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jul 27 10:25:18 2017 (r321610) @@ -112,6 +112,7 @@ #include #include #include +#include #include #include #include @@ -190,6 +191,7 @@ extern uint64_t metaslab_df_alloc_threshold; extern uint64_t zfs_deadman_synctime_ms; extern int metaslab_preload_limit; extern boolean_t zfs_compressed_arc_enabled; +extern boolean_t zfs_abd_scatter_enabled; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5042,7 +5044,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id) enum zio_checksum checksum = spa_dedup_checksum(spa); dmu_buf_t *db; dmu_tx_t *tx; - void *buf; + abd_t *abd; blkptr_t blk; int copies = 2 * ZIO_DEDUPDITTO_MIN; @@ -5122,14 +5124,14 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id) * Damage the block. Dedup-ditto will save us when we read it later. */ psize = BP_GET_PSIZE(&blk); - buf = zio_buf_alloc(psize); - ztest_pattern_set(buf, psize, ~pattern); + abd = abd_alloc_linear(psize, B_TRUE); + ztest_pattern_set(abd_to_buf(abd), psize, ~pattern); (void) zio_wait(zio_rewrite(NULL, spa, 0, &blk, - buf, psize, NULL, NULL, ZIO_PRIORITY_SYNC_WRITE, + abd, psize, NULL, NULL, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL | ZIO_FLAG_INDUCE_DAMAGE, NULL)); - zio_buf_free(buf, psize); + abd_free(abd); (void) rw_unlock(&ztest_name_lock); } @@ -5413,6 +5415,12 @@ ztest_resume_thread(void *arg) */ if (ztest_random(10) == 0) zfs_compressed_arc_enabled = ztest_random(2); + + /* + * Periodically change the zfs_abd_scatter_enabled setting. + */ + if (ztest_random(10) == 0) + zfs_abd_scatter_enabled = ztest_random(2); } return (NULL); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Jul 27 10:25:18 2017 (r321610) @@ -199,19 +199,19 @@ dump_record(dmu_replay_record_t *drr, void *payload, i { ASSERT3U(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), ==, sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t)); - fletcher_4_incremental_native(drr, + (void) fletcher_4_incremental_native(drr, offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), zc); if (drr->drr_type != DRR_BEGIN) { ASSERT(ZIO_CHECKSUM_IS_ZERO(&drr->drr_u. drr_checksum.drr_checksum)); drr->drr_u.drr_checksum.drr_checksum = *zc; } - fletcher_4_incremental_native(&drr->drr_u.drr_checksum.drr_checksum, - sizeof (zio_cksum_t), zc); + (void) fletcher_4_incremental_native( + &drr->drr_u.drr_checksum.drr_checksum, sizeof (zio_cksum_t), zc); if (write(outfd, drr, sizeof (*drr)) == -1) return (errno); if (payload_len != 0) { - fletcher_4_incremental_native(payload, payload_len, zc); + (void) fletcher_4_incremental_native(payload, payload_len, zc); if (write(outfd, payload, payload_len) == -1) return (errno); } @@ -2096,9 +2096,9 @@ recv_read(libzfs_handle_t *hdl, int fd, void *buf, int if (zc) { if (byteswap) - fletcher_4_incremental_byteswap(buf, ilen, zc); + (void) fletcher_4_incremental_byteswap(buf, ilen, zc); else - fletcher_4_incremental_native(buf, ilen, zc); + (void) fletcher_4_incremental_native(buf, ilen, zc); } return (0); } @@ -3688,7 +3688,8 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tos * recv_read() above; do it again correctly. */ bzero(&zcksum, sizeof (zio_cksum_t)); - fletcher_4_incremental_byteswap(&drr, sizeof (drr), &zcksum); + (void) fletcher_4_incremental_byteswap(&drr, + sizeof (drr), &zcksum); flags->byteswap = B_TRUE; drr.drr_type = BSWAP_32(drr.drr_type); Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c Thu Jul 27 10:25:18 2017 (r321610) @@ -24,6 +24,7 @@ */ /* * Copyright 2013 Saso Kiselkov. All rights reserved. + * Copyright (c) 2016 by Delphix. All rights reserved. */ /* @@ -133,17 +134,29 @@ #include #include #include +#include -/*ARGSUSED*/ void -fletcher_2_native(const void *buf, uint64_t size, - const void *ctx_template, zio_cksum_t *zcp) +fletcher_init(zio_cksum_t *zcp) { + ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); +} + +int +fletcher_2_incremental_native(void *buf, size_t size, void *data) +{ + zio_cksum_t *zcp = data; + const uint64_t *ip = buf; const uint64_t *ipend = ip + (size / sizeof (uint64_t)); uint64_t a0, b0, a1, b1; - for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 = zcp->zc_word[0]; + a1 = zcp->zc_word[1]; + b0 = zcp->zc_word[2]; + b1 = zcp->zc_word[3]; + + for (; ip < ipend; ip += 2) { a0 += ip[0]; a1 += ip[1]; b0 += a0; @@ -151,18 +164,33 @@ fletcher_2_native(const void *buf, uint64_t size, } ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); + return (0); } /*ARGSUSED*/ void -fletcher_2_byteswap(const void *buf, uint64_t size, +fletcher_2_native(const void *buf, size_t size, const void *ctx_template, zio_cksum_t *zcp) { + fletcher_init(zcp); + (void) fletcher_2_incremental_native((void *) buf, size, zcp); +} + +int +fletcher_2_incremental_byteswap(void *buf, size_t size, void *data) +{ + zio_cksum_t *zcp = data; + const uint64_t *ip = buf; const uint64_t *ipend = ip + (size / sizeof (uint64_t)); uint64_t a0, b0, a1, b1; - for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 = zcp->zc_word[0]; + a1 = zcp->zc_word[1]; + b0 = zcp->zc_word[2]; + b1 = zcp->zc_word[3]; + + for (; ip < ipend; ip += 2) { a0 += BSWAP_64(ip[0]); a1 += BSWAP_64(ip[1]); b0 += a0; @@ -170,50 +198,23 @@ fletcher_2_byteswap(const void *buf, uint64_t size, } ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); + return (0); } /*ARGSUSED*/ void -fletcher_4_native(const void *buf, uint64_t size, +fletcher_2_byteswap(const void *buf, size_t size, const void *ctx_template, zio_cksum_t *zcp) { - const uint32_t *ip = buf; - const uint32_t *ipend = ip + (size / sizeof (uint32_t)); - uint64_t a, b, c, d; - - for (a = b = c = d = 0; ip < ipend; ip++) { - a += ip[0]; - b += a; - c += b; - d += c; - } - - ZIO_SET_CHECKSUM(zcp, a, b, c, d); + fletcher_init(zcp); + (void) fletcher_2_incremental_byteswap((void *) buf, size, zcp); } -/*ARGSUSED*/ -void -fletcher_4_byteswap(const void *buf, uint64_t size, - const void *ctx_template, zio_cksum_t *zcp) +int +fletcher_4_incremental_native(void *buf, size_t size, void *data) { - const uint32_t *ip = buf; - const uint32_t *ipend = ip + (size / sizeof (uint32_t)); - uint64_t a, b, c, d; + zio_cksum_t *zcp = data; - for (a = b = c = d = 0; ip < ipend; ip++) { - a += BSWAP_32(ip[0]); - b += a; - c += b; - d += c; - } - - ZIO_SET_CHECKSUM(zcp, a, b, c, d); -} - -void -fletcher_4_incremental_native(const void *buf, uint64_t size, - zio_cksum_t *zcp) -{ const uint32_t *ip = buf; const uint32_t *ipend = ip + (size / sizeof (uint32_t)); uint64_t a, b, c, d; @@ -231,12 +232,23 @@ fletcher_4_incremental_native(const void *buf, uint64_ } ZIO_SET_CHECKSUM(zcp, a, b, c, d); + return (0); } +/*ARGSUSED*/ void -fletcher_4_incremental_byteswap(const void *buf, uint64_t size, - zio_cksum_t *zcp) +fletcher_4_native(const void *buf, size_t size, + const void *ctx_template, zio_cksum_t *zcp) { + fletcher_init(zcp); + (void) fletcher_4_incremental_native((void *) buf, size, zcp); +} + +int +fletcher_4_incremental_byteswap(void *buf, size_t size, void *data) +{ + zio_cksum_t *zcp = data; + const uint32_t *ip = buf; const uint32_t *ipend = ip + (size / sizeof (uint32_t)); uint64_t a, b, c, d; @@ -254,4 +266,14 @@ fletcher_4_incremental_byteswap(const void *buf, uint6 } ZIO_SET_CHECKSUM(zcp, a, b, c, d); + return (0); +} + +/*ARGSUSED*/ +void +fletcher_4_byteswap(const void *buf, size_t size, + const void *ctx_template, zio_cksum_t *zcp) +{ + fletcher_init(zcp); + (void) fletcher_4_incremental_byteswap((void *) buf, size, zcp); } Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.h Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.h Thu Jul 27 10:25:18 2017 (r321610) @@ -24,6 +24,7 @@ */ /* * Copyright 2013 Saso Kiselkov. All rights reserved. + * Copyright (c) 2016 by Delphix. All rights reserved. */ #ifndef _ZFS_FLETCHER_H @@ -40,12 +41,15 @@ extern "C" { * fletcher checksum functions */ -void fletcher_2_native(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_2_byteswap(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_4_native(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_4_byteswap(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_4_incremental_native(const void *, uint64_t, zio_cksum_t *); -void fletcher_4_incremental_byteswap(const void *, uint64_t, zio_cksum_t *); +void fletcher_init(zio_cksum_t *); +void fletcher_2_native(const void *, size_t, const void *, zio_cksum_t *); +void fletcher_2_byteswap(const void *, size_t, const void *, zio_cksum_t *); +int fletcher_2_incremental_native(void *, size_t, void *); +int fletcher_2_incremental_byteswap(void *, size_t, void *); +void fletcher_4_native(const void *, size_t, const void *, zio_cksum_t *); +void fletcher_4_byteswap(const void *, size_t, const void *, zio_cksum_t *); +int fletcher_4_incremental_native(void *, size_t, void *); +int fletcher_4_incremental_byteswap(void *, size_t, void *); #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Jul 27 10:19:13 2017 (r321609) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Jul 27 10:25:18 2017 (r321610) @@ -33,6 +33,7 @@ # common to all SunOS systems. ZFS_COMMON_OBJS += \ + abd.o \ arc.o \ bplist.o \ blkptr.o \ Copied: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c (from r320156, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Thu Jul 27 10:25:18 2017 (r321610, copy of r320156, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c) @@ -0,0 +1,944 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2014 by Chunwei Chen. All rights reserved. + * Copyright (c) 2016 by Delphix. All rights reserved. + */ + +/* + * ARC buffer data (ABD). + * + * ABDs are an abstract data structure for the ARC which can use two + * different ways of storing the underlying data: + * + * (a) Linear buffer. In this case, all the data in the ABD is stored in one + * contiguous buffer in memory (from a zio_[data_]buf_* kmem cache). + * + * +-------------------+ + * | ABD (linear) | + * | abd_flags = ... | + * | abd_size = ... | +--------------------------------+ + * | abd_buf ------------->| raw buffer of size abd_size | + * +-------------------+ +--------------------------------+ + * no abd_chunks + * + * (b) Scattered buffer. In this case, the data in the ABD is split into + * equal-sized chunks (from the abd_chunk_cache kmem_cache), with pointers + * to the chunks recorded in an array at the end of the ABD structure. + * + * +-------------------+ + * | ABD (scattered) | + * | abd_flags = ... | + * | abd_size = ... | + * | abd_offset = 0 | +-----------+ + * | abd_chunks[0] ----------------------------->| chunk 0 | + * | abd_chunks[1] ---------------------+ +-----------+ + * | ... | | +-----------+ + * | abd_chunks[N-1] ---------+ +------->| chunk 1 | + * +-------------------+ | +-----------+ + * | ... + * | +-----------+ + * +----------------->| chunk N-1 | + * +-----------+ + * + * Using a large proportion of scattered ABDs decreases ARC fragmentation since + * when we are at the limit of allocatable space, using equal-size chunks will + * allow us to quickly reclaim enough space for a new large allocation (assuming + * it is also scattered). + * + * In addition to directly allocating a linear or scattered ABD, it is also + * possible to create an ABD by requesting the "sub-ABD" starting at an offset + * within an existing ABD. In linear buffers this is simple (set abd_buf of + * the new ABD to the starting point within the original raw buffer), but + * scattered ABDs are a little more complex. The new ABD makes a copy of the + * relevant abd_chunks pointers (but not the underlying data). However, to + * provide arbitrary rather than only chunk-aligned starting offsets, it also + * tracks an abd_offset field which represents the starting point of the data + * within the first chunk in abd_chunks. For both linear and scattered ABDs, + * creating an offset ABD marks the original ABD as the offset's parent, and the + * original ABD's abd_children refcount is incremented. This data allows us to + * ensure the root ABD isn't deleted before its children. + * + * Most consumers should never need to know what type of ABD they're using -- + * the ABD public API ensures that it's possible to transparently switch from + * using a linear ABD to a scattered one when doing so would be beneficial. + * + * If you need to use the data within an ABD directly, if you know it's linear + * (because you allocated it) you can use abd_to_buf() to access the underlying + * raw buffer. Otherwise, you should use one of the abd_borrow_buf* functions + * which will allocate a raw buffer if necessary. Use the abd_return_buf* + * functions to return any raw buffers that are no longer necessary when you're + * done using them. + * + * There are a variety of ABD APIs that implement basic buffer operations: + * compare, copy, read, write, and fill with zeroes. If you need a custom + * function which progressively accesses the whole ABD, use the abd_iterate_* + * functions. + */ + +#include +#include +#include +#include +#include + +typedef struct abd_stats { + kstat_named_t abdstat_struct_size; + kstat_named_t abdstat_scatter_cnt; + kstat_named_t abdstat_scatter_data_size; + kstat_named_t abdstat_scatter_chunk_waste; + kstat_named_t abdstat_linear_cnt; + kstat_named_t abdstat_linear_data_size; +} abd_stats_t; + +static abd_stats_t abd_stats = { + /* Amount of memory occupied by all of the abd_t struct allocations */ + { "struct_size", KSTAT_DATA_UINT64 }, + /* + * The number of scatter ABDs which are currently allocated, excluding + * ABDs which don't own their data (for instance the ones which were + * allocated through abd_get_offset()). + */ + { "scatter_cnt", KSTAT_DATA_UINT64 }, + /* Amount of data stored in all scatter ABDs tracked by scatter_cnt */ + { "scatter_data_size", KSTAT_DATA_UINT64 }, + /* + * The amount of space wasted at the end of the last chunk across all + * scatter ABDs tracked by scatter_cnt. + */ + { "scatter_chunk_waste", KSTAT_DATA_UINT64 }, + /* + * The number of linear ABDs which are currently allocated, excluding + * ABDs which don't own their data (for instance the ones which were + * allocated through abd_get_offset() and abd_get_from_buf()). If an + * ABD takes ownership of its buf then it will become tracked. + */ + { "linear_cnt", KSTAT_DATA_UINT64 }, + /* Amount of data stored in all linear ABDs tracked by linear_cnt */ + { "linear_data_size", KSTAT_DATA_UINT64 }, +}; + +#define ABDSTAT(stat) (abd_stats.stat.value.ui64) +#define ABDSTAT_INCR(stat, val) \ + atomic_add_64(&abd_stats.stat.value.ui64, (val)) +#define ABDSTAT_BUMP(stat) ABDSTAT_INCR(stat, 1) +#define ABDSTAT_BUMPDOWN(stat) ABDSTAT_INCR(stat, -1) + +/* + * It is possible to make all future ABDs be linear by setting this to B_FALSE. + * Otherwise, ABDs are allocated scattered by default unless the caller uses + * abd_alloc_linear(). + */ +boolean_t zfs_abd_scatter_enabled = B_TRUE; + +/* + * The size of the chunks ABD allocates. Because the sizes allocated from the + * kmem_cache can't change, this tunable can only be modified at boot. Changing + * it at runtime would cause ABD iteration to work incorrectly for ABDs which + * were allocated with the old size, so a safeguard has been put in place which + * will cause the machine to panic if you change it and try to access the data + * within a scattered ABD. + */ +size_t zfs_abd_chunk_size = 4096; + +#ifdef _KERNEL +extern vmem_t *zio_alloc_arena; +#endif + +kmem_cache_t *abd_chunk_cache; +static kstat_t *abd_ksp; + +static void * +abd_alloc_chunk() +{ + void *c = kmem_cache_alloc(abd_chunk_cache, KM_PUSHPAGE); + ASSERT3P(c, !=, NULL); + return (c); +} + +static void +abd_free_chunk(void *c) +{ + kmem_cache_free(abd_chunk_cache, c); +} + +void +abd_init(void) +{ +#ifdef illumos + vmem_t *data_alloc_arena = NULL; + +#ifdef _KERNEL + data_alloc_arena = zio_alloc_arena; +#endif + + /* + * Since ABD chunks do not appear in crash dumps, we pass KMC_NOTOUCH + * so that no allocator metadata is stored with the buffers. + */ + abd_chunk_cache = kmem_cache_create("abd_chunk", zfs_abd_chunk_size, 0, + NULL, NULL, NULL, NULL, data_alloc_arena, KMC_NOTOUCH); +#else + abd_chunk_cache = kmem_cache_create("abd_chunk", zfs_abd_chunk_size, 0, + NULL, NULL, NULL, NULL, 0, KMC_NOTOUCH | KMC_NODEBUG); +#endif + abd_ksp = kstat_create("zfs", 0, "abdstats", "misc", KSTAT_TYPE_NAMED, + sizeof (abd_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); + if (abd_ksp != NULL) { + abd_ksp->ks_data = &abd_stats; + kstat_install(abd_ksp); + } +} + +void +abd_fini(void) +{ + if (abd_ksp != NULL) { + kstat_delete(abd_ksp); + abd_ksp = NULL; + } + + kmem_cache_destroy(abd_chunk_cache); + abd_chunk_cache = NULL; +} + +static inline size_t +abd_chunkcnt_for_bytes(size_t size) +{ + return (P2ROUNDUP(size, zfs_abd_chunk_size) / zfs_abd_chunk_size); +} + +static inline size_t +abd_scatter_chunkcnt(abd_t *abd) +{ + ASSERT(!abd_is_linear(abd)); + return (abd_chunkcnt_for_bytes( + abd->abd_u.abd_scatter.abd_offset + abd->abd_size)); +} + +static inline void +abd_verify(abd_t *abd) +{ + ASSERT3U(abd->abd_size, >, 0); + ASSERT3U(abd->abd_size, <=, SPA_MAXBLOCKSIZE); + ASSERT3U(abd->abd_flags, ==, abd->abd_flags & (ABD_FLAG_LINEAR | + ABD_FLAG_OWNER | ABD_FLAG_META)); + IMPLY(abd->abd_parent != NULL, !(abd->abd_flags & ABD_FLAG_OWNER)); + IMPLY(abd->abd_flags & ABD_FLAG_META, abd->abd_flags & ABD_FLAG_OWNER); + if (abd_is_linear(abd)) { + ASSERT3P(abd->abd_u.abd_linear.abd_buf, !=, NULL); + } else { + ASSERT3U(abd->abd_u.abd_scatter.abd_offset, <, + zfs_abd_chunk_size); + size_t n = abd_scatter_chunkcnt(abd); + for (int i = 0; i < n; i++) { + ASSERT3P( + abd->abd_u.abd_scatter.abd_chunks[i], !=, NULL); + } + } +} + +static inline abd_t * +abd_alloc_struct(size_t chunkcnt) +{ + size_t size = offsetof(abd_t, abd_u.abd_scatter.abd_chunks[chunkcnt]); + abd_t *abd = kmem_alloc(size, KM_PUSHPAGE); + ASSERT3P(abd, !=, NULL); + ABDSTAT_INCR(abdstat_struct_size, size); + + return (abd); +} + +static inline void +abd_free_struct(abd_t *abd) +{ + size_t chunkcnt = abd_is_linear(abd) ? 0 : abd_scatter_chunkcnt(abd); + int size = offsetof(abd_t, abd_u.abd_scatter.abd_chunks[chunkcnt]); + kmem_free(abd, size); + ABDSTAT_INCR(abdstat_struct_size, -size); +} + +/* + * Allocate an ABD, along with its own underlying data buffers. Use this if you + * don't care whether the ABD is linear or not. + */ +abd_t * +abd_alloc(size_t size, boolean_t is_metadata) +{ + if (!zfs_abd_scatter_enabled) + return (abd_alloc_linear(size, is_metadata)); + + VERIFY3U(size, <=, SPA_MAXBLOCKSIZE); + + size_t n = abd_chunkcnt_for_bytes(size); + abd_t *abd = abd_alloc_struct(n); + + abd->abd_flags = ABD_FLAG_OWNER; + if (is_metadata) { + abd->abd_flags |= ABD_FLAG_META; + } + abd->abd_size = size; + abd->abd_parent = NULL; + refcount_create(&abd->abd_children); + + abd->abd_u.abd_scatter.abd_offset = 0; + abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size; + + for (int i = 0; i < n; i++) { + void *c = abd_alloc_chunk(); + ASSERT3P(c, !=, NULL); + abd->abd_u.abd_scatter.abd_chunks[i] = c; + } + + ABDSTAT_BUMP(abdstat_scatter_cnt); + ABDSTAT_INCR(abdstat_scatter_data_size, size); + ABDSTAT_INCR(abdstat_scatter_chunk_waste, + n * zfs_abd_chunk_size - size); + + return (abd); +} + +static void +abd_free_scatter(abd_t *abd) +{ + size_t n = abd_scatter_chunkcnt(abd); + for (int i = 0; i < n; i++) { + abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]); + } + + refcount_destroy(&abd->abd_children); + ABDSTAT_BUMPDOWN(abdstat_scatter_cnt); + ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size); + ABDSTAT_INCR(abdstat_scatter_chunk_waste, + abd->abd_size - n * zfs_abd_chunk_size); + + abd_free_struct(abd); +} + +/* + * Allocate an ABD that must be linear, along with its own underlying data + * buffer. Only use this when it would be very annoying to write your ABD + * consumer with a scattered ABD. + */ +abd_t * +abd_alloc_linear(size_t size, boolean_t is_metadata) +{ + abd_t *abd = abd_alloc_struct(0); + + VERIFY3U(size, <=, SPA_MAXBLOCKSIZE); + + abd->abd_flags = ABD_FLAG_LINEAR | ABD_FLAG_OWNER; + if (is_metadata) { + abd->abd_flags |= ABD_FLAG_META; + } + abd->abd_size = size; + abd->abd_parent = NULL; + refcount_create(&abd->abd_children); + + if (is_metadata) { + abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size); + } else { + abd->abd_u.abd_linear.abd_buf = zio_data_buf_alloc(size); + } + + ABDSTAT_BUMP(abdstat_linear_cnt); + ABDSTAT_INCR(abdstat_linear_data_size, size); + + return (abd); +} + +static void +abd_free_linear(abd_t *abd) +{ + if (abd->abd_flags & ABD_FLAG_META) { + zio_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size); + } else { + zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size); + } + + refcount_destroy(&abd->abd_children); + ABDSTAT_BUMPDOWN(abdstat_linear_cnt); + ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); + + abd_free_struct(abd); +} + +/* + * Free an ABD. Only use this on ABDs allocated with abd_alloc() or + * abd_alloc_linear(). + */ +void +abd_free(abd_t *abd) +{ + abd_verify(abd); + ASSERT3P(abd->abd_parent, ==, NULL); + ASSERT(abd->abd_flags & ABD_FLAG_OWNER); + if (abd_is_linear(abd)) + abd_free_linear(abd); + else + abd_free_scatter(abd); +} + +/* + * Allocate an ABD of the same format (same metadata flag, same scatterize + * setting) as another ABD. + */ +abd_t * +abd_alloc_sametype(abd_t *sabd, size_t size) +{ + boolean_t is_metadata = (sabd->abd_flags & ABD_FLAG_META) != 0; + if (abd_is_linear(sabd)) { + return (abd_alloc_linear(size, is_metadata)); + } else { + return (abd_alloc(size, is_metadata)); + } +} + +/* + * If we're going to use this ABD for doing I/O using the block layer, the + * consumer of the ABD data doesn't care if it's scattered or not, and we don't + * plan to store this ABD in memory for a long period of time, we should + * allocate the ABD type that requires the least data copying to do the I/O. + * + * Currently this is linear ABDs, however if ldi_strategy() can ever issue I/Os + * using a scatter/gather list we should switch to that and replace this call + * with vanilla abd_alloc(). + */ +abd_t * +abd_alloc_for_io(size_t size, boolean_t is_metadata) +{ + return (abd_alloc_linear(size, is_metadata)); +} + +/* + * Allocate a new ABD to point to offset off of sabd. It shares the underlying + * buffer data with sabd. Use abd_put() to free. sabd must not be freed while + * any derived ABDs exist. + */ +abd_t * +abd_get_offset(abd_t *sabd, size_t off) +{ + abd_t *abd; + + abd_verify(sabd); + ASSERT3U(off, <=, sabd->abd_size); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jul 27 10:26:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69906DC71C6; Thu, 27 Jul 2017 10:26:59 +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 45F44702B0; Thu, 27 Jul 2017 10:26:59 +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 v6RAQwhq015528; Thu, 27 Jul 2017 10:26:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAQwjB015526; Thu, 27 Jul 2017 10:26:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271026.v6RAQwjB015526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321611 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:26:59 -0000 Author: mav Date: Thu Jul 27 10:26:58 2017 New Revision: 321611 URL: https://svnweb.freebsd.org/changeset/base/321611 Log: MFC r320237: MFV r318947: 7578 Fix/improve some aspects of ZIL writing. FreeBSD note: this commit removes small differences between what mav committed to FreeBSD in r308782 and what ended up committed to illumos after addressing all review comments. illumos/illumos-gate@c5ee46810f82e8a53d2cc5a487568a573f449039 https://github.com/illumos/illumos-gate/commit/c5ee46810f82e8a53d2cc5a487568a573f449039 https://www.illumos.org/issues/7578 After some ZIL changes 6 years ago zil_slog_limit got partially broken due to zl_itx_list_sz not updated when async itx'es upgraded to sync. Actually because of other changes about that time zl_itx_list_sz is not really required to implement the functionality, so this patch removes some unneeded broken code and variables. Original idea of zil_slog_limit was to reduce chance of SLOG abuse by single heavy logger, that increased latency for other (more latency critical) loggers, by pushing heavy log out into the main pool instead of SLOG. Beside huge latency increase for heavy writers, this implementation caused double write of all data, since the log records were explicitly prepared for SLOG. Since we now have I/O scheduler, I've found it can be much more efficient to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. Existing ZIL implementation had problem with space efficiency when it has to write large chunks of data into log blocks of limited size. In some cases efficiency stopped to almost as low as 50%. In case of ZIL stored on spinning rust, that also reduced log write speed in half, since head had to uselessly fly over allocated but not written areas. This change improves the situation by offloading problematic operations from z*_log_write() to zil_lwb_commit(), which knows real situation of log blocks allocation and can split large requests into pieces much more efficiently. Also as side effect it removes one of two data copy operations done by ZIL code WR_COPIED case. While there, untangle and unify code of z*_log_write() functions. Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing block boundary, that may also improve efficiency if ZPL is made to do that. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Reviewed by: Andriy Gapon Reviewed by: Steven Hartland Reviewed by: Brad Lewis Reviewed by: Richard Elling Approved by: Robert Mustacchi Author: Alexander Motin Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Jul 27 10:25:18 2017 (r321610) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Jul 27 10:26:58 2017 (r321611) @@ -139,10 +139,27 @@ typedef struct zil_bp_node { avl_node_t zn_node; } zil_bp_node_t; +/* + * Maximum amount of write data that can be put into single log block. + */ #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ sizeof (lr_write_t)) #define ZIL_MAX_COPIED_DATA \ ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) + +/* + * Maximum amount of log space we agree to waste to reduce number of + * WR_NEED_COPY chunks to reduce zl_get_data() overhead (~12%). + */ +#define ZIL_MAX_WASTE_SPACE (ZIL_MAX_LOG_DATA / 8) + +/* + * Maximum amount of write data for WR_COPIED. Fall back to WR_NEED_COPY + * as more space efficient if we can't fit at least two log records into + * maximum sized log block. + */ +#define ZIL_MAX_COPIED_DATA ((SPA_OLD_MAXBLOCKSIZE - \ + sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Jul 27 10:25:18 2017 (r321610) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Jul 27 10:26:58 2017 (r321611) @@ -90,12 +90,12 @@ SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_R /* * Limit SLOG write size per commit executed with synchronous priority. - * Any writes above that executed with lower (asynchronous) priority to - * limit potential SLOG device abuse by single active ZIL writer. + * Any writes above that will be executed with lower (asynchronous) priority + * to limit potential SLOG device abuse by single active ZIL writer. */ -uint64_t zil_slog_limit = 768 * 1024; -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, - &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); +uint64_t zil_slog_bulk = 768 * 1024; +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_bulk, CTLFLAG_RWTUN, + &zil_slog_bulk, 0, "Maximal SLOG commit size with sync priority"); static kmem_cache_t *zil_lwb_cache; @@ -923,7 +923,7 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) if (lwb->lwb_zio == NULL) { abd_t *lwb_abd = abd_get_from_buf(lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk)); - if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) + if (!lwb->lwb_slog || zilog->zl_cur_used <= zil_slog_bulk) prio = ZIO_PRIORITY_SYNC_WRITE; else prio = ZIO_PRIORITY_ASYNC_WRITE; @@ -1068,36 +1068,38 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea static lwb_t * zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) { - lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ - lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; + lr_t *lrcb, *lrc; + lr_write_t *lrwb, *lrw; char *lr_buf; - uint64_t txg = lrc->lrc_txg; - uint64_t reclen = lrc->lrc_reclen; - uint64_t dlen = 0; - uint64_t dnow, lwb_sp; + uint64_t dlen, dnow, lwb_sp, reclen, txg; if (lwb == NULL) return (NULL); ASSERT(lwb->lwb_buf != NULL); - if (lrc->lrc_txtype == TX_WRITE && itx->itx_wr_state == WR_NEED_COPY) + lrc = &itx->itx_lr; /* Common log record inside itx. */ + lrw = (lr_write_t *)lrc; /* Write log record inside itx. */ + if (lrc->lrc_txtype == TX_WRITE && itx->itx_wr_state == WR_NEED_COPY) { dlen = P2ROUNDUP_TYPED( lrw->lr_length, sizeof (uint64_t), uint64_t); - + } else { + dlen = 0; + } + reclen = lrc->lrc_reclen; zilog->zl_cur_used += (reclen + dlen); + txg = lrc->lrc_txg; zil_lwb_write_init(zilog, lwb); cont: /* * If this record won't fit in the current log block, start a new one. - * For WR_NEED_COPY optimize layout for minimal number of chunks, but - * try to keep wasted space withing reasonable range (12%). + * For WR_NEED_COPY optimize layout for minimal number of chunks. */ lwb_sp = lwb->lwb_sz - lwb->lwb_nused; if (reclen > lwb_sp || (reclen + dlen > lwb_sp && - lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || + lwb_sp < ZIL_MAX_WASTE_SPACE && (dlen % ZIL_MAX_LOG_DATA == 0 || lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { lwb = zil_lwb_write_start(zilog, lwb, B_FALSE); if (lwb == NULL) @@ -1105,14 +1107,14 @@ cont: zil_lwb_write_init(zilog, lwb); ASSERT(LWB_EMPTY(lwb)); lwb_sp = lwb->lwb_sz - lwb->lwb_nused; - ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); + ASSERT3U(reclen + MIN(dlen, sizeof (uint64_t)), <=, lwb_sp); } dnow = MIN(dlen, lwb_sp - reclen); lr_buf = lwb->lwb_buf + lwb->lwb_nused; bcopy(lrc, lr_buf, reclen); - lrcb = (lr_t *)lr_buf; - lrwb = (lr_write_t *)lrcb; + lrcb = (lr_t *)lr_buf; /* Like lrc, but inside lwb. */ + lrwb = (lr_write_t *)lrcb; /* Like lrw, but inside lwb. */ /* * If it's a write, fetch the data or get its blkptr as appropriate. @@ -1328,6 +1330,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *t * this itxg. Save the itxs for release below. * This should be rare. */ + zfs_dbgmsg("zil_itx_assign: missed itx cleanup for " + "txg %llu", itxg->itxg_txg); clean = itxg->itxg_itxs; } itxg->itxg_txg = txg; From owner-svn-src-all@freebsd.org Thu Jul 27 10:28:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42F2FDC7252; Thu, 27 Jul 2017 10:28:09 +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 06F2370405; Thu, 27 Jul 2017 10:28:08 +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 v6RAS8eP015626; Thu, 27 Jul 2017 10:28:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAS8Zb015625; Thu, 27 Jul 2017 10:28:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271028.v6RAS8Zb015625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321612 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:28:09 -0000 Author: mav Date: Thu Jul 27 10:28:07 2017 New Revision: 321612 URL: https://svnweb.freebsd.org/changeset/base/321612 Log: MFC r320238: MFV r319742: 8056 zfs send size estimate is inaccurate for some zvols illumos/illumos-gate@0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16 https://github.com/illumos/illumos-gate/commit/0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16 https://www.illumos.org/issues/8056 The send size estimate for a zvol can be too low, if the size of the record headers (dmu_replay_record_t's) is a significant portion of the size. This is typically the case when the data is highly compressible, especially with embedded blocks. The problem is that dmu_adjust_send_estimate_for_indirects() assumes that blocks are the size of the "recordsize" property (128KB). However, for zvols, the blocks are the size of the "volblocksize" property (8KB). Therefore, we estimate that there will be 16x less record headers than there really will be. Reviewed by: Matthew Ahrens Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Paul Dagnelie Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jul 27 10:26:58 2017 (r321611) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jul 27 10:28:07 2017 (r321612) @@ -1140,10 +1140,17 @@ dmu_adjust_send_estimate_for_indirects(dsl_dataset_t * */ uint64_t recordsize; uint64_t record_count; + objset_t *os; + VERIFY0(dmu_objset_from_ds(ds, &os)); /* Assume all (uncompressed) blocks are recordsize. */ - err = dsl_prop_get_int_ds(ds, zfs_prop_to_name(ZFS_PROP_RECORDSIZE), - &recordsize); + if (os->os_phys->os_type == DMU_OST_ZVOL) { + err = dsl_prop_get_int_ds(ds, + zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &recordsize); + } else { + err = dsl_prop_get_int_ds(ds, + zfs_prop_to_name(ZFS_PROP_RECORDSIZE), &recordsize); + } if (err != 0) return (err); record_count = uncompressed / recordsize; @@ -1212,6 +1219,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fr err = dmu_adjust_send_estimate_for_indirects(ds, uncomp, comp, stream_compressed, sizep); + /* + * Add the size of the BEGIN and END records to the estimate. + */ + *sizep += 2 * sizeof (dmu_replay_record_t); return (err); } From owner-svn-src-all@freebsd.org Thu Jul 27 10:29:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D96DEDC7306; Thu, 27 Jul 2017 10:29:30 +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 95A0170567; Thu, 27 Jul 2017 10:29:30 +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 v6RATTK1015720; Thu, 27 Jul 2017 10:29:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RATTf5015719; Thu, 27 Jul 2017 10:29:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271029.v6RATTf5015719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321613 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 321613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:29:31 -0000 Author: mav Date: Thu Jul 27 10:29:29 2017 New Revision: 321613 URL: https://svnweb.freebsd.org/changeset/base/321613 Log: MFC r320239: MFV r319950: 5220 L2ARC does not support devices that do not provide 512B access FreeBSD note: the actual change has been in FreeBSD since r297848. This commit accounts for integration of that change with subsequent changes, especially r320156 (MFV of r318946) and r314274. illumos/illumos-gate@403a8da73c64ff9dfb6230ba045c765a242213fb https://github.com/illumos/illumos-gate/commit/403a8da73c64ff9dfb6230ba045c765a242213fb https://www.illumos.org/issues/5220 There are disk devices that have logical sector size larger than 512B, for example 4KB. That is, their physical sector size is larger than 512B and they do not provide emulation for 512B sector sizes. For such devices both a data offset and a data size must be properly aligned. L2ARC should arrange that because it uses physical I/O. zio_vdev_io_start() performs a necessary transformation if io_size is not aligned to vdev_ashift, but that is done only for logical I/O. Something similar should be done in L2ARC code. * a temporary write buffer should be allocated if the original buffer is not going to be compressed and its size is not aligned * size of a temporary compression buffer should be ashift aligned * for the reads, if a size of a target buffer is not sufficiently large and it is not aligned then a temporary read buffer should be allocated Reviewed by: George Wilson Reviewed by: Dan Kimmel Reviewed by: Saso Kiselkov Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 27 10:28:07 2017 (r321612) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 27 10:29:29 2017 (r321613) @@ -1343,7 +1343,7 @@ typedef struct l2arc_read_callback { blkptr_t l2rcb_bp; /* original blkptr */ zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ - void *l2rcb_abd; /* temporary buffer */ + abd_t *l2rcb_abd; /* temporary buffer */ } l2arc_read_callback_t; typedef struct l2arc_write_callback { @@ -7485,8 +7485,13 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * Normally the L2ARC can use the hdr's data, but if * we're sharing data between the hdr and one of its * bufs, L2ARC needs its own copy of the data so that - * the ZIO below can't race with the buf consumer. To - * ensure that this copy will be available for the + * the ZIO below can't race with the buf consumer. + * Another case where we need to create a copy of the + * data is when the buffer size is not device-aligned + * and we need to pad the block to make it such. + * That also keeps the clock hand suitably aligned. + * + * To ensure that the copy will be available for the * lifetime of the ZIO and be cleaned up afterwards, we * add it to the l2arc_free_on_write queue. */ From owner-svn-src-all@freebsd.org Thu Jul 27 10:30:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B23C7DC7389; Thu, 27 Jul 2017 10:30:56 +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 8C123706F6; Thu, 27 Jul 2017 10:30:56 +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 v6RAUt5f015842; Thu, 27 Jul 2017 10:30:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAUtAA015839; Thu, 27 Jul 2017 10:30:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271030.v6RAUtAA015839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321614 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 321614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:30:56 -0000 Author: mav Date: Thu Jul 27 10:30:55 2017 New Revision: 321614 URL: https://svnweb.freebsd.org/changeset/base/321614 Log: MFC r320352: zfs: port vdev_file part of illumos change 3306 3306 zdb should be able to issue reads in parallel illumos/illumos-gate/31d7e8fa33fae995f558673adb22641b5aa8b6e1 https://www.illumos.org/issues/3306 The upstream change was made before we started to import upstream commits individually. It was imported into the illumos vendor area as r242733. That commit was MFV-ed in r260138, but as the commit message says vdev_file.c was left intact. This commit actually implements the parallel I/O for vdev_file using a taskqueue with multiple thread. This implementation does not depend on the illumos or FreeBSD bio interface at all, but uses zio_t to pass around all the relevent data. So, the code looks a bit different from the upstream. This commit also incorporates ZoL commit zfsonlinux/zfs/bc25c9325b0e5ced897b9820dad239539d561ec9 that fixed https://github.com/zfsonlinux/zfs/issues/2270 We need to use a dedicated taskqueue for exactly the same reason as ZoL as we do not implement TASKQ_DYNAMIC. Obtained from: illumos, ZFS on Linux Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_file.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jul 27 10:29:29 2017 (r321613) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jul 27 10:30:55 2017 (r321614) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -2024,6 +2025,7 @@ spa_init(int mode) dmu_init(); zil_init(); vdev_cache_stat_init(); + vdev_file_init(); zfs_prop_init(); zpool_prop_init(); zpool_feature_init(); @@ -2043,6 +2045,7 @@ spa_fini(void) spa_evict_all(); + vdev_file_fini(); vdev_cache_stat_fini(); zil_fini(); dmu_fini(); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_file.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_file.h Thu Jul 27 10:29:29 2017 (r321613) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_file.h Thu Jul 27 10:30:55 2017 (r321614) @@ -39,6 +39,9 @@ typedef struct vdev_file { vnode_t *vf_vnode; } vdev_file_t; +extern void vdev_file_init(void); +extern void vdev_file_fini(void); + #ifdef __cplusplus } #endif Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jul 27 10:29:29 2017 (r321613) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jul 27 10:30:55 2017 (r321614) @@ -36,6 +36,21 @@ * Virtual device vector for files. */ +static taskq_t *vdev_file_taskq; + +void +vdev_file_init(void) +{ + vdev_file_taskq = taskq_create("z_vdev_file", MAX(max_ncpus, 16), + minclsyspri, max_ncpus, INT_MAX, 0); +} + +void +vdev_file_fini(void) +{ + taskq_destroy(vdev_file_taskq); +} + static void vdev_file_hold(vdev_t *vd) { @@ -157,41 +172,32 @@ vdev_file_close(vdev_t *vd) vd->vdev_tsd = NULL; } +/* + * Implements the interrupt side for file vdev types. This routine will be + * called when the I/O completes allowing us to transfer the I/O to the + * interrupt taskqs. For consistency, the code structure mimics disk vdev + * types. + */ static void -vdev_file_io_start(zio_t *zio) +vdev_file_io_intr(zio_t *zio) { + zio_delay_interrupt(zio); +} + +static void +vdev_file_io_strategy(void *arg) +{ + zio_t *zio = arg; vdev_t *vd = zio->io_vd; vdev_file_t *vf; vnode_t *vp; void *addr; ssize_t resid; - if (!vdev_readable(vd)) { - zio->io_error = SET_ERROR(ENXIO); - zio_interrupt(zio); - return; - } - vf = vd->vdev_tsd; vp = vf->vf_vnode; - if (zio->io_type == ZIO_TYPE_IOCTL) { - switch (zio->io_cmd) { - case DKIOCFLUSHWRITECACHE: - zio->io_error = VOP_FSYNC(vp, FSYNC | FDSYNC, - kcred, NULL); - break; - default: - zio->io_error = SET_ERROR(ENOTSUP); - } - - zio_execute(zio); - return; - } - ASSERT(zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE); - zio->io_target_timestamp = zio_handle_io_delay(zio); - if (zio->io_type == ZIO_TYPE_READ) { addr = abd_borrow_buf(zio->io_abd, zio->io_size); } else { @@ -211,12 +217,41 @@ vdev_file_io_start(zio_t *zio) if (resid != 0 && zio->io_error == 0) zio->io_error = ENOSPC; - zio_delay_interrupt(zio); + vdev_file_io_intr(zio); +} -#ifdef illumos - VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, bp, +static void +vdev_file_io_start(zio_t *zio) +{ + vdev_t *vd = zio->io_vd; + vdev_file_t *vf = vd->vdev_tsd; + + if (zio->io_type == ZIO_TYPE_IOCTL) { + /* XXPOLICY */ + if (!vdev_readable(vd)) { + zio->io_error = SET_ERROR(ENXIO); + zio_interrupt(zio); + return; + } + + switch (zio->io_cmd) { + case DKIOCFLUSHWRITECACHE: + zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, + kcred, NULL); + break; + default: + zio->io_error = SET_ERROR(ENOTSUP); + } + + zio_execute(zio); + return; + } + + ASSERT(zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE); + zio->io_target_timestamp = zio_handle_io_delay(zio); + + VERIFY3U(taskq_dispatch(vdev_file_taskq, vdev_file_io_strategy, zio, TQ_SLEEP), !=, 0); -#endif } /* ARGSUSED */ From owner-svn-src-all@freebsd.org Thu Jul 27 10:52:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44CF2DC7B85; Thu, 27 Jul 2017 10:52:38 +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 0D80D713B3; Thu, 27 Jul 2017 10:52:37 +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 v6RAqbIj027792; Thu, 27 Jul 2017 10:52:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RAqbZj027791; Thu, 27 Jul 2017 10:52:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271052.v6RAqbZj027791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 10:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321615 - stable/11/usr.sbin/fstyp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.sbin/fstyp X-SVN-Commit-Revision: 321615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 10:52:38 -0000 Author: mav Date: Thu Jul 27 10:52:36 2017 New Revision: 321615 URL: https://svnweb.freebsd.org/changeset/base/321615 Log: MFC r320152 (by avg): fstyp: move sys/ include path after zfs include paths The reason is that FreeBSD refcount.h shadows ZFS refcount.h and that will lead to a build error after a planned import of the ARC buf data scatter-ization. It's possible that some day we will have an opposite problem where a ZFS header would shadow an essential FreeBSD header. So, we need to think about a better long term solution. Modified: stable/11/usr.sbin/fstyp/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/fstyp/Makefile ============================================================================== --- stable/11/usr.sbin/fstyp/Makefile Thu Jul 27 10:30:55 2017 (r321614) +++ stable/11/usr.sbin/fstyp/Makefile Thu Jul 27 10:52:36 2017 (r321615) @@ -18,8 +18,6 @@ WARNS?= 2 SUBDIR+= tests .endif -CFLAGS+=-I${SRCTOP}/sys - .if ${MK_ZFS} != "no" IGNORE_PRAGMA= YES @@ -34,6 +32,8 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head .endif + +CFLAGS+=-I${SRCTOP}/sys LIBADD= geom md From owner-svn-src-all@freebsd.org Thu Jul 27 12:29:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BED2DC9F40; Thu, 27 Jul 2017 12:29:32 +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 473B67446A; Thu, 27 Jul 2017 12:29:32 +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 v6RCTV6E064816; Thu, 27 Jul 2017 12:29:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RCTVwh064815; Thu, 27 Jul 2017 12:29:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707271229.v6RCTVwh064815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 12:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321616 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 12:29:32 -0000 Author: emaste Date: Thu Jul 27 12:29:31 2017 New Revision: 321616 URL: https://svnweb.freebsd.org/changeset/base/321616 Log: genericize target exclusion for missing external toolchain Previously we excluded riscv from make universe / tinderbox if the required xtoolchain package was not installed. Make that logic generic so that we can loop over multiple architectures, in preparation to test patches to have other architectures rely on external toolchain. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11652 Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Thu Jul 27 10:52:36 2017 (r321615) +++ head/Makefile Thu Jul 27 12:29:31 2017 (r321616) @@ -441,14 +441,22 @@ TARGET_ARCHES_${target}?= ${target} MAKE_PARAMS_riscv?= CROSS_TOOLCHAIN=riscv64-gcc -# XXX Remove riscv from universe if the required toolchain package is missing. -.if !exists(/usr/local/share/toolchains/riscv64-gcc.mk) && ${TARGETS:Mriscv} -_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Nriscv} -universe: universe_riscv_skip .PHONY -universe_epilogue: universe_riscv_skip .PHONY -universe_riscv_skip: universe_prologue .PHONY - @echo ">> riscv skipped - install riscv64-xtoolchain-gcc port or package to build" +# XXX Remove architectures only supported by external toolchain from universe +# if required toolchain packages are missing. +TOOLCHAINS_riscv= riscv64 +.for target in riscv +.if ${_UNIVERSE_TARGETS:M${target}} +.for toolchain in ${TOOLCHAINS_${target}} +.if !exists(/usr/local/share/toolchains/${toolchain}-gcc.mk) +_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}} +universe: universe_${toolchain}_skip .PHONY +universe_epilogue: universe_${toolchain}_skip .PHONY +universe_${toolchain}_skip: universe_prologue .PHONY + @echo ">> ${target} skipped - install ${toolchain}-xtoolchain-gcc port or package to build" .endif +.endfor +.endif +.endfor .if defined(UNIVERSE_TARGET) MAKE_JUST_WORLDS= YES From owner-svn-src-all@freebsd.org Thu Jul 27 12:37:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE354DCA2E3; Thu, 27 Jul 2017 12:37:19 +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 BACB9749F6; Thu, 27 Jul 2017 12:37:19 +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 v6RCbIpF068869; Thu, 27 Jul 2017 12:37:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RCbI0L068868; Thu, 27 Jul 2017 12:37:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707271237.v6RCbI0L068868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jul 2017 12:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321617 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 321617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 12:37:20 -0000 Author: emaste Date: Thu Jul 27 12:37:18 2017 New Revision: 321617 URL: https://svnweb.freebsd.org/changeset/base/321617 Log: revert r321601, it depends on an ACPICA update not yet merged Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 12:29:31 2017 (r321616) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Thu Jul 27 12:37:18 2017 (r321617) @@ -1085,8 +1085,7 @@ static const char *srat_types[] = { [ACPI_SRAT_TYPE_CPU_AFFINITY] = "CPU", [ACPI_SRAT_TYPE_MEMORY_AFFINITY] = "Memory", [ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY] = "X2APIC", - [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC", - [ACPI_SRAT_TYPE_GIC_ITS_AFFINITY] = "GIC ITS", + [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC" }; static void From owner-svn-src-all@freebsd.org Thu Jul 27 13:03:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 415F2DCAC11; Thu, 27 Jul 2017 13:03:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B53375882; Thu, 27 Jul 2017 13:03:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RD3b0v080945; Thu, 27 Jul 2017 13:03:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RD3amQ080937; Thu, 27 Jul 2017 13:03:36 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201707271303.v6RD3amQ080937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 27 Jul 2017 13:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321618 - in head: sys/conf sys/net sys/netinet sys/netinet6 usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sys/conf sys/net sys/netinet sys/netinet6 usr.bin/netstat X-SVN-Commit-Revision: 321618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 13:03:38 -0000 Author: bz Date: Thu Jul 27 13:03:36 2017 New Revision: 321618 URL: https://svnweb.freebsd.org/changeset/base/321618 Log: After inpcb route caching was put back in place there is no need for flowtable anymore (as flowtable was never considered to be useful in the forwarding path). Reviewed by: np Differential Revision: https://reviews.freebsd.org/D11448 Deleted: head/sys/net/flowtable.c head/sys/net/flowtable.h head/usr.bin/netstat/flowtable.c Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/net/route.c head/sys/netinet/ip_output.c head/sys/netinet6/ip6_output.c head/usr.bin/netstat/Makefile head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Jul 27 12:37:18 2017 (r321617) +++ head/sys/conf/NOTES Thu Jul 27 13:03:36 2017 (r321618) @@ -646,9 +646,6 @@ options LIBMCHAIN # libalias library, performing NAT options LIBALIAS -# flowtable cache -options FLOWTABLE - # # SCTP is a NEW transport protocol defined by # RFC2960 updated by RFC3309 and RFC3758.. and Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jul 27 12:37:18 2017 (r321617) +++ head/sys/conf/options Thu Jul 27 13:03:36 2017 (r321618) @@ -454,8 +454,6 @@ TCP_RFC7413_MAX_KEYS opt_inet.h TCP_SIGNATURE opt_ipsec.h VLAN_ARRAY opt_vlan.h XBONEHACK -FLOWTABLE opt_route.h -FLOWTABLE_HASH_ALL opt_route.h # # SCTP Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Jul 27 12:37:18 2017 (r321617) +++ head/sys/net/route.c Thu Jul 27 13:03:36 2017 (r321618) @@ -59,7 +59,6 @@ #include #include #include -#include #ifdef RADIX_MPATH #include @@ -1504,79 +1503,12 @@ rt_mpath_unlink(struct rib_head *rnh, struct rt_addrin } #endif -#ifdef FLOWTABLE -static struct rtentry * -rt_flowtable_check_route(struct rib_head *rnh, struct rt_addrinfo *info) -{ -#if defined(INET6) || defined(INET) - struct radix_node *rn; -#endif - struct rtentry *rt0; - - rt0 = NULL; - /* "flow-table" only supports IPv6 and IPv4 at the moment. */ - switch (dst->sa_family) { -#ifdef INET6 - case AF_INET6: -#endif -#ifdef INET - case AF_INET: -#endif -#if defined(INET6) || defined(INET) - rn = rnh->rnh_matchaddr(dst, &rnh->head); - if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { - struct sockaddr *mask; - u_char *m, *n; - int len; - - /* - * compare mask to see if the new route is - * more specific than the existing one - */ - rt0 = RNTORT(rn); - RT_LOCK(rt0); - RT_ADDREF(rt0); - RT_UNLOCK(rt0); - /* - * A host route is already present, so - * leave the flow-table entries as is. - */ - if (rt0->rt_flags & RTF_HOST) { - RTFREE(rt0); - rt0 = NULL; - } else if (!(flags & RTF_HOST) && netmask) { - mask = rt_mask(rt0); - len = mask->sa_len; - m = (u_char *)mask; - n = (u_char *)netmask; - while (len-- > 0) { - if (*n != *m) - break; - n++; - m++; - } - if (len == 0 || (*n < *m)) { - RTFREE(rt0); - rt0 = NULL; - } - } - } -#endif/* INET6 || INET */ - } - - return (rt0); -} -#endif - int rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, u_int fibnum) { int error = 0; struct rtentry *rt, *rt_old; -#ifdef FLOWTABLE - struct rtentry *rt0; -#endif struct radix_node *rn; struct rib_head *rnh; struct ifaddr *ifa; @@ -1710,10 +1642,6 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru } #endif -#ifdef FLOWTABLE - rt0 = rt_flowtable_check_route(rnh, info); -#endif /* FLOWTABLE */ - /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, &rnh->head, rt->rt_nodes); @@ -1748,18 +1676,8 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru ifa_free(rt->rt_ifa); R_Free(rt_key(rt)); uma_zfree(V_rtzone, rt); -#ifdef FLOWTABLE - if (rt0 != NULL) - RTFREE(rt0); -#endif return (EEXIST); } -#ifdef FLOWTABLE - else if (rt0 != NULL) { - flowtable_route_flush(dst->sa_family, rt0); - RTFREE(rt0); - } -#endif if (rt_old != NULL) { rt_notifydelete(rt_old, info); Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Jul 27 12:37:18 2017 (r321617) +++ head/sys/netinet/ip_output.c Thu Jul 27 13:03:36 2017 (r321618) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef RADIX_MPATH #include #endif @@ -243,11 +242,6 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct rou ro = &iproute; bzero(ro, sizeof (*ro)); } - -#ifdef FLOWTABLE - if (ro->ro_rt == NULL) - (void )flowtable_lookup(AF_INET, m, ro); -#endif if (opt) { int len = 0; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Jul 27 12:37:18 2017 (r321617) +++ head/sys/netinet6/ip6_output.c Thu Jul 27 13:03:36 2017 (r321618) @@ -117,10 +117,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FLOWTABLE -#include -#endif - extern int in6_mcast_loop; struct ip6_exthdrs { @@ -502,10 +498,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, if (opt && opt->ip6po_rthdr) ro = &opt->ip6po_route; dst = (struct sockaddr_in6 *)&ro->ro_dst; -#ifdef FLOWTABLE - if (ro->ro_rt == NULL) - (void )flowtable_lookup(AF_INET6, m, (struct route *)ro); -#endif fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m); again: /* Modified: head/usr.bin/netstat/Makefile ============================================================================== --- head/usr.bin/netstat/Makefile Thu Jul 27 12:37:18 2017 (r321617) +++ head/usr.bin/netstat/Makefile Thu Jul 27 13:03:36 2017 (r321618) @@ -6,7 +6,7 @@ PROG= netstat SRCS= if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \ unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c \ - flowtable.c nl_defs.h + nl_defs.h nl_symbols.c: nlist_symbols awk '\ Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Thu Jul 27 12:37:18 2017 (r321617) +++ head/usr.bin/netstat/main.c Thu Jul 27 13:03:36 2017 (r321618) @@ -480,7 +480,6 @@ main(int argc, char *argv[]) xo_open_container("statistics"); if (sflag) { rt_stats(); - flowtable_stats(); } else routepr(fib, af); xo_close_container("statistics"); Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Thu Jul 27 12:37:18 2017 (r321617) +++ head/usr.bin/netstat/netstat.h Thu Jul 27 13:03:36 2017 (r321618) @@ -140,7 +140,6 @@ void intpr(void (*)(char *), int); void pr_family(int); void rt_stats(void); -void flowtable_stats(void); char *routename(struct sockaddr *, int); const char *netname(struct sockaddr *, struct sockaddr *); From owner-svn-src-all@freebsd.org Thu Jul 27 13:37:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92597DCB5E5; Thu, 27 Jul 2017 13:37:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F4F77689E; Thu, 27 Jul 2017 13:37:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RDbLjP092908; Thu, 27 Jul 2017 13:37:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RDbLtR092906; Thu, 27 Jul 2017 13:37:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707271337.v6RDbLtR092906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 27 Jul 2017 13:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321619 - head/release/arm X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/arm X-SVN-Commit-Revision: 321619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 13:37:22 -0000 Author: gjb Date: Thu Jul 27 13:37:21 2017 New Revision: 321619 URL: https://svnweb.freebsd.org/changeset/base/321619 Log: Bump the image size for BANANAPI and CUBIEBOARD2 to 1.5G, as 1G is no longer large enough. Reported by: manu Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Thu Jul 27 13:03:36 2017 (r321618) +++ head/release/arm/BANANAPI.conf Thu Jul 27 13:37:21 2017 (r321619) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-bananapi" KERNEL="GENERIC" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="32m -b 1m" FAT_TYPE="16" Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Thu Jul 27 13:03:36 2017 (r321618) +++ head/release/arm/CUBIEBOARD2.conf Thu Jul 27 13:37:21 2017 (r321619) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-cubieboard2" KERNEL="GENERIC" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="32m -b 1m" FAT_TYPE="16" From owner-svn-src-all@freebsd.org Thu Jul 27 14:34:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39A37DCC6A7; Thu, 27 Jul 2017 14:34:59 +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 042A27C7F3; Thu, 27 Jul 2017 14:34:58 +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 v6REYw8e018265; Thu, 27 Jul 2017 14:34:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6REYwf2018264; Thu, 27 Jul 2017 14:34:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707271434.v6REYwf2018264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Jul 2017 14:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321620 - head/usr.bin/w X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.bin/w X-SVN-Commit-Revision: 321620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 14:34:59 -0000 Author: mav Date: Thu Jul 27 14:34:57 2017 New Revision: 321620 URL: https://svnweb.freebsd.org/changeset/base/321620 Log: Fix singular/plural "users" output. It was broken during libxo'fication. PR: 221039 Submitted by: timur@ MFC after: 1 week Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Thu Jul 27 13:37:21 2017 (r321619) +++ head/usr.bin/w/w.c Thu Jul 27 14:34:57 2017 (r321620) @@ -511,7 +511,7 @@ pr_header(time_t *nowp, int nusers) } /* Print number of users logged in to system */ - xo_emit(" {:users/%d} {N:user%s}", nusers, nusers == 1 ? "" : "s"); + xo_emit(" {:users/%d} {Np:user,users}", nusers); /* * Print 1, 5, and 15 minute load averages. From owner-svn-src-all@freebsd.org Thu Jul 27 15:06:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 797D7DCCFE1; Thu, 27 Jul 2017 15:06:35 +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 472AE7D7C9; Thu, 27 Jul 2017 15:06:35 +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 v6RF6YXA030586; Thu, 27 Jul 2017 15:06:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RF6YxM030585; Thu, 27 Jul 2017 15:06:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201707271506.v6RF6YxM030585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 27 Jul 2017 15:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321621 - head/sys/boot/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/boot/efi/libefi X-SVN-Commit-Revision: 321621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 15:06:35 -0000 Author: andrew Date: Thu Jul 27 15:06:34 2017 New Revision: 321621 URL: https://svnweb.freebsd.org/changeset/base/321621 Log: Always set the receive mask in loader.efi. Some UEFI implementations set this to be too restrictive. We need to have both broadcast and unicast enabled for loader to work. Set them in all cases to ensure this is true. This allows the Cavium ThunderX 2s in the netperf cluster to netboot using a USB NIC. PR: 221001 Reviewed by: emaste, tsoome Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11732 Modified: head/sys/boot/efi/libefi/efinet.c Modified: head/sys/boot/efi/libefi/efinet.c ============================================================================== --- head/sys/boot/efi/libefi/efinet.c Thu Jul 27 14:34:57 2017 (r321620) +++ head/sys/boot/efi/libefi/efinet.c Thu Jul 27 15:06:34 2017 (r321621) @@ -187,6 +187,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) EFI_SIMPLE_NETWORK *net; EFI_HANDLE h; EFI_STATUS status; + UINT32 mask; if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) { printf("Invalid network interface %d\n", nif->nif_unit); @@ -220,16 +221,14 @@ efinet_init(struct iodesc *desc, void *machdep_hint) } } - if (net->Mode->ReceiveFilterSetting == 0) { - UINT32 mask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | - EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST; + mask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | + EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST; - status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL); - if (status != EFI_SUCCESS) { - printf("net%d: cannot set rx. filters (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); - return; - } + status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL); + if (status != EFI_SUCCESS) { + printf("net%d: cannot set rx. filters (status=%lu)\n", + nif->nif_unit, EFI_ERROR_CODE(status)); + return; } #ifdef EFINET_DEBUG From owner-svn-src-all@freebsd.org Thu Jul 27 15:33:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74A10DCD8D8; Thu, 27 Jul 2017 15:33:58 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E79C7E982; Thu, 27 Jul 2017 15:33:58 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RFXvo9043560; Thu, 27 Jul 2017 15:33:57 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RFXvsf043559; Thu, 27 Jul 2017 15:33:57 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707271533.v6RFXvsf043559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 27 Jul 2017 15:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321622 - head/sys/dev/isp X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/dev/isp X-SVN-Commit-Revision: 321622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 15:33:58 -0000 Author: ken Date: Thu Jul 27 15:33:57 2017 New Revision: 321622 URL: https://svnweb.freebsd.org/changeset/base/321622 Log: Fix probing FC targets with hard addressing turned on. This largely reverts FreeBSD SVN change 289937 from October 25th, 2015. The intent of that change was to keep loop IDs persistent across chip reinits. The problem is that the change turned on the PREVLOOP / PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the Qlogic chip to not participate in the loop if it can't get the requested loop address. It also turned off soft addressing on 2400 (4Gb) and newer controllers. The isp(4) driver defaults to loop address 0, and the tape drives I have tested default to loop address 0 if hard addressing is turned on. So when hard loop addressing is turned on on the drive, the isp(4) driver just refuses to participate in the loop. The solution is to largely revert that change. I left some elements in place that are related to virtual ports, since they were new. This does work with IBM tape drives with hard and soft addressing turned on. I have tested it with 4Gb, 8Gb, and 16Gb controllers. sys/dev/isp.c: Largely revert FreeBSD SVN change 289937. I left the ispmbox.h changes in place. Don't use the PREV_ADDRESS bit on initialization. It tells the chip to not participate if it can't get the requested loop ID. Do use soft addressing on 2400 and newer chips. Use hard addressing when the user has requested a specific initiator ID. (hint.isp.X.iid=N in /boot/loader.conf) Leave some of the virtual port options from that change in place, but don't turn on the PREV_ADDRESS bit. Reviewed by: mav MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Thu Jul 27 15:06:34 2017 (r321621) +++ head/sys/dev/isp/isp.c Thu Jul 27 15:33:57 2017 (r321622) @@ -1631,6 +1631,7 @@ isp_fibre_init(ispsoftc_t *isp) fcparam *fcp; isp_icb_t local, *icbp = &local; mbreg_t mbs; + int ownloopid; /* * We only support one channel on non-24XX cards @@ -1709,15 +1710,22 @@ isp_fibre_init(ispsoftc_t *isp) } icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_count = fcp->isp_retry_count; - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; - else - icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS; + icbp->icb_hardaddr = fcp->isp_loopid; + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } /* + * Our life seems so much better with 2200s and later with + * the latest f/w if we set Hard Address. + */ + if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { + icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; + } + + /* * Right now we just set extended options to prefer point-to-point * over loop based upon some soft config options. * @@ -1951,6 +1959,7 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp_icb_2400_t local, *icbp = &local; mbreg_t mbs; int chan; + int ownloopid = 0; /* * Check to see whether all channels have *some* kind of role @@ -2023,14 +2032,18 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_xchgcnt >>= 1; } - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; - else - icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS; + + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + icbp->icb_hardaddr = fcp->isp_loopid; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } + if (ownloopid) + icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; + + icbp->icb_fwoptions2 = fcp->isp_xfwoptions; if (isp->isp_confopts & ISP_CFG_NOFCTAPE) { icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE; } @@ -2093,6 +2106,7 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHA; } + icbp->icb_fwoptions3 = fcp->isp_zfwoptions; if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) { icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24; } @@ -2132,6 +2146,9 @@ isp_fibre_init_2400(ispsoftc_t *isp) break; } } + if (ownloopid == 0) { + icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID; + } icbp->icb_logintime = ICB_LOGIN_TOV; if (fcp->isp_wwnn && fcp->isp_wwpn) { @@ -2244,14 +2261,13 @@ isp_fibre_init_2400(ispsoftc_t *isp) pi.vp_port_options |= ICB2400_VPOPT_INI_ENABLE; if ((fcp2->role & ISP_ROLE_TARGET) == 0) pi.vp_port_options |= ICB2400_VPOPT_TGT_DISABLE; + if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { + pi.vp_port_loopid = fcp2->isp_loopid; + if (isp->isp_confopts & ISP_CFG_OWNLOOPID) + pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; + } + } - if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { - pi.vp_port_loopid = fcp2->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; - else - pi.vp_port_options |= ICB2400_VPOPT_PREV_ADDRESS; - } MAKE_NODE_NAME_FROM_WWN(pi.vp_port_portname, fcp2->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(pi.vp_port_nodename, fcp2->isp_wwnn); off = fcp->isp_scratch; @@ -2329,8 +2345,6 @@ isp_fc_enable_vp(ispsoftc_t *isp, int chan) vp.vp_mod_ports[0].loopid = fcp->isp_loopid; if (isp->isp_confopts & ISP_CFG_OWNLOOPID) vp.vp_mod_ports[0].options |= ICB2400_VPOPT_HARD_ADDRESS; - else - vp.vp_mod_ports[0].options |= ICB2400_VPOPT_PREV_ADDRESS; } MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwpn, fcp->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwnn, fcp->isp_wwnn); From owner-svn-src-all@freebsd.org Thu Jul 27 15:51:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C343FDCDEB5; Thu, 27 Jul 2017 15:51:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 904B17F8A0; Thu, 27 Jul 2017 15:51:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RFpur4050063; Thu, 27 Jul 2017 15:51:56 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RFpuLP050062; Thu, 27 Jul 2017 15:51:56 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707271551.v6RFpuLP050062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 27 Jul 2017 15:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321623 - head/sys/dev/isp X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/dev/isp X-SVN-Commit-Revision: 321623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 15:51:57 -0000 Author: ken Date: Thu Jul 27 15:51:56 2017 New Revision: 321623 URL: https://svnweb.freebsd.org/changeset/base/321623 Log: Remove duplicate assignments from r321622. Submitted by: mav MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Thu Jul 27 15:33:57 2017 (r321622) +++ head/sys/dev/isp/isp.c Thu Jul 27 15:51:56 2017 (r321623) @@ -2043,7 +2043,6 @@ isp_fibre_init_2400(ispsoftc_t *isp) if (ownloopid) icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; - icbp->icb_fwoptions2 = fcp->isp_xfwoptions; if (isp->isp_confopts & ISP_CFG_NOFCTAPE) { icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE; } @@ -2106,7 +2105,6 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHA; } - icbp->icb_fwoptions3 = fcp->isp_zfwoptions; if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) { icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24; } From owner-svn-src-all@freebsd.org Thu Jul 27 15:59:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03652DCE00D; Thu, 27 Jul 2017 15:59:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5D7D7FB8B; Thu, 27 Jul 2017 15:59:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RFxb12052682; Thu, 27 Jul 2017 15:59:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RFxbet052681; Thu, 27 Jul 2017 15:59:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707271559.v6RFxbet052681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 27 Jul 2017 15:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321624 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 321624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 15:59:38 -0000 Author: gjb Date: Thu Jul 27 15:59:36 2017 New Revision: 321624 URL: https://svnweb.freebsd.org/changeset/base/321624 Log: Add an errata entry to reflect an incorrect attribution for r315330. Reported by: Jim Thompson Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jul 27 15:51:56 2017 (r321623) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jul 27 15:59:36 2017 (r321624) @@ -179,6 +179,13 @@ boot Systems being upgraded from 11.1-RC1 and earlier and 11.1-RC3 to 11.1-RELEASE should be unaffected. + + + [2017-07-27] The release notes erroneously state + revision r315330 was sponsored by Rubicon + Communications, LLC (Netgate), when in fact this work was + done by Hiroki Mori independently. + From owner-svn-src-all@freebsd.org Thu Jul 27 16:08:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8678BDCE3B8; Thu, 27 Jul 2017 16:08:36 +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 61EE880298; Thu, 27 Jul 2017 16:08:35 +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 0916710AF12; Thu, 27 Jul 2017 12:08:28 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r321594 - stable/11 Date: Thu, 27 Jul 2017 08:47:30 -0700 Message-ID: <3534925.c9nRS26nSD@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201707262318.v6QNIEJ5041684@repo.freebsd.org> References: <201707262318.v6QNIEJ5041684@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); Thu, 27 Jul 2017 12:08:28 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 16:08:36 -0000 On Wednesday, July 26, 2017 11:18:14 PM Ed Maste wrote: > Author: emaste > Date: Wed Jul 26 23:18:14 2017 > New Revision: 321594 > URL: https://svnweb.freebsd.org/changeset/base/321594 > > Log: > MFC r312857: Use cross-NM (XNM) in compat32 build > > An attempt to build mips64 using external toolchain failed as it tried > to use the host amd64 nm. Note that none of the mips bits for lib32 have been merged to 11. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jul 27 16:40:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 192FFDAA54D; Thu, 27 Jul 2017 16:40:16 +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 D569081E9C; Thu, 27 Jul 2017 16:40:15 +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 v6RGeEPr069695; Thu, 27 Jul 2017 16:40:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RGeEgq069693; Thu, 27 Jul 2017 16:40:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707271640.v6RGeEgq069693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Jul 2017 16:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321625 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 321625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 16:40:16 -0000 Author: kib Date: Thu Jul 27 16:40:14 2017 New Revision: 321625 URL: https://svnweb.freebsd.org/changeset/base/321625 Log: Make the number of children for pctrie node available outside subr_pctrie.c. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D11435 Modified: head/sys/kern/subr_pctrie.c head/sys/sys/pctrie.h Modified: head/sys/kern/subr_pctrie.c ============================================================================== --- head/sys/kern/subr_pctrie.c Thu Jul 27 15:59:36 2017 (r321624) +++ head/sys/kern/subr_pctrie.c Thu Jul 27 16:40:14 2017 (r321625) @@ -58,18 +58,6 @@ __FBSDID("$FreeBSD$"); #include #endif -/* - * These widths should allow the pointers to a node's children to fit within - * a single cache line. The extra levels from a narrow width should not be - * a problem thanks to path compression. - */ -#ifdef __LP64__ -#define PCTRIE_WIDTH 4 -#else -#define PCTRIE_WIDTH 3 -#endif - -#define PCTRIE_COUNT (1 << PCTRIE_WIDTH) #define PCTRIE_MASK (PCTRIE_COUNT - 1) #define PCTRIE_LIMIT (howmany(sizeof(uint64_t) * NBBY, PCTRIE_WIDTH) - 1) Modified: head/sys/sys/pctrie.h ============================================================================== --- head/sys/sys/pctrie.h Thu Jul 27 15:59:36 2017 (r321624) +++ head/sys/sys/pctrie.h Thu Jul 27 16:40:14 2017 (r321625) @@ -133,5 +133,18 @@ pctrie_is_empty(struct pctrie *ptree) return (ptree->pt_root == 0); } +/* + * These widths should allow the pointers to a node's children to fit within + * a single cache line. The extra levels from a narrow width should not be + * a problem thanks to path compression. + */ +#ifdef __LP64__ +#define PCTRIE_WIDTH 4 +#else +#define PCTRIE_WIDTH 3 +#endif + +#define PCTRIE_COUNT (1 << PCTRIE_WIDTH) + #endif /* _KERNEL */ #endif /* !_SYS_PCTRIE_H_ */ From owner-svn-src-all@freebsd.org Thu Jul 27 17:51:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D6D1DAC1E4; Thu, 27 Jul 2017 17:51:52 +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 4CD008480B; Thu, 27 Jul 2017 17:51:52 +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 v6RHpp2e099010; Thu, 27 Jul 2017 17:51:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RHppVD099009; Thu, 27 Jul 2017 17:51:51 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707271751.v6RHppVD099009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 27 Jul 2017 17:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321626 - head/sys/arm/allwinner/clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 321626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 17:51:52 -0000 Author: manu Date: Thu Jul 27 17:51:51 2017 New Revision: 321626 URL: https://svnweb.freebsd.org/changeset/base/321626 Log: Allwinner A64: fix typo 'pll_ddr0' is the dram parent, not 'pll_ddr' Modified: head/sys/arm/allwinner/clkng/ccu_a64.c Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Thu Jul 27 16:40:14 2017 (r321625) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Thu Jul 27 17:51:51 2017 (r321626) @@ -712,7 +712,7 @@ static struct clk_fixed_def *fixed_factor_clks[] = { static struct aw_clk_init init_clks[] = { {"ahb1", "pll_periph0", 0, false}, {"ahb2", "pll_periph0", 0, false}, - {"dram", "pll_ddr", 0, false}, + {"dram", "pll_ddr0", 0, false}, }; void From owner-svn-src-all@freebsd.org Thu Jul 27 20:45:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB2C7DAF866; Thu, 27 Jul 2017 20:45:42 +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 87EE0640E8; Thu, 27 Jul 2017 20:45:42 +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 v6RKjfqK072431; Thu, 27 Jul 2017 20:45:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RKjfJJ072430; Thu, 27 Jul 2017 20:45:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707272045.v6RKjfJJ072430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Jul 2017 20:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321627 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 20:45:42 -0000 Author: kib Date: Thu Jul 27 20:45:41 2017 New Revision: 321627 URL: https://svnweb.freebsd.org/changeset/base/321627 Log: Make it possible to request nosys logging to console. New kern.lognosys values are 1 - log to ctty 2 - log to console 3 - log to both. Inspired by: eugen Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Jul 27 17:51:51 2017 (r321626) +++ head/sys/kern/kern_sig.c Thu Jul 27 20:45:41 2017 (r321627) @@ -3579,9 +3579,14 @@ nosys(struct thread *td, struct nosys_args *args) PROC_LOCK(p); tdsignal(td, SIGSYS); PROC_UNLOCK(p); - if (kern_lognosys) + if (kern_lognosys == 1 || kern_lognosys == 3) { uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, td->td_sa.code); + } + if (kern_lognosys == 2 || kern_lognosys == 3) { + printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, + td->td_sa.code); + } return (ENOSYS); } From owner-svn-src-all@freebsd.org Thu Jul 27 20:55:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F6CCDAFCC3; Thu, 27 Jul 2017 20:55:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DF0A64684; Thu, 27 Jul 2017 20:55:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RKtWiO076432; Thu, 27 Jul 2017 20:55:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RKtVET076423; Thu, 27 Jul 2017 20:55:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707272055.v6RKtVET076423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jul 2017 20:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321628 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 321628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 20:55:33 -0000 Author: rmacklem Date: Thu Jul 27 20:55:31 2017 New Revision: 321628 URL: https://svnweb.freebsd.org/changeset/base/321628 Log: Replace the checks for MNTK_UNMOUNTF with a macro that does the same thing. This patch defines a macro that checks for MNTK_UNMOUNTF and replaces explicit checks with this macro. It has no effect on semantics, but prepares the code for a future patch where there will also be a NFS specific flag for "forced dismount about to occur". Suggested by: kib MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfscl.h head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfs/nfs_commonkrpc.c Thu Jul 27 20:55:31 2017 (r321628) @@ -511,7 +511,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmo if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ - if (nmp != NULL && (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) { + if (nmp != NULL && NFSCL_FORCEDISM(nmp->nm_mountp)) { m_freem(nd->nd_mreq); return (ESTALE); } @@ -1231,7 +1231,7 @@ newnfs_sigintr(struct nfsmount *nmp, struct thread *td sigset_t tmpset; /* Terminate all requests while attempting a forced unmount. */ - if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + if (NFSCL_FORCEDISM(nmp->nm_mountp)) return (EIO); if (!(nmp->nm_flag & NFSMNT_INT)) return (0); Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Jul 27 20:55:31 2017 (r321628) @@ -1839,7 +1839,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *i lp->nfslock_lock |= NFSV4LOCK_LOCKWANTED; } while (lp->nfslock_lock & (NFSV4LOCK_LOCK | NFSV4LOCK_LOCKWANTED)) { - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (mp != NULL && NFSCL_FORCEDISM(mp)) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; return (0); } @@ -1893,7 +1893,7 @@ nfsv4_relref(struct nfsv4lock *lp) * not wait for threads that want the exclusive lock. If priority needs * to be given to threads that need the exclusive lock, a call to nfsv4_lock() * with the 2nd argument == 0 should be done before calling nfsv4_getref(). - * If the mp argument is not NULL, check for MNTK_UNMOUNTF being set and + * If the mp argument is not NULL, check for NFSCL_FORCEDISM() being set and * return without getting a refcnt for that case. */ APPLESTATIC void @@ -1908,7 +1908,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void * Wait for a lock held. */ while (lp->nfslock_lock & NFSV4LOCK_LOCK) { - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + if (mp != NULL && NFSCL_FORCEDISM(mp)) return; lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) @@ -1916,7 +1916,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void (void) nfsmsleep(&lp->nfslock_lock, mutex, PZERO - 1, "nfsv4gr", NULL); } - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + if (mp != NULL && NFSCL_FORCEDISM(mp)) return; lp->nfslock_usecnt++; @@ -4197,9 +4197,7 @@ nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsc * This RPC attempt will fail when it calls * newnfs_request(). */ - if (nmp != NULL && - (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) - != 0) { + if (nmp != NULL && NFSCL_FORCEDISM(nmp->nm_mountp)) { mtx_unlock(&sep->nfsess_mtx); return (ESTALE); } Modified: head/sys/fs/nfs/nfscl.h ============================================================================== --- head/sys/fs/nfs/nfscl.h Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfs/nfscl.h Thu Jul 27 20:55:31 2017 (r321628) @@ -59,6 +59,9 @@ struct nfsv4node { #define NFSCL_RENEW(l) (((l) < 2) ? 1 : ((l) / 2)) #define NFSCL_LEASE(r) ((r) * 2) +/* This macro checks to see if a forced dismount is about to occur. */ +#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + /* * These flag bits are used for the argument to nfscl_fillsattr() to * indicate special handling of the attributes. Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfsclient/nfs_clbio.c Thu Jul 27 20:55:31 2017 (r321628) @@ -1342,7 +1342,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thre if ((nmp->nm_flag & NFSMNT_INT) == 0) intrflg = 0; - if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(nmp->nm_mountp)) intrflg = 1; if (intrflg) { slpflag = PCATCH; Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Jul 27 20:55:31 2017 (r321628) @@ -313,7 +313,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in *npp = NULL; /* For forced dismounts, just return error. */ - if ((mntp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(mntp)) return (EINTR); MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); @@ -336,7 +336,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in * stopped and the MNTK_UNMOUNTF flag is set before doing * a vflush() with FORCECLOSE, we should be ok here. */ - if ((mntp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(mntp)) error = EINTR; else { vfs_hash_ref(mntp, hash, td, &nvp, newnfs_vncmpf, nfhp); Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfsclient/nfs_clstate.c Thu Jul 27 20:55:31 2017 (r321628) @@ -803,7 +803,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP * allocate a new clientid and get out now. For the case where * clp != NULL, this is a harmless optimization. */ - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); if (newclp != NULL) free(newclp, M_NFSCLCLIENT); @@ -843,7 +843,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP } NFSLOCKCLSTATE(); while ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0 && !igotlock && - (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0) + !NFSCL_FORCEDISM(mp)) igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); if (igotlock == 0) { @@ -858,10 +858,10 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); } - if (igotlock == 0 && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (igotlock == 0 && NFSCL_FORCEDISM(mp)) { /* * Both nfsv4_lock() and nfsv4_getref() know to check - * for MNTK_UNMOUNTF and return without sleeping to + * for NFSCL_FORCEDISM() and return without sleeping to * wait for the exclusive lock to be released, since it * might be held by nfscl_umount() and we need to get out * now for that case and not wait until nfscl_umount() @@ -4844,7 +4844,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_ lyp->nfsly_timestamp = NFSD_MONOSEC + 120; } nfsv4_getref(&lyp->nfsly_lock, NULL, NFSCLSTATEMUTEXPTR, mp); - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); if (tlyp != NULL) free(tlyp, M_NFSLAYOUT); @@ -4903,11 +4903,10 @@ nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, do { igotlock = nfsv4_lock(&lyp->nfsly_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); - } while (igotlock == 0 && - (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0); + } while (igotlock == 0 && !NFSCL_FORCEDISM(mp)); *retflpp = NULL; } - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { lyp = NULL; *recalledp = 1; } @@ -5298,7 +5297,7 @@ nfscl_layoutcommit(vnode_t vp, NFSPROC_T *p) return (EPERM); } nfsv4_getref(&lyp->nfsly_lock, NULL, NFSCLSTATEMUTEXPTR, mp); - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); return (EPERM); } Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jul 27 20:55:31 2017 (r321628) @@ -1775,7 +1775,7 @@ nfs_sync(struct mount *mp, int waitfor) * the umount(2) syscall doesn't get stuck in VFS_SYNC() before * calling VFS_UNMOUNT(). */ - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { MNT_IUNLOCK(mp); return (EBADF); } Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Jul 27 20:45:41 2017 (r321627) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Jul 27 20:55:31 2017 (r321628) @@ -663,7 +663,7 @@ nfs_close(struct vop_close_args *ap) int error = 0, ret, localcred = 0; int fmode = ap->a_fflag; - if ((vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(vp->v_mount)) return (0); /* * During shutdown, a_cred isn't valid, so just use root. From owner-svn-src-all@freebsd.org Thu Jul 27 21:21:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A37FDB09EF; Thu, 27 Jul 2017 21:21:44 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57B096553A; Thu, 27 Jul 2017 21:21:44 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RLLh7q087722; Thu, 27 Jul 2017 21:21:43 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RLLhFv087720; Thu, 27 Jul 2017 21:21:43 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707272121.v6RLLhFv087720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 27 Jul 2017 21:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321629 - in head/sys: dev/bnxt net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: dev/bnxt net X-SVN-Commit-Revision: 321629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 21:21:44 -0000 Author: sbruno Date: Thu Jul 27 21:21:43 2017 New Revision: 321629 URL: https://svnweb.freebsd.org/changeset/base/321629 Log: Deprecate unused int isc_max_txqsets and int isc_max_rxqsets as they were redundant and not being used to set anything up. Submitted by: Matt Macy Reported by: Jeb Cramer Sponsored by: Limelight Networks Modified: head/sys/dev/bnxt/if_bnxt.c head/sys/net/iflib.h Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Thu Jul 27 20:55:31 2017 (r321628) +++ head/sys/dev/bnxt/if_bnxt.c Thu Jul 27 21:21:43 2017 (r321629) @@ -761,12 +761,12 @@ bnxt_attach_pre(if_ctx_t ctx) scctx->isc_nrxd[1]; scctx->isc_rxqsizes[2] = sizeof(struct rx_prod_pkt_bd) * scctx->isc_nrxd[2]; - scctx->isc_max_rxqsets = min(pci_msix_count(softc->dev)-1, + scctx->isc_nrxqsets_max = min(pci_msix_count(softc->dev)-1, softc->func.max_cp_rings - 1); - scctx->isc_max_rxqsets = min(scctx->isc_max_rxqsets, + scctx->isc_nrxqsets_max = min(scctx->isc_nrxqsets_max, softc->func.max_rx_rings); - scctx->isc_max_txqsets = min(softc->func.max_rx_rings, - softc->func.max_cp_rings - scctx->isc_max_rxqsets - 1); + scctx->isc_ntxqsets_max = min(softc->func.max_rx_rings, + softc->func.max_cp_rings - scctx->isc_nrxqsets_max - 1); scctx->isc_rss_table_size = HW_HASH_INDEX_SIZE; scctx->isc_rss_table_mask = scctx->isc_rss_table_size - 1; Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Thu Jul 27 20:55:31 2017 (r321628) +++ head/sys/net/iflib.h Thu Jul 27 21:21:43 2017 (r321629) @@ -200,8 +200,6 @@ typedef struct if_softc_ctx { uint8_t isc_txd_size[8]; uint8_t isc_rxd_size[8]; - int isc_max_txqsets; - int isc_max_rxqsets; int isc_tx_tso_segments_max; int isc_tx_tso_size_max; int isc_tx_tso_segsize_max; From owner-svn-src-all@freebsd.org Thu Jul 27 22:53:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D072DB2B61; Thu, 27 Jul 2017 22:53:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1269C683DE; Thu, 27 Jul 2017 22:53:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RMrlpH025260; Thu, 27 Jul 2017 22:53:47 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RMrl90025259; Thu, 27 Jul 2017 22:53:47 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707272253.v6RMrl90025259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 27 Jul 2017 22:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321630 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 321630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 22:53:48 -0000 Author: sbruno Date: Thu Jul 27 22:53:47 2017 New Revision: 321630 URL: https://svnweb.freebsd.org/changeset/base/321630 Log: Slight restructure of iflib_busdma_load_mbuf_sg() to fix accounting when m_collapse() fails. Submitted by: krzystof.galazka@intel.com Reviewed by: Jeb Cramer Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D11476 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Jul 27 21:21:43 2017 (r321629) +++ head/sys/net/iflib.c Thu Jul 27 22:53:47 2017 (r321630) @@ -2975,6 +2975,8 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag #endif ifsd_m[next] = m; while (buflen > 0) { + if (i >= max_segs) + goto err; max_sgsize = MIN(buflen, maxsegsz); curaddr = pmap_kextract(vaddr); sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); @@ -2984,8 +2986,6 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag vaddr += sgsize; buflen -= sgsize; i++; - if (i >= max_segs) - goto err; } count++; tmp = m; From owner-svn-src-all@freebsd.org Thu Jul 27 23:01:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AF16DB2E28; Thu, 27 Jul 2017 23:01:09 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBF6A68669; Thu, 27 Jul 2017 23:01:08 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RN171R028569; Thu, 27 Jul 2017 23:01:07 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RN17oh028568; Thu, 27 Jul 2017 23:01:07 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707272301.v6RN17oh028568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 27 Jul 2017 23:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321631 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 321631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 23:01:09 -0000 Author: sbruno Date: Thu Jul 27 23:01:07 2017 New Revision: 321631 URL: https://svnweb.freebsd.org/changeset/base/321631 Log: Drop IXL RX lock during TCP_LRO, fixes LOR mahem while holding the RX queue lock when the uppoer stack is called inside TCP_LRO Submitted by: Kevin Bowling Reviewed by: erj Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D11724 Modified: head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Thu Jul 27 22:53:47 2017 (r321630) +++ head/sys/dev/ixl/ixl_txrx.c Thu Jul 27 23:01:07 2017 (r321631) @@ -1400,9 +1400,7 @@ ixl_rx_input(struct rx_ring *rxr, struct ifnet *ifp, s return; } #endif - IXL_RX_UNLOCK(rxr); (*ifp->if_input)(ifp, m); - IXL_RX_LOCK(rxr); } @@ -1730,7 +1728,9 @@ next_desc: /* Now send to the stack or do LRO */ if (sendmp != NULL) { rxr->next_check = i; + IXL_RX_UNLOCK(rxr); ixl_rx_input(rxr, ifp, sendmp, ptype); + IXL_RX_LOCK(rxr); i = rxr->next_check; } @@ -1747,6 +1747,8 @@ next_desc: rxr->next_check = i; + IXL_RX_UNLOCK(rxr); + #if defined(INET6) || defined(INET) /* * Flush any outstanding LRO work @@ -1762,7 +1764,6 @@ next_desc: #endif #endif /* defined(INET6) || defined(INET) */ - IXL_RX_UNLOCK(rxr); return (FALSE); } From owner-svn-src-all@freebsd.org Thu Jul 27 23:09:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68F41DB2F58; Thu, 27 Jul 2017 23:09:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34EF268A64; Thu, 27 Jul 2017 23:09:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RN9C7L029718; Thu, 27 Jul 2017 23:09:12 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RN9CUs029717; Thu, 27 Jul 2017 23:09:12 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707272309.v6RN9CUs029717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jul 2017 23:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321632 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/fs/nfsclient X-SVN-Commit-Revision: 321632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 23:09:13 -0000 Author: rmacklem Date: Thu Jul 27 23:09:12 2017 New Revision: 321632 URL: https://svnweb.freebsd.org/changeset/base/321632 Log: MFC: r321314 r320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers. r320062 used nm_rsize, nm_wsize to set the maximum request/response sizes for the NFSv4.1 session. If rsize,wsize are not specified as options, the value of nm_rsize, nm_wsize is 0 at session creation, resulting in values for request/response that are too small. This patch fixes the problem. A workaround is to specify rsize=N,wsize=N mount options explicitly, so they are set before session creation. This bug only affects NFSv4.1 mounts against some non-FreeBSD servers. Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 27 23:01:07 2017 (r321631) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 27 23:09:12 2017 (r321632) @@ -4664,6 +4664,11 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc struct nfsrv_descript *nd = &nfsd; int error, irdcnt; + /* Make sure nm_rsize, nm_wsize is set. */ + if (nmp->nm_rsize > NFS_MAXBSIZE || nmp->nm_rsize == 0) + nmp->nm_rsize = NFS_MAXBSIZE; + if (nmp->nm_wsize > NFS_MAXBSIZE || nmp->nm_wsize == 0) + nmp->nm_wsize = NFS_MAXBSIZE; nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; From owner-svn-src-all@freebsd.org Thu Jul 27 23:14:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7037DDB33B6; Thu, 27 Jul 2017 23:14:18 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D67168FCD; Thu, 27 Jul 2017 23:14:18 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RNEHax033482; Thu, 27 Jul 2017 23:14:17 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RNEHwQ033479; Thu, 27 Jul 2017 23:14:17 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201707272314.v6RNEHwQ033479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 27 Jul 2017 23:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321633 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: zbb X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 321633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 23:14:18 -0000 Author: zbb Date: Thu Jul 27 23:14:17 2017 New Revision: 321633 URL: https://svnweb.freebsd.org/changeset/base/321633 Log: Fix TEX index acquisition using L2 attributes The TEX index is selected using (TEX0 C B) bits from the L2 descriptor. Use correct index by masking and shifting those bits accordingly. Differential Revision: https://reviews.freebsd.org/D11703 Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pte-v6.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Thu Jul 27 23:09:12 2017 (r321632) +++ head/sys/arm/arm/pmap-v6.c Thu Jul 27 23:14:17 2017 (r321633) @@ -525,8 +525,8 @@ pmap_remap_vm_attr(vm_memattr_t old_attr, vm_memattr_t int old_idx, new_idx; /* Map VM memattrs to indexes to tex_class table. */ - old_idx = pte2_attr_tab[(int)old_attr]; - new_idx = pte2_attr_tab[(int)new_attr]; + old_idx = PTE2_ATTR2IDX(pte2_attr_tab[(int)old_attr]); + new_idx = PTE2_ATTR2IDX(pte2_attr_tab[(int)new_attr]); /* Replace TEX attribute and apply it. */ tex_class[old_idx] = tex_class[new_idx]; Modified: head/sys/arm/include/pte-v6.h ============================================================================== --- head/sys/arm/include/pte-v6.h Thu Jul 27 23:09:12 2017 (r321632) +++ head/sys/arm/include/pte-v6.h Thu Jul 27 23:14:17 2017 (r321633) @@ -149,10 +149,12 @@ #define L2_NX 0x00000001 /* Not executable */ #define L2_B 0x00000004 /* Bufferable page */ #define L2_C 0x00000008 /* Cacheable page */ +#define L2_CB_SHIFT 2 /* C,B bit field shift */ #define L2_AP(x) ((x) << 4) #define L2_AP0 0x00000010 /* access permissions bit 0*/ #define L2_AP1 0x00000020 /* access permissions bit 1*/ -#define L2_TEX(x) ((x) << 6) /* type extension */ +#define L2_TEX_SHIFT 6 /* type extension field shift */ +#define L2_TEX(x) ((x) << L2_TEX_SHIFT) /* type extension */ #define L2_TEX0 0x00000040 /* type extension bit 0 */ #define L2_TEX1 0x00000080 /* type extension bit 1 */ #define L2_TEX2 0x00000100 /* type extension bit 2 */ @@ -271,6 +273,10 @@ #define PTE2_FRAME L2_S_FRAME #define PTE2_ATTR_MASK (L2_TEX0 | L2_C | L2_B) +/* PTE2 attributes to TEX class index: (TEX0 C B) */ +#define PTE2_ATTR2IDX(attr) \ + ((((attr) & (L2_C | L2_B)) >> L2_CB_SHIFT) | \ + (((attr) & L2_TEX0) >> (L2_TEX_SHIFT - L2_CB_SHIFT))) #define PTE2_AP_KR (PTE2_RO | PTE2_NM) #define PTE2_AP_KRW 0 From owner-svn-src-all@freebsd.org Thu Jul 27 23:15:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02806DB3431; Thu, 27 Jul 2017 23:15:26 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5816691D5; Thu, 27 Jul 2017 23:15:25 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6RNFP8h033565; Thu, 27 Jul 2017 23:15:25 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6RNFPic033564; Thu, 27 Jul 2017 23:15:25 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707272315.v6RNFPic033564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jul 2017 23:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321634 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/10/sys/fs/nfsclient X-SVN-Commit-Revision: 321634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 23:15:26 -0000 Author: rmacklem Date: Thu Jul 27 23:15:24 2017 New Revision: 321634 URL: https://svnweb.freebsd.org/changeset/base/321634 Log: MFC: r321314 r320062 introduced a bug when doing NFSv4.1 mounts against some non-FreeBSD servers. r320062 used nm_rsize, nm_wsize to set the maximum request/response sizes for the NFSv4.1 session. If rsize,wsize are not specified as options, the value of nm_rsize, nm_wsize is 0 at session creation, resulting in values for request/response that are too small. This patch fixes the problem. A workaround is to specify rsize=N,wsize=N mount options explicitly, so they are set before session creation. This bug only affects NFSv4.1 mounts against some non-FreeBSD servers. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 27 23:14:17 2017 (r321633) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 27 23:15:24 2017 (r321634) @@ -4616,6 +4616,11 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc struct nfsrv_descript *nd = &nfsd; int error, irdcnt; + /* Make sure nm_rsize, nm_wsize is set. */ + if (nmp->nm_rsize > NFS_MAXBSIZE || nmp->nm_rsize == 0) + nmp->nm_rsize = NFS_MAXBSIZE; + if (nmp->nm_wsize > NFS_MAXBSIZE || nmp->nm_wsize == 0) + nmp->nm_wsize = NFS_MAXBSIZE; nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; From owner-svn-src-all@freebsd.org Fri Jul 28 01:17:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DF9FDB56BD; Fri, 28 Jul 2017 01:17:40 +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 F02626C27E; Fri, 28 Jul 2017 01:17:39 +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 v6S1Hd0e082891; Fri, 28 Jul 2017 01:17:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S1Hdwo082890; Fri, 28 Jul 2017 01:17:39 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707280117.v6S1Hdwo082890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 28 Jul 2017 01:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321635 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 321635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 01:17:40 -0000 Author: adrian Date: Fri Jul 28 01:17:38 2017 New Revision: 321635 URL: https://svnweb.freebsd.org/changeset/base/321635 Log: [ar71xx] get rid of ath_pci - it's built as a module now. Modified: head/sys/mips/conf/TL-WDR4300 Modified: head/sys/mips/conf/TL-WDR4300 ============================================================================== --- head/sys/mips/conf/TL-WDR4300 Thu Jul 27 23:15:24 2017 (r321634) +++ head/sys/mips/conf/TL-WDR4300 Fri Jul 28 01:17:38 2017 (r321635) @@ -45,8 +45,7 @@ options GEOM_UZIP # Used for the static uboot partition map device geom_map -# yes, this board has a PCI connected atheros device -device ath_pci +# Yes, this board has a PCI connected atheros device options AR71XX_ATH_EEPROM device firmware # Used by the above options ATH_EEPROM_FIRMWARE From owner-svn-src-all@freebsd.org Fri Jul 28 01:59:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20D4BDB63B5; Fri, 28 Jul 2017 01:59:55 +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 458716D6E1; Fri, 28 Jul 2017 01:59:54 +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 v6S1xrua099663; Fri, 28 Jul 2017 01:59:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S1xr9P099662; Fri, 28 Jul 2017 01:59:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707280159.v6S1xr9P099662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 28 Jul 2017 01:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321636 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 321636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 01:59:55 -0000 Author: imp Date: Fri Jul 28 01:59:53 2017 New Revision: 321636 URL: https://svnweb.freebsd.org/changeset/base/321636 Log: Properly expand shell glob characters in NANO_PACKAGE_LIST. The defualt NANO_PACKAGE_LIST is *, which fails to work properly. Expand glob characters and make sure that we install the special pkg package first. Sponsored by: Netflix Submitted by: wout at canodus dot be PR: 219405 MFC After: 3 days Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Fri Jul 28 01:17:38 2017 (r321635) +++ head/tools/tools/nanobsd/defaults.sh Fri Jul 28 01:59:53 2017 (r321636) @@ -780,7 +780,6 @@ cust_pkgng ( ) ( echo "FAILED: need a pkg/ package for bootstrapping" exit 2 fi - NANO_PACKAGE_LIST="${_NANO_PKG_PACKAGE} ${NANO_PACKAGE_LIST}" # Mount packages into chroot mkdir -p ${NANO_WORLDDIR}/_.p @@ -788,14 +787,25 @@ cust_pkgng ( ) ( trap "umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT - # Install packages - todo="$(echo "${NANO_PACKAGE_LIST}" | awk '{ print NF }')" - echo "=== TODO: $todo" - echo "${NANO_PACKAGE_LIST}" - echo "===" - for _PKG in ${NANO_PACKAGE_LIST}; do - CR "${PKGCMD} add /_.p/${_PKG}" - done + # Install pkg-* package + CR "${PKGCMD} add /_.p/${_NANO_PKG_PACKAGE}" + + ( + # Expand any glob characters in pacakge list + cd "${NANO_PACKAGE_DIR}" + _PKGS=`find ${NANO_PACKAGE_LIST} -not -name "${_NANO_PKG_PACKAGE}" -print | sort | uniq` + + # Show todo + todo=`echo "$_PKGS" | wc -l` + echo "=== TODO: $todo" + echo "$_PKGS" + echo "===" + + # Install packages + for _PKG in $_PKGS; do + CR "${PKGCMD} add /_.p/${_PKG}" + done + ) CR0 "${PKGCMD} info" From owner-svn-src-all@freebsd.org Fri Jul 28 01:59:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A96A0DB63D4; Fri, 28 Jul 2017 01:59:59 +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 788166D6F5; Fri, 28 Jul 2017 01:59:59 +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 v6S1xwQC099729; Fri, 28 Jul 2017 01:59:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S1xwNo099728; Fri, 28 Jul 2017 01:59:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707280159.v6S1xwNo099728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 28 Jul 2017 01:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321637 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 321637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 01:59:59 -0000 Author: imp Date: Fri Jul 28 01:59:58 2017 New Revision: 321637 URL: https://svnweb.freebsd.org/changeset/base/321637 Log: Ensure that ordinary files that happen to start with .git, .hg and .cvs into the image. This makes .gitignore files in the working tree appear in the final tree... PR: 192178 Submitted by: Jason Unovitch Sponsored by: Netflix MFC After: 3 days Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Fri Jul 28 01:59:53 2017 (r321636) +++ head/tools/tools/nanobsd/defaults.sh Fri Jul 28 01:59:58 2017 (r321637) @@ -634,7 +634,7 @@ populate_slice ( ) ( if [ -n "${dir}" -a -d "${dir}" ]; then echo "Populating ${lbl} from ${dir}" cd "${dir}" - find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -dumpv ${mnt} + find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio -dumpv ${mnt} fi df -i ${mnt} nano_umount ${mnt} @@ -742,7 +742,7 @@ cust_allow_ssh_root ( ) ( cust_install_files ( ) ( cd "${NANO_TOOLS}/Files" - find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -Ldumpv ${NANO_WORLDDIR} + find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio -Ldumpv ${NANO_WORLDDIR} if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} From owner-svn-src-all@freebsd.org Fri Jul 28 02:00:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6064DB63FB; Fri, 28 Jul 2017 02:00:04 +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 74D286D75E; Fri, 28 Jul 2017 02:00:04 +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 v6S203pP099844; Fri, 28 Jul 2017 02:00:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S203wm099842; Fri, 28 Jul 2017 02:00:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707280200.v6S203wm099842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 28 Jul 2017 02:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321638 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 321638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 02:00:04 -0000 Author: imp Date: Fri Jul 28 02:00:03 2017 New Revision: 321638 URL: https://svnweb.freebsd.org/changeset/base/321638 Log: Allow _.disk.image to be specified. Submitted by: ask at develooper dot com (reworked to new structure) PR: 199191 Sponsored by: Netflix MFC After: 3 days Modified: head/tools/tools/nanobsd/defaults.sh head/tools/tools/nanobsd/legacy.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Fri Jul 28 01:59:58 2017 (r321637) +++ head/tools/tools/nanobsd/defaults.sh Fri Jul 28 02:00:03 2017 (r321638) @@ -71,6 +71,7 @@ NANO_PMAKE="make -j 3" # The default name for any image we create. NANO_IMGNAME="_.disk.full" +NANO_IMG1NAME="_.disk.image" # Options to put in make.conf during buildworld only CONF_BUILD=' ' @@ -652,7 +653,7 @@ last_orders ( ) ( # Redefine this function with any last orders you may have # after the build completed, for instance to copy the finished # image to a more convenient place: - # cp ${NANO_DISKIMGDIR}/_.disk.image /home/ftp/pub/nanobsd.disk + # cp ${NANO_DISKIMGDIR}/${NANO_IMG1NAME} /home/ftp/pub/nanobsd.disk true ) @@ -919,6 +920,7 @@ set_defaults_and_export ( ) { export_var NANO_HEADS export_var NANO_IMAGES export_var NANO_IMGNAME + export_var NANO_IMG1NAME export_var NANO_MAKE export_var NANO_MAKE_CONF_BUILD export_var NANO_MAKE_CONF_INSTALL Modified: head/tools/tools/nanobsd/legacy.sh ============================================================================== --- head/tools/tools/nanobsd/legacy.sh Fri Jul 28 01:59:58 2017 (r321637) +++ head/tools/tools/nanobsd/legacy.sh Fri Jul 28 02:00:03 2017 (r321638) @@ -191,8 +191,9 @@ create_diskimage ( ) ( fi if ${do_copyout_partition} ; then - echo "Writing out _.disk.image..." - dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + echo "Writing out ${NANO_IMG1NAME}..." + dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} \ + of=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} bs=64k fi mdconfig -d -u $MD From owner-svn-src-all@freebsd.org Fri Jul 28 03:14:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDF9DDBC1AC; Fri, 28 Jul 2017 03:14:32 +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 8C5D370B36; Fri, 28 Jul 2017 03:14:32 +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 v6S3EVU2033834; Fri, 28 Jul 2017 03:14:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3EVau033833; Fri, 28 Jul 2017 03:14:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707280314.v6S3EVau033833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 28 Jul 2017 03:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321639 - head/sys/dev/ksyms X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ksyms X-SVN-Commit-Revision: 321639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:14:32 -0000 Author: markj Date: Fri Jul 28 03:14:31 2017 New Revision: 321639 URL: https://svnweb.freebsd.org/changeset/base/321639 Log: Restrict permissions on /dev/ksyms to 0400. The ksyms(4) device was added specifically for use by lockstat(1), which as a DTrace consumer must run as root. Discussed with: emaste MFC after: 3 days Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Fri Jul 28 02:00:03 2017 (r321638) +++ head/sys/dev/ksyms/ksyms.c Fri Jul 28 03:14:31 2017 (r321639) @@ -592,7 +592,7 @@ ksyms_modevent(module_t mod __unused, int type, void * case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0444, KSYMS_DNAME); + 0400, KSYMS_DNAME); break; case MOD_UNLOAD: From owner-svn-src-all@freebsd.org Fri Jul 28 03:18:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4CE3DBC233; Fri, 28 Jul 2017 03:18:19 +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 A8C5B70CA6; Fri, 28 Jul 2017 03:18:19 +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 v6S3IIHn034008; Fri, 28 Jul 2017 03:18:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3IIxK034007; Fri, 28 Jul 2017 03:18:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707280318.v6S3IIxK034007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 28 Jul 2017 03:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321640 - head/sys/dev/ksyms X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ksyms X-SVN-Commit-Revision: 321640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:18:20 -0000 Author: markj Date: Fri Jul 28 03:18:18 2017 New Revision: 321640 URL: https://svnweb.freebsd.org/changeset/base/321640 Log: Fix style bugs in ksyms.c. No functional change intended. MFC after: 3 days Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Fri Jul 28 03:14:31 2017 (r321639) +++ head/sys/dev/ksyms/ksyms.c Fri Jul 28 03:18:18 2017 (r321640) @@ -62,41 +62,40 @@ #define STR_SYMTAB ".symtab" #define STR_STRTAB ".strtab" -#define STR_SHSTRTAB ".shstrtab" +#define STR_SHSTRTAB ".shstrtab" #define KSYMS_DNAME "ksyms" -static d_open_t ksyms_open; -static d_read_t ksyms_read; -static d_close_t ksyms_close; -static d_ioctl_t ksyms_ioctl; -static d_mmap_t ksyms_mmap; +static d_open_t ksyms_open; +static d_read_t ksyms_read; +static d_close_t ksyms_close; +static d_ioctl_t ksyms_ioctl; +static d_mmap_t ksyms_mmap; static struct cdevsw ksyms_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, - .d_open = ksyms_open, - .d_close = ksyms_close, - .d_read = ksyms_read, - .d_ioctl = ksyms_ioctl, - .d_mmap = ksyms_mmap, - .d_name = KSYMS_DNAME + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_open = ksyms_open, + .d_close = ksyms_close, + .d_read = ksyms_read, + .d_ioctl = ksyms_ioctl, + .d_mmap = ksyms_mmap, + .d_name = KSYMS_DNAME }; struct ksyms_softc { LIST_ENTRY(ksyms_softc) sc_list; - vm_offset_t sc_uaddr; - size_t sc_usize; + vm_offset_t sc_uaddr; + size_t sc_usize; pmap_t sc_pmap; struct proc *sc_proc; }; -static struct mtx ksyms_mtx; -static struct cdev *ksyms_dev; -static LIST_HEAD(, ksyms_softc) ksyms_list = - LIST_HEAD_INITIALIZER(ksyms_list); +static struct mtx ksyms_mtx; +static struct cdev *ksyms_dev; +static LIST_HEAD(, ksyms_softc) ksyms_list = LIST_HEAD_INITIALIZER(ksyms_list); -static const char ksyms_shstrtab[] = +static const char ksyms_shstrtab[] = "\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0"; struct ksyms_hdr { @@ -106,7 +105,7 @@ struct ksyms_hdr { Elf_Shdr kh_shdr[SHDR_NUM]; char kh_shstrtab[sizeof(ksyms_shstrtab)]; }; - + struct tsizes { size_t ts_symsz; size_t ts_strsz; @@ -123,7 +122,7 @@ static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol /* * Get the symbol and string table sizes for a kernel module. Add it to the - * running total. + * running total. */ static int ksyms_size_permod(linker_file_t lf, void *arg) @@ -132,35 +131,36 @@ ksyms_size_permod(linker_file_t lf, void *arg) const Elf_Sym *symtab; caddr_t strtab; long syms; - + ts = arg; - + syms = LINKER_SYMTAB_GET(lf, &symtab); ts->ts_symsz += syms * sizeof(Elf_Sym); ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab); - + return (0); } /* * For kernel module get the symbol and string table sizes, returning the - * totals in *ts. + * totals in *ts. */ -static void +static void ksyms_size_calc(struct tsizes *ts) { + ts->ts_symsz = 0; ts->ts_strsz = 0; - - (void) linker_file_foreach(ksyms_size_permod, ts); + + (void)linker_file_foreach(ksyms_size_permod, ts); } -#define KSYMS_EMIT(src, des, sz) do { \ - copyout(src, (void *)des, sz); \ - des += sz; \ - } while (0) +#define KSYMS_EMIT(src, des, sz) do { \ + copyout(src, (void *)des, sz); \ + des += sz; \ +} while (0) -#define SYMBLKSZ 256 * sizeof (Elf_Sym) +#define SYMBLKSZ (256 * sizeof(Elf_Sym)) /* * For a kernel module, add the symbol and string tables into the @@ -169,6 +169,7 @@ ksyms_size_calc(struct tsizes *ts) static int ksyms_add(linker_file_t lf, void *arg) { + char *buf; struct toffsets *to; const Elf_Sym *symtab; Elf_Sym *symp; @@ -176,43 +177,42 @@ ksyms_add(linker_file_t lf, void *arg) long symsz; size_t strsz, numsyms; linker_symval_t symval; - char *buf; int i, nsyms, len; - + to = arg; - + MOD_SLOCK; numsyms = LINKER_SYMTAB_GET(lf, &symtab); strsz = LINKER_STRTAB_GET(lf, &strtab); symsz = numsyms * sizeof(Elf_Sym); - + buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); - + while (symsz > 0) { len = min(SYMBLKSZ, symsz); bcopy(symtab, buf, len); - /* - * Fix up symbol table for kernel modules: - * string offsets need adjusted + /* + * Fix up symbol table for kernel modules: + * string offsets need adjusted * symbol values made absolute */ symp = (Elf_Sym *) buf; - nsyms = len / sizeof (Elf_Sym); + nsyms = len / sizeof(Elf_Sym); for (i = 0; i < nsyms; i++) { symp[i].st_name += to->to_stridx; - if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, - (c_linker_sym_t) &symtab[i], &symval) == 0) { - symp[i].st_value = (uintptr_t) symval.value; + if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, + (c_linker_sym_t)&symtab[i], &symval) == 0) { + symp[i].st_value = (uintptr_t)symval.value; } } - if (len > to->to_resid) { + if (len > to->to_resid) { MOD_SUNLOCK; free(buf, M_KSYMS); return (ENXIO); - } else - to->to_resid -= len; + } + to->to_resid -= len; KSYMS_EMIT(buf, to->to_symoff, len); symtab += nsyms; @@ -220,14 +220,13 @@ ksyms_add(linker_file_t lf, void *arg) } free(buf, M_KSYMS); MOD_SUNLOCK; - + if (strsz > to->to_resid) return (ENXIO); - else - to->to_resid -= strsz; + to->to_resid -= strsz; KSYMS_EMIT(strtab, to->to_stroff, strsz); to->to_stridx += strsz; - + return (0); } @@ -239,16 +238,14 @@ ksyms_add(linker_file_t lf, void *arg) static int ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, size_t resid) { - struct ksyms_hdr *hdr; - struct toffsets to; + struct toffsets to; int error = 0; - /* Be kernel stack friendly */ - hdr = malloc(sizeof (*hdr), M_KSYMS, M_WAITOK|M_ZERO); + hdr = malloc(sizeof(*hdr), M_KSYMS, M_WAITOK | M_ZERO); - /* - * Create the ELF header. + /* + * Create the ELF header. */ hdr->kh_ehdr.e_ident[EI_PAD] = 0; hdr->kh_ehdr.e_ident[EI_MAG0] = ELFMAG0; @@ -269,32 +266,32 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_ehdr.e_flags = 0; hdr->kh_ehdr.e_ehsize = sizeof(Elf_Ehdr); hdr->kh_ehdr.e_phentsize = sizeof(Elf_Phdr); - hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ + hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ hdr->kh_ehdr.e_shentsize = sizeof(Elf_Shdr); hdr->kh_ehdr.e_shnum = SHDR_NUM; hdr->kh_ehdr.e_shstrndx = SHDR_SHSTRTAB; - /* - * Add both the text and data Program headers. + /* + * Add both the text and data program headers. */ hdr->kh_txtphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .text addr/size here? */ - hdr->kh_txtphdr.p_vaddr = 0; - hdr->kh_txtphdr.p_memsz = 0; + hdr->kh_txtphdr.p_vaddr = 0; + hdr->kh_txtphdr.p_memsz = 0; hdr->kh_txtphdr.p_flags = PF_R | PF_X; - + hdr->kh_datphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .data addr/size here? */ - hdr->kh_datphdr.p_vaddr = 0; - hdr->kh_datphdr.p_memsz = 0; + hdr->kh_datphdr.p_vaddr = 0; + hdr->kh_datphdr.p_memsz = 0; hdr->kh_datphdr.p_flags = PF_R | PF_W | PF_X; - /* - * Add the Section headers: null, symtab, strtab, shstrtab, + /* + * Add the section headers: null, symtab, strtab, shstrtab. */ /* First section header - null */ - + /* Second section header - symtab */ hdr->kh_shdr[SHDR_SYMTAB].sh_name = 1; /* String offset (skip null) */ hdr->kh_shdr[SHDR_SYMTAB].sh_type = SHT_SYMTAB; @@ -302,31 +299,31 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SYMTAB].sh_addr = 0; hdr->kh_shdr[SHDR_SYMTAB].sh_offset = sizeof(*hdr); hdr->kh_shdr[SHDR_SYMTAB].sh_size = ts->ts_symsz; - hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; - hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); + hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; + hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); hdr->kh_shdr[SHDR_SYMTAB].sh_addralign = sizeof(long); hdr->kh_shdr[SHDR_SYMTAB].sh_entsize = sizeof(Elf_Sym); /* Third section header - strtab */ - hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); + hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); hdr->kh_shdr[SHDR_STRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_STRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_STRTAB].sh_offset = - hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; + hdr->kh_shdr[SHDR_STRTAB].sh_offset = + hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; hdr->kh_shdr[SHDR_STRTAB].sh_size = ts->ts_strsz; hdr->kh_shdr[SHDR_STRTAB].sh_link = 0; hdr->kh_shdr[SHDR_STRTAB].sh_info = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addralign = sizeof(char); hdr->kh_shdr[SHDR_STRTAB].sh_entsize = 0; - + /* Fourth section - shstrtab */ hdr->kh_shdr[SHDR_SHSTRTAB].sh_name = 1 + sizeof(STR_SYMTAB) + sizeof(STR_STRTAB); hdr->kh_shdr[SHDR_SHSTRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_SHSTRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_SHSTRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = + hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = offsetof(struct ksyms_hdr, kh_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_size = sizeof(ksyms_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_link = 0; @@ -334,9 +331,9 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SHSTRTAB].sh_addralign = 0 /* sizeof(char) */; hdr->kh_shdr[SHDR_SHSTRTAB].sh_entsize = 0; - /* Copy shstrtab into the header */ + /* Copy shstrtab into the header. */ bcopy(ksyms_shstrtab, hdr->kh_shstrtab, sizeof(ksyms_shstrtab)); - + to.to_symoff = uaddr + hdr->kh_shdr[SHDR_SYMTAB].sh_offset; to.to_stroff = uaddr + hdr->kh_shdr[SHDR_STRTAB].sh_offset; to.to_stridx = 0; @@ -346,13 +343,13 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s } to.to_resid = resid - sizeof(struct ksyms_hdr); - /* Emit Header */ + /* emit header */ copyout(hdr, (void *)uaddr, sizeof(struct ksyms_hdr)); - + free(hdr, M_KSYMS); - /* Add symbol and string tables for each kernelmodule */ - error = linker_file_foreach(ksyms_add, &to); + /* Add symbol and string tables for each kernel module. */ + error = linker_file_foreach(ksyms_add, &to); if (to.to_resid != 0) return (ENXIO); @@ -365,7 +362,7 @@ ksyms_cdevpriv_dtr(void *data) { struct ksyms_softc *sc; - sc = (struct ksyms_softc *)data; + sc = (struct ksyms_softc *)data; mtx_lock(&ksyms_mtx); LIST_REMOVE(sc, sc_list); @@ -373,19 +370,18 @@ ksyms_cdevpriv_dtr(void *data) free(sc, M_KSYMS); } -/* ARGSUSED */ static int ksyms_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { struct tsizes ts; + struct ksyms_softc *sc; size_t total_elf_sz; int error, try; - struct ksyms_softc *sc; - - /* - * Limit one open() per process. The process must close() - * before open()'ing again. - */ + + /* + * Limit one open() per process. The process must close() + * before open()'ing again. + */ mtx_lock(&ksyms_mtx); LIST_FOREACH(sc, &ksyms_list, sc_list) { if (sc->sc_proc == td->td_proc) { @@ -394,9 +390,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus } } - sc = (struct ksyms_softc *) malloc(sizeof (*sc), M_KSYMS, - M_NOWAIT|M_ZERO); - + sc = malloc(sizeof(*sc), M_KSYMS, M_NOWAIT | M_ZERO); if (sc == NULL) { mtx_unlock(&ksyms_mtx); return (ENOMEM); @@ -407,41 +401,39 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus mtx_unlock(&ksyms_mtx); error = devfs_set_cdevpriv(sc, ksyms_cdevpriv_dtr); - if (error) + if (error != 0) goto failed; /* - * MOD_SLOCK doesn't work here (because of a lock reversal with - * KLD_SLOCK). Therefore, simply try upto 3 times to get a "clean" + * MOD_SLOCK doesn't work here (because of a lock reversal with + * KLD_SLOCK). Therefore, simply try up to 3 times to get a "clean" * snapshot of the kernel symbol table. This should work fine in the * rare case of a kernel module being loaded/unloaded at the same - * time. + * time. */ - for(try = 0; try < 3; try++) { + for (try = 0; try < 3; try++) { /* - * Map a buffer in the calling process memory space and - * create a snapshot of the kernel symbol table in it. - */ - + * Map a buffer in the calling process memory space and + * create a snapshot of the kernel symbol table in it. + */ + /* Compute the size of buffer needed. */ ksyms_size_calc(&ts); - total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + - ts.ts_strsz; + total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + + ts.ts_strsz; - error = copyout_map(td, &(sc->sc_uaddr), - (vm_size_t) total_elf_sz); - if (error) + error = copyout_map(td, &sc->sc_uaddr, (vm_size_t)total_elf_sz); + if (error != 0) break; - sc->sc_usize = total_elf_sz; + sc->sc_usize = total_elf_sz; - error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); - if (!error) { - /* Successful Snapshot */ - return (0); - } - - /* Snapshot failed, unmap the memory and try again */ - (void) copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); + error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); + if (error == 0) + /* successful snapshot */ + return (0); + + /* Snapshot failed, unmap the memory and try again. */ + (void)copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); } failed: @@ -449,30 +441,28 @@ failed: return (error); } -/* ARGSUSED */ static int ksyms_read(struct cdev *dev, struct uio *uio, int flags __unused) { - int error; - size_t len, sz; struct ksyms_softc *sc; - off_t off; char *buf; + off_t off; + size_t len, sz; vm_size_t ubase; - + int error; + error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); - + off = uio->uio_offset; - len = uio->uio_resid; - + len = uio->uio_resid; + if (off < 0 || off > sc->sc_usize) return (EFAULT); - if (len > (sc->sc_usize - off)) + if (len > sc->sc_usize - off) len = sc->sc_usize - off; - if (len == 0) return (0); @@ -485,16 +475,14 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag ubase = sc->sc_uaddr + off; while (len) { - sz = min(PAGE_SIZE, len); - if (copyin((void *)ubase, buf, sz)) - error = EFAULT; + if (copyin((void *)ubase, buf, sz) != 0) + error = EFAULT; else error = uiomove(buf, sz, uio); - - if (error) + if (error != 0) break; - + len -= sz; ubase += sz; } @@ -503,27 +491,25 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag return (error); } -/* ARGSUSED */ static int ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, struct thread *td __unused) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); switch (cmd) { case KIOCGSIZE: - /* + /* * Return the size (in bytes) of the symbol table * snapshot. */ *(size_t *)data = sc->sc_usize; break; - case KIOCGADDR: /* * Return the address of the symbol table snapshot. @@ -531,7 +517,6 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data */ *(void **)data = (void *)sc->sc_uaddr; break; - default: error = ENOTTY; break; @@ -540,71 +525,64 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data return (error); } -/* ARGUSED */ static int ksyms_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot __unused, vm_memattr_t *memattr __unused) + int prot __unused, vm_memattr_t *memattr __unused) { - struct ksyms_softc *sc; + struct ksyms_softc *sc; int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* * XXX mmap() will actually map the symbol table into the process * address space again. */ - if (offset > round_page(sc->sc_usize) || - (*paddr = pmap_extract(sc->sc_pmap, - (vm_offset_t)sc->sc_uaddr + offset)) == 0) + if (offset > round_page(sc->sc_usize) || + (*paddr = pmap_extract(sc->sc_pmap, + (vm_offset_t)sc->sc_uaddr + offset)) == 0) return (-1); return (0); } -/* ARGUSED */ static int ksyms_close(struct cdev *dev, int flags __unused, int fmt __unused, - struct thread *td) + struct thread *td) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* Unmap the buffer from the process address space. */ - error = copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); - - return (error); + return (copyout_unmap(td, sc->sc_uaddr, sc->sc_usize)); } -/* ARGSUSED */ static int ksyms_modevent(module_t mod __unused, int type, void *data __unused) { - int error = 0; + int error; + error = 0; switch (type) { case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, 0400, KSYMS_DNAME); break; - case MOD_UNLOAD: if (!LIST_EMPTY(&ksyms_list)) return (EBUSY); destroy_dev(ksyms_dev); mtx_destroy(&ksyms_mtx); break; - case MOD_SHUTDOWN: break; - default: error = EOPNOTSUPP; break; From owner-svn-src-all@freebsd.org Fri Jul 28 03:24:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64F57DBC4F6; Fri, 28 Jul 2017 03:24:58 +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 32863710DF; Fri, 28 Jul 2017 03:24:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6S3OvLR037828; Fri, 28 Jul 2017 03:24:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3OvRD037827; Fri, 28 Jul 2017 03:24:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280324.v6S3OvRD037827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321641 - stable/10/tests/sys/vfs X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/tests/sys/vfs X-SVN-Commit-Revision: 321641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:24:58 -0000 Author: ngie Date: Fri Jul 28 03:24:57 2017 New Revision: 321641 URL: https://svnweb.freebsd.org/changeset/base/321641 Log: MFC r320445: Don't hardcode path to file in /tmp; this violates the kyua sandbox Modified: stable/10/tests/sys/vfs/trailing_slash.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/vfs/trailing_slash.sh ============================================================================== --- stable/10/tests/sys/vfs/trailing_slash.sh Fri Jul 28 03:18:18 2017 (r321640) +++ stable/10/tests/sys/vfs/trailing_slash.sh Fri Jul 28 03:24:57 2017 (r321641) @@ -6,8 +6,9 @@ # point to files. See kern/21768 for details. Fixed in r193028. # -testfile="/tmp/testfile-$$" -testlink="/tmp/testlink-$$" +: ${TMPDIR=/tmp} +testfile="$TMPDIR/testfile-$$" +testlink="$TMPDIR/testlink-$$" tests=" $testfile:$testlink:$testfile:0 From owner-svn-src-all@freebsd.org Fri Jul 28 03:25:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57450DBC528; Fri, 28 Jul 2017 03:25:02 +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 17661710EE; Fri, 28 Jul 2017 03:25:02 +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 v6S3P1dJ037885; Fri, 28 Jul 2017 03:25:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3P1mT037884; Fri, 28 Jul 2017 03:25:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280325.v6S3P1mT037884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321642 - stable/11/tests/sys/vfs X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/tests/sys/vfs X-SVN-Commit-Revision: 321642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:25:02 -0000 Author: ngie Date: Fri Jul 28 03:25:01 2017 New Revision: 321642 URL: https://svnweb.freebsd.org/changeset/base/321642 Log: MFC r320445: Don't hardcode path to file in /tmp; this violates the kyua sandbox Modified: stable/11/tests/sys/vfs/trailing_slash.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/vfs/trailing_slash.sh ============================================================================== --- stable/11/tests/sys/vfs/trailing_slash.sh Fri Jul 28 03:24:57 2017 (r321641) +++ stable/11/tests/sys/vfs/trailing_slash.sh Fri Jul 28 03:25:01 2017 (r321642) @@ -6,8 +6,9 @@ # point to files. See kern/21768 for details. Fixed in r193028. # -testfile="/tmp/testfile-$$" -testlink="/tmp/testlink-$$" +: ${TMPDIR=/tmp} +testfile="$TMPDIR/testfile-$$" +testlink="$TMPDIR/testlink-$$" tests=" $testfile:$testlink:$testfile:0 From owner-svn-src-all@freebsd.org Fri Jul 28 03:25:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97CBFDBC5E1; Fri, 28 Jul 2017 03:25:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B827134D; Fri, 28 Jul 2017 03:25:59 +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 v6S3PwIZ037996; Fri, 28 Jul 2017 03:25:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3PwS0037995; Fri, 28 Jul 2017 03:25:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280325.v6S3PwS0037995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321643 - stable/11/tests/sys/vfs X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/tests/sys/vfs X-SVN-Commit-Revision: 321643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:25:59 -0000 Author: ngie Date: Fri Jul 28 03:25:58 2017 New Revision: 321643 URL: https://svnweb.freebsd.org/changeset/base/321643 Log: MFC r320446: trailing_slash is a TAP-compliant testcase; mark it as such, instead of calling is a plain testcase. Modified: stable/11/tests/sys/vfs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/vfs/Makefile ============================================================================== --- stable/11/tests/sys/vfs/Makefile Fri Jul 28 03:25:01 2017 (r321642) +++ stable/11/tests/sys/vfs/Makefile Fri Jul 28 03:25:58 2017 (r321643) @@ -4,6 +4,6 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/vfs -PLAIN_TESTS_SH+= trailing_slash +TAP_TESTS_SH+= trailing_slash .include From owner-svn-src-all@freebsd.org Fri Jul 28 03:26:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD459DBC623; Fri, 28 Jul 2017 03:26:06 +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 8CAEB71396; Fri, 28 Jul 2017 03:26:06 +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 v6S3Q5d4038050; Fri, 28 Jul 2017 03:26:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3Q5U9038049; Fri, 28 Jul 2017 03:26:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280326.v6S3Q5U9038049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321644 - stable/10/tests/sys/vfs X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/tests/sys/vfs X-SVN-Commit-Revision: 321644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:26:06 -0000 Author: ngie Date: Fri Jul 28 03:26:05 2017 New Revision: 321644 URL: https://svnweb.freebsd.org/changeset/base/321644 Log: MFC r320446: trailing_slash is a TAP-compliant testcase; mark it as such, instead of calling is a plain testcase. Modified: stable/10/tests/sys/vfs/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/vfs/Makefile ============================================================================== --- stable/10/tests/sys/vfs/Makefile Fri Jul 28 03:25:58 2017 (r321643) +++ stable/10/tests/sys/vfs/Makefile Fri Jul 28 03:26:05 2017 (r321644) @@ -2,6 +2,6 @@ TESTSDIR= ${TESTSBASE}/sys/vfs -PLAIN_TESTS_SH+= trailing_slash +TAP_TESTS_SH+= trailing_slash .include From owner-svn-src-all@freebsd.org Fri Jul 28 03:27:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4B92DBC6D3; Fri, 28 Jul 2017 03:27:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7241B715A8; Fri, 28 Jul 2017 03:27:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6S3Rf2T038206; Fri, 28 Jul 2017 03:27:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3Rf92038204; Fri, 28 Jul 2017 03:27:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280327.v6S3Rf92038204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321645 - in stable/11: etc/mtree share/examples/tests/tests share/examples/tests/tests/tap X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11: etc/mtree share/examples/tests/tests share/examples/tests/tests/tap X-SVN-Commit-Revision: 321645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:27:42 -0000 Author: ngie Date: Fri Jul 28 03:27:41 2017 New Revision: 321645 URL: https://svnweb.freebsd.org/changeset/base/321645 Log: MFC r320443,r320444: r320443: Add kyua TAP test integration examples The examples are patterned loosely after the ATF examples, similar to the plain test examples. r320444: Commit the corresponding mtree file change for the TAP test examples MFC with: r320443 Added: stable/11/share/examples/tests/tests/tap/ - copied from r320443, head/share/examples/tests/tests/tap/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/share/examples/tests/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Fri Jul 28 03:26:05 2017 (r321644) +++ stable/11/etc/mtree/BSD.tests.dist Fri Jul 28 03:27:41 2017 (r321645) @@ -384,6 +384,8 @@ .. plain .. + tap + .. .. .. .. Modified: stable/11/share/examples/tests/tests/Makefile ============================================================================== --- stable/11/share/examples/tests/tests/Makefile Fri Jul 28 03:26:05 2017 (r321644) +++ stable/11/share/examples/tests/tests/Makefile Fri Jul 28 03:27:41 2017 (r321645) @@ -17,6 +17,7 @@ TESTSDIR= ${TESTSBASE}/share/examples/tests # of the system. We use TESTS_SUBDIRS instead of SUBDIR because we want # the auto-generated Kyuafile to recurse into these directories. TESTS_SUBDIRS= atf plain +TESTS_SUBDIRS+= tap # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The From owner-svn-src-all@freebsd.org Fri Jul 28 03:30:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A689DBC873; Fri, 28 Jul 2017 03:30:47 +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 7359171722; Fri, 28 Jul 2017 03:30:47 +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 v6S3Ukjj038367; Fri, 28 Jul 2017 03:30:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3Uk3P038364; Fri, 28 Jul 2017 03:30:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280330.v6S3Uk3P038364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321646 - in stable/10: etc/mtree share/examples/tests/tests share/examples/tests/tests/tap X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/10: etc/mtree share/examples/tests/tests share/examples/tests/tests/tap X-SVN-Commit-Revision: 321646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:30:47 -0000 Author: ngie Date: Fri Jul 28 03:30:46 2017 New Revision: 321646 URL: https://svnweb.freebsd.org/changeset/base/321646 Log: MFC r320443,r320444: r320443: Add kyua TAP test integration examples The examples are patterned loosely after the ATF examples, similar to the plain test examples. r320444: Commit the corresponding mtree file change for the TAP test examples MFC with: r320443 Added: stable/10/share/examples/tests/tests/tap/ - copied from r320443, head/share/examples/tests/tests/tap/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/share/examples/tests/tests/Makefile stable/10/share/examples/tests/tests/tap/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Fri Jul 28 03:27:41 2017 (r321645) +++ stable/10/etc/mtree/BSD.tests.dist Fri Jul 28 03:30:46 2017 (r321646) @@ -370,6 +370,8 @@ .. plain .. + tap + .. .. .. .. Modified: stable/10/share/examples/tests/tests/Makefile ============================================================================== --- stable/10/share/examples/tests/tests/Makefile Fri Jul 28 03:27:41 2017 (r321645) +++ stable/10/share/examples/tests/tests/Makefile Fri Jul 28 03:30:46 2017 (r321646) @@ -17,6 +17,7 @@ TESTSDIR= ${TESTSBASE}/share/examples/tests # of the system. We use TESTS_SUBDIRS instead of SUBDIR because we want # the auto-generated Kyuafile to recurse into these directories. TESTS_SUBDIRS= atf plain +TESTS_SUBDIRS+= tap # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The Modified: stable/10/share/examples/tests/tests/tap/Makefile ============================================================================== --- head/share/examples/tests/tests/tap/Makefile Wed Jun 28 08:22:04 2017 (r320443) +++ stable/10/share/examples/tests/tests/tap/Makefile Fri Jul 28 03:30:46 2017 (r321646) @@ -1,11 +1,5 @@ # $FreeBSD$ -# The release package to use for the tests contained within the directory -# -# This applies to components which rely on ^/projects/release-pkg support -# (see UPDATING XXXXXXXXX / svn revision r298107). -PACKAGE= tests - # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -31,17 +25,10 @@ TAP_TESTS_SH= cp_test # definitions from above. KYUAFILE= yes -# Install file1 and file2 as files via bsd.prog.mk. Please note the intentional -# ${PACKAGE} namespace of files. -# -# The basic semantics of this are the same as FILES in bsd.prog.mk, e.g. the -# installation of the files can be manipulated via ${PACKAGE}FILESDIR, -# ${PACKAGE}FILESMODE, etc. -# -# Please see comment above about ${PACKAGE}. Feel free to omit the ${PACKAGE} -# namespace if release package support isn't needed. -${PACKAGE}FILES+= file1 -CLEANFILES+= file1 +# Install file1 and file2 as files via bsd.prog.mk. +FILES+= file1 +FILESDIR= ${TESTSDIR} +CLEANFILES+= file1 file1: @echo "File 1" > ${.TARGET} From owner-svn-src-all@freebsd.org Fri Jul 28 03:32:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D276FDBC8EA; Fri, 28 Jul 2017 03:32:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA12571A62; Fri, 28 Jul 2017 03:32:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6S3WaSJ042250; Fri, 28 Jul 2017 03:32:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3WaDW042247; Fri, 28 Jul 2017 03:32:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280332.v6S3WaDW042247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321647 - in stable/11/share/examples/tests/tests: . atf plain X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11/share/examples/tests/tests: . atf plain X-SVN-Commit-Revision: 321647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:32:37 -0000 Author: ngie Date: Fri Jul 28 03:32:36 2017 New Revision: 321647 URL: https://svnweb.freebsd.org/changeset/base/321647 Log: MFC r320441,r320442: r320441: share/examples/tests/Makefile: clean up example snippets/documentation - TESTSDIR doesn't need to be specified after r289158. - Including bsd.own.mk isn't required since no MK_ knobs are being manipulated. - TESTS_SUBDIRS should be written out in an append format, one entry per line, to provide a better, more conflict resistant example. r320442: share/examples/tests/{atf,plain}/Makefile: tweak example Makefile snippets - Including bsd.own.mk isn't required since no MK_ knobs are being manipulated. - Update documentation to note that ${FILES} is installed via bsd.progs.mk, not bsd.prog.mk. Modified: stable/11/share/examples/tests/tests/Makefile stable/11/share/examples/tests/tests/atf/Makefile stable/11/share/examples/tests/tests/plain/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/tests/tests/Makefile ============================================================================== --- stable/11/share/examples/tests/tests/Makefile Fri Jul 28 03:30:46 2017 (r321646) +++ stable/11/share/examples/tests/tests/Makefile Fri Jul 28 03:32:36 2017 (r321647) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -11,12 +9,16 @@ # # For example: if this Makefile were in src/bin/cp/tests/, its TESTSDIR # would point at ${TESTSBASE}/bin/cp/. -TESTSDIR= ${TESTSBASE}/share/examples/tests +# +# The default path specified by bsd.test.mk is `${TESTSBASE}/${RELDIR:H}`, +# which happens to be the same as `${TESTSBASE}/share/examples/tests`. +#TESTSDIR= ${TESTSBASE}/share/examples/tests # List of subdirectories into which we want to recurse during the build # of the system. We use TESTS_SUBDIRS instead of SUBDIR because we want # the auto-generated Kyuafile to recurse into these directories. -TESTS_SUBDIRS= atf plain +TESTS_SUBDIRS+= atf +TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile Modified: stable/11/share/examples/tests/tests/atf/Makefile ============================================================================== --- stable/11/share/examples/tests/tests/atf/Makefile Fri Jul 28 03:30:46 2017 (r321646) +++ stable/11/share/examples/tests/tests/atf/Makefile Fri Jul 28 03:32:36 2017 (r321647) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # The release package to use for the tests contained within the directory # # This applies to components which rely on ^/projects/release-pkg support @@ -33,10 +31,10 @@ ATF_TESTS_SH= cp_test # definitions from above. KYUAFILE= yes -# Install file1 and file2 as files via bsd.prog.mk. Please note the intentional +# Install file1 and file2 as files via bsd.progs.mk. Please note the intentional # ${PACKAGE} namespace of files. # -# The basic semantics of this are the same as FILES in bsd.prog.mk, e.g. the +# The basic semantics of this are the same as FILES in bsd.progs.mk, e.g. the # installation of the files can be manipulated via ${PACKAGE}FILESDIR, # ${PACKAGE}FILESMODE, etc. # Modified: stable/11/share/examples/tests/tests/plain/Makefile ============================================================================== --- stable/11/share/examples/tests/tests/plain/Makefile Fri Jul 28 03:30:46 2017 (r321646) +++ stable/11/share/examples/tests/tests/plain/Makefile Fri Jul 28 03:32:36 2017 (r321647) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # The release package to use for the tests contained within the directory # # This applies to components which rely on ^/projects/release-pkg support @@ -33,10 +31,10 @@ PLAIN_TESTS_SH= cp_test # definitions from above. KYUAFILE= yes -# Install file1 and file2 as files via bsd.prog.mk. Please note the intentional +# Install file1 and file2 as files via bsd.progs.mk. Please note the intentional # ${PACKAGE} namespace of files. # -# The basic semantics of this are the same as FILES in bsd.prog.mk, e.g. the +# The basic semantics of this are the same as FILES in bsd.progs.mk, e.g. the # installation of the files can be manipulated via ${PACKAGE}FILESDIR, # ${PACKAGE}FILESMODE, etc. # From owner-svn-src-all@freebsd.org Fri Jul 28 03:33:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F653DBC969; Fri, 28 Jul 2017 03:33:10 +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 14C7371B93; Fri, 28 Jul 2017 03:33:10 +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 v6S3X9sP042331; Fri, 28 Jul 2017 03:33:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S3X9DG042330; Fri, 28 Jul 2017 03:33:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707280333.v6S3X9DG042330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 28 Jul 2017 03:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321648 - stable/10/share/examples/tests/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/share/examples/tests/tests X-SVN-Commit-Revision: 321648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 03:33:10 -0000 Author: ngie Date: Fri Jul 28 03:33:09 2017 New Revision: 321648 URL: https://svnweb.freebsd.org/changeset/base/321648 Log: MFC r320441: share/examples/tests/Makefile: clean up example snippets/documentation - TESTSDIR doesn't need to be specified after r289158. - Including bsd.own.mk isn't required since no MK_ knobs are being manipulated. - TESTS_SUBDIRS should be written out in an append format, one entry per line, to provide a better, more conflict resistant example. Modified: stable/10/share/examples/tests/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/tests/tests/Makefile ============================================================================== --- stable/10/share/examples/tests/tests/Makefile Fri Jul 28 03:32:36 2017 (r321647) +++ stable/10/share/examples/tests/tests/Makefile Fri Jul 28 03:33:09 2017 (r321648) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -11,12 +9,16 @@ # # For example: if this Makefile were in src/bin/cp/tests/, its TESTSDIR # would point at ${TESTSBASE}/bin/cp/. -TESTSDIR= ${TESTSBASE}/share/examples/tests +# +# The default path specified by bsd.test.mk is `${TESTSBASE}/${RELDIR:H}`, +# which happens to be the same as `${TESTSBASE}/share/examples/tests`. +#TESTSDIR= ${TESTSBASE}/share/examples/tests # List of subdirectories into which we want to recurse during the build # of the system. We use TESTS_SUBDIRS instead of SUBDIR because we want # the auto-generated Kyuafile to recurse into these directories. -TESTS_SUBDIRS= atf plain +TESTS_SUBDIRS+= atf +TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile From owner-svn-src-all@freebsd.org Fri Jul 28 04:41:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1C62DBD9BB; Fri, 28 Jul 2017 04:41:58 +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 6ED7473578; Fri, 28 Jul 2017 04:41:58 +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 v6S4fvan069724; Fri, 28 Jul 2017 04:41:57 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6S4fvod069723; Fri, 28 Jul 2017 04:41:57 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201707280441.v6S4fvod069723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 28 Jul 2017 04:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321649 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 321649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 04:41:58 -0000 Author: loos Date: Fri Jul 28 04:41:57 2017 New Revision: 321649 URL: https://svnweb.freebsd.org/changeset/base/321649 Log: Remove the unused mutex since r273220. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Fri Jul 28 03:33:09 2017 (r321648) +++ head/sys/net/if_stf.c Fri Jul 28 04:41:57 2017 (r321649) @@ -139,7 +139,6 @@ SYSCTL_INT(_net_link_stf, OID_AUTO, permit_rfc1918, CT struct stf_softc { struct ifnet *sc_ifp; - struct mtx sc_ro_mtx; u_int sc_fibnum; const struct encaptab *encap_cookie; }; @@ -147,10 +146,6 @@ struct stf_softc { static const char stfname[] = "stf"; -/* - * Note that mutable fields in the softc are not currently locked. - * We do lock sc_ro in stf_output though. - */ static MALLOC_DEFINE(M_STF, stfname, "6to4 Tunnel Interface"); static const int ip_stf_ttl = 40; @@ -253,7 +248,6 @@ stf_clone_create(struct if_clone *ifc, char *name, siz ifp->if_dname = stfname; ifp->if_dunit = IF_DUNIT_NONE; - mtx_init(&(sc)->sc_ro_mtx, "stf ro", NULL, MTX_DEF); sc->encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV6, stf_encapcheck, &in_stf_protosw, sc); if (sc->encap_cookie == NULL) { @@ -280,7 +274,6 @@ stf_clone_destroy(struct if_clone *ifc, struct ifnet * err = encap_detach(sc->encap_cookie); KASSERT(err == 0, ("Unexpected error detaching encap_cookie")); - mtx_destroy(&(sc)->sc_ro_mtx); bpfdetach(ifp); if_detach(ifp); if_free(ifp); From owner-svn-src-all@freebsd.org Fri Jul 28 10:31:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8351CDC28F6; Fri, 28 Jul 2017 10:31:00 +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 5F41B7FDD4; Fri, 28 Jul 2017 10:31:00 +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 v6SAUx86009432; Fri, 28 Jul 2017 10:30:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SAUx01009431; Fri, 28 Jul 2017 10:30:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707281030.v6SAUx01009431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Jul 2017 10:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321650 - stable/11/lib/libc/x86/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/x86/sys X-SVN-Commit-Revision: 321650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 10:31:00 -0000 Author: kib Date: Fri Jul 28 10:30:59 2017 New Revision: 321650 URL: https://svnweb.freebsd.org/changeset/base/321650 Log: MFC r314319 (by oshogbo): Don't try to open devices in the gettc() function which will always fail in the Capability mode. Instead silently fallback to the syscall method, which is done for example in the gettimeofday(2) function. MFC r314320 (by oshogbo): Remove unneeded variable initialization from r314319. MFC r321461: Fix indent. Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Jul 28 04:41:57 2017 (r321649) +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Jul 28 10:30:59 2017 (r321650) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include "namespace.h" +#include #include #include #include @@ -124,6 +125,7 @@ __vdso_init_hpet(uint32_t u) static const char devprefix[] = "/dev/hpet"; char devname[64], *c, *c1, t; volatile char *new_map, *old_map; + unsigned int mode; uint32_t u1; int fd; @@ -144,18 +146,25 @@ __vdso_init_hpet(uint32_t u) if (old_map != NULL) return; + if (cap_getmode(&mode) == 0 && mode != 0) + goto fail; + fd = _open(devname, O_RDONLY); - if (fd == -1) { - atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], - (uintptr_t)old_map, (uintptr_t)MAP_FAILED); - return; - } + if (fd == -1) + goto fail; + new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); _close(fd); if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)new_map) == 0 && new_map != MAP_FAILED) munmap((void *)new_map, PAGE_SIZE); + + return; +fail: + /* Prevent the caller from re-entering. */ + atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], + (uintptr_t)old_map, (uintptr_t)MAP_FAILED); } #ifdef WANT_HYPERV @@ -174,16 +183,22 @@ static void __vdso_init_hyperv_tsc(void) { int fd; + unsigned int mode; + if (cap_getmode(&mode) == 0 && mode != 0) + goto fail; + fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY); - if (fd < 0) { - /* Prevent the caller from re-entering. */ - hyperv_ref_tsc = MAP_FAILED; - return; - } + if (fd < 0) + goto fail; hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ, MAP_SHARED, fd, 0); _close(fd); + + return; +fail: + /* Prevent the caller from re-entering. */ + hyperv_ref_tsc = MAP_FAILED; } static int From owner-svn-src-all@freebsd.org Fri Jul 28 11:51:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34E92DC440D; Fri, 28 Jul 2017 11:51:57 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9A6282759; Fri, 28 Jul 2017 11:51:56 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SBpukH042638; Fri, 28 Jul 2017 11:51:56 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SBpukb042637; Fri, 28 Jul 2017 11:51:56 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201707281151.v6SBpukb042637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Fri, 28 Jul 2017 11:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321651 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 321651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 11:51:57 -0000 Author: mw Date: Fri Jul 28 11:51:55 2017 New Revision: 321651 URL: https://svnweb.freebsd.org/changeset/base/321651 Log: Fix remapping VM attributes on Armada 38x pmap_remap_vm_attr() function requires indexes to pte2_attr_tab as the arguments (VM_MEMATTR_). Mistakenly, instead of them, actual values from the table were used (PTE2_ATTR_), when applying work-around for Marvell Armada 38x SoCs. Submitted by: Marcin Wojtas (mw@semihalf.com) Reported by: Rafal Kozik (rk@semihalf.com) Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11704 Modified: head/sys/arm/mv/mv_machdep.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Fri Jul 28 10:30:59 2017 (r321650) +++ head/sys/arm/mv/mv_machdep.c Fri Jul 28 11:51:55 2017 (r321651) @@ -301,7 +301,7 @@ platform_late_init(void) * To avoid that, map all registers including PCIe IO * as strongly ordered instead of device memory. */ - pmap_remap_vm_attr(PTE2_ATTR_DEVICE, PTE2_ATTR_SO); + pmap_remap_vm_attr(VM_MEMATTR_DEVICE, VM_MEMATTR_SO); /* Set IO Sync Barrier bit for all Mbus devices */ if (armada38x_win_set_iosync_barrier() != 0) From owner-svn-src-all@freebsd.org Fri Jul 28 12:22:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB863DC547F; Fri, 28 Jul 2017 12:22:33 +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 8AF0383A4B; Fri, 28 Jul 2017 12:22:33 +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 v6SCMWGM057244; Fri, 28 Jul 2017 12:22:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SCMWdE057243; Fri, 28 Jul 2017 12:22:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707281222.v6SCMWdE057243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Jul 2017 12:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321652 - head/lib/libc/x86/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/x86/sys X-SVN-Commit-Revision: 321652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 12:22:33 -0000 Author: kib Date: Fri Jul 28 12:22:32 2017 New Revision: 321652 URL: https://svnweb.freebsd.org/changeset/base/321652 Log: Simplify flow control. Also add explicit comment why libc cannot simply rely on open(2) failure in capability mode. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/x86/sys/__vdso_gettc.c Modified: head/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- head/lib/libc/x86/sys/__vdso_gettc.c Fri Jul 28 11:51:55 2017 (r321651) +++ head/lib/libc/x86/sys/__vdso_gettc.c Fri Jul 28 12:22:32 2017 (r321652) @@ -197,25 +197,24 @@ __vdso_init_hpet(uint32_t u) if (old_map != NULL) return; - if (cap_getmode(&mode) == 0 && mode != 0) - goto fail; + /* + * Explicitely check for the capability mode to avoid + * triggering trap_enocap on the device open by absolute path. + */ + if ((cap_getmode(&mode) == 0 && mode != 0) || + (fd = _open(devname, O_RDONLY)) == -1) { + /* Prevent the caller from re-entering. */ + atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], + (uintptr_t)old_map, (uintptr_t)MAP_FAILED); + return; + } - fd = _open(devname, O_RDONLY); - if (fd == -1) - goto fail; - new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); _close(fd); if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)new_map) == 0 && new_map != MAP_FAILED) munmap((void *)new_map, PAGE_SIZE); - - return; -fail: - /* Prevent the caller from re-entering. */ - atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], - (uintptr_t)old_map, (uintptr_t)MAP_FAILED); } #ifdef WANT_HYPERV From owner-svn-src-all@freebsd.org Fri Jul 28 15:43:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EDE1DC8853; Fri, 28 Jul 2017 15:43:39 +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 371996578E; Fri, 28 Jul 2017 15:43:39 +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 v6SFhcep039811; Fri, 28 Jul 2017 15:43:38 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SFhaBR039795; Fri, 28 Jul 2017 15:43:36 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201707281543.v6SFhaBR039795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 28 Jul 2017 15:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321653 - in stable/11: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: stable-11 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/11: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Commit-Revision: 321653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 15:43:39 -0000 Author: sjg Date: Fri Jul 28 15:43:36 2017 New Revision: 321653 URL: https://svnweb.freebsd.org/changeset/base/321653 Log: MFC bmake-20170720 PR: 221023 Modified: stable/11/contrib/bmake/ChangeLog stable/11/contrib/bmake/Makefile stable/11/contrib/bmake/bmake.1 stable/11/contrib/bmake/bmake.cat1 stable/11/contrib/bmake/buf.h stable/11/contrib/bmake/compat.c stable/11/contrib/bmake/dir.h stable/11/contrib/bmake/hash.h stable/11/contrib/bmake/job.c stable/11/contrib/bmake/main.c stable/11/contrib/bmake/make.1 stable/11/contrib/bmake/make.h stable/11/contrib/bmake/meta.c stable/11/contrib/bmake/mk/ChangeLog stable/11/contrib/bmake/mk/dirdeps.mk stable/11/contrib/bmake/mk/install-mk stable/11/contrib/bmake/mk/lib.mk stable/11/contrib/bmake/mk/meta.stage.mk stable/11/contrib/bmake/mk/meta.sys.mk stable/11/contrib/bmake/mk/meta2deps.py stable/11/contrib/bmake/mk/own.mk stable/11/contrib/bmake/nonints.h stable/11/contrib/bmake/sprite.h stable/11/usr.bin/bmake/Makefile stable/11/usr.bin/bmake/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bmake/ChangeLog ============================================================================== --- stable/11/contrib/bmake/ChangeLog Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/ChangeLog Fri Jul 28 15:43:36 2017 (r321653) @@ -1,3 +1,23 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + +2017-07-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170711 + forgot to update after merge on 20170708 ;-) + o main.c: refactor to reduce size of main function. + add -v option to always fully expand values. + o meta.c: ensure command output in meta file has ending newline + even when filemon not being used. + When matching ${.MAKE.META.IGNORE_PATTERNS} do not use + pathname via ':L' since any ':' in pathname breaks that. + Instead set a '${.p.}' to pathname in the target context and + use that. + 2017-05-10 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170510 Modified: stable/11/contrib/bmake/Makefile ============================================================================== --- stable/11/contrib/bmake/Makefile Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/Makefile Fri Jul 28 15:43:36 2017 (r321653) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170510 +_MAKE_VERSION= 20170720 PROG= bmake Modified: stable/11/contrib/bmake/bmake.1 ============================================================================== --- stable/11/contrib/bmake/bmake.1 Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/bmake.1 Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34: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 February 1, 2017 +.Dd June 22, 2017 .Dt BMAKE 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -691,9 +713,9 @@ in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -776,6 +798,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -1287,7 +1313,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1751,7 +1777,7 @@ may be any one of the following: .Bl -tag -width "Cm XX" .It Cm \&|\&| Logical OR. -.It Cm \&\*[Am]\*[Am] +.It Cm \&&& Logical .Tn AND ; of higher precedence than @@ -1768,7 +1794,7 @@ The boolean operator may be used to logically negate an entire conditional. It is of higher precedence than -.Ql Ic \&\*[Am]\*[Am] . +.Ql Ic \&&& . .Pp The value of .Ar expression Modified: stable/11/contrib/bmake/bmake.cat1 ============================================================================== --- stable/11/contrib/bmake/bmake.cat1 Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/bmake.cat1 Fri Jul 28 15:43:36 2017 (r321653) @@ -6,8 +6,8 @@ NNAAMMEE SSYYNNOOPPSSIISS bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] - [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] - [_t_a_r_g_e_t _._._.] + [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] + [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.] DDEESSCCRRIIPPTTIIOONN bbmmaakkee is a program designed to simplify the maintenance of other pro- @@ -118,7 +118,9 @@ DDEESSCCRRIIPPTTIIOONN _t Print debugging information about target list mainte- nance. - _V Force the --VV option to print raw values of variables. + _V Force the --VV option to print raw values of variables, + overriding the default behavior set via + _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. _v Print debugging information about variable assignment. @@ -209,13 +211,26 @@ DDEESSCCRRIIPPTTIIOONN to-date. --VV _v_a_r_i_a_b_l_e - Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- - text. Do not build any targets. Multiple instances of this - option may be specified; the variables will be printed one per - line, with a blank line for each null or undefined variable. If - _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before - printing. + Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple + instances of this option may be specified; the variables will be + printed one per line, with a blank line for each null or unde- + fined variable. The value printed is extracted from the global + context after all makefiles have been read. By default, the raw + variable contents (which may include additional unexpanded vari- + able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the + value will be recursively expanded to its complete resultant text + before printing. The expanded value will also be printed if + _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not + been used to override it. Note that loop-local and target-local + variables, as well as values taken temporarily by global vari- + ables during makefile processing, are not accessible via this + option. The --ddvv debug mode can be used to see these at the cost + of generating substantial extraneous output. + --vv _v_a_r_i_a_b_l_e + Like --VV but the variable is always expanded to its complete + value. + --WW Treat any warnings during makefile parsing as errors. --ww Print entering and leaving directory messages, pre and post pro- @@ -488,7 +503,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S A boolean that controls the default behavior of the --VV - option. + option. If true, variable values printed with --VV are + fully expanded; if false, the raw variable contents + (which may include additional unexpanded variable refer- + ences) are shown. _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. @@ -1523,4 +1541,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 7.1_RC1 February 1, 2017 NetBSD 7.1_RC1 +NetBSD 7.1_RC1 June 22, 2017 NetBSD 7.1_RC1 Modified: stable/11/contrib/bmake/buf.h ============================================================================== --- stable/11/contrib/bmake/buf.h Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/buf.h Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.17 2012/04/24 20:26:58 sjg Exp $ */ +/* $NetBSD: buf.h,v 1.19 2017/05/31 22:02:06 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -77,8 +77,8 @@ * Header for users of the buf library. */ -#ifndef _BUF_H -#define _BUF_H +#ifndef MAKE_BUF_H +#define MAKE_BUF_H typedef char Byte; @@ -116,4 +116,4 @@ void Buf_Init(Buffer *, int); Byte *Buf_Destroy(Buffer *, Boolean); Byte *Buf_DestroyCompact(Buffer *); -#endif /* _BUF_H */ +#endif /* MAKE_BUF_H */ Modified: stable/11/contrib/bmake/compat.c ============================================================================== --- stable/11/contrib/bmake/compat.c Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/compat.c Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); +__RCSID("$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -118,6 +118,8 @@ __RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +static pid_t compatChild; +static int compatSigno; /* * CompatDeleteTarget -- delete a failed, interrupted, or otherwise @@ -176,8 +178,17 @@ CompatInterrupt(int signo) } if (signo == SIGQUIT) _exit(signo); - bmake_signal(signo, SIG_DFL); - kill(myPid, signo); + /* + * If there is a child running, pass the signal on + * we will exist after it has exited. + */ + compatSigno = signo; + if (compatChild > 0) { + KILLPG(compatChild, signo); + } else { + bmake_signal(signo, SIG_DFL); + kill(myPid, signo); + } } /*- @@ -370,7 +381,7 @@ again: /* * Fork and execute the single command. If the fork fails, we abort. */ - cpid = vFork(); + compatChild = cpid = vFork(); if (cpid < 0) { Fatal("Could not fork"); } @@ -483,7 +494,12 @@ again: } } free(cmdStart); - + compatChild = 0; + if (compatSigno) { + bmake_signal(compatSigno, SIG_DFL); + kill(myPid, compatSigno); + } + return (status); } Modified: stable/11/contrib/bmake/dir.h ============================================================================== --- stable/11/contrib/bmake/dir.h Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/dir.h Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.15 2012/04/07 18:29:08 christos Exp $ */ +/* $NetBSD: dir.h,v 1.18 2017/05/31 22:02:06 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -75,8 +75,8 @@ /* dir.h -- */ -#ifndef _DIR -#define _DIR +#ifndef MAKE_DIR_H +#define MAKE_DIR_H typedef struct Path { char *name; /* Name of directory */ @@ -105,4 +105,4 @@ void Dir_PrintPath(Lst); void Dir_Destroy(void *); void * Dir_CopyDir(void *); -#endif /* _DIR */ +#endif /* MAKE_DIR_H */ Modified: stable/11/contrib/bmake/hash.h ============================================================================== --- stable/11/contrib/bmake/hash.h Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/hash.h Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.11 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: hash.h,v 1.12 2017/05/31 21:07:03 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -78,8 +78,8 @@ * which maintains hash tables. */ -#ifndef _HASH -#define _HASH +#ifndef _HASH_H +#define _HASH_H /* * The following defines one entry in the hash table. @@ -146,4 +146,4 @@ void Hash_DeleteEntry(Hash_Table *, Hash_Entry *); Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *); Hash_Entry *Hash_EnumNext(Hash_Search *); -#endif /* _HASH */ +#endif /* _HASH_H */ Modified: stable/11/contrib/bmake/job.c ============================================================================== --- stable/11/contrib/bmake/job.c Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/job.c Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */ +/* $NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $"); +__RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -364,11 +364,6 @@ static Job childExitJob; /* child exit pseudo-job */ (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) static sigset_t caught_signals; /* Set of signals we handle */ -#if defined(SYSV) -#define KILLPG(pid, sig) kill(-(pid), (sig)) -#else -#define KILLPG(pid, sig) killpg((pid), (sig)) -#endif static void JobChildSig(int); static void JobContinueSig(int); Modified: stable/11/contrib/bmake/main.c ============================================================================== --- stable/11/contrib/bmake/main.c Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/main.c Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $ */ +/* $NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $"); #endif #endif /* not lint */ #endif @@ -159,7 +159,9 @@ Boolean deleteOnError; /* .DELETE_ON_ERROR: set */ static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ -static Boolean printVars; /* print value of one or more vars */ +static int printVars; /* -[vV] argument */ +#define COMPAT_VARS 1 +#define EXPAND_VARS 2 static Lst variables; /* list of variables to print */ int maxJobs; /* -j argument */ static int maxJobTokens; /* -j argument */ @@ -421,7 +423,7 @@ MainParseArgs(int argc, char **argv) Boolean inOption, dashDash = FALSE; char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ -#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstw" +#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstv:w" /* Can't actually use getopt(3) because rescanning is not portable */ getopt_def = OPTFLAGS; @@ -546,8 +548,9 @@ rearg: Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); break; case 'V': + case 'v': if (argvalue == NULL) goto noarg; - printVars = TRUE; + printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS; (void)Lst_AtEnd(variables, argvalue); Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); @@ -877,6 +880,89 @@ MakeMode(const char *mode) free(mp); } +static void +doPrintVars(void) +{ + LstNode ln; + Boolean expandVars; + + if (printVars == EXPAND_VARS) + expandVars = TRUE; + else if (debugVflag) + expandVars = FALSE; + else + expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); + + for (ln = Lst_First(variables); ln != NULL; + ln = Lst_Succ(ln)) { + char *var = (char *)Lst_Datum(ln); + char *value; + char *p1; + + if (strchr(var, '$')) { + value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, + VARF_WANTRES); + } else if (expandVars) { + char tmp[128]; + int len = snprintf(tmp, sizeof(tmp), "${%s}", var); + + if (len >= (int)sizeof(tmp)) + Fatal("%s: variable name too big: %s", + progname, var); + value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, + VARF_WANTRES); + } else { + value = Var_Value(var, VAR_GLOBAL, &p1); + } + printf("%s\n", value ? value : ""); + free(p1); + } +} + +static Boolean +runTargets(void) +{ + Lst targs; /* target nodes to create -- passed to Make_Init */ + Boolean outOfDate; /* FALSE if all targets up to date */ + + /* + * Have now read the entire graph and need to make a list of + * targets to create. If none was given on the command line, + * we consult the parsing module to find the main target(s) + * to create. + */ + if (Lst_IsEmpty(create)) + targs = Parse_MainName(); + else + targs = Targ_FindList(create, TARG_CREATE); + + if (!compatMake) { + /* + * Initialize job module before traversing the graph + * now that any .BEGIN and .END targets have been read. + * This is done only if the -q flag wasn't given + * (to prevent the .BEGIN from being executed should + * it exist). + */ + if (!queryFlag) { + Job_Init(); + jobsRunning = TRUE; + } + + /* Traverse the graph, checking on all the targets */ + outOfDate = Make_Run(targs); + } else { + /* + * Compat_Init will take care of creating all the + * targets as well as initializing the module. + */ + Compat_Run(targs); + outOfDate = FALSE; + } + Lst_Destroy(targs, NULL); + return outOfDate; +} + /*- * main -- * The main function, for obvious reasons. Initializes variables @@ -897,8 +983,7 @@ MakeMode(const char *mode) int main(int argc, char **argv) { - Lst targs; /* target nodes to create -- passed to Make_Init */ - Boolean outOfDate = FALSE; /* FALSE if all targets up to date */ + Boolean outOfDate; /* FALSE if all targets up to date */ struct stat sb, sa; char *p1, *path; char mdpath[MAXPATHLEN]; @@ -1027,7 +1112,7 @@ main(int argc, char **argv) create = Lst_Init(FALSE); makefiles = Lst_Init(FALSE); - printVars = FALSE; + printVars = 0; debugVflag = FALSE; variables = Lst_Init(FALSE); beSilent = FALSE; /* Print commands as executed */ @@ -1406,73 +1491,13 @@ main(int argc, char **argv) /* print the values of any variables requested by the user */ if (printVars) { - LstNode ln; - Boolean expandVars; - - if (debugVflag) - expandVars = FALSE; - else - expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); - for (ln = Lst_First(variables); ln != NULL; - ln = Lst_Succ(ln)) { - char *var = (char *)Lst_Datum(ln); - char *value; - - if (strchr(var, '$')) { - value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, - VARF_WANTRES); - } else if (expandVars) { - char tmp[128]; - - if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp))) - Fatal("%s: variable name too big: %s", - progname, var); - value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, - VARF_WANTRES); - } else { - value = Var_Value(var, VAR_GLOBAL, &p1); - } - printf("%s\n", value ? value : ""); - free(p1); - } + doPrintVars(); + outOfDate = FALSE; } else { - /* - * Have now read the entire graph and need to make a list of - * targets to create. If none was given on the command line, - * we consult the parsing module to find the main target(s) - * to create. - */ - if (Lst_IsEmpty(create)) - targs = Parse_MainName(); - else - targs = Targ_FindList(create, TARG_CREATE); - - if (!compatMake) { - /* - * Initialize job module before traversing the graph - * now that any .BEGIN and .END targets have been read. - * This is done only if the -q flag wasn't given - * (to prevent the .BEGIN from being executed should - * it exist). - */ - if (!queryFlag) { - Job_Init(); - jobsRunning = TRUE; - } - - /* Traverse the graph, checking on all the targets */ - outOfDate = Make_Run(targs); - } else { - /* - * Compat_Init will take care of creating all the - * targets as well as initializing the module. - */ - Compat_Run(targs); - } + outOfDate = runTargets(); } #ifdef CLEANUP - Lst_Destroy(targs, NULL); Lst_Destroy(variables, NULL); Lst_Destroy(makefiles, NULL); Lst_Destroy(create, (FreeProc *)free); @@ -1931,7 +1956,8 @@ usage(void) "usage: %s [-BeikNnqrstWwX] \n\ [-C directory] [-D variable] [-d flags] [-f makefile]\n\ [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n\ - [-V variable] [variable=value] [target ...]\n", progname); + [-V variable] [-v variable] [variable=value] [target ...]\n", + progname); exit(2); } Modified: stable/11/contrib/bmake/make.1 ============================================================================== --- stable/11/contrib/bmake/make.1 Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/make.1 Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34: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 February 1, 2017 +.Dd June 22, 2017 .Dt MAKE 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -691,9 +713,9 @@ in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -787,6 +809,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -1298,7 +1324,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1762,7 +1788,7 @@ may be any one of the following: .Bl -tag -width "Cm XX" .It Cm \&|\&| Logical OR. -.It Cm \&\*[Am]\*[Am] +.It Cm \&&& Logical .Tn AND ; of higher precedence than @@ -1779,7 +1805,7 @@ The boolean operator may be used to logically negate an entire conditional. It is of higher precedence than -.Ql Ic \&\*[Am]\*[Am] . +.Ql Ic \&&& . .Pp The value of .Ar expression Modified: stable/11/contrib/bmake/make.h ============================================================================== --- stable/11/contrib/bmake/make.h Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/make.h Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ +/* $NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -541,6 +541,12 @@ int cached_stat(const char *, void *); #endif #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN +#endif + +#if defined(SYSV) +#define KILLPG(pid, sig) kill(-(pid), (sig)) +#else +#define KILLPG(pid, sig) killpg((pid), (sig)) #endif #endif /* _MAKE_H_ */ Modified: stable/11/contrib/bmake/meta.c ============================================================================== --- stable/11/contrib/bmake/meta.c Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/meta.c Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.68 2017/07/09 04:54:00 sjg Exp $ */ /* * Implement 'meta' mode. @@ -727,7 +727,7 @@ meta_job_error(Job *job, GNode *gn, int flags, int sta pbm = &Mybm; } if (pbm->mfp != NULL) { - fprintf(pbm->mfp, "*** Error code %d%s\n", + fprintf(pbm->mfp, "\n*** Error code %d%s\n", status, (flags & JOB_IGNERR) ? "(ignored)" : ""); @@ -782,13 +782,13 @@ int meta_cmd_finish(void *pbmp) { int error = 0; -#ifdef USE_FILEMON BuildMon *pbm = pbmp; int x; if (!pbm) pbm = &Mybm; +#ifdef USE_FILEMON if (pbm->filemon_fd >= 0) { if (close(pbm->filemon_fd) < 0) error = errno; @@ -796,8 +796,9 @@ meta_cmd_finish(void *pbmp) if (error == 0 && x != 0) error = x; pbm->filemon_fd = pbm->mon_fd = -1; - } + } else #endif + fprintf(pbm->mfp, "\n"); /* ensure end with newline */ return error; } @@ -861,6 +862,8 @@ fgetLine(char **bufp, size_t *szp, int o, FILE *fp) newsz = ROUNDUP((fs.st_size / 2), BUFSIZ); if (newsz <= bufsz) newsz = ROUNDUP(fs.st_size, BUFSIZ); + if (newsz <= bufsz) + return x; /* truncated */ if (DEBUG(META)) fprintf(debug_file, "growing buffer %u -> %u\n", (unsigned)bufsz, (unsigned)newsz); @@ -948,10 +951,10 @@ meta_ignore(GNode *gn, const char *p) 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); + Var_Set(".p.", p, gn, 0); + pm = Var_Subst(NULL, + "${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}", + gn, VARF_WANTRES); if (*pm) { #ifdef DEBUG_META_MODE if (DEBUG(META)) Modified: stable/11/contrib/bmake/mk/ChangeLog ============================================================================== --- stable/11/contrib/bmake/mk/ChangeLog Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/mk/ChangeLog Fri Jul 28 15:43:36 2017 (r321653) @@ -1,3 +1,22 @@ +2017-06-30 Simon J. Gerraty + + * install-mk (MK_VERSION): 20170630 + + * meta.stage.mk: avoid triggering stage_* targets with nothing to do. + +2017-05-23 Simon J. Gerraty + + * meta2deps.py: take special care of '..' + +2017-05-15 Simon J. Gerraty + + * install-mk (MK_VERSION): 20170515 + + * dirdeps.mk (DEP_EXPORT_VARS): on rare occasions it is + useful/necessary for a Makefile.depend file to export some knobs. + This is complicated when we are doing DIRDEPS_CACHE, so we will + handle export of any variables listed in DEP_EXPORT_VARS. + 2017-05-08 Simon J. Gerraty * install-mk (MK_VERSION): 20170505 Modified: stable/11/contrib/bmake/mk/dirdeps.mk ============================================================================== --- stable/11/contrib/bmake/mk/dirdeps.mk Fri Jul 28 12:22:32 2017 (r321652) +++ stable/11/contrib/bmake/mk/dirdeps.mk Fri Jul 28 15:43:36 2017 (r321653) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.88 2017/04/24 20:34:59 sjg Exp $ +# $Id: dirdeps.mk,v 1.89 2017/05/17 17:41:47 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -636,6 +636,11 @@ _build_all_dirs := ${_build_all_dirs:O:u} x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \ echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo +.if !empty(DEP_EXPORT_VARS) +# Discouraged, but there are always exceptions. +# Handle it here rather than explain how. +x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo +.endif .else # this makes it all happen dirdeps: ${_build_all_dirs} @@ -644,6 +649,11 @@ ${_build_all_dirs}: _DIRDEP_USE .if ${_debug_reldir} .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs} +.endif + +.if !empty(DEP_EXPORT_VARS) +.export ${DEP_EXPORT_VARS} +DEP_EXPORT_VARS= .endif # this builds the dependency graph *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 28 17:44:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 824D7DCAE64; Fri, 28 Jul 2017 17:44:41 +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 371EF69C55; Fri, 28 Jul 2017 17:44:41 +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 v6SHieNo088957; Fri, 28 Jul 2017 17:44:40 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SHibdM088924; Fri, 28 Jul 2017 17:44:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201707281744.v6SHibdM088924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 28 Jul 2017 17:44:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321655 - in vendor-sys/acpica/dist: . generate/unix generate/unix/acpiexamples generate/unix/acpiexec generate/unix/acpinames generate/unix/iasl source/common source/compiler source/co... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . generate/unix generate/unix/acpiexamples generate/unix/acpiexec generate/unix/acpinames generate/unix/iasl source/common source/compiler source/components/debugger source/... X-SVN-Commit-Revision: 321655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 17:44:41 -0000 Author: jkim Date: Fri Jul 28 17:44:36 2017 New Revision: 321655 URL: https://svnweb.freebsd.org/changeset/base/321655 Log: Import ACPICA 20170728. Added: vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c (contents, props changed) Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/Makefile.config vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile vendor-sys/acpica/dist/generate/unix/acpinames/Makefile vendor-sys/acpica/dist/generate/unix/iasl/Makefile vendor-sys/acpica/dist/source/common/ahtable.c vendor-sys/acpica/dist/source/common/dmtable.c vendor-sys/acpica/dist/source/common/dmtbinfo.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/aslcompiler.l vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslhelp.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslparseop.c vendor-sys/acpica/dist/source/compiler/aslrules.y vendor-sys/acpica/dist/source/compiler/asltokens.y vendor-sys/acpica/dist/source/compiler/asltransform.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/dtcompiler.h vendor-sys/acpica/dist/source/compiler/dttemplate.h vendor-sys/acpica/dist/source/compiler/dtutils.c vendor-sys/acpica/dist/source/compiler/prmacros.c vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c vendor-sys/acpica/dist/source/components/dispatcher/dsobject.c vendor-sys/acpica/dist/source/components/dispatcher/dsopcode.c vendor-sys/acpica/dist/source/components/executer/excreate.c vendor-sys/acpica/dist/source/components/executer/exdump.c vendor-sys/acpica/dist/source/components/executer/exmisc.c vendor-sys/acpica/dist/source/components/executer/exoparg2.c vendor-sys/acpica/dist/source/components/hardware/hwregs.c vendor-sys/acpica/dist/source/components/namespace/nsaccess.c vendor-sys/acpica/dist/source/components/namespace/nsarguments.c vendor-sys/acpica/dist/source/components/namespace/nsinit.c vendor-sys/acpica/dist/source/components/namespace/nsnames.c vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c vendor-sys/acpica/dist/source/components/parser/psloop.c vendor-sys/acpica/dist/source/components/resources/rsxface.c vendor-sys/acpica/dist/source/components/tables/tbdata.c vendor-sys/acpica/dist/source/components/tables/tbxface.c vendor-sys/acpica/dist/source/components/utilities/utclib.c vendor-sys/acpica/dist/source/components/utilities/uthex.c vendor-sys/acpica/dist/source/components/utilities/utmath.c vendor-sys/acpica/dist/source/components/utilities/utmisc.c vendor-sys/acpica/dist/source/components/utilities/utobject.c vendor-sys/acpica/dist/source/components/utilities/utprint.c vendor-sys/acpica/dist/source/components/utilities/utresrc.c vendor-sys/acpica/dist/source/components/utilities/utstate.c vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c vendor-sys/acpica/dist/source/components/utilities/uttrack.c vendor-sys/acpica/dist/source/include/acdisasm.h vendor-sys/acpica/dist/source/include/acdispat.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acnames.h vendor-sys/acpica/dist/source/include/acobject.h vendor-sys/acpica/dist/source/include/acpi.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actbl2.h vendor-sys/acpica/dist/source/include/actypes.h vendor-sys/acpica/dist/source/include/acutils.h vendor-sys/acpica/dist/source/include/platform/accygwin.h vendor-sys/acpica/dist/source/include/platform/acdragonfly.h vendor-sys/acpica/dist/source/include/platform/acefi.h vendor-sys/acpica/dist/source/include/platform/acefiex.h vendor-sys/acpica/dist/source/include/platform/acfreebsd.h vendor-sys/acpica/dist/source/include/platform/acgcc.h vendor-sys/acpica/dist/source/include/platform/achaiku.h vendor-sys/acpica/dist/source/include/platform/aclinux.h vendor-sys/acpica/dist/source/include/platform/acmsvc.h vendor-sys/acpica/dist/source/include/platform/acnetbsd.h vendor-sys/acpica/dist/source/include/platform/acos2.h vendor-sys/acpica/dist/source/include/platform/acqnx.h vendor-sys/acpica/dist/source/include/platform/acwin.h vendor-sys/acpica/dist/source/include/platform/acwin64.h vendor-sys/acpica/dist/source/os_specific/service_layers/oslinuxtbl.c vendor-sys/acpica/dist/source/tools/acpidump/apfiles.c vendor-sys/acpica/dist/source/tools/acpidump/apmain.c vendor-sys/acpica/dist/source/tools/acpihelp/ahaslkey.c vendor-sys/acpica/dist/source/tools/efihello/efihello.c vendor-sys/acpica/dist/tests/misc/grammar.asl Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/changes.txt Fri Jul 28 17:44:36 2017 (r321655) @@ -1,4 +1,86 @@ ---------------------------------------- +28 July 2017. Summary of changes for version 20170728: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression seen with small resource descriptors that could cause +an inadvertent AE_AML_NO_RESOURCE_END_TAG exception. + +AML interpreter: Implemented a new feature that allows forward references +from individual named references within package objects that are +contained within blocks of "module-level code". This provides +compatibility with other ACPI implementations and supports existing +firmware that depends on this feature. Example: + + Name (ABCD, 1) + If (ABCD) /* An If() at module-level */ + { + Name (PKG1, Package() + { + INT1 /* Forward reference to object INT1 +*/ + }) + Name (INT1, 0x1234) + } + +AML Interpreter: Fixed a problem with the Alias() operator where aliases +to some ASL objects were not handled properly. Objects affected are: +Mutex, Event, and OperationRegion. + +AML Debugger: Enhanced to properly handle AML Alias objects. These +objects have one level of indirection which was not fully supported by +the debugger. + +Table Manager: Added support to detect and ignore duplicate SSDTs within +the XSDT/RSDT. This error in the XSDT has been seen in the field. + +EFI and EDK2 support: + Enabled /WX flag for MSVC builds + Added support for AcpiOsStall, AcpiOsSleep, and AcpiOsGetTimer + Added local support for 64-bit multiply and shift operations + Added support to compile acpidump.efi on Windows + Added OSL function stubs for interfaces not used under EFI + +Added additional support for the _DMA predefined name. _DMA returns a +buffer containing a resource template. This change add support within the +resource manager (AcpiWalkResourceBuffer) to walk and parse this list of +resource descriptors. Lorenzo Pieralisi + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem where the internal input line buffer(s) could +overflow if there are very long lines in the input ASL source code file. +Implemented buffer management that automatically increases the size of +the buffers as necessary. + +iASL: Added an option (-vx) to "expect" particular remarks, warnings and +errors. If the specified exception is not raised during compilation, the +compiler emits an error. This is intended to support the ASL test suite, +but may be useful in other contexts. + +iASL: Implemented a new predefined macro, __METHOD__, which returns a +string containing the name of the current control method that is being +compiled. + +iASL: Implemented debugger and table compiler support for the SDEI ACPI +table (Software Delegated Exception Interface). James Morse + + +Unix/Linux makefiles: Added an option to disable compile optimizations. +The disable occurs when the NOOPT flag is set to TRUE. +theracermaster@gmail.com + +Acpidump: Added support for multiple DSDT and FACS tables. This can occur +when there are different tables for 32-bit versus 64-bit. + +Enhanced error reporting for the ASL test suite (ASLTS) by removing +unnecessary/verbose text, and emit the actual line number where an error +has occurred. These changes are intended to improve the usefulness of the +test suite. + +---------------------------------------- 29 June 2017. Summary of changes for version 20170629: Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config ============================================================================== --- vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Jul 28 17:44:36 2017 (r321655) @@ -43,7 +43,7 @@ CC = gcc OBJDIR = obj BINDIR = bin COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $< -LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) +LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) $(OPT_LDFLAGS) PREFIX ?= /usr INSTALLDIR = $(PREFIX)/bin UNAME_S := $(shell uname -s) @@ -162,6 +162,8 @@ endif # ifneq ($(NOOPT),TRUE) OPT_CFLAGS += -O2 +else +OPT_CFLAGS += -O0 endif # @@ -176,14 +178,14 @@ CFLAGS += \ -D$(HOST)\ -D_GNU_SOURCE\ -I$(ACPICA_INCLUDE) - + # # QNX requires __EXT to enable most functions in its C library, analogous # to _GNU_SOURCE. # ifeq ($(HOST), _QNX) CFLAGS+=-D__EXT -endif +endif # # Common compiler warning flags. The warning flags in addition Modified: vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile Fri Jul 28 17:44:36 2017 (r321655) @@ -47,6 +47,7 @@ OBJECTS = \ $(OBJDIR)/dsmthdat.o\ $(OBJDIR)/dsobject.o\ $(OBJDIR)/dsopcode.o\ + $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ $(OBJDIR)/dswexec.o\ $(OBJDIR)/dswload.o\ Modified: vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Jul 28 17:44:36 2017 (r321655) @@ -85,6 +85,7 @@ OBJECTS = \ $(OBJDIR)/dsmthdat.o\ $(OBJDIR)/dsobject.o\ $(OBJDIR)/dsopcode.o\ + $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ $(OBJDIR)/dswexec.o\ $(OBJDIR)/dswload.o\ Modified: vendor-sys/acpica/dist/generate/unix/acpinames/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Fri Jul 28 17:44:36 2017 (r321655) @@ -43,6 +43,7 @@ OBJECTS = \ $(OBJDIR)/dsinit.o\ $(OBJDIR)/dsmthdat.o\ $(OBJDIR)/dsobject.o\ + $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ $(OBJDIR)/dswload.o\ $(OBJDIR)/dswload2.o\ Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Fri Jul 28 17:44:36 2017 (r321655) @@ -134,6 +134,7 @@ OBJECTS = \ $(OBJDIR)/dsfield.o\ $(OBJDIR)/dsobject.o\ $(OBJDIR)/dsopcode.o\ + $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ $(OBJDIR)/dswexec.o\ $(OBJDIR)/dswload.o\ Modified: vendor-sys/acpica/dist/source/common/ahtable.c ============================================================================== --- vendor-sys/acpica/dist/source/common/ahtable.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/common/ahtable.c Fri Jul 28 17:44:36 2017 (r321655) @@ -239,6 +239,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, + {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, Modified: vendor-sys/acpica/dist/source/common/dmtable.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtable.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/common/dmtable.c Fri Jul 28 17:44:36 2017 (r321655) @@ -493,6 +493,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, + {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, Modified: vendor-sys/acpica/dist/source/common/dmtbinfo.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbinfo.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/common/dmtbinfo.c Fri Jul 28 17:44:36 2017 (r321655) @@ -218,6 +218,7 @@ #define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) +#define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f) #define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) @@ -2767,6 +2768,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = ACPI_DMT_TERMINATOR }; +/******************************************************************************* + * + * SDEI - Software Delegated Execption Interface Descriptor Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] = +{ + ACPI_DMT_TERMINATOR +}; /******************************************************************************* * Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Jul 28 17:44:36 2017 (r321655) @@ -815,6 +815,7 @@ CmCleanupAndExit ( BOOLEAN DeleteAmlFile = FALSE; + AslCheckExpectedExceptions (); AePrintErrorLog (ASL_FILE_STDERR); if (Gbl_DebugFlag) { Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Jul 28 17:44:36 2017 (r321655) @@ -413,12 +413,20 @@ AslError ( ACPI_PARSE_OBJECT *Op, char *ExtraMessage); +void +AslCheckExpectedExceptions ( + void); + ACPI_STATUS +AslExpectException ( + char *MessageIdString); + +ACPI_STATUS AslDisableException ( char *MessageIdString); BOOLEAN -AslIsExceptionDisabled ( +AslIsExceptionIgnored ( UINT8 Level, UINT16 MessageId); Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.l Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.l Fri Jul 28 17:44:36 2017 (r321655) @@ -809,7 +809,7 @@ NamePathTail [.]{NameSeg} "__FILE__" { count (0); return (PARSEOP___FILE__); } "__LINE__" { count (0); return (PARSEOP___LINE__); } "__PATH__" { count (0); return (PARSEOP___PATH__); } - +"__METHOD__" { count (0); return (PARSEOP___METHOD__); } {NameSeg} { char *s; count (0); Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Jul 28 17:44:36 2017 (r321655) @@ -160,7 +160,17 @@ static void AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +static BOOLEAN +AslIsExceptionExpected ( + UINT8 Level, + UINT16 MessageId); +static BOOLEAN +AslIsExceptionDisabled ( + UINT8 Level, + UINT16 MessageId); + + /******************************************************************************* * * FUNCTION: AslAbort @@ -806,9 +816,118 @@ AslCommonError ( return; } +/******************************************************************************* + * + * FUNCTION: AslIsExceptionIgnored + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * + * RETURN: BOOLEAN + * + * DESCRIPTION: Check if a particular exception is ignored. In this case it + * means that the exception is (expected or disabled. + * + ******************************************************************************/ +BOOLEAN +AslIsExceptionIgnored ( + UINT8 Level, + UINT16 MessageId) +{ + BOOLEAN ExceptionIgnored; + + + /* Note: this allows exception to be disabled and expected */ + + ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId); + ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId); + + return (Gbl_AllExceptionsDisabled || ExceptionIgnored); +} + + /******************************************************************************* * + * FUNCTION: AslCheckExpectException + * + * PARAMETERS: none + * + * RETURN: none + * + * DESCRIPTION: Check the global expected messages table and raise an error + * for each message that has not been received. + * + ******************************************************************************/ + +void +AslCheckExpectedExceptions ( + void) +{ + UINT8 i; + + for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i) + { + if (!Gbl_ExpectedMessages[i].MessageReceived) + { + AslError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED, NULL, + Gbl_ExpectedMessages[i].MessageIdStr); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AslExpectException + * + * PARAMETERS: MessageIdString - ID of excepted exception during compile + * + * RETURN: Status + * + * DESCRIPTION: Enter a message ID into the global expected messages table + * If these messages are not raised during the compilation, throw + * an error. + * + ******************************************************************************/ + +ACPI_STATUS +AslExpectException ( + char *MessageIdString) +{ + UINT32 MessageId; + + + /* Convert argument to an integer and validate it */ + + MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); + + if (MessageId > 6999) + { + printf ("\"%s\" is not a valid warning/remark/erro ID\n", + MessageIdString); + return (AE_BAD_PARAMETER); + } + + /* Insert value into the global expected message array */ + + if (Gbl_ExpectedMessagesIndex >= ASL_MAX_EXPECTED_MESSAGES) + { + printf ("Too many messages have been registered as expected (max %u)\n", + ASL_MAX_DISABLED_MESSAGES); + return (AE_LIMIT); + } + + Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageId = MessageId; + Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageIdStr = MessageIdString; + Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageReceived = FALSE; + Gbl_ExpectedMessagesIndex++; + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AslDisableException * * PARAMETERS: MessageIdString - ID to be disabled @@ -866,7 +985,48 @@ AslDisableException ( * ******************************************************************************/ -BOOLEAN +static BOOLEAN +AslIsExceptionExpected ( + UINT8 Level, + UINT16 MessageId) +{ + UINT32 EncodedMessageId; + UINT32 i; + + + /* + * Mark this exception as received + */ + EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); + for (i = 0; i < Gbl_ExpectedMessagesIndex; i++) + { + /* Simple implementation via fixed array */ + + if (EncodedMessageId == Gbl_ExpectedMessages[i].MessageId) + { + return (Gbl_ExpectedMessages[i].MessageReceived = TRUE); + } + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: AslIsExceptionDisabled + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * + * RETURN: TRUE if exception/message should be ignored + * + * DESCRIPTION: Check if the user has specified options such that this + * exception should be ignored + * + ******************************************************************************/ + +static BOOLEAN AslIsExceptionDisabled ( UINT8 Level, UINT16 MessageId) @@ -940,8 +1100,7 @@ AslError ( /* Check if user wants to ignore this exception */ - if (Gbl_AllExceptionsDisabled || - AslIsExceptionDisabled (Level, MessageId)) + if (AslIsExceptionIgnored (Level, MessageId)) { return; } Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Jul 28 17:44:36 2017 (r321655) @@ -252,6 +252,7 @@ extern int AslCompilerdebug; #define ASL_DEFAULT_LINE_BUFFER_SIZE (1024 * 32) /* 32K */ #define ASL_MSG_BUFFER_SIZE (1024 * 32) /* 32k */ #define ASL_MAX_DISABLED_MESSAGES 32 +#define ASL_MAX_EXPECTED_MESSAGES 32 #define HEX_TABLE_LINE_SIZE 8 #define HEX_LISTING_LINE_SIZE 8 @@ -396,6 +397,7 @@ ASL_EXTERN UINT32 ASL_INIT_GLOBAL (G ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_DisabledMessagesIndex, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ExpectedMessagesIndex, 0); ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); @@ -438,6 +440,7 @@ ASL_EXTERN char MsgBuffer[ASL_MSG_ ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; ASL_EXTERN UINT32 Gbl_DisabledMessages[ASL_MAX_DISABLED_MESSAGES]; +ASL_EXTERN ASL_EXPECTED_MESSAGE Gbl_ExpectedMessages[ASL_MAX_EXPECTED_MESSAGES]; #endif /* __ASLGLOBAL_H */ Modified: vendor-sys/acpica/dist/source/compiler/aslhelp.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslhelp.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslhelp.c Fri Jul 28 17:44:36 2017 (r321655) @@ -205,6 +205,7 @@ Usage ( ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); ACPI_OPTION ("-vr", "Disable remarks"); ACPI_OPTION ("-vw ", "Disable specific warning or remark"); + ACPI_OPTION ("-vx ", "Expect a specific warning, remark, or error"); ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Jul 28 17:44:36 2017 (r321655) @@ -348,7 +348,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", /* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression", -/* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT" +/* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT", +/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:" }; /* Table compiler */ Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Jul 28 17:44:36 2017 (r321655) @@ -351,6 +351,7 @@ typedef enum ASL_MSG_ARG_NOT_USED, ASL_MSG_CONSTANT_REQUIRED, ASL_MSG_CROSS_TABLE_SCOPE, + ASL_MSG_EXCEPTION_NOT_RECEIVED, /* These messages are used by the Data Table compiler only */ Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Jul 28 17:44:36 2017 (r321655) @@ -954,6 +954,22 @@ AslDoOptions ( } break; + case 'x': + + /* Get the required argument */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + + Status = AslExpectException (AcpiGbl_Optarg); + if (ACPI_FAILURE (Status)) + { + return (-1); + } + break; + default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); Modified: vendor-sys/acpica/dist/source/compiler/aslparseop.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslparseop.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslparseop.c Fri Jul 28 17:44:36 2017 (r321655) @@ -685,10 +685,10 @@ TrCreateNullTargetOp ( * DESCRIPTION: Create a leaf op (no children or peers) for one of the * special constants - __LINE__, __FILE__, and __DATE__. * - * Note: An implemenation of __FUNC__ cannot happen here because we don't - * have a full parse tree at this time and cannot find the parent control - * method. If it is ever needed, __FUNC__ must be implemented later, after - * the parse tree has been fully constructed. + * Note: The fullimplemenation of __METHOD__ cannot happen here because we + * don't have a full parse tree at this time and cannot find the parent + * control method. __METHOD__ must be implemented later, after the parse + * tree has been fully constructed. * ******************************************************************************/ @@ -709,6 +709,14 @@ TrCreateConstantLeafOp ( Op = TrAllocateOp (PARSEOP_INTEGER); Op->Asl.Value.Integer = Op->Asl.LineNumber; + break; + + case PARSEOP___METHOD__: + + /* Will become a string literal later */ + + Op = TrAllocateOp (PARSEOP___METHOD__); + Op->Asl.Value.String = NULL; break; case PARSEOP___PATH__: Modified: vendor-sys/acpica/dist/source/compiler/aslrules.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Jul 28 17:44:36 2017 (r321655) @@ -592,6 +592,7 @@ ConstExprTerm | PARSEOP___FILE__ {$$ = TrCreateConstantLeafOp (PARSEOP___FILE__);} | PARSEOP___LINE__ {$$ = TrCreateConstantLeafOp (PARSEOP___LINE__);} | PARSEOP___PATH__ {$$ = TrCreateConstantLeafOp (PARSEOP___PATH__);} + | PARSEOP___METHOD__ {$$ = TrCreateConstantLeafOp (PARSEOP___METHOD__);} ; Integer Modified: vendor-sys/acpica/dist/source/compiler/asltokens.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltokens.y Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/asltokens.y Fri Jul 28 17:44:36 2017 (r321655) @@ -637,3 +637,4 @@ NoEcho(' %token PARSEOP___FILE__ %token PARSEOP___LINE__ %token PARSEOP___PATH__ +%token PARSEOP___METHOD__ Modified: vendor-sys/acpica/dist/source/compiler/asltransform.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltransform.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/asltransform.c Fri Jul 28 17:44:36 2017 (r321655) @@ -430,7 +430,9 @@ static void TrTransformSubtree ( ACPI_PARSE_OBJECT *Op) { + ACPI_PARSE_OBJECT *MethodOp; + if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) { return; @@ -463,6 +465,35 @@ TrTransformSubtree ( ExDoExternal (Op); } + break; + + case PARSEOP___METHOD__: + + /* Transform to a string op containing the parent method name */ + + Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; + UtSetParseOpName (Op); + + /* Find the parent control method op */ + + MethodOp = Op; + while (MethodOp) + { + if (MethodOp->Asl.ParseOpcode == PARSEOP_METHOD) + { + /* First child contains the method name */ + + MethodOp = MethodOp->Asl.Child; + Op->Asl.Value.String = MethodOp->Asl.Value.String; + return; + } + + MethodOp = MethodOp->Asl.Parent; + } + + /* At the root, invocation not within a control method */ + + Op->Asl.Value.String = "\\"; break; default: Modified: vendor-sys/acpica/dist/source/compiler/asltypes.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Jul 28 17:44:36 2017 (r321655) @@ -355,6 +355,15 @@ typedef struct asl_error_msg } ASL_ERROR_MSG; +/* An entry in the expected messages array */ +typedef struct asl_expected_message +{ + UINT32 MessageId; + char *MessageIdStr; + BOOLEAN MessageReceived; + +} ASL_EXPECTED_MESSAGE; + /* An entry in the listing file stack (for include files) */ Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Jul 28 17:44:36 2017 (r321655) @@ -174,7 +174,13 @@ UtAttachNameseg ( ACPI_PARSE_OBJECT *Op, char *Name); +static void +UtReallocLineBuffers ( + char **Buffer, + UINT32 OldSize, + UINT32 NewSize); + /******************************************************************************* * * FUNCTION: UtIsBigEndianMachine @@ -733,43 +739,48 @@ UtExpandLineBuffers ( Gbl_LineBufferSize, NewSize); } - Gbl_CurrentLineBuffer = realloc (Gbl_CurrentLineBuffer, NewSize); + UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize); + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - if (!Gbl_CurrentLineBuffer) - { - goto ErrorExit; - } + Gbl_LineBufferSize = NewSize; +} - Gbl_MainTokenBuffer = realloc (Gbl_MainTokenBuffer, NewSize); - if (!Gbl_MainTokenBuffer) - { - goto ErrorExit; - } - Gbl_MacroTokenBuffer = realloc (Gbl_MacroTokenBuffer, NewSize); - if (!Gbl_MacroTokenBuffer) - { - goto ErrorExit; - } +/****************************************************************************** + * + * FUNCTION: UtReallocLineBuffers + * + * PARAMETERS: Buffer - Buffer to realloc + * OldSize - Old size of Buffer + * NewSize - New size of Buffer + * + * RETURN: none + * + * DESCRIPTION: Reallocate and initialize Buffer + * + *****************************************************************************/ - Gbl_ExpressionTokenBuffer = realloc (Gbl_ExpressionTokenBuffer, NewSize); - if (!Gbl_ExpressionTokenBuffer) +static void +UtReallocLineBuffers ( + char **Buffer, + UINT32 OldSize, + UINT32 NewSize) +{ + + *Buffer = realloc (*Buffer, NewSize); + if (*Buffer) { - goto ErrorExit; + memset (*Buffer + OldSize, 0, NewSize - OldSize); + return; } - Gbl_LineBufferSize = NewSize; - return; - - - /* On error above, simply issue error messages and abort, cannot continue */ - -ErrorExit: printf ("Could not increase line buffer size from %u to %u\n", - Gbl_LineBufferSize, Gbl_LineBufferSize * 2); + OldSize, NewSize); - AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, - NULL, NULL); + AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, NULL, NULL); AslAbort (); } Modified: vendor-sys/acpica/dist/source/compiler/dtcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompile.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/dtcompile.c Fri Jul 28 17:44:36 2017 (r321655) @@ -486,18 +486,21 @@ DtCompileDataTable ( } else if (TableData->TableInfo) { - /* Simple table, just walk the info table */ + /* Simple table, just walk the info table, unless its empty */ - Subtable = NULL; - Status = DtCompileTable (FieldList, TableData->TableInfo, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) + if (FieldList && *FieldList) { - return (Status); - } + Subtable = NULL; + Status = DtCompileTable (FieldList, TableData->TableInfo, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - DtInsertSubtable (Gbl_RootTable, Subtable); - DtPopSubtable (); + DtInsertSubtable (Gbl_RootTable, Subtable); + DtPopSubtable (); + } } else { Modified: vendor-sys/acpica/dist/source/compiler/dtcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompiler.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/dtcompiler.h Fri Jul 28 17:44:36 2017 (r321655) @@ -726,6 +726,7 @@ extern const unsigned char TemplateRasf[]; extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; extern const unsigned char TemplateSbst[]; +extern const unsigned char TemplateSdei[]; extern const unsigned char TemplateSlic[]; extern const unsigned char TemplateSlit[]; extern const unsigned char TemplateSpcr[]; Modified: vendor-sys/acpica/dist/source/compiler/dttemplate.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dttemplate.h Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/dttemplate.h Fri Jul 28 17:44:36 2017 (r321655) @@ -1178,6 +1178,15 @@ const unsigned char TemplateSbst[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */ }; +const unsigned char TemplateSdei[] = +{ + 0x53,0x44,0x45,0x49,0x3e,0x00,0x00,0x00, /* 00000000 "SDEI>..." */ + 0x01,0x59,0x41,0x52,0x4d,0x20,0x20,0x20, /* 00000008 ".mARM " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x30,0x09,0x16,0x20 /* 00000028 "0.. " */ +}; + const unsigned char TemplateSlic[] = { 0x53,0x4C,0x49,0x43,0x76,0x01,0x00,0x00, /* 00000000 "SLICv..." */ Modified: vendor-sys/acpica/dist/source/compiler/dtutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtutils.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/dtutils.c Fri Jul 28 17:44:36 2017 (r321655) @@ -190,7 +190,7 @@ DtError ( /* Check if user wants to ignore this exception */ - if (AslIsExceptionDisabled (Level, MessageId)) + if (AslIsExceptionIgnored (Level, MessageId)) { return; } Modified: vendor-sys/acpica/dist/source/compiler/prmacros.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/prmacros.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/compiler/prmacros.c Fri Jul 28 17:44:36 2017 (r321655) @@ -483,7 +483,7 @@ PrAddMacro ( { /* Search the macro arg list for matching arg */ - for (i = 0; Args[i].Name && (i < PR_MAX_MACRO_ARGS); i++) + for (i = 0; ((i < PR_MAX_MACRO_ARGS) && Args[i].Name); i++) { /* * Save argument offset within macro body. This is the mechanism Modified: vendor-sys/acpica/dist/source/components/debugger/dbdisply.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Fri Jul 28 17:44:36 2017 (r321655) @@ -451,7 +451,7 @@ DumpNode: else { - AcpiOsPrintf ("Object (%p) Pathname: %s\n", + AcpiOsPrintf ("Object %p: Namespace Node - Pathname: %s\n", Node, (char *) RetBuf.Pointer); } @@ -468,7 +468,7 @@ DumpNode: ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { - AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); + AcpiOsPrintf ("\nAttached Object %p:", ObjDesc); if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) { AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", @@ -476,8 +476,33 @@ DumpNode: return; } - AcpiUtDebugDumpBuffer ((void *) ObjDesc, - sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); + if (ACPI_GET_DESCRIPTOR_TYPE ( + ((ACPI_NAMESPACE_NODE *) ObjDesc)) == ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf (" Namespace Node - "); + Status = AcpiGetName ((ACPI_NAMESPACE_NODE *) ObjDesc, + ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not convert name to pathname\n"); + } + else + { + AcpiOsPrintf ("Pathname: %s", + (char *) RetBuf.Pointer); + } + + AcpiOsPrintf ("\n"); + AcpiUtDebugDumpBuffer ((void *) ObjDesc, + sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); + } + else + { + AcpiOsPrintf ("\n"); + AcpiUtDebugDumpBuffer ((void *) ObjDesc, + sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); + } + AcpiExDumpObjectDescriptor (ObjDesc, 1); } } Modified: vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c Fri Jul 28 17:44:36 2017 (r321655) @@ -313,6 +313,8 @@ AcpiDsCreateBufferField ( if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) { + ACPI_ERROR ((AE_INFO, + "Parse execute mode is not set")); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -701,6 +703,8 @@ AcpiDsInitFieldObjects ( return_ACPI_STATUS (AE_OK); } + ACPI_ERROR ((AE_INFO, + "Parse deferred mode is not set")); return_ACPI_STATUS (AE_AML_INTERNAL); } Modified: vendor-sys/acpica/dist/source/components/dispatcher/dsobject.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dsobject.c Fri Jul 28 17:10:19 2017 (r321654) +++ vendor-sys/acpica/dist/source/components/dispatcher/dsobject.c Fri Jul 28 17:44:36 2017 (r321655) @@ -160,15 +160,7 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsobject") -/* Local prototypes */ -static ACPI_STATUS -AcpiDsBuildInternalObject ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT **ObjDescPtr); - - #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* * @@ -185,7 +177,7 @@ AcpiDsBuildInternalObject ( * ******************************************************************************/ -static ACPI_STATUS +ACPI_STATUS AcpiDsBuildInternalObject ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, @@ -193,7 +185,6 @@ AcpiDsBuildInternalObject ( { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; - ACPI_OBJECT_TYPE Type; ACPI_FUNCTION_TRACE (DsBuildInternalObject); @@ -204,129 +195,43 @@ AcpiDsBuildInternalObject ( { /* * This is a named object reference. If this name was - * previously looked up in the namespace, it was stored in this op. - * Otherwise, go ahead and look it up now + * previously looked up in the namespace, it was stored in + * this op. Otherwise, go ahead and look it up now */ if (!Op->Common.Node) { - Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); - if (ACPI_FAILURE (Status)) - { - /* Check if we are resolving a named reference within a package */ + /* Check if we are resolving a named reference within a package */ - if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) && - - ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))) + if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) + { + /* + * We won't resolve package elements here, we will do this + * after all ACPI tables are loaded into the namespace. This + * behavior supports both forward references to named objects + * and external references to objects in other tables. + */ + goto CreateNewObject; + } + else + { + Status = AcpiNsLookup (WalkState->ScopeInfo, + Op->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, + ACPI_CAST_INDIRECT_PTR ( + ACPI_NAMESPACE_NODE, &(Op->Common.Node))); + if (ACPI_FAILURE (Status)) { - /* - * We didn't find the target and we are populating elements - * of a package - ignore if slack enabled. Some ASL code - * contains dangling invalid references in packages and - * expects that no exception will be issued. Leave the - * element as a null element. It cannot be used, but it - * can be overwritten by subsequent ASL code - this is - * typically the case. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Ignoring unresolved reference in package [%4.4s]\n", - WalkState->ScopeInfo->Scope.Node->Name.Ascii)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 28 17:45:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D018DCAEB1; Fri, 28 Jul 2017 17:45:21 +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 435A369D74; Fri, 28 Jul 2017 17:45:21 +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 v6SHjKw3089028; Fri, 28 Jul 2017 17:45:20 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SHjKdx089027; Fri, 28 Jul 2017 17:45:20 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201707281745.v6SHjKdx089027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 28 Jul 2017 17:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321656 - vendor-sys/acpica/20170728 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20170728 X-SVN-Commit-Revision: 321656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 17:45:21 -0000 Author: jkim Date: Fri Jul 28 17:45:20 2017 New Revision: 321656 URL: https://svnweb.freebsd.org/changeset/base/321656 Log: Tag ACPICA 20170728. Added: vendor-sys/acpica/20170728/ - copied from r321655, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Fri Jul 28 18:09:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69731DCB2E7; Fri, 28 Jul 2017 18:09:42 +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 3845F6A656; Fri, 28 Jul 2017 18:09:42 +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 v6SI9f29097175; Fri, 28 Jul 2017 18:09:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SI9fYo097174; Fri, 28 Jul 2017 18:09:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707281809.v6SI9fYo097174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Jul 2017 18:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321657 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 321657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:09:42 -0000 Author: jhb Date: Fri Jul 28 18:09:41 2017 New Revision: 321657 URL: https://svnweb.freebsd.org/changeset/base/321657 Log: MFC 321075: Set the current vnet pointer in the socket buffer AIO handler. This fixes panics when using AIO under VIMAGE. Sponsored by: Chelsio Communications Modified: stable/11/sys/kern/sys_socket.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sys_socket.c ============================================================================== --- stable/11/sys/kern/sys_socket.c Fri Jul 28 17:45:20 2017 (r321656) +++ stable/11/sys/kern/sys_socket.c Fri Jul 28 18:09:41 2017 (r321657) @@ -675,6 +675,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb { struct kaiocb *job; + CURVNET_SET(so->so_vnet); SOCKBUF_LOCK(sb); while (!TAILQ_EMPTY(&sb->sb_aiojobq) && soaio_ready(so, sb)) { job = TAILQ_FIRST(&sb->sb_aiojobq); @@ -698,6 +699,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); + CURVNET_RESTORE(); } void From owner-svn-src-all@freebsd.org Fri Jul 28 18:11:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41DF2DCB4AA; Fri, 28 Jul 2017 18:11:55 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F0426A96C; Fri, 28 Jul 2017 18:11:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SIBrBP000429; Fri, 28 Jul 2017 18:11:53 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIBrH6000428; Fri, 28 Jul 2017 18:11:53 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707281811.v6SIBrH6000428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 28 Jul 2017 18:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321658 - head/usr.sbin/binmiscctl X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/usr.sbin/binmiscctl X-SVN-Commit-Revision: 321658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:11:55 -0000 Author: sbruno Date: Fri Jul 28 18:11:53 2017 New Revision: 321658 URL: https://svnweb.freebsd.org/changeset/base/321658 Log: binmiscctl should use modfind instead of kldfind kldfind() only matches kernel modules, so if you link imgact_binmisc directly into the kernel, binmiscctl can't find it, tries to load it, and errors out with: Can't load imgact_binmisc kernel module: File exists A quick search of other base commands shows that the correct procedure is to call modfind(), and then try kldload() if that fails. PR: 218593 Submitted by: Dan Nelson MFC after: 1 week Modified: head/usr.sbin/binmiscctl/binmiscctl.c Modified: head/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:09:41 2017 (r321657) +++ head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:11:53 2017 (r321658) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include enum cmd { @@ -401,7 +402,7 @@ main(int argc, char **argv) size_t xbe_out_sz = 0, *xbe_out_szp = NULL; uint32_t i; - if (kldfind(KMOD_NAME) == -1) { + if (modfind(KMOD_NAME) == -1) { if (kldload(KMOD_NAME) == -1) fatal("Can't load %s kernel module: %s", KMOD_NAME, strerror(errno)); From owner-svn-src-all@freebsd.org Fri Jul 28 18:27:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F529DCBCEF; Fri, 28 Jul 2017 18:27:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BF1C6B60C; Fri, 28 Jul 2017 18:27:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SIRU0m005786; Fri, 28 Jul 2017 18:27:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIRUmc005785; Fri, 28 Jul 2017 18:27:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707281827.v6SIRUmc005785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 28 Jul 2017 18:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321659 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 321659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:27:31 -0000 Author: gjb Date: Fri Jul 28 18:27:30 2017 New Revision: 321659 URL: https://svnweb.freebsd.org/changeset/base/321659 Log: Turn off ChallengeResponseAuthentication for EC2 AMIs, one of EC2's requirements. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Fri Jul 28 18:11:53 2017 (r321658) +++ head/release/tools/ec2.conf Fri Jul 28 18:27:30 2017 (r321659) @@ -81,6 +81,12 @@ vm_extra_pre_umount() { # Load the kernel module for the Amazon "Elastic Network Adapter" echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf + # Disable ChallengeResponseAuthentication according to EC2 + # requirements. + sed -i '' -e \ + 's/^#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/' \ + ${DESTDIR}/etc/ssh/sshd_config + # The first time the AMI boots, the installed "first boot" scripts # should be allowed to run: # * ec2_configinit (download and process EC2 user-data) From owner-svn-src-all@freebsd.org Fri Jul 28 18:35:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5FE6DCBEFC; Fri, 28 Jul 2017 18:35:30 +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 946586BAF5; Fri, 28 Jul 2017 18:35:30 +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 v6SIZTQU010138; Fri, 28 Jul 2017 18:35:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIZTOn010137; Fri, 28 Jul 2017 18:35:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707281835.v6SIZTOn010137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 28 Jul 2017 18:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321660 - in stable: 10/sys/boot/efi/boot1 11/sys/boot/efi/boot1 X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/sys/boot/efi/boot1 11/sys/boot/efi/boot1 X-SVN-Commit-Revision: 321660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:35:30 -0000 Author: dim Date: Fri Jul 28 18:35:29 2017 New Revision: 321660 URL: https://svnweb.freebsd.org/changeset/base/321660 Log: MFC r321305: Fix printf format warning in zfs_module.c Clang 5.0.0 got better warnings about print format strings using %zd, and this leads to the following -Werror warning on e.g. arm: sys/boot/efi/boot1/zfs_module.c:186:18: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat] "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); ^~~~~~~~~~ Fix this by casting off_t arguments to intmax_t, and using %jd instead. Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D11678 Modified: stable/10/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- stable/10/sys/boot/efi/boot1/zfs_module.c Fri Jul 28 18:27:30 2017 (r321659) +++ stable/10/sys/boot/efi/boot1/zfs_module.c Fri Jul 28 18:35:29 2017 (r321660) @@ -135,8 +135,8 @@ load(const char *filepath, dev_info_t *devinfo, void * if ((status = bs->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf)) != EFI_SUCCESS) { - printf("Failed to allocate load buffer %zd for pool '%s' for '%s' " - "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); + printf("Failed to allocate load buffer %jd for pool '%s' for '%s' " + "(%lu)\n", (intmax_t)st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); return (EFI_INVALID_PARAMETER); } From owner-svn-src-all@freebsd.org Fri Jul 28 18:35:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90D2BDCBEF8; Fri, 28 Jul 2017 18:35:30 +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 5F0656BAF4; Fri, 28 Jul 2017 18:35:30 +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 v6SIZTAd010131; Fri, 28 Jul 2017 18:35:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIZTVS010130; Fri, 28 Jul 2017 18:35:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707281835.v6SIZTVS010130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 28 Jul 2017 18:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321660 - in stable: 10/sys/boot/efi/boot1 11/sys/boot/efi/boot1 X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/sys/boot/efi/boot1 11/sys/boot/efi/boot1 X-SVN-Commit-Revision: 321660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:35:30 -0000 Author: dim Date: Fri Jul 28 18:35:29 2017 New Revision: 321660 URL: https://svnweb.freebsd.org/changeset/base/321660 Log: MFC r321305: Fix printf format warning in zfs_module.c Clang 5.0.0 got better warnings about print format strings using %zd, and this leads to the following -Werror warning on e.g. arm: sys/boot/efi/boot1/zfs_module.c:186:18: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat] "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); ^~~~~~~~~~ Fix this by casting off_t arguments to intmax_t, and using %jd instead. Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D11678 Modified: stable/11/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- stable/11/sys/boot/efi/boot1/zfs_module.c Fri Jul 28 18:27:30 2017 (r321659) +++ stable/11/sys/boot/efi/boot1/zfs_module.c Fri Jul 28 18:35:29 2017 (r321660) @@ -173,8 +173,8 @@ load(const char *filepath, dev_info_t *devinfo, void * if ((status = bs->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf)) != EFI_SUCCESS) { - printf("Failed to allocate load buffer %zd for pool '%s' for '%s' " - "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); + printf("Failed to allocate load buffer %jd for pool '%s' for '%s' " + "(%lu)\n", (intmax_t)st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); return (EFI_INVALID_PARAMETER); } From owner-svn-src-all@freebsd.org Fri Jul 28 18:46:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D641DCC1E9; Fri, 28 Jul 2017 18:46:04 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CD116C21C; Fri, 28 Jul 2017 18:46:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SIk3er014409; Fri, 28 Jul 2017 18:46:03 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIk3xr014408; Fri, 28 Jul 2017 18:46:03 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707281846.v6SIk3xr014408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 28 Jul 2017 18:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321661 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 321661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:46:04 -0000 Author: gjb Date: Fri Jul 28 18:46:02 2017 New Revision: 321661 URL: https://svnweb.freebsd.org/changeset/base/321661 Log: Revert r321659, re-enabling ChallengeResponseAuthentication, which was discussed a while back between cperciva@ and so@, and I forgot. Reported by: cperciva Sponsored by: The FreeBSD Foundation Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Fri Jul 28 18:35:29 2017 (r321660) +++ head/release/tools/ec2.conf Fri Jul 28 18:46:02 2017 (r321661) @@ -81,12 +81,6 @@ vm_extra_pre_umount() { # Load the kernel module for the Amazon "Elastic Network Adapter" echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf - # Disable ChallengeResponseAuthentication according to EC2 - # requirements. - sed -i '' -e \ - 's/^#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/' \ - ${DESTDIR}/etc/ssh/sshd_config - # The first time the AMI boots, the installed "first boot" scripts # should be allowed to run: # * ec2_configinit (download and process EC2 user-data) From owner-svn-src-all@freebsd.org Fri Jul 28 18:47:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 707C5DCC24C; Fri, 28 Jul 2017 18:47:05 +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 3EB9E6C37E; Fri, 28 Jul 2017 18:47:05 +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 v6SIl48m014496; Fri, 28 Jul 2017 18:47:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SIl42I014495; Fri, 28 Jul 2017 18:47:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707281847.v6SIl42I014495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 28 Jul 2017 18:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321662 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 321662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 18:47:05 -0000 Author: dim Date: Fri Jul 28 18:47:04 2017 New Revision: 321662 URL: https://svnweb.freebsd.org/changeset/base/321662 Log: MFC r321306: Fix printf format warning in iflib.c Clang 5.0.0 got better warnings about printf format strings using %zd, and this leads to the following -Werror warning on e.g. arm: sys/net/iflib.c:1517:8: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat] sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize); ^~~~~~~~~~~~~~~~~~~~ sys/net/iflib.c:1517:41: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat] sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize); ^~~~~~~~~~~~~~~~~~~~~~~ Fix this by casting bus_size_t arguments to uintmax_t, and using %ju instead. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D11679 Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Fri Jul 28 18:46:02 2017 (r321661) +++ stable/11/sys/net/iflib.c Fri Jul 28 18:47:04 2017 (r321662) @@ -1262,8 +1262,8 @@ iflib_txsd_alloc(iflib_txq_t txq) NULL, /* lockfuncarg */ &txq->ift_desc_tag))) { device_printf(dev,"Unable to allocate TX DMA tag: %d\n", err); - device_printf(dev,"maxsize: %zd nsegments: %d maxsegsize: %zd\n", - sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize); + device_printf(dev,"maxsize: %ju nsegments: %d maxsegsize: %ju\n", + (uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize); goto fail; } #ifdef IFLIB_DIAGNOSTICS From owner-svn-src-all@freebsd.org Fri Jul 28 19:10:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EF1CDCC7C6; Fri, 28 Jul 2017 19:10:35 +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 47DED6CD71; Fri, 28 Jul 2017 19:10:35 +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 v6SJAYMd022944; Fri, 28 Jul 2017 19:10:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SJAYZ4022943; Fri, 28 Jul 2017 19:10:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707281910.v6SJAYZ4022943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 28 Jul 2017 19:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321663 - stable/11/contrib/llvm/tools/clang/lib/AST X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/contrib/llvm/tools/clang/lib/AST X-SVN-Commit-Revision: 321663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 19:10:35 -0000 Author: dim Date: Fri Jul 28 19:10:34 2017 New Revision: 321663 URL: https://svnweb.freebsd.org/changeset/base/321663 Log: MFC r321342: Pull in r295886 from upstream clang trunk (by Richard Smith): PR32034: Evaluate _Atomic(T) in-place when T is a class or array type. This is necessary in order for the evaluation of an _Atomic initializer for those types to have an associated object, which an initializer for class or array type needs. This fixes an assertion when building recent versions of LinuxCNC. Reported by: trasz PR: 220883 Modified: stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp ============================================================================== --- stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Fri Jul 28 18:47:04 2017 (r321662) +++ stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Fri Jul 28 19:10:34 2017 (r321663) @@ -1404,7 +1404,8 @@ static bool EvaluateIntegerOrLValue(const Expr *E, APV EvalInfo &Info); static bool EvaluateFloat(const Expr *E, APFloat &Result, EvalInfo &Info); static bool EvaluateComplex(const Expr *E, ComplexValue &Res, EvalInfo &Info); -static bool EvaluateAtomic(const Expr *E, APValue &Result, EvalInfo &Info); +static bool EvaluateAtomic(const Expr *E, const LValue *This, APValue &Result, + EvalInfo &Info); static bool EvaluateAsRValue(EvalInfo &Info, const Expr *E, APValue &Result); //===----------------------------------------------------------------------===// @@ -4691,7 +4692,10 @@ class ExprEvaluatorBase (public) case CK_AtomicToNonAtomic: { APValue AtomicVal; - if (!EvaluateAtomic(E->getSubExpr(), AtomicVal, Info)) + // This does not need to be done in place even for class/array types: + // atomic-to-non-atomic conversion implies copying the object + // representation. + if (!Evaluate(AtomicVal, Info, E->getSubExpr())) return false; return DerivedSuccess(AtomicVal, E); } @@ -9565,10 +9569,11 @@ bool ComplexExprEvaluator::VisitInitListExpr(const Ini namespace { class AtomicExprEvaluator : public ExprEvaluatorBase { + const LValue *This; APValue &Result; public: - AtomicExprEvaluator(EvalInfo &Info, APValue &Result) - : ExprEvaluatorBaseTy(Info), Result(Result) {} + AtomicExprEvaluator(EvalInfo &Info, const LValue *This, APValue &Result) + : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {} bool Success(const APValue &V, const Expr *E) { Result = V; @@ -9578,7 +9583,10 @@ class AtomicExprEvaluator : (public) bool ZeroInitialization(const Expr *E) { ImplicitValueInitExpr VIE( E->getType()->castAs()->getValueType()); - return Evaluate(Result, Info, &VIE); + // For atomic-qualified class (and array) types in C++, initialize the + // _Atomic-wrapped subobject directly, in-place. + return This ? EvaluateInPlace(Result, Info, *This, &VIE) + : Evaluate(Result, Info, &VIE); } bool VisitCastExpr(const CastExpr *E) { @@ -9586,15 +9594,17 @@ class AtomicExprEvaluator : (public) default: return ExprEvaluatorBaseTy::VisitCastExpr(E); case CK_NonAtomicToAtomic: - return Evaluate(Result, Info, E->getSubExpr()); + return This ? EvaluateInPlace(Result, Info, *This, E->getSubExpr()) + : Evaluate(Result, Info, E->getSubExpr()); } } }; } // end anonymous namespace -static bool EvaluateAtomic(const Expr *E, APValue &Result, EvalInfo &Info) { +static bool EvaluateAtomic(const Expr *E, const LValue *This, APValue &Result, + EvalInfo &Info) { assert(E->isRValue() && E->getType()->isAtomicType()); - return AtomicExprEvaluator(Info, Result).Visit(E); + return AtomicExprEvaluator(Info, This, Result).Visit(E); } //===----------------------------------------------------------------------===// @@ -9699,8 +9709,17 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, if (!EvaluateVoid(E, Info)) return false; } else if (T->isAtomicType()) { - if (!EvaluateAtomic(E, Result, Info)) - return false; + QualType Unqual = T.getAtomicUnqualifiedType(); + if (Unqual->isArrayType() || Unqual->isRecordType()) { + LValue LV; + LV.set(E, Info.CurrentCall->Index); + APValue &Value = Info.CurrentCall->createTemporary(E, false); + if (!EvaluateAtomic(E, &LV, Value, Info)) + return false; + } else { + if (!EvaluateAtomic(E, nullptr, Result, Info)) + return false; + } } else if (Info.getLangOpts().CPlusPlus11) { Info.FFDiag(E, diag::note_constexpr_nonliteral) << E->getType(); return false; @@ -9725,10 +9744,16 @@ static bool EvaluateInPlace(APValue &Result, EvalInfo if (E->isRValue()) { // Evaluate arrays and record types in-place, so that later initializers can // refer to earlier-initialized members of the object. - if (E->getType()->isArrayType()) + QualType T = E->getType(); + if (T->isArrayType()) return EvaluateArray(E, This, Result, Info); - else if (E->getType()->isRecordType()) + else if (T->isRecordType()) return EvaluateRecord(E, This, Result, Info); + else if (T->isAtomicType()) { + QualType Unqual = T.getAtomicUnqualifiedType(); + if (Unqual->isArrayType() || Unqual->isRecordType()) + return EvaluateAtomic(E, &This, Result, Info); + } } // For any other type, in-place evaluation is unimportant. From owner-svn-src-all@freebsd.org Fri Jul 28 20:13:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE060DCDCB9; Fri, 28 Jul 2017 20:13:26 +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 99F466F117; Fri, 28 Jul 2017 20:13:26 +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 v6SKDPx8051281; Fri, 28 Jul 2017 20:13:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SKDPpg051279; Fri, 28 Jul 2017 20:13:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707282013.v6SKDPpg051279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 28 Jul 2017 20:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321664 - in head/contrib/llvm/lib: CodeGen Target/X86 X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/lib: CodeGen Target/X86 X-SVN-Commit-Revision: 321664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 20:13:26 -0000 Author: dim Date: Fri Jul 28 20:13:25 2017 New Revision: 321664 URL: https://svnweb.freebsd.org/changeset/base/321664 Log: Pull in r308891 from upstream llvm trunk (by Benjamin Kramer): [CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses. This avoids excessive compile time. The case I'm looking at is Function.cpp from an old version of LLVM that still had the giant memcmp string matcher in it. Before r308322 this compiled in about 2 minutes, after it, clang takes infinite* time to compile it. With this patch we're at 5 min, which is still bad but this is a pathological case. The cut off at 20 uses was chosen by looking at other cut-offs in LLVM for user scanning. It's probably too high, but does the job and is very unlikely to regress anything. Fixes PR33900. * I'm impatient and aborted after 15 minutes, on the bug report it was killed after 2h. Pull in r308986 from upstream llvm trunk (by Simon Pilgrim): [X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914) D35067/rL308322 attempted to support up to 4 load pairs for memcmp inlining which resulted in regressions for some optimized libc memcmp implementations (PR33914). Until we can match these more optimal cases, this patch reduces the memcmp expansion to a maximum of 2 load pairs (which matches what we do for -Os). This patch should be considered for the 5.0.0 release branch as well Differential Revision: https://reviews.llvm.org/D35830 These fix a hang (or extremely long compile time) when building older LLVM ports. Reported by: antoine PR: 219139 Modified: head/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Modified: head/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp Fri Jul 28 19:10:34 2017 (r321663) +++ head/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp Fri Jul 28 20:13:25 2017 (r321664) @@ -4016,14 +4016,18 @@ static bool IsOperandAMemoryOperand(CallInst *CI, Inli return true; } +// Max number of memory uses to look at before aborting the search to conserve +// compile time. +static constexpr int MaxMemoryUsesToScan = 20; + /// Recursively walk all the uses of I until we find a memory use. /// If we find an obviously non-foldable instruction, return true. /// Add the ultimately found memory instructions to MemoryUses. static bool FindAllMemoryUses( Instruction *I, SmallVectorImpl> &MemoryUses, - SmallPtrSetImpl &ConsideredInsts, - const TargetLowering &TLI, const TargetRegisterInfo &TRI) { + SmallPtrSetImpl &ConsideredInsts, const TargetLowering &TLI, + const TargetRegisterInfo &TRI, int SeenInsts = 0) { // If we already considered this instruction, we're done. if (!ConsideredInsts.insert(I).second) return false; @@ -4036,8 +4040,12 @@ static bool FindAllMemoryUses( // Loop over all the uses, recursively processing them. for (Use &U : I->uses()) { - Instruction *UserI = cast(U.getUser()); + // Conservatively return true if we're seeing a large number or a deep chain + // of users. This avoids excessive compilation times in pathological cases. + if (SeenInsts++ >= MaxMemoryUsesToScan) + return true; + Instruction *UserI = cast(U.getUser()); if (LoadInst *LI = dyn_cast(UserI)) { MemoryUses.push_back(std::make_pair(LI, U.getOperandNo())); continue; @@ -4082,7 +4090,8 @@ static bool FindAllMemoryUses( continue; } - if (FindAllMemoryUses(UserI, MemoryUses, ConsideredInsts, TLI, TRI)) + if (FindAllMemoryUses(UserI, MemoryUses, ConsideredInsts, TLI, TRI, + SeenInsts)) return true; } Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Jul 28 19:10:34 2017 (r321663) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Jul 28 20:13:25 2017 (r321664) @@ -1672,8 +1672,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa // TODO: These control memcmp expansion in CGP and could be raised higher, but // that needs to benchmarked and balanced with the potential use of vector - // load/store types (PR33329). - MaxLoadsPerMemcmp = 4; + // load/store types (PR33329, PR33914). + MaxLoadsPerMemcmp = 2; MaxLoadsPerMemcmpOptSize = 2; // Set loop alignment to 2^ExperimentalPrefLoopAlignment bytes (default: 2^4). From owner-svn-src-all@freebsd.org Fri Jul 28 21:07:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2B0EDCF297; Fri, 28 Jul 2017 21:07:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B026271092; Fri, 28 Jul 2017 21:07:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SL7v5i071573; Fri, 28 Jul 2017 21:07:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SL7vtk071572; Fri, 28 Jul 2017 21:07:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707282107.v6SL7vtk071572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 28 Jul 2017 21:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321665 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 321665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 21:07:59 -0000 Author: rmacklem Date: Fri Jul 28 21:07:57 2017 New Revision: 321665 URL: https://svnweb.freebsd.org/changeset/base/321665 Log: Modify /etc/rc.d/nfsd so it doesn't force a startup of nfsuserd for NFSv4. Given that RFC7530 allows uid/gids to be placed in owner/owner_group strings directly, many NFSv4 environments don't need the nfsuserd. This small patch modified /etc/rc.d/nfsd so that it does not force startup of the nfsuserd daemon unless nfs_server_managegids is enabled. This implies that nfsuserd_enable="YES" must be added to /etc/rc.conf for NFSv4 server environments that use Kerberos mounts or clients that do not support the uid/gid in string capability. Since this could be considered a POLA violation, it will not be MFC'd. Discussed on: freebsd-current Modified: head/etc/rc.d/nfsd Modified: head/etc/rc.d/nfsd ============================================================================== --- head/etc/rc.d/nfsd Fri Jul 28 20:13:25 2017 (r321664) +++ head/etc/rc.d/nfsd Fri Jul 28 21:07:57 2017 (r321665) @@ -33,8 +33,7 @@ nfsd_precmd() sysctl vfs.nfsd.nfs_privport=0 > /dev/null fi - if checkyesno nfsv4_server_enable || \ - checkyesno nfs_server_managegids; then + if checkyesno nfs_server_managegids; then force_depend nfsuserd || err 1 "Cannot run nfsuserd" fi From owner-svn-src-all@freebsd.org Fri Jul 28 21:14:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 273E5DCF5B6; Fri, 28 Jul 2017 21:14:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E319E715C2; Fri, 28 Jul 2017 21:14:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SLETfD075591; Fri, 28 Jul 2017 21:14:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SLETsb075590; Fri, 28 Jul 2017 21:14:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707282114.v6SLETsb075590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 28 Jul 2017 21:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321666 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 21:14:30 -0000 Author: rmacklem Date: Fri Jul 28 21:14:28 2017 New Revision: 321666 URL: https://svnweb.freebsd.org/changeset/base/321666 Log: Add an entry to UPDATING for r321665. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jul 28 21:07:57 2017 (r321665) +++ head/UPDATING Fri Jul 28 21:14:28 2017 (r321666) @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170728: + As of r321665, an NFSv4 server configuration that services + Kerberos mounts or clients that do not support the uid/gid in + owner/owner_group string capability, must explicitly enable + the nfsuserd daemon by adding nfsuserd_enable="YES" to the + machine's /etc/rc.conf file. + 20170722: Clang, llvm, lldb, compiler-rt and libc++ have been upgraded to 5.0.0. Please see the 20141231 entry below for information about prerequisites From owner-svn-src-all@freebsd.org Fri Jul 28 21:43:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32895DD0549; Fri, 28 Jul 2017 21:43:01 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F12D172CDD; Fri, 28 Jul 2017 21:43:00 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SLgxqL088556; Fri, 28 Jul 2017 21:42:59 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SLgxAe088555; Fri, 28 Jul 2017 21:42:59 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201707282142.v6SLgxAe088555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 28 Jul 2017 21:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321668 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 321668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 21:43:01 -0000 Author: rlibby Date: Fri Jul 28 21:42:59 2017 New Revision: 321668 URL: https://svnweb.freebsd.org/changeset/base/321668 Log: bhyve/pci_e82545.c: squelch gcc warning for noreturn procedure Gcc complained that e82545_tx_thread has a return type declared but doesn't return anything. Annotate the procedure with _Noreturn. Reviewed by: grehan Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11774 Modified: head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Fri Jul 28 21:30:54 2017 (r321667) +++ head/usr.sbin/bhyve/pci_e82545.c Fri Jul 28 21:42:59 2017 (r321668) @@ -1405,7 +1405,7 @@ e82545_tx_run(struct e82545_softc *sc) sc->esc_TDH, sc->esc_TDHr, sc->esc_TDT); } -static void * +static _Noreturn void * e82545_tx_thread(void *param) { struct e82545_softc *sc = param; From owner-svn-src-all@freebsd.org Fri Jul 28 21:47:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6BF2DD07E2; Fri, 28 Jul 2017 21:47:11 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 949C47328D; Fri, 28 Jul 2017 21:47:11 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6SLlAJ4089266; Fri, 28 Jul 2017 21:47:10 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SLlAub089265; Fri, 28 Jul 2017 21:47:10 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201707282147.v6SLlAub089265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 28 Jul 2017 21:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321669 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 321669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 21:47:11 -0000 Author: rlibby Date: Fri Jul 28 21:47:10 2017 New Revision: 321669 URL: https://svnweb.freebsd.org/changeset/base/321669 Log: bhyve/vga.c: fix atc_color_select_67 bit shift Gcc noticed that the result of the bit shift is always zero. Shift so that the ATC_CS_C67 bits end up in bits 6 & 7. Reviewed by: grehan, tychon Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11775 Modified: head/usr.sbin/bhyve/vga.c Modified: head/usr.sbin/bhyve/vga.c ============================================================================== --- head/usr.sbin/bhyve/vga.c Fri Jul 28 21:42:59 2017 (r321668) +++ head/usr.sbin/bhyve/vga.c Fri Jul 28 21:47:10 2017 (r321669) @@ -1069,7 +1069,7 @@ vga_port_out_handler(struct vmctx *ctx, int in, int po sc->vga_atc.atc_color_select_45 = (val & ATC_CS_C45) << 4; sc->vga_atc.atc_color_select_67 = - (val & ATC_CS_C67) << 6; + ((val & ATC_CS_C67) >> 2) << 6; break; default: //printf("XXX VGA ATC: outb 0x%04x, 0x%02x at index %d\n", port, val, sc->vga_atc.atc_index); From owner-svn-src-all@freebsd.org Fri Jul 28 22:23:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95BE9DD1353; Fri, 28 Jul 2017 22:23:33 +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 332A574773; Fri, 28 Jul 2017 22:23:33 +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 v6SMNWhx005723; Fri, 28 Jul 2017 22:23:32 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SMNUVu005702; Fri, 28 Jul 2017 22:23:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201707282223.v6SMNUVu005702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 28 Jul 2017 22:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321670 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/compon... X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disassembler sys/con... X-SVN-Commit-Revision: 321670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 22:23:33 -0000 Author: jkim Date: Fri Jul 28 22:23:29 2017 New Revision: 321670 URL: https://svnweb.freebsd.org/changeset/base/321670 Log: Merge ACPICA 20170728. Added: head/sys/contrib/dev/acpica/compiler/aslparseop.c - copied, changed from r320476, vendor-sys/acpica/dist/source/compiler/aslparseop.c head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c - copied, changed from r321655, vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c Modified: head/sys/conf/files head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/acfileio.c head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/adwalk.c head/sys/contrib/dev/acpica/common/ahpredef.c head/sys/contrib/dev/acpica/common/ahtable.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtbinfo.c head/sys/contrib/dev/acpica/compiler/aslanalyze.c head/sys/contrib/dev/acpica/compiler/aslbtypes.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/aslcstyle.y head/sys/contrib/dev/acpica/compiler/asldefine.h head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslexternal.c head/sys/contrib/dev/acpica/compiler/aslfold.c head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslhelp.c head/sys/contrib/dev/acpica/compiler/aslhelpers.y head/sys/contrib/dev/acpica/compiler/aslkeywords.y head/sys/contrib/dev/acpica/compiler/asllength.c head/sys/contrib/dev/acpica/compiler/asllisting.c head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/asllookup.c head/sys/contrib/dev/acpica/compiler/aslmap.c head/sys/contrib/dev/acpica/compiler/aslmapoutput.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslmethod.c head/sys/contrib/dev/acpica/compiler/asloffset.c head/sys/contrib/dev/acpica/compiler/aslopcodes.c head/sys/contrib/dev/acpica/compiler/aslopt.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslpld.c head/sys/contrib/dev/acpica/compiler/aslpredef.c head/sys/contrib/dev/acpica/compiler/aslprimaries.y head/sys/contrib/dev/acpica/compiler/aslprintf.c head/sys/contrib/dev/acpica/compiler/aslresource.c head/sys/contrib/dev/acpica/compiler/aslresources.y head/sys/contrib/dev/acpica/compiler/aslrules.y head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/aslsupport.y head/sys/contrib/dev/acpica/compiler/asltokens.y head/sys/contrib/dev/acpica/compiler/asltransform.c head/sys/contrib/dev/acpica/compiler/asltree.c head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/aslwalks.c head/sys/contrib/dev/acpica/compiler/aslxref.c head/sys/contrib/dev/acpica/compiler/cvcompiler.c head/sys/contrib/dev/acpica/compiler/cvdisasm.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dttemplate.h head/sys/contrib/dev/acpica/compiler/dtutils.c head/sys/contrib/dev/acpica/compiler/prmacros.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c head/sys/contrib/dev/acpica/components/dispatcher/dsobject.c head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c head/sys/contrib/dev/acpica/components/executer/excreate.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/executer/exmisc.c head/sys/contrib/dev/acpica/components/executer/exoparg2.c head/sys/contrib/dev/acpica/components/hardware/hwregs.c head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nsarguments.c head/sys/contrib/dev/acpica/components/namespace/nsinit.c head/sys/contrib/dev/acpica/components/namespace/nsnames.c head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c head/sys/contrib/dev/acpica/components/parser/psloop.c head/sys/contrib/dev/acpica/components/parser/psobject.c head/sys/contrib/dev/acpica/components/resources/rsxface.c head/sys/contrib/dev/acpica/components/tables/tbdata.c head/sys/contrib/dev/acpica/components/tables/tbinstal.c head/sys/contrib/dev/acpica/components/tables/tbutils.c head/sys/contrib/dev/acpica/components/tables/tbxface.c head/sys/contrib/dev/acpica/components/tables/tbxfload.c head/sys/contrib/dev/acpica/components/utilities/uthex.c head/sys/contrib/dev/acpica/components/utilities/utmath.c head/sys/contrib/dev/acpica/components/utilities/utmisc.c head/sys/contrib/dev/acpica/components/utilities/utobject.c head/sys/contrib/dev/acpica/components/utilities/utresrc.c head/sys/contrib/dev/acpica/components/utilities/utstate.c head/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c head/sys/contrib/dev/acpica/components/utilities/uttrack.c head/sys/contrib/dev/acpica/include/acapps.h head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acdispat.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acnames.h head/sys/contrib/dev/acpica/include/acobject.h head/sys/contrib/dev/acpica/include/acpi.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actables.h head/sys/contrib/dev/acpica/include/actbl.h head/sys/contrib/dev/acpica/include/actbl2.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acutils.h head/sys/contrib/dev/acpica/include/platform/acenv.h head/sys/contrib/dev/acpica/include/platform/acfreebsd.h head/sys/contrib/dev/acpica/include/platform/acgcc.h head/sys/dev/acpica/acpi.c head/usr.sbin/acpi/acpidb/Makefile head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/conf/files Fri Jul 28 22:23:29 2017 (r321670) @@ -355,6 +355,7 @@ contrib/dev/acpica/components/dispatcher/dsmethod.c op contrib/dev/acpica/components/dispatcher/dsmthdat.c optional acpi contrib/dev/acpica/components/dispatcher/dsobject.c optional acpi contrib/dev/acpica/components/dispatcher/dsopcode.c optional acpi +contrib/dev/acpica/components/dispatcher/dspkginit.c optional acpi contrib/dev/acpica/components/dispatcher/dsutils.c optional acpi contrib/dev/acpica/components/dispatcher/dswexec.c optional acpi contrib/dev/acpica/components/dispatcher/dswload.c optional acpi Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Fri Jul 28 22:23:29 2017 (r321670) @@ -21,10 +21,9 @@ stripdirs="generate libraries parsers preprocessor tes stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \ acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \ acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \ - acwin.h acwin64.h acwinex.h dspkginit.c new_table.txt \ - osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \ - osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \ - readme.txt utclib.c utprint.c" + acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \ + osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \ + oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c" # include files to canonify src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \ Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/changes.txt Fri Jul 28 22:23:29 2017 (r321670) @@ -1,4 +1,156 @@ ---------------------------------------- +28 July 2017. Summary of changes for version 20170728: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression seen with small resource descriptors that could cause +an inadvertent AE_AML_NO_RESOURCE_END_TAG exception. + +AML interpreter: Implemented a new feature that allows forward references +from individual named references within package objects that are +contained within blocks of "module-level code". This provides +compatibility with other ACPI implementations and supports existing +firmware that depends on this feature. Example: + + Name (ABCD, 1) + If (ABCD) /* An If() at module-level */ + { + Name (PKG1, Package() + { + INT1 /* Forward reference to object INT1 +*/ + }) + Name (INT1, 0x1234) + } + +AML Interpreter: Fixed a problem with the Alias() operator where aliases +to some ASL objects were not handled properly. Objects affected are: +Mutex, Event, and OperationRegion. + +AML Debugger: Enhanced to properly handle AML Alias objects. These +objects have one level of indirection which was not fully supported by +the debugger. + +Table Manager: Added support to detect and ignore duplicate SSDTs within +the XSDT/RSDT. This error in the XSDT has been seen in the field. + +EFI and EDK2 support: + Enabled /WX flag for MSVC builds + Added support for AcpiOsStall, AcpiOsSleep, and AcpiOsGetTimer + Added local support for 64-bit multiply and shift operations + Added support to compile acpidump.efi on Windows + Added OSL function stubs for interfaces not used under EFI + +Added additional support for the _DMA predefined name. _DMA returns a +buffer containing a resource template. This change add support within the +resource manager (AcpiWalkResourceBuffer) to walk and parse this list of +resource descriptors. Lorenzo Pieralisi + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem where the internal input line buffer(s) could +overflow if there are very long lines in the input ASL source code file. +Implemented buffer management that automatically increases the size of +the buffers as necessary. + +iASL: Added an option (-vx) to "expect" particular remarks, warnings and +errors. If the specified exception is not raised during compilation, the +compiler emits an error. This is intended to support the ASL test suite, +but may be useful in other contexts. + +iASL: Implemented a new predefined macro, __METHOD__, which returns a +string containing the name of the current control method that is being +compiled. + +iASL: Implemented debugger and table compiler support for the SDEI ACPI +table (Software Delegated Exception Interface). James Morse + + +Unix/Linux makefiles: Added an option to disable compile optimizations. +The disable occurs when the NOOPT flag is set to TRUE. +theracermaster@gmail.com + +Acpidump: Added support for multiple DSDT and FACS tables. This can occur +when there are different tables for 32-bit versus 64-bit. + +Enhanced error reporting for the ASL test suite (ASLTS) by removing +unnecessary/verbose text, and emit the actual line number where an error +has occurred. These changes are intended to improve the usefulness of the +test suite. + +---------------------------------------- +29 June 2017. Summary of changes for version 20170629: + + +1) ACPICA kernel-resident subsystem: + +Tables: Implemented a deferred ACPI table verification. This is useful +for operating systems where the tables cannot be verified in the early +initialization stage due to early memory mapping limitations on some +architectures. Lv Zheng. + +Tables: Removed the signature validation for dynamically loaded tables. +Provides compatibility with other ACPI implementations. Previously, only +SSDT tables were allowed, as per the ACPI specification. Now, any table +signature can be used via the Load() operator. Lv Zheng. + +Tables: Fixed several mutex issues that could cause errors during table +acquisition. Lv Zheng. + +Tables: Fixed a problem where an ACPI warning could be generated if a +null pointer was passed to the AcpiPutTable interface. Lv Zheng. + +Tables: Added a mechanism to handle imbalances for the AcpiGetTable and +AcpiPutTable interfaces. This applies to the "late stage" table loading +when the use of AcpiPutTable is no longer required (since the system +memory manager is fully running and available). Lv Zheng. + +Fixed/Reverted a regression during processing of resource descriptors +that contain only a single EndTag. Fixes an AE_AML_NO_RESOURCE_END_TAG +exception in this case. + +Headers: IORT/SMMU support: Updated the SMMU models for Revision C of the +I/O Remapping specification. Robin Murphy + +Interpreter: Fixed a possible fault if an Alias operator with an invalid +or duplicate target is encountered during Alias creation in +AcpiExCreateAlias. Alex James + +Added an option to use designated initializers for function pointers. +Kees Cook + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Allow compilation of External declarations with target pathnames +that refer to existing named objects within the table. Erik Schmauss. + +iASL: Fixed a regression when compiling FieldUnits. Fixes an error if a +FieldUnit name also is declared via External in the same table. Erik +Schmauss. + +iASL: Allow existing scope names within pathnames used in External +statements. For example: + External (ABCD.EFGH) // ABCD exists, but EFGH is truly external + Device (ABCD) + +iASL: IORT ACPI table: Implemented changes required to decode the new +Proximity Domain for the SMMUv3 IORT. Disassembler and Data Table +compiler. Ganapatrao Kulkarni + +Disassembler: Don't abort disassembly on errors from External() +statements. Erik Schmauss. + +Disassembler: fixed a possible fault when one of the Create*Field +operators references a Resource Template. ACPICA Bugzilla 1396. + +iASL: In the source code, resolved some naming inconsistences across the +parsing support. Fixes confusion between "Parse Op" and "Parse Node". +Adds a new file, aslparseop.c + +---------------------------------------- 31 May 2017. Summary of changes for version 20170531: Modified: head/sys/contrib/dev/acpica/common/acfileio.c ============================================================================== --- head/sys/contrib/dev/acpica/common/acfileio.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/acfileio.c Fri Jul 28 22:23:29 2017 (r321670) @@ -175,6 +175,36 @@ AcCheckTextModeCorruption ( /******************************************************************************* * + * FUNCTION: AcDeleteTableList + * + * PARAMETERS: ListHead - List to delete + * + * RETURN: Status + * + * DESCRIPTION: Delete a list of tables. This is useful for removing memory + * allocated by AcGetAllTablesFromFile + * + ******************************************************************************/ + +void +AcDeleteTableList ( + ACPI_NEW_TABLE_DESC *ListHead) +{ + ACPI_NEW_TABLE_DESC *Current = ListHead; + ACPI_NEW_TABLE_DESC *Previous = Current; + + + while (Current) + { + Current = Current->Next; + AcpiOsFree (Previous); + Previous = Current; + } +} + + +/******************************************************************************* + * * FUNCTION: AcGetAllTablesFromFile * * PARAMETERS: Filename - Table filename Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/adisasm.c Fri Jul 28 22:23:29 2017 (r321670) @@ -408,6 +408,8 @@ Cleanup: ACPI_FREE (Table); } + AcDeleteTableList (ListHead); + if (File) { fclose (File); @@ -748,6 +750,7 @@ AdDoExternalFileList ( continue; } + AcDeleteTableList (ExternalListHead); return (Status); } @@ -761,6 +764,7 @@ AdDoExternalFileList ( { AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", AcpiFormatException (Status)); + AcDeleteTableList (ExternalListHead); return (Status); } @@ -779,6 +783,8 @@ AdDoExternalFileList ( ExternalFileList = ExternalFileList->Next; } + + AcDeleteTableList (ExternalListHead); if (ACPI_FAILURE (GlobalStatus)) { Modified: head/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adwalk.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/adwalk.c Fri Jul 28 22:23:29 2017 (r321670) @@ -536,11 +536,20 @@ AcpiDmDumpDescending ( case AML_NAME_OP: case AML_METHOD_OP: case AML_DEVICE_OP: + + AcpiOsPrintf ("%4.4s", + ACPI_CAST_PTR (char, &Op->Named.Name)); + break; + case AML_INT_NAMEDFIELD_OP: - AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name)); + AcpiOsPrintf ("%4.4s Length: (bits) %8.8X%8.8X (bytes) %8.8X%8.8X", + ACPI_CAST_PTR (char, &Op->Named.Name), + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer), + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer / 8)); break; + default: break; @@ -1070,10 +1079,10 @@ AcpiDmCommonDescendingOp ( { ACPI_STATUS Status; + /* Resource descriptor conversion */ Status = AcpiDmProcessResourceDescriptors (Op, Level, Context); - if (ACPI_FAILURE (Status)) { return (Status); @@ -1082,7 +1091,6 @@ AcpiDmCommonDescendingOp ( /* Switch/Case conversion */ Status = AcpiDmProcessSwitch (Op); - return (AE_OK); } @@ -1113,6 +1121,7 @@ AcpiDmProcessResourceDescriptors ( ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status; + WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); @@ -1138,7 +1147,6 @@ AcpiDmProcessResourceDescriptors ( * If so, convert the reference into a symbolic reference. */ AcpiDmCheckResourceReference (Op, WalkState); - return (AE_OK); } Modified: head/sys/contrib/dev/acpica/common/ahpredef.c ============================================================================== --- head/sys/contrib/dev/acpica/common/ahpredef.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/ahpredef.c Fri Jul 28 22:23:29 2017 (r321670) @@ -474,6 +474,15 @@ AcpiAhMatchPredefinedName ( const AH_PREDEFINED_NAME *Info; + /* Nameseg must start with an underscore */ + + if (*Nameseg != '_') + { + return (NULL); + } + + /* Search for a match in the predefined name table */ + for (Info = AslPredefinedInfo; Info->Name; Info++) { if (ACPI_COMPARE_NAME (Nameseg, Info->Name)) Modified: head/sys/contrib/dev/acpica/common/ahtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/ahtable.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/ahtable.c Fri Jul 28 22:23:29 2017 (r321670) @@ -239,6 +239,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, + {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/dmtable.c Fri Jul 28 22:23:29 2017 (r321670) @@ -493,6 +493,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, + {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, Modified: head/sys/contrib/dev/acpica/common/dmtbinfo.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbinfo.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/common/dmtbinfo.c Fri Jul 28 22:23:29 2017 (r321670) @@ -218,6 +218,7 @@ #define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) +#define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f) #define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) @@ -1838,6 +1839,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] = {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Flags), "Flags (decoded below)", 0}, {ACPI_DMT_FLAG0, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "COHACC Override", 0}, {ACPI_DMT_FLAG1, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "HTTU Override", 0}, + {ACPI_DMT_FLAG3, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "Proximity Domain Valid", 0}, {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_IORT4_OFFSET (VatosAddress), "VATOS Address", 0}, {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Model), "Model", 0}, @@ -1845,6 +1847,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] = {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (PriGsiv), "PRI GSIV", 0}, {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (GerrGsiv), "GERR GSIV", 0}, {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (SyncGsiv), "Sync GSIV", 0}, + {ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Pxm), "Proximity Domain", 0}, + {ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_IORT4_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR }; @@ -2763,6 +2768,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = ACPI_DMT_TERMINATOR }; +/******************************************************************************* + * + * SDEI - Software Delegated Execption Interface Descriptor Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] = +{ + ACPI_DMT_TERMINATOR +}; /******************************************************************************* * Modified: head/sys/contrib/dev/acpica/compiler/aslanalyze.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslanalyze.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslanalyze.c Fri Jul 28 22:23:29 2017 (r321670) @@ -435,13 +435,13 @@ AnCheckMethodReturnValue ( /* Examine the parent op of this method */ OwningOp = Node->Op; - if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL) + if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL) { /* Method NEVER returns a value */ AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName); } - else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL) + else if (OwningOp->Asl.CompileFlags & OP_METHOD_SOME_NO_RETVAL) { /* Method SOMETIMES returns a value, SOMETIMES not */ Modified: head/sys/contrib/dev/acpica/compiler/aslbtypes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslbtypes.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslbtypes.c Fri Jul 28 22:23:29 2017 (r321670) @@ -560,7 +560,7 @@ AnGetBtype ( return (ACPI_UINT32_MAX); } - if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED) + if (ReferencedNode->Asl.CompileFlags & OP_METHOD_TYPED) { ThisNodeBtype = ReferencedNode->Asl.AcpiBtype; } Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Fri Jul 28 22:23:29 2017 (r321670) @@ -291,6 +291,8 @@ CgAmlWriteWalk ( /* 19 */ Op->Asl.LogicalLineNumber, /* 20 */ Op->Asl.EndLogicalLine); + TrPrintOpFlags (Op->Asl.CompileFlags, ASL_TREE_OUTPUT); + DbgPrint (ASL_TREE_OUTPUT, "\n"); return (AE_OK); } @@ -438,7 +440,7 @@ CgWriteAmlOpcode ( /* Does this opcode have an associated "PackageLength" field? */ - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) + if (Op->Asl.CompileFlags & OP_AML_PACKAGE) { if (Op->Asl.AmlPkgLenBytes == 1) { Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Fri Jul 28 22:23:29 2017 (r321670) @@ -815,6 +815,7 @@ CmCleanupAndExit ( BOOLEAN DeleteAmlFile = FALSE; + AslCheckExpectedExceptions (); AePrintErrorLog (ASL_FILE_STDERR); if (Gbl_DebugFlag) { Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Fri Jul 28 22:23:29 2017 (r321670) @@ -413,12 +413,20 @@ AslError ( ACPI_PARSE_OBJECT *Op, char *ExtraMessage); +void +AslCheckExpectedExceptions ( + void); + ACPI_STATUS +AslExpectException ( + char *MessageIdString); + +ACPI_STATUS AslDisableException ( char *MessageIdString); BOOLEAN -AslIsExceptionDisabled ( +AslIsExceptionIgnored ( UINT8 Level, UINT16 MessageId); @@ -790,17 +798,6 @@ TrAmlTransformWalkEnd ( /* - * asltree - parse tree support - */ -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context); - -/* * aslexternal - External opcode support */ ACPI_STATUS @@ -826,103 +823,111 @@ ExDoExternal ( #define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) -void -TrSetParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *ParentOp); - +/* + * aslparseop.c - Parse op create/allocate/cache + */ ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode); - -void -TrPrintNodeCompileFlags ( - UINT32 Flags); - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrUpdateNode ( +TrCreateOp ( UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, UINT32 NumChildren, ...); ACPI_PARSE_OBJECT * -TrCreateLeafNode ( +TrCreateLeafOp ( UINT32 ParseOpcode); ACPI_PARSE_OBJECT * -TrCreateNullTarget ( +TrCreateNullTargetOp ( void); ACPI_PARSE_OBJECT * -TrCreateAssignmentNode ( +TrCreateAssignmentOp ( ACPI_PARSE_OBJECT *Target, ACPI_PARSE_OBJECT *Source); ACPI_PARSE_OBJECT * -TrCreateTargetOperand ( +TrCreateTargetOp ( ACPI_PARSE_OBJECT *OriginalOp, ACPI_PARSE_OBJECT *ParentOp); ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( +TrCreateValuedLeafOp ( UINT32 ParseOpcode, UINT64 Value); ACPI_PARSE_OBJECT * -TrCreateConstantLeafNode ( +TrCreateConstantLeafOp ( UINT32 ParseOpcode); ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...); +TrAllocateOp ( + UINT32 ParseOpcode); void -TrSetEndLineNumber ( +TrPrintOpFlags ( + UINT32 Flags, + UINT32 OutputLevel); + + +/* + * asltree.c - Parse tree management + */ +void +TrSetOpParent ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *ParentOp); + +ACPI_PARSE_OBJECT * +TrSetOpIntegerValue ( + UINT32 ParseOpcode, ACPI_PARSE_OBJECT *Op); void -TrSetCurrentFilename ( +TrSetOpEndLineNumber ( ACPI_PARSE_OBJECT *Op); void -TrWalkTree ( - void); +TrSetOpCurrentFilename ( + ACPI_PARSE_OBJECT *Op); ACPI_PARSE_OBJECT * -TrLinkPeerNode ( +TrLinkOpChildren ( + ACPI_PARSE_OBJECT *Op, + UINT32 NumChildren, + ...); + +ACPI_PARSE_OBJECT * +TrLinkPeerOp ( ACPI_PARSE_OBJECT *Op1, ACPI_PARSE_OBJECT *Op2); ACPI_PARSE_OBJECT * -TrLinkChildNode ( +TrLinkChildOp ( ACPI_PARSE_OBJECT *Op1, ACPI_PARSE_OBJECT *Op2); ACPI_PARSE_OBJECT * -TrSetNodeFlags ( +TrSetOpFlags ( ACPI_PARSE_OBJECT *Op, UINT32 Flags); ACPI_PARSE_OBJECT * -TrSetNodeAmlLength ( +TrSetOpAmlLength ( ACPI_PARSE_OBJECT *Op, UINT32 Length); ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( +TrLinkPeerOps ( UINT32 NumPeers, ...); + +ACPI_STATUS +TrWalkParseTree ( + ACPI_PARSE_OBJECT *Op, + UINT32 Visitation, + ASL_WALK_CALLBACK DescendingCallback, + ASL_WALK_CALLBACK AscendingCallback, + void *Context); /* Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.l Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l Fri Jul 28 22:23:29 2017 (r321670) @@ -809,7 +809,7 @@ NamePathTail [.]{NameSeg} "__FILE__" { count (0); return (PARSEOP___FILE__); } "__LINE__" { count (0); return (PARSEOP___LINE__); } "__PATH__" { count (0); return (PARSEOP___PATH__); } - +"__METHOD__" { count (0); return (PARSEOP___METHOD__); } {NameSeg} { char *s; count (0); Modified: head/sys/contrib/dev/acpica/compiler/aslcstyle.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcstyle.y Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslcstyle.y Fri Jul 28 22:23:29 2017 (r321670) @@ -201,59 +201,59 @@ Expression /* Unary operators */ - : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafNode (PARSEOP_LNOT);} - TermArg {$$ = TrLinkChildren ($2,1,$3);} - | PARSEOP_EXP_NOT {$$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg {$$ = TrLinkChildren ($2,2,$3,TrCreateNullTarget ());} + : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafOp (PARSEOP_LNOT);} + TermArg {$$ = TrLinkOpChildren ($2,1,$3);} + | PARSEOP_EXP_NOT {$$ = TrCreateLeafOp (PARSEOP_NOT);} + TermArg {$$ = TrLinkOpChildren ($2,2,$3,TrCreateNullTargetOp ());} - | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} - {$$ = TrLinkChildren ($3,1,$1);} - | SuperName PARSEOP_EXP_DECREMENT {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - {$$ = TrLinkChildren ($3,1,$1);} + | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafOp (PARSEOP_INCREMENT);} + {$$ = TrLinkOpChildren ($3,1,$1);} + | SuperName PARSEOP_EXP_DECREMENT {$$ = TrCreateLeafOp (PARSEOP_DECREMENT);} + {$$ = TrLinkOpChildren ($3,1,$1);} /* Binary operators: math and logical */ - | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), - TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafOp (PARSEOP_ADD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafOp (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkOpChildren ($3,4,$1,$4,TrCreateNullTargetOp (), + TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafOp (PARSEOP_MOD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafOp (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafOp (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} - | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafOp (PARSEOP_AND);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafOp (PARSEOP_OR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafOp (PARSEOP_XOR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} - | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_GREATER_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_LESS {$$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_LESS_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafOp (PARSEOP_LGREATER);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LGREATEREQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS {$$ = TrCreateLeafOp (PARSEOP_LLESS);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LLESSEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_NOT_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_NOT_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LNOTEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_LOGICAL_AND {$$ = TrCreateLeafNode (PARSEOP_LAND);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} - | TermArg PARSEOP_EXP_LOGICAL_OR {$$ = TrCreateLeafNode (PARSEOP_LOR);} - TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_AND {$$ = TrCreateLeafOp (PARSEOP_LAND);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_OR {$$ = TrCreateLeafOp (PARSEOP_LOR);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} /* Parentheses */ @@ -280,8 +280,8 @@ IndexExpTerm : SuperName PARSEOP_EXP_INDEX_LEFT TermArg - PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafNode (PARSEOP_INDEX); - TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} + PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafOp (PARSEOP_INDEX); + TrLinkOpChildren ($$,3,$1,$3,TrCreateNullTargetOp ());} ; @@ -304,7 +304,7 @@ EqualsTerm | SuperName PARSEOP_EXP_EQUALS - TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + TermArg {$$ = TrCreateAssignmentOp ($1, $3);} /* Chained equals: (a=RefOf)=b, a=b=c=d etc. */ @@ -312,47 +312,47 @@ EqualsTerm EqualsTerm PARSEOP_CLOSE_PAREN PARSEOP_EXP_EQUALS - TermArg {$$ = TrCreateAssignmentNode ($2, $5);} + TermArg {$$ = TrCreateAssignmentOp ($2, $5);} /* Compound assignments -- Add (operand, operand, target) */ - | TermArg PARSEOP_EXP_ADD_EQ {$$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_ADD_EQ {$$ = TrCreateLeafOp (PARSEOP_ADD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafOp (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkOpChildren ($3,4,$1,$4,TrCreateNullTargetOp (), + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafOp (PARSEOP_MOD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_MUL_EQ {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_MUL_EQ {$$ = TrCreateLeafOp (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_SHL_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_SHL_EQ {$$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_SHR_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_SHR_EQ {$$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_SUB_EQ {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_SUB_EQ {$$ = TrCreateLeafOp (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_AND_EQ {$$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_AND_EQ {$$ = TrCreateLeafOp (PARSEOP_AND);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_OR_EQ {$$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_OR_EQ {$$ = TrCreateLeafOp (PARSEOP_OR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} - | TermArg PARSEOP_EXP_XOR_EQ {$$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + | TermArg PARSEOP_EXP_XOR_EQ {$$ = TrCreateLeafOp (PARSEOP_XOR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} ; Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Fri Jul 28 22:23:29 2017 (r321670) @@ -290,7 +290,7 @@ #define ASL_PARSE_TREE_DEBUG2 \ " %08X %04X %04X %01X %04X %04X %05X %05X "\ - "%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d\n" + "%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d" /* * Macros for ASL/ASL+ converter Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslerror.c Fri Jul 28 21:47:10 2017 (r321669) +++ head/sys/contrib/dev/acpica/compiler/aslerror.c Fri Jul 28 22:23:29 2017 (r321670) @@ -160,7 +160,17 @@ static void AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +static BOOLEAN +AslIsExceptionExpected ( + UINT8 Level, + UINT16 MessageId); +static BOOLEAN +AslIsExceptionDisabled ( + UINT8 Level, + UINT16 MessageId); + + /******************************************************************************* * * FUNCTION: AslAbort @@ -806,9 +816,118 @@ AslCommonError ( return; } +/******************************************************************************* + * + * FUNCTION: AslIsExceptionIgnored + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * + * RETURN: BOOLEAN + * + * DESCRIPTION: Check if a particular exception is ignored. In this case it + * means that the exception is (expected or disabled. + * + ******************************************************************************/ +BOOLEAN +AslIsExceptionIgnored ( + UINT8 Level, + UINT16 MessageId) +{ + BOOLEAN ExceptionIgnored; + + + /* Note: this allows exception to be disabled and expected */ + + ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId); + ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId); + + return (Gbl_AllExceptionsDisabled || ExceptionIgnored); +} + + /******************************************************************************* * + * FUNCTION: AslCheckExpectException + * + * PARAMETERS: none + * + * RETURN: none + * + * DESCRIPTION: Check the global expected messages table and raise an error + * for each message that has not been received. + * + ******************************************************************************/ + +void +AslCheckExpectedExceptions ( + void) +{ + UINT8 i; + + for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i) + { + if (!Gbl_ExpectedMessages[i].MessageReceived) + { + AslError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED, NULL, + Gbl_ExpectedMessages[i].MessageIdStr); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AslExpectException + * + * PARAMETERS: MessageIdString - ID of excepted exception during compile + * + * RETURN: Status + * + * DESCRIPTION: Enter a message ID into the global expected messages table + * If these messages are not raised during the compilation, throw + * an error. + * + ******************************************************************************/ + +ACPI_STATUS +AslExpectException ( + char *MessageIdString) +{ + UINT32 MessageId; + + + /* Convert argument to an integer and validate it */ + + MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); + + if (MessageId > 6999) + { + printf ("\"%s\" is not a valid warning/remark/erro ID\n", + MessageIdString); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 28 22:28:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A091DD16A5; Fri, 28 Jul 2017 22:28:46 +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 379BA74C9A; Fri, 28 Jul 2017 22:28:46 +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 v6SMSjXO005974; Fri, 28 Jul 2017 22:28:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SMSjdK005973; Fri, 28 Jul 2017 22:28:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <201707282228.v6SMSjdK005973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jul 2017 22:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321671 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 321671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 22:28:46 -0000 Author: np Date: Fri Jul 28 22:28:45 2017 New Revision: 321671 URL: https://svnweb.freebsd.org/changeset/base/321671 Log: cxgbe/iw_cxgbe: Log the end point's history and flags to the trace buffer just before it's freed. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Jul 28 22:23:29 2017 (r321670) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Jul 28 22:28:45 2017 (r321671) @@ -1002,6 +1002,8 @@ void _c4iw_free_ep(struct kref *kref) __func__, epc)); if (test_bit(QP_REFERENCED, &ep->com.flags)) deref_qp(ep); + CTR4(KTR_IW_CXGBE, "%s: ep %p, history 0x%lx, flags 0x%lx", + __func__, ep, epc->history, epc->flags); kfree(ep); } From owner-svn-src-all@freebsd.org Fri Jul 28 23:48:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9253DAAEC8; Fri, 28 Jul 2017 23:48:52 +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 9618676F99; Fri, 28 Jul 2017 23:48:52 +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 v6SNmpXs038576; Fri, 28 Jul 2017 23:48:51 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SNmpEO038572; Fri, 28 Jul 2017 23:48:51 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707282348.v6SNmpEO038572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Jul 2017 23:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321672 - in vendor/libarchive/dist: . build libarchive X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in vendor/libarchive/dist: . build libarchive X-SVN-Commit-Revision: 321672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 23:48:52 -0000 Author: mm Date: Fri Jul 28 23:48:51 2017 New Revision: 321672 URL: https://svnweb.freebsd.org/changeset/base/321672 Log: Update vendor/libarchive to git 347ac2b6adfd4bca7418d30d7278d5343fc6e25e libarchive 3.3.3dev Modified: vendor/libarchive/dist/build/version vendor/libarchive/dist/configure.ac vendor/libarchive/dist/libarchive/archive.h vendor/libarchive/dist/libarchive/archive_entry.h Modified: vendor/libarchive/dist/build/version ============================================================================== --- vendor/libarchive/dist/build/version Fri Jul 28 22:28:45 2017 (r321671) +++ vendor/libarchive/dist/build/version Fri Jul 28 23:48:51 2017 (r321672) @@ -1 +1 @@ -3003002 +3003003dev Modified: vendor/libarchive/dist/configure.ac ============================================================================== --- vendor/libarchive/dist/configure.ac Fri Jul 28 22:28:45 2017 (r321671) +++ vendor/libarchive/dist/configure.ac Fri Jul 28 23:48:51 2017 (r321672) @@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.3.2]) -m4_define([LIBARCHIVE_VERSION_N],[3003002]) +m4_define([LIBARCHIVE_VERSION_S],[3.3.3dev]) +m4_define([LIBARCHIVE_VERSION_N],[3003003]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) Modified: vendor/libarchive/dist/libarchive/archive.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive.h Fri Jul 28 22:28:45 2017 (r321671) +++ vendor/libarchive/dist/libarchive/archive.h Fri Jul 28 23:48:51 2017 (r321672) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3003002 +#define ARCHIVE_VERSION_NUMBER 3003003 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.3.2" +#define ARCHIVE_VERSION_ONLY_STRING "3.3.3dev" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: vendor/libarchive/dist/libarchive/archive_entry.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_entry.h Fri Jul 28 22:28:45 2017 (r321671) +++ vendor/libarchive/dist/libarchive/archive_entry.h Fri Jul 28 23:48:51 2017 (r321672) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3003002 +#define ARCHIVE_VERSION_NUMBER 3003003 /* * Note: archive_entry.h is for use outside of libarchive; the From owner-svn-src-all@freebsd.org Fri Jul 28 23:51:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F5F9DAAF93; Fri, 28 Jul 2017 23:51:09 +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 5E52B7713B; Fri, 28 Jul 2017 23:51:09 +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 v6SNp8MN040826; Fri, 28 Jul 2017 23:51:08 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SNp8o8040824; Fri, 28 Jul 2017 23:51:08 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707282351.v6SNp8o8040824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Jul 2017 23:51:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321673 - vendor/libarchive/dist/libarchive X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: vendor/libarchive/dist/libarchive X-SVN-Commit-Revision: 321673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 23:51:09 -0000 Author: mm Date: Fri Jul 28 23:51:08 2017 New Revision: 321673 URL: https://svnweb.freebsd.org/changeset/base/321673 Log: Update vendor/libarchive to git de20494ba2a4fcff8b56010faa75467ad8d5a40b Relevant vendor changes: PR #926: ensure ar strtab is null terminated Modified: vendor/libarchive/dist/libarchive/archive_cryptor_private.h vendor/libarchive/dist/libarchive/archive_write_set_format_ar.c Modified: vendor/libarchive/dist/libarchive/archive_cryptor_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_cryptor_private.h Fri Jul 28 23:48:51 2017 (r321672) +++ vendor/libarchive/dist/libarchive/archive_cryptor_private.h Fri Jul 28 23:51:08 2017 (r321673) @@ -64,7 +64,7 @@ typedef struct { } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) -#include +#include /* Common in other bcrypt implementations, but missing from VS2008. */ #ifndef BCRYPT_SUCCESS Modified: vendor/libarchive/dist/libarchive/archive_write_set_format_ar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:48:51 2017 (r321672) +++ vendor/libarchive/dist/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:51:08 2017 (r321673) @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s); + ar->strtab = (char *)malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); return (ARCHIVE_FATAL); } - strncpy(ar->strtab, buff, s); + memcpy(ar->strtab, buff, s); + ar->strtab[s] = '\0'; ar->has_strtab = 1; } From owner-svn-src-all@freebsd.org Fri Jul 28 23:56:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2106FDAB2A2; Fri, 28 Jul 2017 23:56:09 +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 E24DB775B9; Fri, 28 Jul 2017 23:56:08 +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 v6SNu8rB042704; Fri, 28 Jul 2017 23:56:08 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6SNu89R042702; Fri, 28 Jul 2017 23:56:08 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707282356.v6SNu89R042702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Jul 2017 23:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321674 - head/contrib/libarchive/libarchive X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: head/contrib/libarchive/libarchive X-SVN-Commit-Revision: 321674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2017 23:56:09 -0000 Author: mm Date: Fri Jul 28 23:56:07 2017 New Revision: 321674 URL: https://svnweb.freebsd.org/changeset/base/321674 Log: MFV r321673: Sync libarchive with vendor. Relevant vendor changes: PR #926: ensure ar strtab is null terminated MFC after: 1 week Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Jul 28 23:51:08 2017 (r321673) +++ head/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Jul 28 23:56:07 2017 (r321674) @@ -64,7 +64,7 @@ typedef struct { } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) -#include +#include /* Common in other bcrypt implementations, but missing from VS2008. */ #ifndef BCRYPT_SUCCESS Modified: head/contrib/libarchive/libarchive/archive_write_set_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:51:08 2017 (r321673) +++ head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:56:07 2017 (r321674) @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s); + ar->strtab = (char *)malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); return (ARCHIVE_FATAL); } - strncpy(ar->strtab, buff, s); + memcpy(ar->strtab, buff, s); + ar->strtab[s] = '\0'; ar->has_strtab = 1; } From owner-svn-src-all@freebsd.org Sat Jul 29 02:25:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07DBFDB0D60; Sat, 29 Jul 2017 02:25:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9E7D7FE3B; Sat, 29 Jul 2017 02:25:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6T2Pne6002862; Sat, 29 Jul 2017 02:25:49 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T2Pnon002861; Sat, 29 Jul 2017 02:25:49 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707290225.v6T2Pnon002861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 29 Jul 2017 02:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321675 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 321675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 02:25:51 -0000 Author: rmacklem Date: Sat Jul 29 02:25:49 2017 New Revision: 321675 URL: https://svnweb.freebsd.org/changeset/base/321675 Log: Fix possible crash for the NFSv4.1 pNFS client. If the nfsrpc_createlayoutrpc() call in nfsrpc_getcreatelayout() fails, the code used nfhpp when it might be set NULL. This patch checks for the error cases (laystat != 0) and avoids using nfhpp for the failure case. This would only affect NFSv4.1 mounts with the "pnfs" option. Found while testing the "umount -N" patch not yet in head. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Fri Jul 28 23:56:07 2017 (r321674) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 29 02:25:49 2017 (r321675) @@ -6643,9 +6643,14 @@ nfsrpc_getcreatelayout(vnode_t dvp, char *name, int na NFSCL_DEBUG(4, "aft nfsrpc_createlayoutrpc laystat=%d err=%d\n", laystat, error); lyp = NULL; - nfhp = *nfhpp; - laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, nfhp->nfh_len, - &stateid, retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); + if (laystat == 0) { + nfhp = *nfhpp; + laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, + nfhp->nfh_len, &stateid, retonclose, NULL, &lyp, &flh, + laystat, NULL, cred, p); + } else + laystat = nfsrpc_layoutgetres(nmp, dvp, NULL, 0, &stateid, + retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); if (laystat == 0) nfscl_rellayout(lyp, 0); return (error); From owner-svn-src-all@freebsd.org Sat Jul 29 07:59:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E13CDBD761; Sat, 29 Jul 2017 07:59:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F1193DA6; Sat, 29 Jul 2017 07:59: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 v6T7xSZ7037462; Sat, 29 Jul 2017 07:59:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T7xSNQ037461; Sat, 29 Jul 2017 07:59:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707290759.v6T7xSNQ037461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 29 Jul 2017 07:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321676 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 321676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 07:59:29 -0000 Author: kib Date: Sat Jul 29 07:59:28 2017 New Revision: 321676 URL: https://svnweb.freebsd.org/changeset/base/321676 Log: MFC r321371: Do not allocate struct kinfo_vmobject on stack. Modified: stable/11/sys/vm/vm_object.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Sat Jul 29 02:25:49 2017 (r321675) +++ stable/11/sys/vm/vm_object.c Sat Jul 29 07:59:28 2017 (r321676) @@ -2282,7 +2282,7 @@ vm_object_vnode(vm_object_t object) static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { - struct kinfo_vmobject kvo; + struct kinfo_vmobject *kvo; char *fullpath, *freepath; struct vnode *vp; struct vattr va; @@ -2307,6 +2307,7 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) count * 11 / 10)); } + kvo = malloc(sizeof(*kvo), M_TEMP, M_WAITOK); error = 0; /* @@ -2324,13 +2325,13 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) continue; } mtx_unlock(&vm_object_list_mtx); - kvo.kvo_size = ptoa(obj->size); - kvo.kvo_resident = obj->resident_page_count; - kvo.kvo_ref_count = obj->ref_count; - kvo.kvo_shadow_count = obj->shadow_count; - kvo.kvo_memattr = obj->memattr; - kvo.kvo_active = 0; - kvo.kvo_inactive = 0; + kvo->kvo_size = ptoa(obj->size); + kvo->kvo_resident = obj->resident_page_count; + kvo->kvo_ref_count = obj->ref_count; + kvo->kvo_shadow_count = obj->shadow_count; + kvo->kvo_memattr = obj->memattr; + kvo->kvo_active = 0; + kvo->kvo_inactive = 0; TAILQ_FOREACH(m, &obj->memq, listq) { /* * A page may belong to the object but be @@ -2342,45 +2343,45 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) * approximation of the system anyway. */ if (vm_page_active(m)) - kvo.kvo_active++; + kvo->kvo_active++; else if (vm_page_inactive(m)) - kvo.kvo_inactive++; + kvo->kvo_inactive++; } - kvo.kvo_vn_fileid = 0; - kvo.kvo_vn_fsid = 0; + kvo->kvo_vn_fileid = 0; + kvo->kvo_vn_fsid = 0; freepath = NULL; fullpath = ""; vp = NULL; switch (obj->type) { case OBJT_DEFAULT: - kvo.kvo_type = KVME_TYPE_DEFAULT; + kvo->kvo_type = KVME_TYPE_DEFAULT; break; case OBJT_VNODE: - kvo.kvo_type = KVME_TYPE_VNODE; + kvo->kvo_type = KVME_TYPE_VNODE; vp = obj->handle; vref(vp); break; case OBJT_SWAP: - kvo.kvo_type = KVME_TYPE_SWAP; + kvo->kvo_type = KVME_TYPE_SWAP; break; case OBJT_DEVICE: - kvo.kvo_type = KVME_TYPE_DEVICE; + kvo->kvo_type = KVME_TYPE_DEVICE; break; case OBJT_PHYS: - kvo.kvo_type = KVME_TYPE_PHYS; + kvo->kvo_type = KVME_TYPE_PHYS; break; case OBJT_DEAD: - kvo.kvo_type = KVME_TYPE_DEAD; + kvo->kvo_type = KVME_TYPE_DEAD; break; case OBJT_SG: - kvo.kvo_type = KVME_TYPE_SG; + kvo->kvo_type = KVME_TYPE_SG; break; case OBJT_MGTDEVICE: - kvo.kvo_type = KVME_TYPE_MGTDEVICE; + kvo->kvo_type = KVME_TYPE_MGTDEVICE; break; default: - kvo.kvo_type = KVME_TYPE_UNKNOWN; + kvo->kvo_type = KVME_TYPE_UNKNOWN; break; } VM_OBJECT_RUNLOCK(obj); @@ -2388,27 +2389,28 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) vn_fullpath(curthread, vp, &fullpath, &freepath); vn_lock(vp, LK_SHARED | LK_RETRY); if (VOP_GETATTR(vp, &va, curthread->td_ucred) == 0) { - kvo.kvo_vn_fileid = va.va_fileid; - kvo.kvo_vn_fsid = va.va_fsid; + kvo->kvo_vn_fileid = va.va_fileid; + kvo->kvo_vn_fsid = va.va_fsid; } vput(vp); } - strlcpy(kvo.kvo_path, fullpath, sizeof(kvo.kvo_path)); + strlcpy(kvo->kvo_path, fullpath, sizeof(kvo->kvo_path)); if (freepath != NULL) free(freepath, M_TEMP); /* Pack record size down */ - kvo.kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path) + - strlen(kvo.kvo_path) + 1; - kvo.kvo_structsize = roundup(kvo.kvo_structsize, + kvo->kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path) + + strlen(kvo->kvo_path) + 1; + kvo->kvo_structsize = roundup(kvo->kvo_structsize, sizeof(uint64_t)); - error = SYSCTL_OUT(req, &kvo, kvo.kvo_structsize); + error = SYSCTL_OUT(req, kvo, kvo->kvo_structsize); mtx_lock(&vm_object_list_mtx); if (error) break; } mtx_unlock(&vm_object_list_mtx); + free(kvo, M_TEMP); return (error); } SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | From owner-svn-src-all@freebsd.org Sat Jul 29 08:24:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2A47DBDE7A; Sat, 29 Jul 2017 08:24:52 +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 7DDFE639FB; Sat, 29 Jul 2017 08:24:52 +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 v6T8Op0q049350; Sat, 29 Jul 2017 08:24:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T8Op79049349; Sat, 29 Jul 2017 08:24:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707290824.v6T8Op79049349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 29 Jul 2017 08:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321677 - stable/10/sys/vm X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/vm X-SVN-Commit-Revision: 321677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 08:24:52 -0000 Author: kib Date: Sat Jul 29 08:24:51 2017 New Revision: 321677 URL: https://svnweb.freebsd.org/changeset/base/321677 Log: MFC r321371: Do not allocate struct kinfo_vmobject on stack. Modified: stable/10/sys/vm/vm_object.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Sat Jul 29 07:59:28 2017 (r321676) +++ stable/10/sys/vm/vm_object.c Sat Jul 29 08:24:51 2017 (r321677) @@ -2279,7 +2279,7 @@ vm_object_vnode(vm_object_t object) static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { - struct kinfo_vmobject kvo; + struct kinfo_vmobject *kvo; char *fullpath, *freepath; struct vnode *vp; struct vattr va; @@ -2304,6 +2304,7 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) count * 11 / 10)); } + kvo = malloc(sizeof(*kvo), M_TEMP, M_WAITOK); error = 0; /* @@ -2321,13 +2322,13 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) continue; } mtx_unlock(&vm_object_list_mtx); - kvo.kvo_size = ptoa(obj->size); - kvo.kvo_resident = obj->resident_page_count; - kvo.kvo_ref_count = obj->ref_count; - kvo.kvo_shadow_count = obj->shadow_count; - kvo.kvo_memattr = obj->memattr; - kvo.kvo_active = 0; - kvo.kvo_inactive = 0; + kvo->kvo_size = ptoa(obj->size); + kvo->kvo_resident = obj->resident_page_count; + kvo->kvo_ref_count = obj->ref_count; + kvo->kvo_shadow_count = obj->shadow_count; + kvo->kvo_memattr = obj->memattr; + kvo->kvo_active = 0; + kvo->kvo_inactive = 0; TAILQ_FOREACH(m, &obj->memq, listq) { /* * A page may belong to the object but be @@ -2339,45 +2340,45 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) * approximation of the system anyway. */ if (m->queue == PQ_ACTIVE) - kvo.kvo_active++; + kvo->kvo_active++; else if (m->queue == PQ_INACTIVE) - kvo.kvo_inactive++; + kvo->kvo_inactive++; } - kvo.kvo_vn_fileid = 0; - kvo.kvo_vn_fsid = 0; + kvo->kvo_vn_fileid = 0; + kvo->kvo_vn_fsid = 0; freepath = NULL; fullpath = ""; vp = NULL; switch (obj->type) { case OBJT_DEFAULT: - kvo.kvo_type = KVME_TYPE_DEFAULT; + kvo->kvo_type = KVME_TYPE_DEFAULT; break; case OBJT_VNODE: - kvo.kvo_type = KVME_TYPE_VNODE; + kvo->kvo_type = KVME_TYPE_VNODE; vp = obj->handle; vref(vp); break; case OBJT_SWAP: - kvo.kvo_type = KVME_TYPE_SWAP; + kvo->kvo_type = KVME_TYPE_SWAP; break; case OBJT_DEVICE: - kvo.kvo_type = KVME_TYPE_DEVICE; + kvo->kvo_type = KVME_TYPE_DEVICE; break; case OBJT_PHYS: - kvo.kvo_type = KVME_TYPE_PHYS; + kvo->kvo_type = KVME_TYPE_PHYS; break; case OBJT_DEAD: - kvo.kvo_type = KVME_TYPE_DEAD; + kvo->kvo_type = KVME_TYPE_DEAD; break; case OBJT_SG: - kvo.kvo_type = KVME_TYPE_SG; + kvo->kvo_type = KVME_TYPE_SG; break; case OBJT_MGTDEVICE: - kvo.kvo_type = KVME_TYPE_MGTDEVICE; + kvo->kvo_type = KVME_TYPE_MGTDEVICE; break; default: - kvo.kvo_type = KVME_TYPE_UNKNOWN; + kvo->kvo_type = KVME_TYPE_UNKNOWN; break; } VM_OBJECT_RUNLOCK(obj); @@ -2385,27 +2386,28 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) vn_fullpath(curthread, vp, &fullpath, &freepath); vn_lock(vp, LK_SHARED | LK_RETRY); if (VOP_GETATTR(vp, &va, curthread->td_ucred) == 0) { - kvo.kvo_vn_fileid = va.va_fileid; - kvo.kvo_vn_fsid = va.va_fsid; + kvo->kvo_vn_fileid = va.va_fileid; + kvo->kvo_vn_fsid = va.va_fsid; } vput(vp); } - strlcpy(kvo.kvo_path, fullpath, sizeof(kvo.kvo_path)); + strlcpy(kvo->kvo_path, fullpath, sizeof(kvo->kvo_path)); if (freepath != NULL) free(freepath, M_TEMP); /* Pack record size down */ - kvo.kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path) + - strlen(kvo.kvo_path) + 1; - kvo.kvo_structsize = roundup(kvo.kvo_structsize, + kvo->kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path) + + strlen(kvo->kvo_path) + 1; + kvo->kvo_structsize = roundup(kvo->kvo_structsize, sizeof(uint64_t)); - error = SYSCTL_OUT(req, &kvo, kvo.kvo_structsize); + error = SYSCTL_OUT(req, kvo, kvo->kvo_structsize); mtx_lock(&vm_object_list_mtx); if (error) break; } mtx_unlock(&vm_object_list_mtx); + free(kvo, M_TEMP); return (error); } SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | From owner-svn-src-all@freebsd.org Sat Jul 29 08:35:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74AAADBE135; Sat, 29 Jul 2017 08:35:08 +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 4E50963E8B; Sat, 29 Jul 2017 08:35:08 +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 v6T8Z7Ui053378; Sat, 29 Jul 2017 08:35:07 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T8Z7s2053377; Sat, 29 Jul 2017 08:35:07 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201707290835.v6T8Z7s2053377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 29 Jul 2017 08:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321678 - head/usr.sbin/prometheus_sysctl_exporter X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/usr.sbin/prometheus_sysctl_exporter X-SVN-Commit-Revision: 321678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 08:35:08 -0000 Author: ed Date: Sat Jul 29 08:35:07 2017 New Revision: 321678 URL: https://svnweb.freebsd.org/changeset/base/321678 Log: Be a bit more liberal about sysctl naming. On the systems on which I tested this exporter, I never ran into metrics that were named in such a way that they couldn't be exported to Prometheus metrics directly. Now it turns out that on systems with NUMA, the sysctl tree contains metrics named dev.${driver}.${index}.%domain. For these metrics, the % in the name is problematic, as Prometheus doesn't allow this symbol to be used. Remove the assertions that were originally put in place to prevent the exporter from generating malformed output and add code to deal with it accordingly. For metric names, convert any unsupported character to an underscore. For label values, perform string escaping. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221035 Reported by: lifanov@ Modified: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c Modified: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c ============================================================================== --- head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c Sat Jul 29 08:24:51 2017 (r321677) +++ head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c Sat Jul 29 08:35:07 2017 (r321678) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Nuxi, https://nuxi.nl/ + * Copyright (c) 2016-2017 Nuxi, https://nuxi.nl/ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -384,11 +385,12 @@ oidname_print(const struct oidname *on, const struct o label = on->labels; for (i = 0; i < on->oid.len; ++i) { if (*label == '\0') { - assert(name[strspn(name, - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_")] == '\0'); - fprintf(fp, "_%s", name); + fputc('_', fp); + while (*name != '\0') { + /* Map unsupported characters to underscores. */ + fputc(isalnum(*name) ? *name : '_', fp); + ++name; + } } name += strlen(name) + 1; label += strlen(label) + 1; @@ -404,15 +406,18 @@ oidname_print(const struct oidname *on, const struct o separator = '{'; for (i = 0; i < on->oid.len; ++i) { if (*label != '\0') { - assert(name[strspn(name, - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_-")] == '\0'); assert(label[strspn(label, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789_")] == '\0'); - fprintf(fp, "%c%s=\"%s\"", separator, label, name); + fprintf(fp, "%c%s=\"", separator, label); + while (*name != '\0') { + /* Escape backslashes and double quotes. */ + if (*name == '\\' || *name == '"') + fputc('\\', fp); + fputc(*name++, fp); + } + fputc('"', fp); separator = ','; } name += strlen(name) + 1; From owner-svn-src-all@freebsd.org Sat Jul 29 09:22:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1505DBF443; Sat, 29 Jul 2017 09:22:49 +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 B0A1D658A8; Sat, 29 Jul 2017 09:22:49 +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 v6T9Mm0j073567; Sat, 29 Jul 2017 09:22:48 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T9Mm2E073566; Sat, 29 Jul 2017 09:22:48 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201707290922.v6T9Mm2E073566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 29 Jul 2017 09:22:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321679 - head/sys/dev/virtio/network X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/dev/virtio/network X-SVN-Commit-Revision: 321679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 09:22:50 -0000 Author: kp Date: Sat Jul 29 09:22:48 2017 New Revision: 321679 URL: https://svnweb.freebsd.org/changeset/base/321679 Log: vtnet: Support jumbo frames without TSO/GSO Currently in Virtio driver without TSO/GSO features enabled, the max scatter gather segments for the TX path can be 4, which limits the support for 9K JUMBO frames. 9K JUMBO frames results in more than 4 scatter gather segments and virtio driver fails to send the frame down to host OS. With TSO/GSO feature enabled max scatter gather segments can be 64, then 9K JUMBO frames are fine, this is making virtio driver to support JUMBO frames only with TSO/GSO. Increasing the VTNET_MIN_TX_SEGS which is the case for non TSO/GSO to 32 to support upto 64K JUMBO frames to Host. Submitted by: Lohith Bellad Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D8803 Modified: head/sys/dev/virtio/network/if_vtnetvar.h Modified: head/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- head/sys/dev/virtio/network/if_vtnetvar.h Sat Jul 29 08:35:07 2017 (r321678) +++ head/sys/dev/virtio/network/if_vtnetvar.h Sat Jul 29 09:22:48 2017 (r321679) @@ -314,7 +314,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE) #define VTNET_MRG_RX_SEGS 1 #define VTNET_MIN_RX_SEGS 2 #define VTNET_MAX_RX_SEGS 34 -#define VTNET_MIN_TX_SEGS 4 +#define VTNET_MIN_TX_SEGS 32 #define VTNET_MAX_TX_SEGS 64 /* From owner-svn-src-all@freebsd.org Sat Jul 29 09:56:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D67DBFF87; Sat, 29 Jul 2017 09:56:09 +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 0087E6666A; Sat, 29 Jul 2017 09:56:08 +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 v6T9u84S086186; Sat, 29 Jul 2017 09:56:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6T9u85G086185; Sat, 29 Jul 2017 09:56:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707290956.v6T9u85G086185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 29 Jul 2017 09:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321680 - stable/11/sys/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/boot/zfs X-SVN-Commit-Revision: 321680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 09:56:09 -0000 Author: mav Date: Sat Jul 29 09:56:07 2017 New Revision: 321680 URL: https://svnweb.freebsd.org/changeset/base/321680 Log: MFC r307865 (by tsoome): loader should boot pre-feature flags pools. The feature flags chek is missing the corner case where we have valid pool version, but feature flags are not enabled - as for example plain v28 pool. This update does fix the boot support for such pools. Differential Revision: https://reviews.freebsd.org/D8331 PR: 221084 Modified: stable/11/sys/boot/zfs/zfsimpl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Sat Jul 29 09:22:48 2017 (r321679) +++ stable/11/sys/boot/zfs/zfsimpl.c Sat Jul 29 09:56:07 2017 (r321680) @@ -2046,8 +2046,13 @@ check_mos_features(const spa_t *spa) if ((rc = objset_get_dnode(spa, &spa->spa_mos, DMU_OT_OBJECT_DIRECTORY, &dir)) != 0) return (rc); - if ((rc = zap_lookup(spa, &dir, DMU_POOL_FEATURES_FOR_READ, &objnum)) != 0) - return (rc); + if ((rc = zap_lookup(spa, &dir, DMU_POOL_FEATURES_FOR_READ, &objnum)) != 0) { + /* + * It is older pool without features. As we have already + * tested the label, just return without raising the error. + */ + return (0); + } if ((rc = objset_get_dnode(spa, &spa->spa_mos, objnum, &dir)) != 0) return (rc); From owner-svn-src-all@freebsd.org Sat Jul 29 10:30:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DFA0DC0CD7; Sat, 29 Jul 2017 10:30:14 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64B8C677A0; Sat, 29 Jul 2017 10:30:14 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TAUDMS098602; Sat, 29 Jul 2017 10:30:13 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TAUDcn098600; Sat, 29 Jul 2017 10:30:13 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707291030.v6TAUDcn098600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Jul 2017 10:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321681 - stable/11/sys/fs/fdescfs X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/fs/fdescfs X-SVN-Commit-Revision: 321681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 10:30:14 -0000 Author: dchagin Date: Sat Jul 29 10:30:13 2017 New Revision: 321681 URL: https://svnweb.freebsd.org/changeset/base/321681 Log: MFC r320814: Style(9). Add blank line aftr {. MFC r320815: Remove init from declaration. MFC r320816: Remove init from declaration, collapse two int vars declarations into single. MFC r320817: Don't take a lock around atomic operation. MFC r320818: Eliminate the bogus cast. MFC r320819: Eliminate the bogus cast. MFC r320820: Don't initialize error in declaration. Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vfsops.c Sat Jul 29 09:56:07 2017 (r321680) +++ stable/11/sys/fs/fdescfs/fdesc_vfsops.c Sat Jul 29 10:30:13 2017 (r321681) @@ -68,6 +68,7 @@ static vfs_root_t fdesc_root; int fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags) { + return kernel_mount(ma, flags); } @@ -77,10 +78,10 @@ fdesc_cmount(struct mntarg *ma, void *data, uint64_t f static int fdesc_mount(struct mount *mp) { - int error = 0; struct fdescmount *fmp; struct thread *td = curthread; struct vnode *rvp; + int error; if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_FDESCFS)) return (EPERM); @@ -98,7 +99,7 @@ fdesc_mount(struct mount *mp) * We need to initialize a few bits of our local mount point struct to * avoid confusion in allocvp. */ - mp->mnt_data = (qaddr_t) fmp; + mp->mnt_data = fmp; fmp->flags = 0; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { @@ -122,11 +123,10 @@ static int fdesc_unmount(struct mount *mp, int mntflags) { struct fdescmount *fmp; - caddr_t data; - int error; - int flags = 0; + int error, flags; - fmp = (struct fdescmount *)mp->mnt_data; + flags = 0; + fmp = mp->mnt_data; if (mntflags & MNT_FORCE) { /* The hash mutex protects the private mount flags. */ mtx_lock(&fdesc_hashmtx); @@ -147,15 +147,10 @@ fdesc_unmount(struct mount *mp, int mntflags) return (error); /* - * Finally, throw away the fdescmount structure. Hold the hashmtx to - * protect the fdescmount structure. + * Finally, throw away the fdescmount structure. */ - mtx_lock(&fdesc_hashmtx); - data = mp->mnt_data; mp->mnt_data = NULL; - mtx_unlock(&fdesc_hashmtx); - free(data, M_FDESCMNT); /* XXX */ - + free(fmp, M_FDESCMNT); return (0); } Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sat Jul 29 09:56:07 2017 (r321680) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sat Jul 29 10:30:13 2017 (r321681) @@ -152,7 +152,7 @@ fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, s struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; struct thread *td; - int error = 0; + int error; td = curthread; fc = FD_NHASH(ix); From owner-svn-src-all@freebsd.org Sat Jul 29 10:31:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DF2DDC0D50; Sat, 29 Jul 2017 10:31:58 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B1DE679A6; Sat, 29 Jul 2017 10:31:58 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TAVvRj002188; Sat, 29 Jul 2017 10:31:57 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TAVvxa002182; Sat, 29 Jul 2017 10:31:57 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707291031.v6TAVvxa002182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Jul 2017 10:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321682 - stable/11/sys/compat/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/compat/linux X-SVN-Commit-Revision: 321682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 10:31:58 -0000 Author: dchagin Date: Sat Jul 29 10:31:57 2017 New Revision: 321682 URL: https://svnweb.freebsd.org/changeset/base/321682 Log: MFC r321366: Style(9) whitespace fix. Modified: stable/11/sys/compat/linux/linux_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.h ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.h Sat Jul 29 10:30:13 2017 (r321681) +++ stable/11/sys/compat/linux/linux_ioctl.h Sat Jul 29 10:31:57 2017 (r321682) @@ -198,7 +198,7 @@ #define LINUX_VT_SETMODE 0x5602 #define LINUX_VT_GETSTATE 0x5603 #define LINUX_VT_RELDISP 0x5605 -#define LINUX_VT_ACTIVATE 0x5606 +#define LINUX_VT_ACTIVATE 0x5606 #define LINUX_VT_WAITACTIVE 0x5607 #define LINUX_IOCTL_CONSOLE_MIN LINUX_KIOCSOUND From owner-svn-src-all@freebsd.org Sat Jul 29 11:27:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 223C1DC1C5D; Sat, 29 Jul 2017 11:27:56 +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 E362768FD5; Sat, 29 Jul 2017 11:27:55 +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 v6TBRtAa022709; Sat, 29 Jul 2017 11:27:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TBRtD7022708; Sat, 29 Jul 2017 11:27:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707291127.v6TBRtD7022708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 29 Jul 2017 11:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321683 - stable/11/sys/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/boot/zfs X-SVN-Commit-Revision: 321683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 11:27:56 -0000 Author: mav Date: Sat Jul 29 11:27:54 2017 New Revision: 321683 URL: https://svnweb.freebsd.org/changeset/base/321683 Log: MFC r314504 (by tsoome): loader: r314112 did introduce dereference freed pointer entry CID: 1371675 Reported by: Coverity Differential Revision: https://reviews.freebsd.org/D9846 Modified: stable/11/sys/boot/zfs/zfsimpl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Sat Jul 29 10:31:57 2017 (r321682) +++ stable/11/sys/boot/zfs/zfsimpl.c Sat Jul 29 11:27:54 2017 (r321683) @@ -2217,7 +2217,7 @@ zfs_lookup(const struct zfsmount *mount, const char *u char path[1024]; int symlinks_followed = 0; struct stat sb; - struct obj_list *entry; + struct obj_list *entry, *tentry; STAILQ_HEAD(, obj_list) on_cache = STAILQ_HEAD_INITIALIZER(on_cache); spa = mount->spa; @@ -2365,7 +2365,7 @@ zfs_lookup(const struct zfsmount *mount, const char *u *dnode = dn; done: - STAILQ_FOREACH(entry, &on_cache, entry) + STAILQ_FOREACH_SAFE(entry, &on_cache, entry, tentry) free(entry); return (rc); } From owner-svn-src-all@freebsd.org Sat Jul 29 12:22:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDF3EDC31E5; Sat, 29 Jul 2017 12:22:30 +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 B67FA6AADD; Sat, 29 Jul 2017 12:22:30 +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 v6TCMTPm046864; Sat, 29 Jul 2017 12:22:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TCMT0T046863; Sat, 29 Jul 2017 12:22:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707291222.v6TCMT0T046863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 12:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321684 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 321684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 12:22:31 -0000 Author: dim Date: Sat Jul 29 12:22:29 2017 New Revision: 321684 URL: https://svnweb.freebsd.org/changeset/base/321684 Log: Don't use libc++ when cross-building for gcc arches Since we imported clang 5.0.0, the version check in Makefile.inc1 which checks whether to use libc++ fires even when the compiler for the target architecture is gcc 4.2.1. This is because only X_COMPILER_VERSION is checked. Also check X_COMPILER_TYPE, so it will only use libc++ when an external gcc toolchain is used. Reviewed by: emaste, rpokala MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D11776 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Jul 29 11:27:54 2017 (r321683) +++ head/Makefile.inc1 Sat Jul 29 12:22:29 2017 (r321684) @@ -624,8 +624,7 @@ XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTM # combined with --sysroot. XCFLAGS+= -B${WORLDTMP}/usr/lib # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif From owner-svn-src-all@freebsd.org Sat Jul 29 13:54:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A5DBDC495B; Sat, 29 Jul 2017 13:54:29 +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 550A46CCDA; Sat, 29 Jul 2017 13:54:29 +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 v6TDsSba083277; Sat, 29 Jul 2017 13:54:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TDsSFp083276; Sat, 29 Jul 2017 13:54:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707291354.v6TDsSFp083276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 29 Jul 2017 13:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321685 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 321685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 13:54:29 -0000 Author: mav Date: Sat Jul 29 13:54:28 2017 New Revision: 321685 URL: https://svnweb.freebsd.org/changeset/base/321685 Log: Fix IORDY bits definition. According to the ATA specs, IORDYDIS should be bit 10, IORDY -- bit 11. PR: 221049 Submitted by: aaron.styx@baesystems.com MFC after: 1 week Modified: head/sys/sys/ata.h Modified: head/sys/sys/ata.h ============================================================================== --- head/sys/sys/ata.h Sat Jul 29 12:22:29 2017 (r321684) +++ head/sys/sys/ata.h Sat Jul 29 13:54:28 2017 (r321685) @@ -68,8 +68,8 @@ struct ata_params { /*049*/ u_int16_t capabilities1; #define ATA_SUPPORT_DMA 0x0100 #define ATA_SUPPORT_LBA 0x0200 -#define ATA_SUPPORT_IORDY 0x0400 -#define ATA_SUPPORT_IORDYDIS 0x0800 +#define ATA_SUPPORT_IORDYDIS 0x0400 +#define ATA_SUPPORT_IORDY 0x0800 #define ATA_SUPPORT_OVERLAP 0x4000 /*050*/ u_int16_t capabilities2; From owner-svn-src-all@freebsd.org Sat Jul 29 15:20:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBCE3DC59BA; Sat, 29 Jul 2017 15:20:08 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 698AB6EB56; Sat, 29 Jul 2017 15:20:08 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (mh0.gentlemail.de [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id v6TFK4Gi055279; Sat, 29 Jul 2017 17:20:04 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 70F53BDE; Sat, 29 Jul 2017 17:20:04 +0200 (CEST) Message-ID: <597CA7A3.4050404@omnilan.de> Date: Sat, 29 Jul 2017 17:20:03 +0200 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Kristof Provost CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320802 - head/etc/rc.d References: <201707080928.v689SV93013507@repo.freebsd.org> In-Reply-To: <201707080928.v689SV93013507@repo.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Sat, 29 Jul 2017 17:20:04 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 15:20:08 -0000 Bezüglich Kristof Provost's Nachricht vom 08.07.2017 11:28 (localtime): > Author: kp > Date: Sat Jul 8 09:28:31 2017 > New Revision: 320802 > URL: https://svnweb.freebsd.org/changeset/base/320802 > > Log: > Allow more services to run in vnet jails > > After some tests, here are the services that run into a vnet jail: > - defaultroute > - dhclient > - ip6addrctl > - natd > - pf > - pfsync > - pflog (deamon runs, pflog0 interface usable, but /var/log/pflog not filled) > - rarpd > - route6d (do nothing anyway because obsolete) > - routed (do nothing anyway because obsolete) > - rtsold > - static_arp > - static_ndp > > PR: 220530 > Submitted by: olivier@freebsd.org Do you (or somebidy else) plan to MFC this, along with r320696? Valuable "extension" IMHO. Thanks, -harry From owner-svn-src-all@freebsd.org Sat Jul 29 15:22:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14013DC5BB2; Sat, 29 Jul 2017 15:22:58 +0000 (UTC) (envelope-from srs0=pmua=7a=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3C3F6EF28; Sat, 29 Jul 2017 15:22:57 +0000 (UTC) (envelope-from srs0=pmua=7a=freebsd.org=kp@codepro.be) Received: from [10.0.2.164] (ptr-8ripyyewexqkewvy3sy.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:2106:f3e4:9b75:26c2]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id C959DBB01; Sat, 29 Jul 2017 17:22:55 +0200 (CEST) From: "Kristof Provost" To: "Harry Schmalzbauer" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320802 - head/etc/rc.d Date: Sat, 29 Jul 2017 17:22:53 +0200 Message-ID: <4C595496-31A5-476A-9D3B-3CD85E9A198D@FreeBSD.org> In-Reply-To: <597CA7A3.4050404@omnilan.de> References: <201707080928.v689SV93013507@repo.freebsd.org> <597CA7A3.4050404@omnilan.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6089) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 15:22:58 -0000 On 29 Jul 2017, at 17:20, Harry Schmalzbauer wrote: > Bezüglich Kristof Provost's Nachricht vom 08.07.2017 11:28 > (localtime): >> Author: kp >> Date: Sat Jul 8 09:28:31 2017 >> New Revision: 320802 >> URL: https://svnweb.freebsd.org/changeset/base/320802 >> >> Log: >> Allow more services to run in vnet jails >> > Do you (or somebidy else) plan to MFC this, along with r320696? > Valuable "extension" IMHO. > I have no plans to, no. I’m not terribly confident that vnet is sufficiently robust in stable/11 to encourage people to use it. There are a number of vnet bugs that are fixed (or being worked on) in CURRENT that still affect stable/11. Regards, Kristof From owner-svn-src-all@freebsd.org Sat Jul 29 15:29:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17B2BDC5CF8; Sat, 29 Jul 2017 15:29:13 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5E036F11B; Sat, 29 Jul 2017 15:29:12 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id v6TFTAxK055394; Sat, 29 Jul 2017 17:29:10 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 8F237BE7; Sat, 29 Jul 2017 17:29:10 +0200 (CEST) Message-ID: <597CA9C6.20204@omnilan.de> Date: Sat, 29 Jul 2017 17:29:10 +0200 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Kristof Provost CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320802 - head/etc/rc.d References: <201707080928.v689SV93013507@repo.freebsd.org> <597CA7A3.4050404@omnilan.de> In-Reply-To: <597CA7A3.4050404@omnilan.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Greylist: ACL 129 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Sat, 29 Jul 2017 17:29:10 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 15:29:13 -0000 Bez=FCglich Harry Schmalzbauer's Nachricht vom 29.07.2017 17:20 (localti= me): > Bez=FCglich Kristof Provost's Nachricht vom 08.07.2017 11:28 (localtim= e): >> Author: kp >> Date: Sat Jul 8 09:28:31 2017 >> New Revision: 320802 >> URL: https://svnweb.freebsd.org/changeset/base/320802 >> >> Log: >> Allow more services to run in vnet jails >> =20 >> After some tests, here are the services that run into a vnet jail: >> - defaultroute >> - dhclient >> - ip6addrctl >> - natd >> - pf >> - pfsync >> - pflog (deamon runs, pflog0 interface usable, but /var/log/pflog = not filled) >> - rarpd >> - route6d (do nothing anyway because obsolete) >> - routed (do nothing anyway because obsolete) >> - rtsold >> - static_arp >> - static_ndp >> =20 >> PR: 220530 >> Submitted by: olivier@freebsd.org > Do you (or somebidy else) plan to MFC this, along with r320696? Forgot to mention r320618 also. > Valuable "extension" IMHO. > > Thanks, > > -harry > From owner-svn-src-all@freebsd.org Sat Jul 29 15:35:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25C89DC5EF6; Sat, 29 Jul 2017 15:35:37 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA84B6F4FC; Sat, 29 Jul 2017 15:35:36 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (mh0.gentlemail.de [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id v6TFZZl4055464; Sat, 29 Jul 2017 17:35:35 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id B98BCBEA; Sat, 29 Jul 2017 17:35:34 +0200 (CEST) Message-ID: <597CAB46.8010509@omnilan.de> Date: Sat, 29 Jul 2017 17:35:34 +0200 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Kristof Provost CC: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r320802 - head/etc/rc.d References: <201707080928.v689SV93013507@repo.freebsd.org> <597CA7A3.4050404@omnilan.de> <4C595496-31A5-476A-9D3B-3CD85E9A198D@FreeBSD.org> In-Reply-To: <4C595496-31A5-476A-9D3B-3CD85E9A198D@FreeBSD.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Sat, 29 Jul 2017 17:35:35 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 15:35:37 -0000 Bezüglich Kristof Provost's Nachricht vom 29.07.2017 17:22 (localtime): > On 29 Jul 2017, at 17:20, Harry Schmalzbauer wrote: >> Bezüglich Kristof Provost's Nachricht vom 08.07.2017 11:28 (localtime): >>> Author: kp >>> Date: Sat Jul 8 09:28:31 2017 >>> New Revision: 320802 >>> URL: https://svnweb.freebsd.org/changeset/base/320802 >>> >>> Log: >>> Allow more services to run in vnet jails >>> >> Do you (or somebidy else) plan to MFC this, along with r320696? >> Valuable "extension" IMHO. >> > I have no plans to, no. > > I’m not terribly confident that vnet is sufficiently robust in stable/11 to > encourage people to use it. There are a number of vnet bugs that are > fixed (or > being worked on) in CURRENT that still affect stable/11. I see, thanks a lot for your quick response. Haven't used vnet (in production) before stable/11, but palnning to do so, so I'm prepared to find some of them in the near future. I'm merging locally and can at least provide testing. Thanks, -harry From owner-svn-src-all@freebsd.org Sat Jul 29 16:06:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E354DC6672 for ; Sat, 29 Jul 2017 16:06:21 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFA3A700AD for ; Sat, 29 Jul 2017 16:06:20 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: d4ce0ec6-7477-11e7-b2f5-7fbc454a3a22 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id d4ce0ec6-7477-11e7-b2f5-7fbc454a3a22; Sat, 29 Jul 2017 16:06:09 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v6TG652g001414; Sat, 29 Jul 2017 10:06:05 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1501344365.90400.99.camel@freebsd.org> Subject: Re: svn commit: r321633 - in head/sys/arm: arm include From: Ian Lepore To: Zbigniew Bodek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 29 Jul 2017 10:06:05 -0600 In-Reply-To: <201707272314.v6RNEHwQ033479@repo.freebsd.org> References: <201707272314.v6RNEHwQ033479@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 16:06:21 -0000 On Thu, 2017-07-27 at 23:14 +0000, Zbigniew Bodek wrote: > Author: zbb > Date: Thu Jul 27 23:14:17 2017 > New Revision: 321633 > URL: https://svnweb.freebsd.org/changeset/base/321633 > > Log: >   Fix TEX index acquisition using L2 attributes >    >   The TEX index is selected using (TEX0 C B) bits >   from the L2 descriptor. Use correct index by masking >   and shifting those bits accordingly. >    >   Differential Revision: https://reviews.freebsd.org/D11703 How did you guys discover this bug, like what were the symptoms?  Should we consider merging this to 11-stable? -- Ian From owner-svn-src-all@freebsd.org Sat Jul 29 17:00:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD82DDC6FBA; Sat, 29 Jul 2017 17:00:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FECD71324; Sat, 29 Jul 2017 17:00:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TH0NZ7056638; Sat, 29 Jul 2017 17:00:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TH0Nx0056634; Sat, 29 Jul 2017 17:00:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707291700.v6TH0Nx0056634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 29 Jul 2017 17:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321686 - in head/sys: arm/arm compat/linuxkpi/common/src dev/ow sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/arm compat/linuxkpi/common/src dev/ow sys X-SVN-Commit-Revision: 321686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 17:00:24 -0000 Author: ian Date: Sat Jul 29 17:00:23 2017 New Revision: 321686 URL: https://svnweb.freebsd.org/changeset/base/321686 Log: Add inline functions to convert between sbintime_t and decimal time units. Use them in some existing code that is vulnerable to roundoff errors. The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into writing code such as long_timeout_ns*SBT_1NS to generate the argument for a sleep call. The actual value of 1ns in sbt units is ~4.3, leading to a large roundoff error giving a shorter sleep than expected when multiplying by the trucated value of 4 in SBT_1NS. (The evil honeypot aspect becomes clear after you waste a whole day figuring out why your sleeps return early.) Modified: head/sys/arm/arm/mpcore_timer.c head/sys/compat/linuxkpi/common/src/linux_hrtimer.c head/sys/dev/ow/owc_gpiobus.c head/sys/sys/time.h Modified: head/sys/arm/arm/mpcore_timer.c ============================================================================== --- head/sys/arm/arm/mpcore_timer.c Sat Jul 29 13:54:28 2017 (r321685) +++ head/sys/arm/arm/mpcore_timer.c Sat Jul 29 17:00:23 2017 (r321686) @@ -351,7 +351,7 @@ attach_et(struct arm_tmr_softc *sc) sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; sc->et.et_quality = 1000; sc->et.et_frequency = sc->clkfreq; - sc->et.et_min_period = 20 * SBT_1NS; + sc->et.et_min_period = nstosbt(20); sc->et.et_max_period = 2 * SBT_1S; sc->et.et_start = arm_tmr_start; sc->et.et_stop = arm_tmr_stop; Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Sat Jul 29 13:54:28 2017 (r321685) +++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Sat Jul 29 17:00:23 2017 (r321686) @@ -101,8 +101,8 @@ linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, { mtx_lock(&hrtimer->mtx); - callout_reset_sbt(&hrtimer->callout, time.tv64 * SBT_1NS, - nsec * SBT_1NS, hrtimer_call_handler, hrtimer, 0); + callout_reset_sbt(&hrtimer->callout, nstosbt(time.tv64), nstosbt(nsec), + hrtimer_call_handler, hrtimer, 0); hrtimer->flags |= HRTIMER_ACTIVE; mtx_unlock(&hrtimer->mtx); } Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Sat Jul 29 13:54:28 2017 (r321685) +++ head/sys/dev/ow/owc_gpiobus.c Sat Jul 29 17:00:23 2017 (r321686) @@ -295,10 +295,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * do { now = sbinuptime(); GETPIN(sc, &sample); - } while ((now - then) / SBT_1US < t->t_rdv + 2 && sample == 0); + } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); critical_exit(); - if ((now - then) / SBT_1NS < t->t_rdv * 1000) + if (sbttons(now - then) < t->t_rdv * 1000) *bit = 1; else *bit = 0; Modified: head/sys/sys/time.h ============================================================================== --- head/sys/sys/time.h Sat Jul 29 13:54:28 2017 (r321685) +++ head/sys/sys/time.h Sat Jul 29 17:00:23 2017 (r321686) @@ -128,7 +128,7 @@ bintime_shift(struct bintime *_bt, int _exp) #define SBT_1M (SBT_1S * 60) #define SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 1000000) -#define SBT_1NS (SBT_1S / 1000000000) +#define SBT_1NS (SBT_1S / 1000000000) /* beware rounding, see nstosbt() */ #define SBT_MAX 0x7fffffffffffffffLL static __inline int @@ -155,6 +155,53 @@ sbttobt(sbintime_t _sbt) return (_bt); } +/* + * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS results in + * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and + * microsecond functions are also provided for completeness. + */ +static __inline int64_t +sbttons(sbintime_t _sbt) +{ + + return ((1000000000 * _sbt) >> 32); +} + +static __inline sbintime_t +nstosbt(int64_t _ns) +{ + + return ((_ns * (((uint64_t)1 << 63) / 500000000) >> 32)); +} + +static __inline int64_t +sbttous(sbintime_t _sbt) +{ + + return ((1000000 * _sbt) >> 32); +} + +static __inline sbintime_t +ustosbt(int64_t _us) +{ + + return ((_us * (((uint64_t)1 << 63) / 500000) >> 32)); +} + +static __inline int64_t +sbttoms(sbintime_t _sbt) +{ + + return ((1000 * _sbt) >> 32); +} + +static __inline sbintime_t +mstosbt(int64_t _ms) +{ + + return ((_ms * (((uint64_t)1 << 63) / 500) >> 32)); +} + /*- * Background information: * @@ -210,7 +257,7 @@ sbttots(sbintime_t _sbt) struct timespec _ts; _ts.tv_sec = _sbt >> 32; - _ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)_sbt) >> 32; + _ts.tv_nsec = sbttons((uint32_t)_sbt); return (_ts); } @@ -218,8 +265,7 @@ static __inline sbintime_t tstosbt(struct timespec _ts) { - return (((sbintime_t)_ts.tv_sec << 32) + - (_ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32)); + return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec)); } static __inline struct timeval @@ -228,7 +274,7 @@ sbttotv(sbintime_t _sbt) struct timeval _tv; _tv.tv_sec = _sbt >> 32; - _tv.tv_usec = ((uint64_t)1000000 * (uint32_t)_sbt) >> 32; + _tv.tv_usec = sbttous((uint32_t)_sbt); return (_tv); } @@ -236,8 +282,7 @@ static __inline sbintime_t tvtosbt(struct timeval _tv) { - return (((sbintime_t)_tv.tv_sec << 32) + - (_tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32)); + return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec)); } #endif /* __BSD_VISIBLE */ From owner-svn-src-all@freebsd.org Sat Jul 29 17:30:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7E69DC7857; Sat, 29 Jul 2017 17:30:26 +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 A4A8B71EE8; Sat, 29 Jul 2017 17:30:26 +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 v6THUPtn068698; Sat, 29 Jul 2017 17:30:25 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6THUP1C068696; Sat, 29 Jul 2017 17:30:25 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201707291730.v6THUP1C068696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 29 Jul 2017 17:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321687 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 321687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 17:30:26 -0000 Author: kp Date: Sat Jul 29 17:30:25 2017 New Revision: 321687 URL: https://svnweb.freebsd.org/changeset/base/321687 Log: MFC r321370 Handle WITH/WITHOUT_PF in libsysdecode Only filter out the PF ioctls if we're building without pf support. Until now those were always filtered out, so truss did not show symbolic names for pf ioctls. Differential Revision: https://reviews.freebsd.org/D11629 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/mkioctls Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Jul 29 17:00:23 2017 (r321686) +++ stable/11/lib/libsysdecode/Makefile Sat Jul 29 17:30:25 2017 (r321687) @@ -121,7 +121,7 @@ tables.h: mktables ioctl.c: .PHONY .endif ioctl.c: mkioctls .META - env MACHINE=${MACHINE} CPP="${CPP}" \ + env MACHINE=${MACHINE} CPP="${CPP}" MK_PF="${MK_PF}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} beforedepend: ioctl.c tables.h Modified: stable/11/lib/libsysdecode/mkioctls ============================================================================== --- stable/11/lib/libsysdecode/mkioctls Sat Jul 29 17:00:23 2017 (r321686) +++ stable/11/lib/libsysdecode/mkioctls Sat Jul 29 17:30:25 2017 (r321687) @@ -17,8 +17,14 @@ LC_ALL=C; export LC_ALL # XXX should we use an ANSI cpp? ioctl_includes=$( cd $includedir + + filter='(.*disk.*)\.h' + if [ "${MK_PF}" == "no" ]; then + filter="(${filter})|((net/pfvar|net/if_pfsync)\.h)" + fi + find -H -s * -name '*.h' | \ - egrep -v '(.*disk.*|net/pfvar|net/if_pfsync)\.h' | \ + egrep -v ${filter} | \ xargs egrep -l \ '^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO[^a-z0-9_]' | awk '{printf("#include <%s>\\n", $1)}' From owner-svn-src-all@freebsd.org Sat Jul 29 19:52:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C7DBDC9F68; Sat, 29 Jul 2017 19:52:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4854576364; Sat, 29 Jul 2017 19:52:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TJqmMY031807; Sat, 29 Jul 2017 19:52:48 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TJqlcE031799; Sat, 29 Jul 2017 19:52:47 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707291952.v6TJqlcE031799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 29 Jul 2017 19:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321688 - in head/sys: fs/nfs fs/nfsclient nfs sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys: fs/nfs fs/nfsclient nfs sys X-SVN-Commit-Revision: 321688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 19:52:49 -0000 Author: rmacklem Date: Sat Jul 29 19:52:47 2017 New Revision: 321688 URL: https://svnweb.freebsd.org/changeset/base/321688 Log: Add kernel support for the NFS client forced dismount "umount -N" option. When an NFS mount is hung against an unresponsive NFS server, the "umount -f" option can be used to dismount the mount. Unfortunately, "umount -f" gets hung as well if a "umount" without "-f" has already been done. Usually, this is because of a vnode lock being held by the "umount" for the mounted-on vnode. This patch adds kernel code so that a new "-N" option can be added to "umount", allowing it to avoid getting hung for this case. It adds two flags. One indicates that a forced dismount is about to happen and the other is used, along with setting mnt_data == NULL, to handshake with the nfs_unmount() VFS call. It includes a slight change to the interface used between the client and common NFS modules, so I bumped __FreeBSD_version to ensure both modules are rebuilt. Tested by: pho Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11735 Modified: head/sys/fs/nfs/nfscl.h head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfsmount.h head/sys/nfs/nfs_nfssvc.c head/sys/nfs/nfssvc.h head/sys/sys/param.h Modified: head/sys/fs/nfs/nfscl.h ============================================================================== --- head/sys/fs/nfs/nfscl.h Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/fs/nfs/nfscl.h Sat Jul 29 19:52:47 2017 (r321688) @@ -60,7 +60,8 @@ struct nfsv4node { #define NFSCL_LEASE(r) ((r) * 2) /* This macro checks to see if a forced dismount is about to occur. */ -#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0) +#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0 || \ + (VFSTONFS(m)->nm_privflag & NFSMNTP_FORCEDISM) != 0) /* * These flag bits are used for the argument to nfscl_fillsattr() to Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/fs/nfsclient/nfs_clport.c Sat Jul 29 19:52:47 2017 (r321688) @@ -1311,6 +1311,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *ua cap_rights_t rights; char *buf; int error; + struct mount *mp; + struct nfsmount *nmp; if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); @@ -1365,6 +1367,56 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *ua dumpmntopts.ndmnt_blen); free(buf, M_TEMP); } + } else if (uap->flag & NFSSVC_FORCEDISM) { + buf = malloc(MNAMELEN + 1, M_TEMP, M_WAITOK); + error = copyinstr(uap->argp, buf, MNAMELEN + 1, NULL); + if (error == 0) { + nmp = NULL; + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + if (strcmp(mp->mnt_stat.f_mntonname, buf) == + 0 && strcmp(mp->mnt_stat.f_fstypename, + "nfs") == 0 && mp->mnt_data != NULL) { + nmp = VFSTONFS(mp); + mtx_lock(&nmp->nm_mtx); + if ((nmp->nm_privflag & + NFSMNTP_FORCEDISM) == 0) { + nmp->nm_privflag |= + (NFSMNTP_FORCEDISM | + NFSMNTP_CANCELRPCS); + mtx_unlock(&nmp->nm_mtx); + } else { + nmp = NULL; + mtx_unlock(&nmp->nm_mtx); + } + break; + } + } + mtx_unlock(&mountlist_mtx); + + if (nmp != NULL) { + /* + * Call newnfs_nmcancelreqs() to cause + * any RPCs in progress on the mount point to + * fail. + * This will cause any process waiting for an + * RPC to complete while holding a vnode lock + * on the mounted-on vnode (such as "df" or + * a non-forced "umount") to fail. + * This will unlock the mounted-on vnode so + * a forced dismount can succeed. + * Then clear NFSMNTP_CANCELRPCS and wakeup(), + * so that nfs_unmount() can complete. + */ + newnfs_nmcancelreqs(nmp); + mtx_lock(&nmp->nm_mtx); + nmp->nm_privflag &= ~NFSMNTP_CANCELRPCS; + wakeup(nmp); + mtx_unlock(&nmp->nm_mtx); + } else + error = EINVAL; + } + free(buf, M_TEMP); } else { error = EINVAL; } Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Sat Jul 29 19:52:47 2017 (r321688) @@ -1698,6 +1698,11 @@ nfs_unmount(struct mount *mp, int mntflags) */ if ((mntflags & MNT_FORCE) == 0) nfscl_umount(nmp, td); + else { + mtx_lock(&nmp->nm_mtx); + nmp->nm_privflag |= NFSMNTP_FORCEDISM; + mtx_unlock(&nmp->nm_mtx); + } /* Make sure no nfsiods are assigned to this mount. */ mtx_lock(&ncl_iod_mutex); for (i = 0; i < NFS_MAXASYNCDAEMON; i++) @@ -1706,6 +1711,19 @@ nfs_unmount(struct mount *mp, int mntflags) ncl_iodmount[i] = NULL; } mtx_unlock(&ncl_iod_mutex); + + /* + * We can now set mnt_data to NULL and wait for + * nfssvc(NFSSVC_FORCEDISM) to complete. + */ + mtx_lock(&mountlist_mtx); + mtx_lock(&nmp->nm_mtx); + mp->mnt_data = NULL; + mtx_unlock(&mountlist_mtx); + while ((nmp->nm_privflag & NFSMNTP_CANCELRPCS) != 0) + msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0); + mtx_unlock(&nmp->nm_mtx); + newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); FREE(nmp->nm_nam, M_SONAME); Modified: head/sys/fs/nfsclient/nfsmount.h ============================================================================== --- head/sys/fs/nfsclient/nfsmount.h Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/fs/nfsclient/nfsmount.h Sat Jul 29 19:52:47 2017 (r321688) @@ -44,6 +44,7 @@ */ struct nfsmount { struct nfsmount_common nm_com; /* Common fields for nlm */ + uint32_t nm_privflag; /* Private flags */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ @@ -98,6 +99,10 @@ struct nfsmount { #define nm_hostname nm_com.nmcom_hostname #define nm_getinfo nm_com.nmcom_getinfo #define nm_vinvalbuf nm_com.nmcom_vinvalbuf + +/* Private flags. */ +#define NFSMNTP_FORCEDISM 0x00000001 +#define NFSMNTP_CANCELRPCS 0x00000002 #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) #define NFSMNT_SRVKRBNAME(m) \ Modified: head/sys/nfs/nfs_nfssvc.c ============================================================================== --- head/sys/nfs/nfs_nfssvc.c Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/nfs/nfs_nfssvc.c Sat Jul 29 19:52:47 2017 (r321688) @@ -92,7 +92,7 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap) nfsd_call_nfsserver != NULL) error = (*nfsd_call_nfsserver)(td, uap); else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | - NFSSVC_DUMPMNTOPTS)) && nfsd_call_nfscl != NULL) + NFSSVC_DUMPMNTOPTS | NFSSVC_FORCEDISM)) && nfsd_call_nfscl != NULL) error = (*nfsd_call_nfscl)(td, uap); else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | Modified: head/sys/nfs/nfssvc.h ============================================================================== --- head/sys/nfs/nfssvc.h Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/nfs/nfssvc.h Sat Jul 29 19:52:47 2017 (r321688) @@ -70,6 +70,7 @@ #define NFSSVC_RESUMENFSD 0x08000000 #define NFSSVC_DUMPMNTOPTS 0x10000000 #define NFSSVC_NEWSTRUCT 0x20000000 +#define NFSSVC_FORCEDISM 0x40000000 /* Argument structure for NFSSVC_DUMPMNTOPTS. */ struct nfscl_dumpmntopts { Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Jul 29 17:30:25 2017 (r321687) +++ head/sys/sys/param.h Sat Jul 29 19:52:47 2017 (r321688) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200039 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200040 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Sat Jul 29 20:08:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29EE1DCA204; Sat, 29 Jul 2017 20:08:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB23B768A4; Sat, 29 Jul 2017 20:08:26 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TK8Q2Z036023; Sat, 29 Jul 2017 20:08:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TK8Pa2036021; Sat, 29 Jul 2017 20:08:25 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707292008.v6TK8Pa2036021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 29 Jul 2017 20:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321689 - head/sbin/umount X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sbin/umount X-SVN-Commit-Revision: 321689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 20:08:27 -0000 Author: rmacklem Date: Sat Jul 29 20:08:25 2017 New Revision: 321689 URL: https://svnweb.freebsd.org/changeset/base/321689 Log: Add a new "-N" option to umount(8), that does a forced dismount of an NFS mount point. The new "-N" option does a forced dismount of an NFS mount point, but avoids doing any checking of the mounted-on path, so that it will not get hung when a vnode lock is held by another hung process on the mounted-on vnode. The most common case of this is a "umount" with the "-f" option. Other than avoiding checking the mounted-on path, it performs the same forced dismount as a successful "umount -f" would do. This commit includes a content change to the man page. Tested by: pho Reviewed by: kib MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11735 Modified: head/sbin/umount/umount.8 head/sbin/umount/umount.c Modified: head/sbin/umount/umount.8 ============================================================================== --- head/sbin/umount/umount.8 Sat Jul 29 19:52:47 2017 (r321688) +++ head/sbin/umount/umount.8 Sat Jul 29 20:08:25 2017 (r321689) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd September 10, 2016 +.Dd July 25, 2017 .Dt UMOUNT 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd unmount file systems .Sh SYNOPSIS .Nm -.Op Fl fnv +.Op Fl fNnv .Ar special ... | node ... | fsid ... .Nm .Fl a | A @@ -81,6 +81,15 @@ The root file system cannot be forcibly unmounted. For NFS, a forced dismount can take up to 1 minute or more to complete against an unresponsive server and may throw away data not yet written to the server for this case. +If a process, such as +.Nm +without the +.Fl f +flag is hung on an +.Tn NFS +mount point, use the +.Fl N +flag instead. Also, doing a forced dismount of an NFSv3 mount when .Xr rpc.lockd 8 is running is unsafe and can result in a crash. @@ -94,6 +103,24 @@ option and, unless otherwise specified with the option, will only unmount .Tn NFS file systems. +.It Fl N +Do a forced dismount of an +.Tn NFS +mount point without checking the mount path. +This option can only be used with the path to the mount point +.Ar node +and the path must be specified exactly as it was at mount time. +This option is useful when a process is hung waiting for an unresponsive +.Tn NFS +server while holding a vnode lock on the mounted-on vnode, such that +.Nm +with the +.Fl f +flag can't complete. +Using this option can result in a loss of file updates that have not been +flushed to the +.Tn NFS +server. .It Fl n Unless the .Fl f Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Sat Jul 29 19:52:47 2017 (r321688) +++ head/sbin/umount/umount.c Sat Jul 29 20:08:25 2017 (r321689) @@ -86,13 +86,13 @@ int xdr_dir (XDR *, char *); int main(int argc, char *argv[]) { - int all, errs, ch, mntsize, error; + int all, errs, ch, mntsize, error, nfsforce, ret; char **typelist = NULL; struct statfs *mntbuf, *sfs; struct addrinfo hints; - all = errs = 0; - while ((ch = getopt(argc, argv, "AaF:fh:nt:v")) != -1) + nfsforce = all = errs = 0; + while ((ch = getopt(argc, argv, "AaF:fh:Nnt:v")) != -1) switch (ch) { case 'A': all = 2; @@ -110,6 +110,9 @@ main(int argc, char *argv[]) all = 2; nfshost = optarg; break; + case 'N': + nfsforce = 1; + break; case 'n': fflag |= MNT_NONBUSY; break; @@ -132,12 +135,15 @@ main(int argc, char *argv[]) err(1, "-f and -n are mutually exclusive"); /* Start disks transferring immediately. */ - if ((fflag & (MNT_FORCE | MNT_NONBUSY)) == 0) + if ((fflag & (MNT_FORCE | MNT_NONBUSY)) == 0 && nfsforce == 0) sync(); if ((argc == 0 && !all) || (argc != 0 && all)) usage(); + if (nfsforce != 0 && (argc == 0 || nfshost != NULL || typelist != NULL)) + usage(); + /* -h implies "-t nfs" if no -t flag. */ if ((nfshost != NULL) && (typelist == NULL)) typelist = makevfslist("nfs"); @@ -175,7 +181,20 @@ main(int argc, char *argv[]) break; case 0: for (errs = 0; *argv != NULL; ++argv) - if (checkname(*argv, typelist) != 0) + if (nfsforce != 0) { + /* + * First do the nfssvc() syscall to shut down + * the mount point and then do the forced + * dismount. + */ + ret = nfssvc(NFSSVC_FORCEDISM, *argv); + if (ret >= 0) + ret = unmount(*argv, MNT_FORCE); + if (ret < 0) { + warn("%s", *argv); + errs = 1; + } + } else if (checkname(*argv, typelist) != 0) errs = 1; break; } @@ -635,7 +654,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", - "usage: umount [-fnv] special ... | node ... | fsid ...", + "usage: umount [-fNnv] special ... | node ... | fsid ...", " umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]"); exit(1); } From owner-svn-src-all@freebsd.org Sat Jul 29 20:11:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 503C0DCA280; Sat, 29 Jul 2017 20:11:47 +0000 (UTC) (envelope-from zbodek@gmail.com) Received: from mail-pg0-x22a.google.com (mail-pg0-x22a.google.com [IPv6:2607:f8b0:400e:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17BCF76AA9; Sat, 29 Jul 2017 20:11:47 +0000 (UTC) (envelope-from zbodek@gmail.com) Received: by mail-pg0-x22a.google.com with SMTP id u185so17723106pgb.1; Sat, 29 Jul 2017 13:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=cLha8ZBeMCZrMf02pYawsOmVk391mp+6z1JubeRmGwc=; b=okMMSjyhcJmKbH3uB6PMNPVCyWQfe9kQwTi57v02Co5InYhiVr0m0PQpUSGWfZJ/P1 mLa/hNLOdmTvlrgekgNeFxrTBsZTlGl2lE8NLrzosbA9V6LDjXT1tJzyjgSLk6REOqWW 3KqO/vcPTW8wLranSrpPPG5sGFxzcJQlFfgCY4+gfZXz+VfnwGr4HbsmlrWabblqEBCV bqKg2DYXF6iwUjvb5GvXmNxB2oEug3metgTjOu4z2kf/w2jikrYZl0QCcUNlwq607YzU w1Snr+Blb3lXJZryiIRQnKmh7h1VNqjxAWmPsf0lWyOqz+ymgCASbwG0LAjkV7y6k1kD SDdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=cLha8ZBeMCZrMf02pYawsOmVk391mp+6z1JubeRmGwc=; b=jmGxDcJWf41SHpKzMJt37r3/bpwlGDBzlX3JJ1PzLzb0QMgzGFNX8RdTm5mkhtqStZ JVD2rz5hsg8cjP+H8s+BS5639y0x8obbN/RSB1McuV8tCKUg54CAiC+5KaQbm4lWc642 yVbn3TJE/OeTtnbww+f+Xr+i35pJFejmv5yMHsTFoUW6ZjbzYCpKVJsFv3PFMvUwRrWc UWx4BAL2kRh6G5xwgaTBrnmlaMqsjUlN4q3f1VV7YYvbTKq6FBsXd9iBpjEzmALmFg/O fjbtsz86FdDxnWBUZuROblPaGAl2fLNujtfavhyqcd+p/Vkke/jogscYJt40uVDrp4VI db8A== X-Gm-Message-State: AIVw112Fy1d8AZlC18MQO0TKgPrm5y3tgyxCy9Yb7UX/vRzPENMeG6Sa 1RXeBa9mZGpmliOuh6ply4xxUcklAyTh7Kw= X-Received: by 10.84.191.165 with SMTP id a34mr11956914pld.243.1501359106532; Sat, 29 Jul 2017 13:11:46 -0700 (PDT) MIME-Version: 1.0 Sender: zbodek@gmail.com Received: by 10.100.157.166 with HTTP; Sat, 29 Jul 2017 13:11:26 -0700 (PDT) In-Reply-To: <1501344365.90400.99.camel@freebsd.org> References: <201707272314.v6RNEHwQ033479@repo.freebsd.org> <1501344365.90400.99.camel@freebsd.org> From: Zbigniew Bodek Date: Sat, 29 Jul 2017 22:11:26 +0200 X-Google-Sender-Auth: vdfSFZD8VJZZ3BbwBKfxaWL74mA Message-ID: Subject: Re: svn commit: r321633 - in head/sys/arm: arm include To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 20:11:47 -0000 2017-07-29 18:06 GMT+02:00 Ian Lepore : > On Thu, 2017-07-27 at 23:14 +0000, Zbigniew Bodek wrote: >> Author: zbb >> Date: Thu Jul 27 23:14:17 2017 >> New Revision: 321633 >> URL: https://svnweb.freebsd.org/changeset/base/321633 >> >> Log: >> Fix TEX index acquisition using L2 attributes >> >> The TEX index is selected using (TEX0 C B) bits >> from the L2 descriptor. Use correct index by masking >> and shifting those bits accordingly. >> >> Differential Revision: https://reviews.freebsd.org/D11703 > > How did you guys discover this bug, like what were the symptoms? Hello Ian, We had bug in usage of pmap_remap_vm_attr() and fixing it didn't help for the issue so the second bug has been found here. > Should we consider merging this to 11-stable? As far as I know nobody besides Armada38x is using this function in HEAD and nobody uses it in 11. You may merge it to 11 though (just for the safety of this code in the future). > > -- Ian From owner-svn-src-all@freebsd.org Sat Jul 29 20:52:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 109CBDCAF6A for ; Sat, 29 Jul 2017 20:52:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9827377CF9 for ; Sat, 29 Jul 2017 20:52:57 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: e2b3602b-749f-11e7-b2f5-7fbc454a3a22 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id e2b3602b-749f-11e7-b2f5-7fbc454a3a22; Sat, 29 Jul 2017 20:52:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v6TKqmsH001795; Sat, 29 Jul 2017 14:52:48 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1501361568.90400.100.camel@freebsd.org> Subject: Re: svn commit: r321633 - in head/sys/arm: arm include From: Ian Lepore To: Zbigniew Bodek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 29 Jul 2017 14:52:48 -0600 In-Reply-To: References: <201707272314.v6RNEHwQ033479@repo.freebsd.org> <1501344365.90400.99.camel@freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 20:52:58 -0000 On Sat, 2017-07-29 at 22:11 +0200, Zbigniew Bodek wrote: > 2017-07-29 18:06 GMT+02:00 Ian Lepore : > > > > On Thu, 2017-07-27 at 23:14 +0000, Zbigniew Bodek wrote: > > > > > > Author: zbb > > > Date: Thu Jul 27 23:14:17 2017 > > > New Revision: 321633 > > > URL: https://svnweb.freebsd.org/changeset/base/321633 > > > > > > Log: > > >   Fix TEX index acquisition using L2 attributes > > > > > >   The TEX index is selected using (TEX0 C B) bits > > >   from the L2 descriptor. Use correct index by masking > > >   and shifting those bits accordingly. > > > > > >   Differential Revision:      https://reviews.freebsd.org/D11703 > > How did you guys discover this bug, like what were the symptoms? > Hello Ian, > > We had bug in usage of  pmap_remap_vm_attr() and fixing it didn't > help > for the issue so the second bug has been found here. > > > > >  Should we consider merging this to 11-stable? > As far as I know nobody besides Armada38x is using this function in > HEAD and nobody uses it in 11. > You may merge it to 11 though (just for the safety of this code in > the future). Cool, thanks.  We just imported 11-stable for use at $work, so I want to start from the most bug-free base we can.  :) -- Ian From owner-svn-src-all@freebsd.org Sat Jul 29 21:25:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 827EEDCB659; Sat, 29 Jul 2017 21:25: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 1C96F7CC29; Sat, 29 Jul 2017 21:25:23 +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 v6TLPMeW068200; Sat, 29 Jul 2017 21:25:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLPIBP068166; Sat, 29 Jul 2017 21:25:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292125.v6TLPIBP068166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321691 - in vendor/llvm/dist: . docs examples/ParallelJIT include/llvm/CodeGen/GlobalISel include/llvm/Support include/llvm/Transforms/Utils lib/CodeGen lib/CodeGen/SelectionDAG lib/Op... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist: . docs examples/ParallelJIT include/llvm/CodeGen/GlobalISel include/llvm/Support include/llvm/Transforms/Utils lib/CodeGen lib/CodeGen/SelectionDAG lib/Option lib/Support lib/Targ... X-SVN-Commit-Revision: 321691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:25:23 -0000 Author: dim Date: Sat Jul 29 21:25:18 2017 New Revision: 321691 URL: https://svnweb.freebsd.org/changeset/base/321691 Log: Vendor import of llvm release_50 branch r309439: https://llvm.org/svn/llvm-project/llvm/branches/release_50@309439 Added: vendor/llvm/dist/test/CodeGen/AMDGPU/spill-empty-live-interval.mir vendor/llvm/dist/test/CodeGen/X86/pr33844.ll vendor/llvm/dist/test/CodeGen/X86/pr33960.ll vendor/llvm/dist/test/MC/Sparc/sparc-tls-relocations.s (contents, props changed) vendor/llvm/dist/test/Transforms/JumpThreading/pr33605.ll vendor/llvm/dist/test/Transforms/JumpThreading/pr33917.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/pr33605.ll Modified: vendor/llvm/dist/CMakeLists.txt vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/examples/ParallelJIT/ParallelJIT.cpp vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelector.h vendor/llvm/dist/include/llvm/Support/CommandLine.h vendor/llvm/dist/include/llvm/Support/TargetRegistry.h vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp vendor/llvm/dist/lib/CodeGen/InlineSpiller.cpp vendor/llvm/dist/lib/CodeGen/RegAllocBase.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp vendor/llvm/dist/lib/Option/OptTable.cpp vendor/llvm/dist/lib/Support/CommandLine.cpp vendor/llvm/dist/lib/Support/ErrorHandling.cpp vendor/llvm/dist/lib/Support/TargetRegistry.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.td vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ14.td vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Transforms/Scalar/JumpThreading.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp vendor/llvm/dist/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll vendor/llvm/dist/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll vendor/llvm/dist/test/CodeGen/AArch64/win64_vararg.ll vendor/llvm/dist/test/CodeGen/X86/memcmp-minsize.ll vendor/llvm/dist/test/CodeGen/X86/memcmp-optsize.ll vendor/llvm/dist/test/CodeGen/X86/memcmp.ll vendor/llvm/dist/test/CodeGen/X86/vector-shift-ashr-256.ll vendor/llvm/dist/test/Transforms/CodeGenPrepare/X86/memcmp.ll vendor/llvm/dist/test/Transforms/JumpThreading/static-profile.ll vendor/llvm/dist/test/Transforms/LoopUnroll/peel-loop.ll vendor/llvm/dist/test/Transforms/LoopUnswitch/2015-06-17-Metadata.ll vendor/llvm/dist/test/Transforms/LoopUnswitch/infinite-loop.ll vendor/llvm/dist/test/Transforms/LoopVectorize/X86/float-induction-x86.ll vendor/llvm/dist/test/Transforms/LoopVectorize/float-induction.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/multiple-phis.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/CMakeLists.txt ============================================================================== --- vendor/llvm/dist/CMakeLists.txt Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/CMakeLists.txt Sat Jul 29 21:25:18 2017 (r321691) @@ -29,7 +29,7 @@ if(NOT DEFINED LLVM_VERSION_PATCH) set(LLVM_VERSION_PATCH 0) endif() if(NOT DEFINED LLVM_VERSION_SUFFIX) - set(LLVM_VERSION_SUFFIX svn) + set(LLVM_VERSION_SUFFIX "") endif() if (POLICY CMP0048) Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Sat Jul 29 21:25:18 2017 (r321691) @@ -71,6 +71,12 @@ Non-comprehensive list of changes in this release Changes to the LLVM IR ---------------------- +* The datalayout string may now indicate an address space to use for + the pointer type of alloca rather than the default of 0. + +* Added speculatable attribute indicating a function which does has no + side-effects which could inhibit hoisting of calls. + Changes to the ARM Backend -------------------------- @@ -91,12 +97,30 @@ Changes to the PowerPC Target Changes to the X86 Target ------------------------- - During this release ... +* Added initial AMD Ryzen (znver1) scheduler support. +* Added support for Intel Goldmont CPUs. + +* Add support for avx512vpopcntdq instructions. + +* Added heuristics to convert CMOV into branches when it may be profitable. + +* More aggressive inlining of memcmp calls. + +* Improve vXi64 shuffles on 32-bit targets. + +* Improved use of PMOVMSKB for any_of/all_of comparision reductions. + +* Improved Silvermont, Sandybridge, and Jaguar (btver2) schedulers. + +* Improved support for AVX512 vector rotations. + +* Added support for AMD Lightweight Profiling (LWP) instructions. + Changes to the AMDGPU Target ----------------------------- - During this release ... +* Initial gfx9 support Changes to the AVR Target ----------------------------- Modified: vendor/llvm/dist/examples/ParallelJIT/ParallelJIT.cpp ============================================================================== --- vendor/llvm/dist/examples/ParallelJIT/ParallelJIT.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/examples/ParallelJIT/ParallelJIT.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -145,6 +145,7 @@ class WaitForThreads (public) waitFor = 0; int result = pthread_cond_init( &condition, nullptr ); + (void)result; assert( result == 0 ); result = pthread_mutex_init( &mutex, nullptr ); Modified: vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelector.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelector.h Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelector.h Sat Jul 29 21:25:18 2017 (r321691) @@ -40,7 +40,8 @@ class TargetRegisterInfo; /// This is convenient because std::bitset does not have a constructor /// with an initializer list of set bits. /// -/// Each InstructionSelector subclass should define a PredicateBitset class with: +/// Each InstructionSelector subclass should define a PredicateBitset class +/// with: /// const unsigned MAX_SUBTARGET_PREDICATES = 192; /// using PredicateBitset = PredicateBitsetImpl; /// and updating the constant to suit the target. Tablegen provides a suitable @@ -102,7 +103,8 @@ enum { /// - OpIdx - Operand index /// - Expected integer GIM_CheckConstantInt, - /// Check the operand is a specific literal integer (i.e. MO.isImm() or MO.isCImm() is true). + /// Check the operand is a specific literal integer (i.e. MO.isImm() or + /// MO.isCImm() is true). /// - InsnID - Instruction ID /// - OpIdx - Operand index /// - Expected integer Modified: vendor/llvm/dist/include/llvm/Support/CommandLine.h ============================================================================== --- vendor/llvm/dist/include/llvm/Support/CommandLine.h Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/include/llvm/Support/CommandLine.h Sat Jul 29 21:25:18 2017 (r321691) @@ -66,15 +66,12 @@ bool ParseCommandLineOptions(int argc, const char *con void ParseEnvironmentOptions(const char *progName, const char *envvar, const char *Overview = ""); -// Function pointer type for printing version information. -using VersionPrinterTy = std::function; - ///===---------------------------------------------------------------------===// /// SetVersionPrinter - Override the default (LLVM specific) version printer /// used to print out the version when --version is given /// on the command line. This allows other systems using the /// CommandLine utilities to print their own version string. -void SetVersionPrinter(VersionPrinterTy func); +void SetVersionPrinter(void (*func)()); ///===---------------------------------------------------------------------===// /// AddExtraVersionPrinter - Add an extra printer to use in addition to the @@ -83,7 +80,7 @@ void SetVersionPrinter(VersionPrinterTy func); /// which will be called after the basic LLVM version /// printing is complete. Each can then add additional /// information specific to the tool. -void AddExtraVersionPrinter(VersionPrinterTy func); +void AddExtraVersionPrinter(void (*func)()); // PrintOptionValues - Print option values. // With -print-options print the difference between option values and defaults. Modified: vendor/llvm/dist/include/llvm/Support/TargetRegistry.h ============================================================================== --- vendor/llvm/dist/include/llvm/Support/TargetRegistry.h Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/include/llvm/Support/TargetRegistry.h Sat Jul 29 21:25:18 2017 (r321691) @@ -599,7 +599,7 @@ struct TargetRegistry { /// printRegisteredTargetsForVersion - Print the registered targets /// appropriately for inclusion in a tool's version output. - static void printRegisteredTargetsForVersion(raw_ostream &OS); + static void printRegisteredTargetsForVersion(); /// @name Registry Access /// @{ Modified: vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h ============================================================================== --- vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h Sat Jul 29 21:25:18 2017 (r321691) @@ -531,8 +531,10 @@ Value *createTargetReduction(IRBuilder<> &B, const Tar /// Get the intersection (logical and) of all of the potential IR flags /// of each scalar operation (VL) that will be converted into a vector (I). +/// If OpValue is non-null, we only consider operations similar to OpValue +/// when intersecting. /// Flag set: NSW, NUW, exact, and all of fast-math. -void propagateIRFlags(Value *I, ArrayRef VL); +void propagateIRFlags(Value *I, ArrayRef VL, Value *OpValue = nullptr); } // end namespace llvm Modified: vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -4016,14 +4016,18 @@ static bool IsOperandAMemoryOperand(CallInst *CI, Inli return true; } +// Max number of memory uses to look at before aborting the search to conserve +// compile time. +static constexpr int MaxMemoryUsesToScan = 20; + /// Recursively walk all the uses of I until we find a memory use. /// If we find an obviously non-foldable instruction, return true. /// Add the ultimately found memory instructions to MemoryUses. static bool FindAllMemoryUses( Instruction *I, SmallVectorImpl> &MemoryUses, - SmallPtrSetImpl &ConsideredInsts, - const TargetLowering &TLI, const TargetRegisterInfo &TRI) { + SmallPtrSetImpl &ConsideredInsts, const TargetLowering &TLI, + const TargetRegisterInfo &TRI, int SeenInsts = 0) { // If we already considered this instruction, we're done. if (!ConsideredInsts.insert(I).second) return false; @@ -4036,8 +4040,12 @@ static bool FindAllMemoryUses( // Loop over all the uses, recursively processing them. for (Use &U : I->uses()) { - Instruction *UserI = cast(U.getUser()); + // Conservatively return true if we're seeing a large number or a deep chain + // of users. This avoids excessive compilation times in pathological cases. + if (SeenInsts++ >= MaxMemoryUsesToScan) + return true; + Instruction *UserI = cast(U.getUser()); if (LoadInst *LI = dyn_cast(UserI)) { MemoryUses.push_back(std::make_pair(LI, U.getOperandNo())); continue; @@ -4082,7 +4090,8 @@ static bool FindAllMemoryUses( continue; } - if (FindAllMemoryUses(UserI, MemoryUses, ConsideredInsts, TLI, TRI)) + if (FindAllMemoryUses(UserI, MemoryUses, ConsideredInsts, TLI, TRI, + SeenInsts)) return true; } Modified: vendor/llvm/dist/lib/CodeGen/InlineSpiller.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/InlineSpiller.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/CodeGen/InlineSpiller.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -643,8 +643,11 @@ void InlineSpiller::reMaterializeAll() { Edit->eraseVirtReg(Reg); continue; } - assert((LIS.hasInterval(Reg) && !LIS.getInterval(Reg).empty()) && - "Reg with empty interval has reference"); + + assert(LIS.hasInterval(Reg) && + (!LIS.getInterval(Reg).empty() || !MRI.reg_nodbg_empty(Reg)) && + "Empty and not used live-range?!"); + RegsToSpill[ResultPos++] = Reg; } RegsToSpill.erase(RegsToSpill.begin() + ResultPos, RegsToSpill.end()); Modified: vendor/llvm/dist/lib/CodeGen/RegAllocBase.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/RegAllocBase.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/CodeGen/RegAllocBase.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -133,18 +133,19 @@ void RegAllocBase::allocatePhysRegs() { if (AvailablePhysReg) Matrix->assign(*VirtReg, AvailablePhysReg); - for (VirtRegVec::iterator I = SplitVRegs.begin(), E = SplitVRegs.end(); - I != E; ++I) { - LiveInterval *SplitVirtReg = &LIS->getInterval(*I); + for (unsigned Reg : SplitVRegs) { + assert(LIS->hasInterval(Reg)); + + LiveInterval *SplitVirtReg = &LIS->getInterval(Reg); assert(!VRM->hasPhys(SplitVirtReg->reg) && "Register already assigned"); if (MRI->reg_nodbg_empty(SplitVirtReg->reg)) { + assert(SplitVirtReg->empty() && "Non-empty but used interval"); DEBUG(dbgs() << "not queueing unused " << *SplitVirtReg << '\n'); aboutToRemoveInterval(*SplitVirtReg); LIS->removeInterval(SplitVirtReg->reg); continue; } DEBUG(dbgs() << "queuing new interval: " << *SplitVirtReg << "\n"); - assert(!SplitVirtReg->empty() && "expecting non-empty interval"); assert(TargetRegisterInfo::isVirtualRegister(SplitVirtReg->reg) && "expect split value in virtual register"); enqueue(SplitVirtReg); Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -2965,7 +2965,12 @@ static inline bool isSETCCorConvertedSETCC(SDValue N) else if (N.getOpcode() == ISD::SIGN_EXTEND) N = N.getOperand(0); - return (N.getOpcode() == ISD::SETCC); + if (isLogicalMaskOp(N.getOpcode())) + return isSETCCorConvertedSETCC(N.getOperand(0)) && + isSETCCorConvertedSETCC(N.getOperand(1)); + + return (N.getOpcode() == ISD::SETCC || + ISD::isBuildVectorOfConstantSDNodes(N.getNode())); } #endif @@ -2973,28 +2978,20 @@ static inline bool isSETCCorConvertedSETCC(SDValue N) // to ToMaskVT if needed with vector extension or truncation. SDValue DAGTypeLegalizer::convertMask(SDValue InMask, EVT MaskVT, EVT ToMaskVT) { - LLVMContext &Ctx = *DAG.getContext(); - // Currently a SETCC or a AND/OR/XOR with two SETCCs are handled. - unsigned InMaskOpc = InMask->getOpcode(); - // FIXME: This code seems to be too restrictive, we might consider // generalizing it or dropping it. - assert((InMaskOpc == ISD::SETCC || - ISD::isBuildVectorOfConstantSDNodes(InMask.getNode()) || - (isLogicalMaskOp(InMaskOpc) && - isSETCCorConvertedSETCC(InMask->getOperand(0)) && - isSETCCorConvertedSETCC(InMask->getOperand(1)))) && - "Unexpected mask argument."); + assert(isSETCCorConvertedSETCC(InMask) && "Unexpected mask argument."); // Make a new Mask node, with a legal result VT. SmallVector Ops; for (unsigned i = 0; i < InMask->getNumOperands(); ++i) Ops.push_back(InMask->getOperand(i)); - SDValue Mask = DAG.getNode(InMaskOpc, SDLoc(InMask), MaskVT, Ops); + SDValue Mask = DAG.getNode(InMask->getOpcode(), SDLoc(InMask), MaskVT, Ops); // If MaskVT has smaller or bigger elements than ToMaskVT, a vector sign // extend or truncate is needed. + LLVMContext &Ctx = *DAG.getContext(); unsigned MaskScalarBits = MaskVT.getScalarSizeInBits(); unsigned ToMaskScalBits = ToMaskVT.getScalarSizeInBits(); if (MaskScalarBits < ToMaskScalBits) { Modified: vendor/llvm/dist/lib/Option/OptTable.cpp ============================================================================== --- vendor/llvm/dist/lib/Option/OptTable.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Option/OptTable.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -235,7 +235,9 @@ OptTable::findByPrefix(StringRef Cur, unsigned short D continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) + S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Modified: vendor/llvm/dist/lib/Support/CommandLine.cpp ============================================================================== --- vendor/llvm/dist/lib/Support/CommandLine.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Support/CommandLine.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -2039,9 +2039,9 @@ void CommandLineParser::printOptionValues() { Opts[i].second->printOptionValue(MaxArgLen, PrintAllOptions); } -static VersionPrinterTy OverrideVersionPrinter = nullptr; +static void (*OverrideVersionPrinter)() = nullptr; -static std::vector *ExtraVersionPrinters = nullptr; +static std::vector *ExtraVersionPrinters = nullptr; namespace { class VersionPrinter { @@ -2081,7 +2081,7 @@ class VersionPrinter { (public) return; if (OverrideVersionPrinter != nullptr) { - OverrideVersionPrinter(outs()); + (*OverrideVersionPrinter)(); exit(0); } print(); @@ -2090,8 +2090,10 @@ class VersionPrinter { (public) // information. if (ExtraVersionPrinters != nullptr) { outs() << '\n'; - for (auto I : *ExtraVersionPrinters) - I(outs()); + for (std::vector::iterator I = ExtraVersionPrinters->begin(), + E = ExtraVersionPrinters->end(); + I != E; ++I) + (*I)(); } exit(0); @@ -2129,11 +2131,11 @@ void cl::PrintHelpMessage(bool Hidden, bool Categorize /// Utility function for printing version number. void cl::PrintVersionMessage() { VersionPrinterInstance.print(); } -void cl::SetVersionPrinter(VersionPrinterTy func) { OverrideVersionPrinter = func; } +void cl::SetVersionPrinter(void (*func)()) { OverrideVersionPrinter = func; } -void cl::AddExtraVersionPrinter(VersionPrinterTy func) { +void cl::AddExtraVersionPrinter(void (*func)()) { if (!ExtraVersionPrinters) - ExtraVersionPrinters = new std::vector; + ExtraVersionPrinters = new std::vector; ExtraVersionPrinters->push_back(func); } Modified: vendor/llvm/dist/lib/Support/ErrorHandling.cpp ============================================================================== --- vendor/llvm/dist/lib/Support/ErrorHandling.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Support/ErrorHandling.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -169,7 +169,8 @@ void llvm::report_bad_alloc_error(const char *Reason, // Don't call the normal error handler. It may allocate memory. Directly write // an OOM to stderr and abort. char OOMMessage[] = "LLVM ERROR: out of memory\n"; - (void)::write(2, OOMMessage, strlen(OOMMessage)); + ssize_t written = ::write(2, OOMMessage, strlen(OOMMessage)); + (void)written; abort(); #endif } Modified: vendor/llvm/dist/lib/Support/TargetRegistry.cpp ============================================================================== --- vendor/llvm/dist/lib/Support/TargetRegistry.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Support/TargetRegistry.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -114,7 +114,7 @@ static int TargetArraySortFn(const std::pairfirst.compare(RHS->first); } -void TargetRegistry::printRegisteredTargetsForVersion(raw_ostream &OS) { +void TargetRegistry::printRegisteredTargetsForVersion() { std::vector > Targets; size_t Width = 0; for (const auto &T : TargetRegistry::targets()) { @@ -123,6 +123,7 @@ void TargetRegistry::printRegisteredTargetsForVersion( } array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn); + raw_ostream &OS = outs(); OS << " Registered Targets:\n"; for (unsigned i = 0, e = Targets.size(); i != e; ++i) { OS << " " << Targets[i].first; Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -2889,9 +2889,12 @@ void AArch64TargetLowering::saveVarArgRegisters(CCStat unsigned GPRSaveSize = 8 * (NumGPRArgRegs - FirstVariadicGPR); int GPRIdx = 0; if (GPRSaveSize != 0) { - if (IsWin64) + if (IsWin64) { GPRIdx = MFI.CreateFixedObject(GPRSaveSize, -(int)GPRSaveSize, false); - else + if (GPRSaveSize & 15) + // The extra size here, if triggered, will always be 8. + MFI.CreateFixedObject(16 - (GPRSaveSize & 15), -(int)alignTo(GPRSaveSize, 16), false); + } else GPRIdx = MFI.CreateStackObject(GPRSaveSize, 8, false); SDValue FIN = DAG.getFrameIndex(GPRIdx, PtrVT); Modified: vendor/llvm/dist/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -297,6 +297,11 @@ void AMDGPUInstPrinter::printRegOperand(unsigned RegNo case AMDGPU::FLAT_SCR_HI: O << "flat_scratch_hi"; return; + case AMDGPU::FP_REG: + case AMDGPU::SP_REG: + case AMDGPU::SCRATCH_WAVE_OFFSET_REG: + case AMDGPU::PRIVATE_RSRC_REG: + llvm_unreachable("pseudo-register should not ever be emitted"); default: break; } Modified: vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.td ============================================================================== --- vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.td Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.td Sat Jul 29 21:25:18 2017 (r321691) @@ -274,8 +274,7 @@ def VGPR_512 : RegisterTuples<[sub0, sub1, sub2, sub3, def SReg_32_XM0_XEXEC : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32, (add SGPR_32, VCC_LO, VCC_HI, FLAT_SCR_LO, FLAT_SCR_HI, TTMP_32, TMA_LO, TMA_HI, TBA_LO, TBA_HI, SRC_SHARED_BASE, SRC_SHARED_LIMIT, - SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT, - FP_REG, SP_REG, SCRATCH_WAVE_OFFSET_REG)> { + SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT)> { let AllocationPriority = 7; } Modified: vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -61,14 +61,6 @@ static unsigned adjustFixupValue(unsigned Kind, uint64 case Sparc::fixup_sparc_lo10: return Value & 0x3ff; - case Sparc::fixup_sparc_tls_ldo_hix22: - case Sparc::fixup_sparc_tls_le_hix22: - return (~Value >> 10) & 0x3fffff; - - case Sparc::fixup_sparc_tls_ldo_lox10: - case Sparc::fixup_sparc_tls_le_lox10: - return (~(~Value & 0x3ff)) & 0x1fff; - case Sparc::fixup_sparc_h44: return (Value >> 22) & 0x3fffff; @@ -83,6 +75,13 @@ static unsigned adjustFixupValue(unsigned Kind, uint64 case Sparc::fixup_sparc_hm: return (Value >> 32) & 0x3ff; + + case Sparc::fixup_sparc_tls_ldo_hix22: + case Sparc::fixup_sparc_tls_le_hix22: + case Sparc::fixup_sparc_tls_ldo_lox10: + case Sparc::fixup_sparc_tls_le_lox10: + assert(Value == 0 && "Sparc TLS relocs expect zero Value"); + return 0; case Sparc::fixup_sparc_tls_gd_add: case Sparc::fixup_sparc_tls_gd_call: Modified: vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ14.td ============================================================================== --- vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ14.td Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ14.td Sat Jul 29 21:25:18 2017 (r321691) @@ -455,10 +455,10 @@ def : InstRW<[FXa, LSU, Lat8], (instregex "MH(Y)?$")>; def : InstRW<[FXa2, Lat6, GroupAlone], (instregex "M(L)?R$")>; def : InstRW<[FXa2, LSU, Lat10, GroupAlone], (instregex "M(FY|L)?$")>; def : InstRW<[FXa, LSU, Lat8], (instregex "MGH$")>; -def : InstRW<[FXa, LSU, Lat12, GroupAlone], (instregex "MG$")>; -def : InstRW<[FXa, Lat8, GroupAlone], (instregex "MGRK$")>; -def : InstRW<[FXa, LSU, Lat9, GroupAlone], (instregex "MSC$")>; -def : InstRW<[FXa, LSU, Lat11, GroupAlone], (instregex "MSGC$")>; +def : InstRW<[FXa, FXa, LSU, Lat12, GroupAlone], (instregex "MG$")>; +def : InstRW<[FXa, FXa, Lat8, GroupAlone], (instregex "MGRK$")>; +def : InstRW<[FXa, LSU, Lat9], (instregex "MSC$")>; +def : InstRW<[FXa, LSU, Lat11], (instregex "MSGC$")>; def : InstRW<[FXa, Lat5], (instregex "MSRKC$")>; def : InstRW<[FXa, Lat7], (instregex "MSGRKC$")>; @@ -620,7 +620,7 @@ def : InstRW<[FXa, Lat30], (instregex "(PCC|PPNO|PRNO) def : InstRW<[LSU], (instregex "LGG$")>; def : InstRW<[LSU, Lat5], (instregex "LLGFSG$")>; -def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(L|ST)GSC$")>; +def : InstRW<[LSU, Lat30], (instregex "(L|ST)GSC$")>; //===----------------------------------------------------------------------===// // Decimal arithmetic @@ -708,7 +708,7 @@ def : InstRW<[FXb, LSU, Lat5], (instregex "NTSTG$")>; // Processor assist //===----------------------------------------------------------------------===// -def : InstRW<[FXb], (instregex "PPA$")>; +def : InstRW<[FXb, GroupAlone], (instregex "PPA$")>; //===----------------------------------------------------------------------===// // Miscellaneous Instructions. @@ -1276,9 +1276,9 @@ def : InstRW<[VecXsPm], (instregex "VESRL(B|F|G|H)?$") def : InstRW<[VecXsPm], (instregex "VESRLV(B|F|G|H)?$")>; def : InstRW<[VecXsPm], (instregex "VSL(DB)?$")>; -def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSLB$")>; +def : InstRW<[VecXsPm], (instregex "VSLB$")>; def : InstRW<[VecXsPm], (instregex "VSR(A|L)$")>; -def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSR(A|L)B$")>; +def : InstRW<[VecXsPm], (instregex "VSR(A|L)B$")>; def : InstRW<[VecXsPm], (instregex "VSB(I|IQ|CBI|CBIQ)?$")>; def : InstRW<[VecXsPm], (instregex "VSCBI(B|F|G|H|Q)?$")>; @@ -1435,9 +1435,9 @@ def : InstRW<[VecStr, Lat5], (instregex "VSTRCZ(B|F|H) // Vector: Packed-decimal instructions //===----------------------------------------------------------------------===// -def : InstRW<[VecDF, VecDF, Lat10, GroupAlone], (instregex "VLIP$")>; -def : InstRW<[VecDFX, LSU, Lat12, GroupAlone], (instregex "VPKZ$")>; -def : InstRW<[VecDFX, FXb, LSU, Lat12, GroupAlone], (instregex "VUPKZ$")>; +def : InstRW<[VecDF, VecDF, Lat10], (instregex "VLIP$")>; +def : InstRW<[VecDFX, LSU, GroupAlone], (instregex "VPKZ$")>; +def : InstRW<[VecDFX, FXb, LSU, Lat12, BeginGroup], (instregex "VUPKZ$")>; def : InstRW<[VecDF, VecDF, FXb, Lat20, GroupAlone], (instregex "VCVB(G)?$")>; def : InstRW<[VecDF, VecDF, FXb, Lat20, GroupAlone], (instregex "VCVD(G)?$")>; def : InstRW<[VecDFX], (instregex "V(A|S)P$")>; Modified: vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -1055,7 +1055,10 @@ static bool foldMaskAndShiftToScale(SelectionDAG &DAG, // Scale the leading zero count down based on the actual size of the value. // Also scale it down based on the size of the shift. - MaskLZ -= (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt; + unsigned ScaleDown = (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt; + if (MaskLZ < ScaleDown) + return true; + MaskLZ -= ScaleDown; // The final check is to ensure that any masked out high bits of X are // already known to be zero. Otherwise, the mask has a semantic impact Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -1672,8 +1672,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa // TODO: These control memcmp expansion in CGP and could be raised higher, but // that needs to benchmarked and balanced with the potential use of vector - // load/store types (PR33329). - MaxLoadsPerMemcmp = 4; + // load/store types (PR33329, PR33914). + MaxLoadsPerMemcmp = 2; MaxLoadsPerMemcmpOptSize = 2; // Set loop alignment to 2^ExperimentalPrefLoopAlignment bytes (default: 2^4). @@ -22022,8 +22022,9 @@ static SDValue LowerScalarImmediateShift(SDValue Op, S return getTargetVShiftByConstNode(X86Opc, dl, VT, R, ShiftAmt, DAG); // i64 SRA needs to be performed as partial shifts. - if ((VT == MVT::v2i64 || (Subtarget.hasInt256() && VT == MVT::v4i64)) && - Op.getOpcode() == ISD::SRA && !Subtarget.hasXOP()) + if (((!Subtarget.hasXOP() && VT == MVT::v2i64) || + (Subtarget.hasInt256() && VT == MVT::v4i64)) && + Op.getOpcode() == ISD::SRA) return ArithmeticShiftRight64(ShiftAmt); if (VT == MVT::v16i8 || Modified: vendor/llvm/dist/lib/Transforms/Scalar/JumpThreading.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/JumpThreading.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Transforms/Scalar/JumpThreading.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -64,6 +64,11 @@ ImplicationSearchThreshold( "condition to use to thread over a weaker condition"), cl::init(3), cl::Hidden); +static cl::opt PrintLVIAfterJumpThreading( + "print-lvi-after-jump-threading", + cl::desc("Print the LazyValueInfo cache after JumpThreading"), cl::init(false), + cl::Hidden); + namespace { /// This pass performs 'jump threading', which looks at blocks that have /// multiple predecessors and multiple successors. If one or more of the @@ -93,9 +98,10 @@ namespace { bool runOnFunction(Function &F) override; void getAnalysisUsage(AnalysisUsage &AU) const override { + if (PrintLVIAfterJumpThreading) + AU.addRequired(); AU.addRequired(); AU.addRequired(); - AU.addPreserved(); AU.addPreserved(); AU.addRequired(); } @@ -137,8 +143,14 @@ bool JumpThreading::runOnFunction(Function &F) { BFI.reset(new BlockFrequencyInfo(F, *BPI, LI)); } - return Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), - std::move(BPI)); + bool Changed = Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), + std::move(BPI)); + if (PrintLVIAfterJumpThreading) { + dbgs() << "LVI for function '" << F.getName() << "':\n"; + LVI->printLVI(F, getAnalysis().getDomTree(), + dbgs()); + } + return Changed; } PreservedAnalyses JumpThreadingPass::run(Function &F, @@ -231,13 +243,15 @@ bool JumpThreadingPass::runImpl(Function &F, TargetLib // Can't thread an unconditional jump, but if the block is "almost // empty", we can replace uses of it with uses of the successor and make // this dead. - // We should not eliminate the loop header either, because eliminating - // a loop header might later prevent LoopSimplify from transforming nested - // loops into simplified form. + // We should not eliminate the loop header or latch either, because + // eliminating a loop header or latch might later prevent LoopSimplify + // from transforming nested loops into simplified form. We will rely on + // later passes in backend to clean up empty blocks. if (BI && BI->isUnconditional() && BB != &BB->getParent()->getEntryBlock() && // If the terminator is the only non-phi instruction, try to nuke it. - BB->getFirstNonPHIOrDbg()->isTerminator() && !LoopHeaders.count(BB)) { + BB->getFirstNonPHIOrDbg()->isTerminator() && !LoopHeaders.count(BB) && + !LoopHeaders.count(BI->getSuccessor(0))) { // FIXME: It is always conservatively correct to drop the info // for a block even if it doesn't get erased. This isn't totally // awesome, but it allows us to use AssertingVH to prevent nasty Modified: vendor/llvm/dist/lib/Transforms/Utils/LoopUtils.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Utils/LoopUtils.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Transforms/Utils/LoopUtils.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -1376,16 +1376,21 @@ Value *llvm::createTargetReduction(IRBuilder<> &Builde } } -void llvm::propagateIRFlags(Value *I, ArrayRef VL) { - if (auto *VecOp = dyn_cast(I)) { - if (auto *I0 = dyn_cast(VL[0])) { - // VecOVp is initialized to the 0th scalar, so start counting from index - // '1'. - VecOp->copyIRFlags(I0); - for (int i = 1, e = VL.size(); i < e; ++i) { - if (auto *Scalar = dyn_cast(VL[i])) - VecOp->andIRFlags(Scalar); - } - } +void llvm::propagateIRFlags(Value *I, ArrayRef VL, Value *OpValue) { + auto *VecOp = dyn_cast(I); + if (!VecOp) + return; + auto *Intersection = (OpValue == nullptr) ? dyn_cast(VL[0]) + : dyn_cast(OpValue); + if (!Intersection) + return; + const unsigned Opcode = Intersection->getOpcode(); + VecOp->copyIRFlags(Intersection); + for (auto *V : VL) { + auto *Instr = dyn_cast(V); + if (!Instr) + continue; + if (OpValue == nullptr || Opcode == Instr->getOpcode()) + VecOp->andIRFlags(V); } } Modified: vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp Sat Jul 29 21:25:18 2017 (r321691) @@ -5656,20 +5656,22 @@ static bool TryToMergeLandingPad(LandingPadInst *LPad, bool SimplifyCFGOpt::SimplifyUncondBranch(BranchInst *BI, IRBuilder<> &Builder) { BasicBlock *BB = BI->getParent(); + BasicBlock *Succ = BI->getSuccessor(0); if (SinkCommon && SinkThenElseCodeToEnd(BI)) return true; // If the Terminator is the only non-phi instruction, simplify the block. - // if LoopHeader is provided, check if the block is a loop header - // (This is for early invocations before loop simplify and vectorization - // to keep canonical loop forms for nested loops. - // These blocks can be eliminated when the pass is invoked later - // in the back-end.) + // if LoopHeader is provided, check if the block or its successor is a loop + // header (This is for early invocations before loop simplify and + // vectorization to keep canonical loop forms for nested loops. These blocks + // can be eliminated when the pass is invoked later in the back-end.) + bool NeedCanonicalLoop = + !LateSimplifyCFG && + (LoopHeaders && (LoopHeaders->count(BB) || LoopHeaders->count(Succ))); BasicBlock::iterator I = BB->getFirstNonPHIOrDbg()->getIterator(); if (I->isTerminator() && BB != &BB->getParent()->getEntryBlock() && - (!LoopHeaders || !LoopHeaders->count(BB)) && - TryToSimplifyUncondBranchFromEmptyBlock(BB)) + !NeedCanonicalLoop && TryToSimplifyUncondBranchFromEmptyBlock(BB)) return true; // If the only instruction in the block is a seteq/setne comparison Modified: vendor/llvm/dist/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll ============================================================================== --- vendor/llvm/dist/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -1,4 +1,4 @@ -; RUN: opt < %s -jump-threading -print-lazy-value-info -disable-output 2>&1 | FileCheck %s +; RUN: opt < %s -jump-threading -print-lvi-after-jump-threading -disable-output 2>&1 | FileCheck %s ; Testing LVI cache after jump-threading @@ -19,13 +19,10 @@ entry: ; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: overdefined ; CHECK-NEXT: ; LatticeVal for: 'i32 %length' is: overdefined ; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%backedge' is: constantrange<0, 400> -; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%exit' is: constantrange<399, 400> ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ] ; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%backedge' is: constantrange<1, 401> -; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%exit' is: constantrange<400, 401> ; CHECK-NEXT: %iv.next = add nsw i32 %iv, 1 ; CHECK-NEXT: ; LatticeVal for: ' %cont = icmp slt i32 %iv.next, 400' in BB: '%backedge' is: overdefined -; CHECK-NEXT: ; LatticeVal for: ' %cont = icmp slt i32 %iv.next, 400' in BB: '%exit' is: constantrange<0, -1> ; CHECK-NEXT: %cont = icmp slt i32 %iv.next, 400 ; CHECK-NOT: loop loop: Modified: vendor/llvm/dist/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -19,9 +19,9 @@ entry: do.body.i: ; CHECK-LABEL: do.body.i: -; CHECK: %uglygep2 = getelementptr i8, i8* %uglygep, i64 %3 -; CHECK-NEXT: %4 = bitcast i8* %uglygep2 to i32* -; CHECK-NOT: %uglygep2 = getelementptr i8, i8* %uglygep, i64 1032 +; CHECK: %uglygep1 = getelementptr i8, i8* %uglygep, i64 %3 +; CHECK-NEXT: %4 = bitcast i8* %uglygep1 to i32* +; CHECK-NOT: %uglygep1 = getelementptr i8, i8* %uglygep, i64 1032 %0 = phi i32 [ 256, %entry ], [ %.be, %do.body.i.backedge ] Modified: vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -59,10 +59,12 @@ entry: } ; CHECK-LABEL: f7: -; CHECK: sub sp, sp, #16 -; CHECK: add x8, sp, #8 -; CHECK: add x0, sp, #8 -; CHECK: stp x8, x7, [sp], #16 +; CHECK: sub sp, sp, #32 +; CHECK: add x8, sp, #24 +; CHECK: str x7, [sp, #24] +; CHECK: add x0, sp, #24 +; CHECK: str x8, [sp, #8] +; CHECK: add sp, sp, #32 ; CHECK: ret define win64cc i8* @f7(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, ...) nounwind { entry: Modified: vendor/llvm/dist/test/CodeGen/AArch64/win64_vararg.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/AArch64/win64_vararg.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/CodeGen/AArch64/win64_vararg.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -59,10 +59,12 @@ entry: } ; CHECK-LABEL: f7: -; CHECK: sub sp, sp, #16 -; CHECK: add x8, sp, #8 -; CHECK: add x0, sp, #8 -; CHECK: stp x8, x7, [sp], #16 +; CHECK: sub sp, sp, #32 +; CHECK: add x8, sp, #24 +; CHECK: str x7, [sp, #24] +; CHECK: add x0, sp, #24 +; CHECK: str x8, [sp, #8] +; CHECK: add sp, sp, #32 ; CHECK: ret define i8* @f7(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, ...) nounwind { entry: @@ -79,9 +81,8 @@ entry: ; CHECK: stp x6, x7, [sp, #64] ; CHECK: stp x4, x5, [sp, #48] ; CHECK: stp x2, x3, [sp, #32] -; CHECK: stp x8, x1, [sp, #16] -; CHECK: str x8, [sp, #8] -; CHECK: add sp, sp, #80 +; CHECK: str x1, [sp, #24] +; CHECK: stp x8, x8, [sp], #80 ; CHECK: ret define void @copy1(i64 %a0, ...) nounwind { entry: @@ -92,4 +93,55 @@ entry: call void @llvm.va_start(i8* %ap1) call void @llvm.va_copy(i8* %cp1, i8* %ap1) ret void +} + +declare void @llvm.va_end(i8*) +declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 +declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 + +declare i32 @__stdio_common_vsprintf(i64, i8*, i64, i8*, i8*, i8*) local_unnamed_addr #3 +declare i64* @__local_stdio_printf_options() local_unnamed_addr #4 + +; CHECK-LABEL: snprintf +; CHECK: sub sp, sp, #96 +; CHECK: stp x21, x20, [sp, #16] +; CHECK: stp x19, x30, [sp, #32] +; CHECK: add x8, sp, #56 +; CHECK: mov x19, x2 +; CHECK: mov x20, x1 +; CHECK: mov x21, x0 +; CHECK: stp x6, x7, [sp, #80] +; CHECK: stp x4, x5, [sp, #64] +; CHECK: str x3, [sp, #56] +; CHECK: str x8, [sp, #8] +; CHECK: bl __local_stdio_printf_options +; CHECK: ldr x8, [x0] +; CHECK: add x5, sp, #56 +; CHECK: mov x1, x21 +; CHECK: mov x2, x20 +; CHECK: orr x0, x8, #0x2 +; CHECK: mov x3, x19 +; CHECK: mov x4, xzr +; CHECK: bl __stdio_common_vsprintf +; CHECK: ldp x19, x30, [sp, #32] +; CHECK: ldp x21, x20, [sp, #16] +; CHECK: cmp w0, #0 +; CHECK: csinv w0, w0, wzr, ge +; CHECK: add sp, sp, #96 +; CHECK: ret +define i32 @snprintf(i8*, i64, i8*, ...) local_unnamed_addr #5 { + %4 = alloca i8*, align 8 + %5 = bitcast i8** %4 to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %5) #2 + call void @llvm.va_start(i8* nonnull %5) + %6 = load i8*, i8** %4, align 8 + %7 = call i64* @__local_stdio_printf_options() #2 + %8 = load i64, i64* %7, align 8 + %9 = or i64 %8, 2 + %10 = call i32 @__stdio_common_vsprintf(i64 %9, i8* %0, i64 %1, i8* %2, i8* null, i8* %6) #2 + %11 = icmp sgt i32 %10, -1 + %12 = select i1 %11, i32 %10, i32 -1 + call void @llvm.va_end(i8* nonnull %5) + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) #2 + ret i32 %12 } Added: vendor/llvm/dist/test/CodeGen/AMDGPU/spill-empty-live-interval.mir ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/AMDGPU/spill-empty-live-interval.mir Sat Jul 29 21:25:18 2017 (r321691) @@ -0,0 +1,74 @@ +# RUN: llc -mtriple=amdgcn-amd-amdhsa-opencl -verify-machineinstrs -stress-regalloc=1 -start-before=simple-register-coalescing -stop-after=greedy -o - %s | FileCheck %s +# https://bugs.llvm.org/show_bug.cgi?id=33620 + +--- +# This would assert due to the empty live interval created for %vreg9 +# on the last S_NOP with an undef subreg use. + +# CHECK-LABEL: name: expecting_non_empty_interval + +# CHECK: undef %7.sub1 = V_MAC_F32_e32 0, undef %1, undef %7.sub1, implicit %exec +# CHECK-NEXT: SI_SPILL_V64_SAVE %7, %stack.0, %sgpr0_sgpr1_sgpr2_sgpr3, %sgpr5, 0, implicit %exec :: (store 8 into %stack.0, align 4) +# CHECK-NEXT: undef %5.sub1 = V_MOV_B32_e32 1786773504, implicit %exec +# CHECK-NEXT: dead %2 = V_MUL_F32_e32 0, %5.sub1, implicit %exec + +# CHECK: S_NOP 0, implicit %6.sub1 +# CHECK-NEXT: %8 = SI_SPILL_V64_RESTORE %stack.0, %sgpr0_sgpr1_sgpr2_sgpr3, %sgpr5, 0, implicit %exec :: (load 8 from %stack.0, align 4) +# CHECK-NEXT: S_NOP 0, implicit %8.sub1 +# CHECK-NEXT: S_NOP 0, implicit undef %9.sub0 + +name: expecting_non_empty_interval +tracksRegLiveness: true +registers: + - { id: 0, class: vreg_64, preferred-register: '' } + - { id: 1, class: vgpr_32, preferred-register: '' } + - { id: 2, class: vgpr_32, preferred-register: '' } + - { id: 3, class: vreg_64, preferred-register: '' } +body: | + bb.0: + successors: %bb.1 + undef %0.sub1 = V_MAC_F32_e32 0, undef %1, undef %0.sub1, implicit %exec + undef %3.sub1 = V_MOV_B32_e32 1786773504, implicit %exec + dead %2 = V_MUL_F32_e32 0, %3.sub1, implicit %exec + + bb.1: + S_NOP 0, implicit %3.sub1 + S_NOP 0, implicit %0.sub1 + S_NOP 0, implicit undef %0.sub0 + S_ENDPGM + +... + +# Similar assert which happens when trying to rematerialize. +# https://bugs.llvm.org/show_bug.cgi?id=33884 +--- +# CHECK-LABEL: name: rematerialize_empty_interval_has_reference + +# CHECK-NOT: MOV +# CHECK: undef %3.sub2 = V_MOV_B32_e32 1786773504, implicit %exec + +# CHECK: bb.1: +# CHECK-NEXT: S_NOP 0, implicit %3.sub2 +# CHECK-NEXT: S_NOP 0, implicit undef %6.sub0 +# CHECK-NEXT: undef %4.sub2 = V_MOV_B32_e32 0, implicit %exec +# CHECK-NEXT: S_NOP 0, implicit %4.sub2 +name: rematerialize_empty_interval_has_reference +tracksRegLiveness: true +registers: + - { id: 0, class: vreg_128, preferred-register: '' } + - { id: 1, class: vgpr_32, preferred-register: '' } + - { id: 2, class: vgpr_32, preferred-register: '' } + - { id: 3, class: vreg_128, preferred-register: '' } +body: | + bb.0: + successors: %bb.1 + + undef %0.sub2 = V_MOV_B32_e32 0, implicit %exec + undef %3.sub2 = V_MOV_B32_e32 1786773504, implicit %exec + + bb.1: + S_NOP 0, implicit %3.sub2 + S_NOP 0, implicit undef %0.sub0 + S_NOP 0, implicit %0.sub2 + +... Modified: vendor/llvm/dist/test/CodeGen/X86/memcmp-minsize.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/memcmp-minsize.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/CodeGen/X86/memcmp-minsize.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -527,6 +527,93 @@ define i1 @length16_eq_const(i8* %X) nounwind minsize ret i1 %c } +; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914 + +define i32 @length24(i8* %X, i8* %Y) nounwind minsize { +; X86-LABEL: length24: +; X86: # BB#0: +; X86-NEXT: subl $16, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: andl $0, {{[0-9]+}}(%esp) +; X86-NEXT: movl $24, {{[0-9]+}}(%esp) +; X86-NEXT: calll memcmp +; X86-NEXT: addl $16, %esp +; X86-NEXT: retl +; +; X64-LABEL: length24: +; X64: # BB#0: +; X64-NEXT: pushq $24 +; X64-NEXT: popq %rdx +; X64-NEXT: jmp memcmp # TAILCALL + %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 24) nounwind + ret i32 %m +} + +define i1 @length24_eq(i8* %x, i8* %y) nounwind minsize { +; X86-LABEL: length24_eq: +; X86: # BB#0: +; X86-NEXT: subl $16, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: andl $0, {{[0-9]+}}(%esp) +; X86-NEXT: movl $24, {{[0-9]+}}(%esp) +; X86-NEXT: calll memcmp +; X86-NEXT: testl %eax, %eax +; X86-NEXT: sete %al +; X86-NEXT: addl $16, %esp +; X86-NEXT: retl +; +; X64-LABEL: length24_eq: +; X64: # BB#0: +; X64-NEXT: pushq %rax +; X64-NEXT: pushq $24 +; X64-NEXT: popq %rdx +; X64-NEXT: callq memcmp +; X64-NEXT: testl %eax, %eax +; X64-NEXT: sete %al +; X64-NEXT: popq %rcx +; X64-NEXT: retq + %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 24) nounwind + %cmp = icmp eq i32 %call, 0 + ret i1 %cmp +} + +define i1 @length24_eq_const(i8* %X) nounwind minsize { +; X86-LABEL: length24_eq_const: +; X86: # BB#0: +; X86-NEXT: subl $16, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: andl $0, {{[0-9]+}}(%esp) +; X86-NEXT: movl $24, {{[0-9]+}}(%esp) +; X86-NEXT: movl $.L.str, {{[0-9]+}}(%esp) +; X86-NEXT: calll memcmp +; X86-NEXT: testl %eax, %eax +; X86-NEXT: setne %al +; X86-NEXT: addl $16, %esp +; X86-NEXT: retl +; +; X64-LABEL: length24_eq_const: +; X64: # BB#0: +; X64-NEXT: pushq %rax +; X64-NEXT: pushq $24 +; X64-NEXT: popq %rdx +; X64-NEXT: movl $.L.str, %esi +; X64-NEXT: callq memcmp +; X64-NEXT: testl %eax, %eax +; X64-NEXT: setne %al +; X64-NEXT: popq %rcx +; X64-NEXT: retq + %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 24) nounwind + %c = icmp ne i32 %m, 0 + ret i1 %c +} + define i32 @length32(i8* %X, i8* %Y) nounwind minsize { ; X86-LABEL: length32: ; X86: # BB#0: Modified: vendor/llvm/dist/test/CodeGen/X86/memcmp-optsize.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/memcmp-optsize.ll Sat Jul 29 20:19:37 2017 (r321690) +++ vendor/llvm/dist/test/CodeGen/X86/memcmp-optsize.ll Sat Jul 29 21:25:18 2017 (r321691) @@ -699,6 +699,82 @@ define i1 @length16_eq_const(i8* %X) nounwind optsize ret i1 %c } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jul 29 21:25:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DA72DCB65E; Sat, 29 Jul 2017 21:25:27 +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 214CA7CC2D; Sat, 29 Jul 2017 21:25:27 +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 v6TLPQb3068247; Sat, 29 Jul 2017 21:25:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLPQB4068246; Sat, 29 Jul 2017 21:25:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292125.v6TLPQB4068246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321692 - vendor/llvm/llvm-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_50-r309439 X-SVN-Commit-Revision: 321692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:25:27 -0000 Author: dim Date: Sat Jul 29 21:25:26 2017 New Revision: 321692 URL: https://svnweb.freebsd.org/changeset/base/321692 Log: Tag llvm release_50 branch r309439. Added: vendor/llvm/llvm-release_50-r309439/ - copied from r321691, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:28:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5521FDCB734; Sat, 29 Jul 2017 21:28:14 +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 0B3497CE89; Sat, 29 Jul 2017 21:28:13 +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 v6TLSDuc068386; Sat, 29 Jul 2017 21:28:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLSDpI068384; Sat, 29 Jul 2017 21:28:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292128.v6TLSDpI068384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321693 - in vendor/clang/dist: docs include/clang/AST lib/AST lib/Basic lib/CodeGen lib/Driver lib/Headers lib/Sema test/CodeCompletion test/CodeGenCXX test/Driver test/Index tools/cla... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist: docs include/clang/AST lib/AST lib/Basic lib/CodeGen lib/Driver lib/Headers lib/Sema test/CodeCompletion test/CodeGenCXX test/Driver test/Index tools/clang-format tools/clang-off... X-SVN-Commit-Revision: 321693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:28:14 -0000 Author: dim Date: Sat Jul 29 21:28:13 2017 New Revision: 321693 URL: https://svnweb.freebsd.org/changeset/base/321693 Log: Vendor import of clang release_50 branch r309439: https://llvm.org/svn/llvm-project/cfe/branches/release_50@309439 Added: vendor/clang/dist/test/CodeGenCXX/std-byte.cpp (contents, props changed) Modified: vendor/clang/dist/docs/AttributeReference.rst vendor/clang/dist/docs/ClangCommandLineReference.rst vendor/clang/dist/docs/UsersManual.rst vendor/clang/dist/include/clang/AST/Type.h vendor/clang/dist/lib/AST/StmtProfile.cpp vendor/clang/dist/lib/AST/Type.cpp vendor/clang/dist/lib/Basic/DiagnosticIDs.cpp vendor/clang/dist/lib/Basic/Version.cpp vendor/clang/dist/lib/CodeGen/CodeGenTBAA.cpp vendor/clang/dist/lib/Driver/Driver.cpp vendor/clang/dist/lib/Headers/unwind.h vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp vendor/clang/dist/test/CodeCompletion/functions.cpp vendor/clang/dist/test/Driver/autocomplete.c vendor/clang/dist/test/Index/code-completion.cpp vendor/clang/dist/test/Index/complete-optional-params.cpp vendor/clang/dist/tools/clang-format/ClangFormat.cpp vendor/clang/dist/tools/clang-offload-bundler/ClangOffloadBundler.cpp vendor/clang/dist/utils/bash-autocomplete.sh Modified: vendor/clang/dist/docs/AttributeReference.rst ============================================================================== --- vendor/clang/dist/docs/AttributeReference.rst Sat Jul 29 21:25:26 2017 (r321692) +++ vendor/clang/dist/docs/AttributeReference.rst Sat Jul 29 21:28:13 2017 (r321693) @@ -1,13 +1,3471 @@ .. ------------------------------------------------------------------- NOTE: This file is automatically generated by running clang-tblgen - -gen-attr-docs. Do not edit this file by hand!! The contents for - this file are automatically generated by a server-side process. - - Please do not commit this file. The file exists for local testing - purposes only. + -gen-attr-docs. Do not edit this file by hand!! ------------------------------------------------------------------- =================== Attributes in Clang -=================== \ No newline at end of file +=================== +.. contents:: + :local: + +Introduction +============ + +This page lists the attributes currently supported by Clang. + +Function Attributes +=================== + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "" + +Clang supports the GNU style ``__attribute__((interrupt("TYPE")))`` attribute on +ARM targets. This attribute may be attached to a function definition and +instructs the backend to generate appropriate function entry/exit code so that +it can be used directly as an interrupt service routine. + +The parameter passed to the interrupt attribute is optional, but if +provided it must be a string literal with one of the following values: "IRQ", +"FIQ", "SWI", "ABORT", "UNDEF". + +The semantics are as follows: + +- If the function is AAPCS, Clang instructs the backend to realign the stack to + 8 bytes on entry. This is a general requirement of the AAPCS at public + interfaces, but may not hold when an exception is taken. Doing this allows + other AAPCS functions to be called. +- If the CPU is M-class this is all that needs to be done since the architecture + itself is designed in such a way that functions obeying the normal AAPCS ABI + constraints are valid exception handlers. +- If the CPU is not M-class, the prologue and epilogue are modified to save all + non-banked registers that are used, so that upon return the user-mode state + will not be corrupted. Note that to avoid unnecessary overhead, only + general-purpose (integer) registers are saved in this way. If VFP operations + are needed, that state must be saved manually. + + Specifically, interrupt kinds other than "FIQ" will save all core registers + except "lr" and "sp". "FIQ" interrupts will save r0-r7. +- If the CPU is not M-class, the return instruction is changed to one of the + canonical sequences permitted by the architecture for exception return. Where + possible the function itself will make the necessary "lr" adjustments so that + the "preferred return address" is selected. + + Unfortunately the compiler is unable to make this guarantee for an "UNDEF" + handler, where the offset from "lr" to the preferred return address depends on + the execution state of the code which generated the exception. In this case + a sequence equivalent to "movs pc, lr" will be used. + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "X" + +Clang supports the GNU style ``__attribute__((interrupt))`` attribute on +AVR targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be used +directly as an interrupt service routine. + +On the AVR, the hardware globally disables interrupts when an interrupt is executed. +The first instruction of an interrupt handler declared with this attribute is a SEI +instruction to re-enable interrupts. See also the signal attribute that +does not insert a SEI instruction. + + +signal +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "X" + +Clang supports the GNU style ``__attribute__((signal))`` attribute on +AVR targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be used +directly as an interrupt service routine. + +Interrupt handler functions defined with the signal attribute do not re-enable interrupts. + + +abi_tag (gnu::abi_tag) +---------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``abi_tag`` attribute can be applied to a function, variable, class or +inline namespace declaration to modify the mangled name of the entity. It gives +the ability to distinguish between different versions of the same entity but +with different ABI versions supported. For example, a newer version of a class +could have a different set of data members and thus have a different size. Using +the ``abi_tag`` attribute, it is possible to have different mangled names for +a global variable of the class type. Therefor, the old code could keep using +the old manged name and the new code will use the new mangled name with tags. + + +acquire_capability (acquire_shared_capability, clang::acquire_capability, clang::acquire_shared_capability) +----------------------------------------------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "" + +Marks a function as acquiring a capability. + + +alloc_align (gnu::alloc_align) +------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "" + +Use ``__attribute__((alloc_align())`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) is at least as aligned as the value of the indicated parameter. The +parameter is given by its index in the list of formal parameters; the first +parameter has index 1 unless the function is a C++ non-static member function, +in which case the first parameter has index 2 to account for the implicit ``this`` +parameter. + +.. code-block:: c++ + + // The returned pointer has the alignment specified by the first parameter. + void *a(size_t align) __attribute__((alloc_align(1))); + + // The returned pointer has the alignment specified by the second parameter. + void *b(void *v, size_t align) __attribute__((alloc_align(2))); + + // The returned pointer has the alignment specified by the second visible + // parameter, however it must be adjusted for the implicit 'this' parameter. + void *Foo::b(void *v, size_t align) __attribute__((alloc_align(3))); + +Note that this attribute merely informs the compiler that a function always +returns a sufficiently aligned pointer. It does not cause the compiler to +emit code to enforce that alignment. The behavior is undefined if the returned +poitner is not sufficiently aligned. + + +alloc_size (gnu::alloc_size) +---------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``alloc_size`` attribute can be placed on functions that return pointers in +order to hint to the compiler how many bytes of memory will be available at the +returned poiner. ``alloc_size`` takes one or two arguments. + +- ``alloc_size(N)`` implies that argument number N equals the number of + available bytes at the returned pointer. +- ``alloc_size(N, M)`` implies that the product of argument number N and + argument number M equals the number of available bytes at the returned + pointer. + +Argument numbers are 1-based. + +An example of how to use ``alloc_size`` + +.. code-block:: c + + void *my_malloc(int a) __attribute__((alloc_size(1))); + void *my_calloc(int a, int b) __attribute__((alloc_size(1, 2))); + + int main() { + void *const p = my_malloc(100); + assert(__builtin_object_size(p, 0) == 100); + void *const a = my_calloc(20, 5); + assert(__builtin_object_size(a, 0) == 100); + } + +.. Note:: This attribute works differently in clang than it does in GCC. + Specifically, clang will only trace ``const`` pointers (as above); we give up + on pointers that are not marked as ``const``. In the vast majority of cases, + this is unimportant, because LLVM has support for the ``alloc_size`` + attribute. However, this may cause mildly unintuitive behavior when used with + other attributes, such as ``enable_if``. + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "" + +Clang supports the GNU style ``__attribute__((interrupt))`` attribute on +x86/x86-64 targets.The compiler generates function entry and exit sequences +suitable for use in an interrupt handler when this attribute is present. +The 'IRET' instruction, instead of the 'RET' instruction, is used to return +from interrupt or exception handlers. All registers, except for the EFLAGS +register which is restored by the 'IRET' instruction, are preserved by the +compiler. + +Any interruptible-without-stack-switch code must be compiled with +-mno-red-zone since interrupt handlers can and will, because of the +hardware design, touch the red zone. + +1. interrupt handler must be declared with a mandatory pointer argument: + + .. code-block:: c + + struct interrupt_frame + { + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; + }; + + __attribute__ ((interrupt)) + void f (struct interrupt_frame *frame) { + ... + } + +2. exception handler: + + The exception handler is very similar to the interrupt handler with + a different mandatory function signature: + + .. code-block:: c + + __attribute__ ((interrupt)) + void f (struct interrupt_frame *frame, uword_t error_code) { + ... + } + + and compiler pops 'ERROR_CODE' off stack before the 'IRET' instruction. + + The exception handler should only be used for exceptions which push an + error code and all other exceptions must use the interrupt handler. + The system will crash if the wrong handler is used. + + +no_caller_saved_registers (gnu::no_caller_saved_registers) +---------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "" + +Use this attribute to indicate that the specified function has no +caller-saved registers. That is, all registers are callee-saved except for +registers used for passing parameters to the function or returning parameters +from the function. +The compiler saves and restores any modified registers that were not used for +passing or returning arguments to the function. + +The user can call functions specified with the 'no_caller_saved_registers' +attribute from an interrupt handler without saving and restoring all +call-clobbered registers. + +Note that 'no_caller_saved_registers' attribute is not a calling convention. +In fact, it only overrides the decision of which registers should be saved by +the caller, but not how the parameters are passed from the caller to the callee. + +For example: + + .. code-block:: c + + __attribute__ ((no_caller_saved_registers, fastcall)) + void f (int arg1, int arg2) { + ... + } + + In this case parameters 'arg1' and 'arg2' will be passed in registers. + In this case, on 32-bit x86 targets, the function 'f' will use ECX and EDX as + register parameters. However, it will not assume any scratch registers and + should save and restore any modified registers except for ECX and EDX. + + +assert_capability (assert_shared_capability, clang::assert_capability, clang::assert_shared_capability) +------------------------------------------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "" + +Marks a function that dynamically tests whether a capability is held, and halts +the program if it is not held. + + +assume_aligned (gnu::assume_aligned) +------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +Use ``__attribute__((assume_aligned([,]))`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) has the specified offset, in bytes, from an address with the +specified alignment. The offset is taken to be zero if omitted. + +.. code-block:: c++ + + // The returned pointer value has 32-byte alignment. + void *a() __attribute__((assume_aligned (32))); + + // The returned pointer value is 4 bytes greater than an address having + // 32-byte alignment. + void *b() __attribute__((assume_aligned (32, 4))); + +Note that this attribute provides information to the compiler regarding a +condition that the code already ensures is true. It does not cause the compiler +to enforce the provided alignment assumption. + + +availability +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "X" + +The ``availability`` attribute can be placed on declarations to describe the +lifecycle of that declaration relative to operating system versions. Consider +the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); + +The availability attribute states that ``f`` was introduced in macOS 10.4, +deprecated in macOS 10.6, and obsoleted in macOS 10.7. This information +is used by Clang to determine when it is safe to use ``f``: for example, if +Clang is instructed to compile code for macOS 10.5, a call to ``f()`` +succeeds. If Clang is instructed to compile code for macOS 10.6, the call +succeeds but Clang emits a warning specifying that the function is deprecated. +Finally, if Clang is instructed to compile code for macOS 10.7, the call +fails because ``f()`` is no longer available. + +The availability attribute is a comma-separated list starting with the +platform name and then including clauses specifying important milestones in the +declaration's lifetime (in any order) along with additional information. Those +clauses can be: + +introduced=\ *version* + The first version in which this declaration was introduced. + +deprecated=\ *version* + The first version in which this declaration was deprecated, meaning that + users should migrate away from this API. + +obsoleted=\ *version* + The first version in which this declaration was obsoleted, meaning that it + was removed completely and can no longer be used. + +unavailable + This declaration is never available on this platform. + +message=\ *string-literal* + Additional message text that Clang will provide when emitting a warning or + error about use of a deprecated or obsoleted declaration. Useful to direct + users to replacement APIs. + +replacement=\ *string-literal* + Additional message text that Clang will use to provide Fix-It when emitting + a warning about use of a deprecated declaration. The Fix-It will replace + the deprecated declaration with the new declaration specified. + +Multiple availability attributes can be placed on a declaration, which may +correspond to different platforms. Only the availability attribute with the +platform corresponding to the target platform will be used; any others will be +ignored. If no availability attribute specifies availability for the current +target platform, the availability attributes are ignored. Supported platforms +are: + +``ios`` + Apple's iOS operating system. The minimum deployment target is specified by + the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*`` + command-line arguments. + +``macos`` + Apple's macOS operating system. The minimum deployment target is + specified by the ``-mmacosx-version-min=*version*`` command-line argument. + ``macosx`` is supported for backward-compatibility reasons, but it is + deprecated. + +``tvos`` + Apple's tvOS operating system. The minimum deployment target is specified by + the ``-mtvos-version-min=*version*`` command-line argument. + +``watchos`` + Apple's watchOS operating system. The minimum deployment target is specified by + the ``-mwatchos-version-min=*version*`` command-line argument. + +A declaration can typically be used even when deploying back to a platform +version prior to when the declaration was introduced. When this happens, the +declaration is `weakly linked +`_, +as if the ``weak_import`` attribute were added to the declaration. A +weakly-linked declaration may or may not be present a run-time, and a program +can determine whether the declaration is present by checking whether the +address of that declaration is non-NULL. + +The flag ``strict`` disallows using API when deploying back to a +platform version prior to when the declaration was introduced. An +attempt to use such API before its introduction causes a hard error. +Weakly-linking is almost always a better API choice, since it allows +users to query availability at runtime. + +If there are multiple declarations of the same entity, the availability +attributes must either match on a per-platform basis or later +declarations must not have availability attributes for that +platform. For example: + +.. code-block:: c + + void g(void) __attribute__((availability(macos,introduced=10.4))); + void g(void) __attribute__((availability(macos,introduced=10.4))); // okay, matches + void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, adds a new platform + void g(void); // okay, inherits both macos and ios availability from above. + void g(void) __attribute__((availability(macos,introduced=10.5))); // error: mismatch + +When one method overrides another, the overriding method can be more widely available than the overridden method, e.g.,: + +.. code-block:: objc + + @interface A + - (id)method __attribute__((availability(macos,introduced=10.4))); + - (id)method2 __attribute__((availability(macos,introduced=10.4))); + @end + + @interface B : A + - (id)method __attribute__((availability(macos,introduced=10.3))); // okay: method moved into base class later + - (id)method __attribute__((availability(macos,introduced=10.5))); // error: this method was available via the base class in 10.4 + @end + +Starting with the macOS 10.12 SDK, the ``API_AVAILABLE`` macro from +```` can simplify the spelling: + +.. code-block:: objc + + @interface A + - (id)method API_AVAILABLE(macos(10.11))); + - (id)otherMethod API_AVAILABLE(macos(10.11), ios(11.0)); + @end + +Also see the documentation for `@available +`_ + + +_Noreturn +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "","","","X", "", "" + +A function declared as ``_Noreturn`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``_Noreturn`` +that appears to be capable of returning to its caller. + + +noreturn +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "","X","","", "", "X" + +A function declared as ``[[noreturn]]`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``[[noreturn]]`` +that appears to be capable of returning to its caller. + + +carries_dependency +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``carries_dependency`` attribute specifies dependency propagation into and +out of functions. + +When specified on a function or Objective-C method, the ``carries_dependency`` +attribute means that the return value carries a dependency out of the function, +so that the implementation need not constrain ordering upon return from that +function. Implementations of the function and its caller may choose to preserve +dependencies instead of emitting memory ordering instructions such as fences. + +Note, this attribute does not change the meaning of the program, but may result +in generation of more efficient code. + + +convergent (clang::convergent) +------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``convergent`` attribute can be placed on a function declaration. It is +translated into the LLVM ``convergent`` attribute, which indicates that the call +instructions of a function with this attribute cannot be made control-dependent +on any additional values. + +In languages designed for SPMD/SIMT programming model, e.g. OpenCL or CUDA, +the call instructions of a function with this attribute must be executed by +all work items or threads in a work group or sub group. + +This attribute is different from ``noduplicate`` because it allows duplicating +function calls if it can be proved that the duplicated function calls are +not made control-dependent on any additional values, e.g., unrolling a loop +executed by all work items. + +Sample usage: +.. code-block:: c + + void convfunc(void) __attribute__((convergent)); + // Setting it as a C++11 attribute is also valid in a C++ program. + // void convfunc(void) [[clang::convergent]]; + + +deprecated (gnu::deprecated) +---------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","X","", "", "" + +The ``deprecated`` attribute can be applied to a function, a variable, or a +type. This is useful when identifying functions, variables, or types that are +expected to be removed in a future version of a program. + +Consider the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((deprecated("message", "replacement"))); + +When spelled as `__attribute__((deprecated))`, the deprecated attribute can have +two optional string arguments. The first one is the message to display when +emitting the warning; the second one enables the compiler to provide a Fix-It +to replace the deprecated name with a new name. Otherwise, when spelled as +`[[gnu::deprecated]] or [[deprecated]]`, the attribute can have one optional +string argument which is the message to display when emitting the warning. + + +diagnose_if +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "" + +The ``diagnose_if`` attribute can be placed on function declarations to emit +warnings or errors at compile-time if calls to the attributed function meet +certain user-defined criteria. For example: + +.. code-block:: c + + void abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); + void must_abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "error"))); + + int val = abs(1); // warning: Redundant abs call + int val2 = must_abs(1); // error: Redundant abs call + int val3 = abs(val); + int val4 = must_abs(val); // Because run-time checks are not emitted for + // diagnose_if attributes, this executes without + // issue. + + +``diagnose_if`` is closely related to ``enable_if``, with a few key differences: + +* Overload resolution is not aware of ``diagnose_if`` attributes: they're + considered only after we select the best candidate from a given candidate set. +* Function declarations that differ only in their ``diagnose_if`` attributes are + considered to be redeclarations of the same function (not overloads). +* If the condition provided to ``diagnose_if`` cannot be evaluated, no + diagnostic will be emitted. + +Otherwise, ``diagnose_if`` is essentially the logical negation of ``enable_if``. + +As a result of bullet number two, ``diagnose_if`` attributes will stack on the +same function. For example: + +.. code-block:: c + + int foo() __attribute__((diagnose_if(1, "diag1", "warning"))); + int foo() __attribute__((diagnose_if(1, "diag2", "warning"))); + + int bar = foo(); // warning: diag1 + // warning: diag2 + int (*fooptr)(void) = foo; // warning: diag1 + // warning: diag2 + + constexpr int supportsAPILevel(int N) { return N < 5; } + int baz(int a) + __attribute__((diagnose_if(!supportsAPILevel(10), + "Upgrade to API level 10 to use baz", "error"))); + int baz(int a) + __attribute__((diagnose_if(!a, "0 is not recommended.", "warning"))); + + int (*bazptr)(int) = baz; // error: Upgrade to API level 10 to use baz + int v = baz(0); // error: Upgrade to API level 10 to use baz + +Query for this feature with ``__has_attribute(diagnose_if)``. + + +disable_tail_calls (clang::disable_tail_calls) +---------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside the marked function. + +For example: + + .. code-block:: c + + int callee(int); + + int foo(int a) __attribute__((disable_tail_calls)) { + return callee(a); // This call is not tail-call optimized. + } + +Marking virtual functions as ``disable_tail_calls`` is legal. + + .. code-block:: c++ + + int callee(int); + + class Base { + public: + [[clang::disable_tail_calls]] virtual int foo1() { + return callee(); // This call is not tail-call optimized. + } + }; + + class Derived1 : public Base { + public: + int foo1() override { + return callee(); // This call is tail-call optimized. + } + }; + + +enable_if +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","","","", "", "X" + +.. Note:: Some features of this attribute are experimental. The meaning of + multiple enable_if attributes on a single declaration is subject to change in + a future version of clang. Also, the ABI is not standardized and the name + mangling may change in future versions. To avoid that, use asm labels. + +The ``enable_if`` attribute can be placed on function declarations to control +which overload is selected based on the values of the function's arguments. +When combined with the ``overloadable`` attribute, this feature is also +available in C. + +.. code-block:: c++ + + int isdigit(int c); + int isdigit(int c) __attribute__((enable_if(c <= -1 || c > 255, "chosen when 'c' is out of range"))) __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); + + void foo(char c) { + isdigit(c); + isdigit(10); + isdigit(-10); // results in a compile-time error. + } + +The enable_if attribute takes two arguments, the first is an expression written +in terms of the function parameters, the second is a string explaining why this +overload candidate could not be selected to be displayed in diagnostics. The +expression is part of the function signature for the purposes of determining +whether it is a redeclaration (following the rules used when determining +whether a C++ template specialization is ODR-equivalent), but is not part of +the type. + +The enable_if expression is evaluated as if it were the body of a +bool-returning constexpr function declared with the arguments of the function +it is being applied to, then called with the parameters at the call site. If the +result is false or could not be determined through constant expression +evaluation, then this overload will not be chosen and the provided string may +be used in a diagnostic if the compile fails as a result. + +Because the enable_if expression is an unevaluated context, there are no global +state changes, nor the ability to pass information from the enable_if +expression to the function body. For example, suppose we want calls to +strnlen(strbuf, maxlen) to resolve to strnlen_chk(strbuf, maxlen, size of +strbuf) only if the size of strbuf can be determined: + +.. code-block:: c++ + + __attribute__((always_inline)) + static inline size_t strnlen(const char *s, size_t maxlen) + __attribute__((overloadable)) + __attribute__((enable_if(__builtin_object_size(s, 0) != -1))), + "chosen when the buffer size is known but 'maxlen' is not"))) + { + return strnlen_chk(s, maxlen, __builtin_object_size(s, 0)); + } + +Multiple enable_if attributes may be applied to a single declaration. In this +case, the enable_if expressions are evaluated from left to right in the +following manner. First, the candidates whose enable_if expressions evaluate to +false or cannot be evaluated are discarded. If the remaining candidates do not +share ODR-equivalent enable_if expressions, the overload resolution is +ambiguous. Otherwise, enable_if overload resolution continues with the next +enable_if attribute on the candidates that have not been discarded and have +remaining enable_if attributes. In this way, we pick the most specific +overload out of a number of viable overloads using enable_if. + +.. code-block:: c++ + + void f() __attribute__((enable_if(true, ""))); // #1 + void f() __attribute__((enable_if(true, ""))) __attribute__((enable_if(true, ""))); // #2 + + void g(int i, int j) __attribute__((enable_if(i, ""))); // #1 + void g(int i, int j) __attribute__((enable_if(j, ""))) __attribute__((enable_if(true))); // #2 + +In this example, a call to f() is always resolved to #2, as the first enable_if +expression is ODR-equivalent for both declarations, but #1 does not have another +enable_if expression to continue evaluating, so the next round of evaluation has +only a single candidate. In a call to g(1, 1), the call is ambiguous even though +#2 has more enable_if attributes, because the first enable_if expressions are +not ODR-equivalent. + +Query for this feature with ``__has_attribute(enable_if)``. + +Note that functions with one or more ``enable_if`` attributes may not have +their address taken, unless all of the conditions specified by said +``enable_if`` are constants that evaluate to ``true``. For example: + +.. code-block:: c + + const int TrueConstant = 1; + const int FalseConstant = 0; + int f(int a) __attribute__((enable_if(a > 0, ""))); + int g(int a) __attribute__((enable_if(a == 0 || a != 0, ""))); + int h(int a) __attribute__((enable_if(1, ""))); + int i(int a) __attribute__((enable_if(TrueConstant, ""))); + int j(int a) __attribute__((enable_if(FalseConstant, ""))); + + void fn() { + int (*ptr)(int); + ptr = &f; // error: 'a > 0' is not always true + ptr = &g; // error: 'a == 0 || a != 0' is not a truthy constant + ptr = &h; // OK: 1 is a truthy constant + ptr = &i; // OK: 'TrueConstant' is a truthy constant + ptr = &j; // error: 'FalseConstant' is a constant, but not truthy + } + +Because ``enable_if`` evaluation happens during overload resolution, +``enable_if`` may give unintuitive results when used with templates, depending +on when overloads are resolved. In the example below, clang will emit a +diagnostic about no viable overloads for ``foo`` in ``bar``, but not in ``baz``: + +.. code-block:: c++ + + double foo(int i) __attribute__((enable_if(i > 0, ""))); + void *foo(int i) __attribute__((enable_if(i <= 0, ""))); + template + auto bar() { return foo(I); } + + template + auto baz() { return foo(T::number); } + + struct WithNumber { constexpr static int number = 1; }; + void callThem() { + bar(); + baz(); + } + +This is because, in ``bar``, ``foo`` is resolved prior to template +instantiation, so the value for ``I`` isn't known (thus, both ``enable_if`` +conditions for ``foo`` fail). However, in ``baz``, ``foo`` is resolved during +template instantiation, so the value for ``T::number`` is known. + + +external_source_symbol (clang::external_source_symbol) +------------------------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``external_source_symbol`` attribute specifies that a declaration originates +from an external source and describes the nature of that source. + +The fact that Clang is capable of recognizing declarations that were defined +externally can be used to provide better tooling support for mixed-language +projects or projects that rely on auto-generated code. For instance, an IDE that +uses Clang and that supports mixed-language projects can use this attribute to +provide a correct 'jump-to-definition' feature. For a concrete example, +consider a protocol that's defined in a Swift file: + +.. code-block:: swift + + @objc public protocol SwiftProtocol { + func method() + } + +This protocol can be used from Objective-C code by including a header file that +was generated by the Swift compiler. The declarations in that header can use +the ``external_source_symbol`` attribute to make Clang aware of the fact +that ``SwiftProtocol`` actually originates from a Swift module: + +.. code-block:: objc + + __attribute__((external_source_symbol(language="Swift",defined_in="module"))) + @protocol SwiftProtocol + @required + - (void) method; + @end + +Consequently, when 'jump-to-definition' is performed at a location that +references ``SwiftProtocol``, the IDE can jump to the original definition in +the Swift source file rather than jumping to the Objective-C declaration in the +auto-generated header file. + +The ``external_source_symbol`` attribute is a comma-separated list that includes +clauses that describe the origin and the nature of the particular declaration. +Those clauses can be: + +language=\ *string-literal* + The name of the source language in which this declaration was defined. + +defined_in=\ *string-literal* + The name of the source container in which the declaration was defined. The + exact definition of source container is language-specific, e.g. Swift's + source containers are modules, so ``defined_in`` should specify the Swift + module name. + +generated_declaration + This declaration was automatically generated by some tool. + +The clauses can be specified in any order. The clauses that are listed above are +all optional, but the attribute has to have at least one clause. + + +flatten (gnu::flatten) +---------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``flatten`` attribute causes calls within the attributed function to +be inlined unless it is impossible to do so, for example if the body of the +callee is unavailable or if the callee has the ``noinline`` attribute. + + +format (gnu::format) +-------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "" + +Clang supports the ``format`` attribute, which indicates that the function +accepts a ``printf`` or ``scanf``-like format string and corresponding +arguments or a ``va_list`` that contains these arguments. + +Please see `GCC documentation about format attribute +`_ to find details +about attribute syntax. + +Clang implements two kinds of checks with this attribute. + +#. Clang checks that the function with the ``format`` attribute is called with + a format string that uses format specifiers that are allowed, and that + arguments match the format string. This is the ``-Wformat`` warning, it is + on by default. + +#. Clang checks that the format string argument is a literal string. This is + the ``-Wformat-nonliteral`` warning, it is off by default. + + Clang implements this mostly the same way as GCC, but there is a difference + for functions that accept a ``va_list`` argument (for example, ``vprintf``). + GCC does not emit ``-Wformat-nonliteral`` warning for calls to such + functions. Clang does not warn if the format string comes from a function + parameter, where the function is annotated with a compatible attribute, + otherwise it warns. For example: + + .. code-block:: c + + __attribute__((__format__ (__scanf__, 1, 3))) + void foo(const char* s, char *buf, ...) { + va_list ap; + va_start(ap, buf); + + vprintf(s, ap); // warning: format string is not a string literal + } + + In this case we warn because ``s`` contains a format string for a + ``scanf``-like function, but it is passed to a ``printf``-like function. + + If the attribute is removed, clang still warns, because the format string is + not a string literal. + + Another example: + + .. code-block:: c + + __attribute__((__format__ (__printf__, 1, 3))) + void foo(const char* s, char *buf, ...) { + va_list ap; + va_start(ap, buf); + + vprintf(s, ap); // warning + } + + In this case Clang does not warn because the format string ``s`` and + the corresponding arguments are annotated. If the arguments are + incorrect, the caller of ``foo`` will receive a warning. + + +ifunc (gnu::ifunc) +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +``__attribute__((ifunc("resolver")))`` is used to mark that the address of a declaration should be resolved at runtime by calling a resolver function. + +The symbol name of the resolver function is given in quotes. A function with this name (after mangling) must be defined in the current translation unit; it may be ``static``. The resolver function should take no arguments and return a pointer. + +The ``ifunc`` attribute may only be used on a function declaration. A function declaration with an ``ifunc`` attribute is considered to be a definition of the declared entity. The entity must not have weak linkage; for example, in C++, it cannot be applied to a declaration if a definition at that location would be considered inline. + +Not all targets support this attribute. ELF targets support this attribute when using binutils v2.20.1 or higher and glibc v2.11.1 or higher. Non-ELF targets currently do not support this attribute. + + +internal_linkage (clang::internal_linkage) +------------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +The ``internal_linkage`` attribute changes the linkage type of the declaration to internal. +This is similar to C-style ``static``, but can be used on classes and class methods. When applied to a class definition, +this attribute affects all methods and static data members of that class. +This can be used to contain the ABI of a C++ library by excluding unwanted class methods from the export tables. + + +micromips (gnu::micromips) +-------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + + "X","X","","", "", "X" + +Clang supports the GNU style ``__attribute__((micromips))`` and +``__attribute__((nomicromips))`` attributes on MIPS targets. These attributes +may be attached to a function definition and instructs the backend to generate +or not to generate microMIPS code for that function. + +These attributes override the `-mmicromips` and `-mno-micromips` options +on the command line. + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute" + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jul 29 21:28:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13881DCB73B; Sat, 29 Jul 2017 21:28:17 +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 BD38A7CE8A; Sat, 29 Jul 2017 21:28:16 +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 v6TLSFiV068433; Sat, 29 Jul 2017 21:28:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLSFGi068432; Sat, 29 Jul 2017 21:28:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292128.v6TLSFGi068432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321694 - vendor/clang/clang-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_50-r309439 X-SVN-Commit-Revision: 321694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:28:17 -0000 Author: dim Date: Sat Jul 29 21:28:15 2017 New Revision: 321694 URL: https://svnweb.freebsd.org/changeset/base/321694 Log: Tag clang release_50 branch r309439. Added: vendor/clang/clang-release_50-r309439/ - copied from r321693, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:28:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A81B1DCB7FC; Sat, 29 Jul 2017 21:28:46 +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 5F0977D0D5; Sat, 29 Jul 2017 21:28:46 +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 v6TLSjVk068610; Sat, 29 Jul 2017 21:28:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLSjYL068609; Sat, 29 Jul 2017 21:28:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292128.v6TLSjYL068609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321695 - vendor/compiler-rt/compiler-rt-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_50-r309439 X-SVN-Commit-Revision: 321695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:28:46 -0000 Author: dim Date: Sat Jul 29 21:28:45 2017 New Revision: 321695 URL: https://svnweb.freebsd.org/changeset/base/321695 Log: Tag compiler-rt release_50 branch r309439. Added: vendor/compiler-rt/compiler-rt-release_50-r309439/ - copied from r321694, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:30:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1991CDCB88B; Sat, 29 Jul 2017 21:30:00 +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 D99757D2D5; Sat, 29 Jul 2017 21:29: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 v6TLTxdR068692; Sat, 29 Jul 2017 21:29:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLTxXd068691; Sat, 29 Jul 2017 21:29:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292129.v6TLTxXd068691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321696 - vendor/libc++/dist X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/dist X-SVN-Commit-Revision: 321696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:30:00 -0000 Author: dim Date: Sat Jul 29 21:29:58 2017 New Revision: 321696 URL: https://svnweb.freebsd.org/changeset/base/321696 Log: Vendor import of libc++ release_50 branch r309439: https://llvm.org/svn/llvm-project/libcxx/branches/release_50@309439 Modified: vendor/libc++/dist/CMakeLists.txt Modified: vendor/libc++/dist/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/CMakeLists.txt Sat Jul 29 21:28:45 2017 (r321695) +++ vendor/libc++/dist/CMakeLists.txt Sat Jul 29 21:29:58 2017 (r321696) @@ -23,7 +23,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR project(libcxx CXX C) set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 5.0.0svn) + set(PACKAGE_VERSION 5.0.0) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") From owner-svn-src-all@freebsd.org Sat Jul 29 21:30:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD4E7DCB89A; Sat, 29 Jul 2017 21:30:02 +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 941E87D2D8; Sat, 29 Jul 2017 21:30:02 +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 v6TLU137068763; Sat, 29 Jul 2017 21:30:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLU18p068762; Sat, 29 Jul 2017 21:30:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292130.v6TLU18p068762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321697 - vendor/libc++/libc++-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_50-r309439 X-SVN-Commit-Revision: 321697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:30:03 -0000 Author: dim Date: Sat Jul 29 21:30:01 2017 New Revision: 321697 URL: https://svnweb.freebsd.org/changeset/base/321697 Log: Tag libc++ release_50 branch r309439. Added: vendor/libc++/libc++-release_50-r309439/ - copied from r321696, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:30:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 862AFDCB90D; Sat, 29 Jul 2017 21:30:29 +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 4D7227D4FE; Sat, 29 Jul 2017 21:30:29 +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 v6TLUSFN068833; Sat, 29 Jul 2017 21:30:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLURIA068819; Sat, 29 Jul 2017 21:30:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292130.v6TLURIA068819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321698 - in vendor/lld/dist: COFF ELF docs lib/ReaderWriter/MachO test/COFF test/ELF test/ELF/Inputs X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist: COFF ELF docs lib/ReaderWriter/MachO test/COFF test/ELF test/ELF/Inputs X-SVN-Commit-Revision: 321698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:30:29 -0000 Author: dim Date: Sat Jul 29 21:30:27 2017 New Revision: 321698 URL: https://svnweb.freebsd.org/changeset/base/321698 Log: Vendor import of lld release_50 branch r309439: https://llvm.org/svn/llvm-project/lld/branches/release_50@309439 Added: vendor/lld/dist/test/ELF/Inputs/symver-archive1.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/symver-archive2.s (contents, props changed) vendor/lld/dist/test/ELF/symver-archive.s (contents, props changed) Modified: vendor/lld/dist/COFF/Config.h vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/docs/ReleaseNotes.rst vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp vendor/lld/dist/test/COFF/manifest.test vendor/lld/dist/test/COFF/manifestinput.test Modified: vendor/lld/dist/COFF/Config.h ============================================================================== --- vendor/lld/dist/COFF/Config.h Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/COFF/Config.h Sat Jul 29 21:30:27 2017 (r321698) @@ -130,7 +130,7 @@ struct Configuration { std::map Section; // Options for manifest files. - ManifestKind Manifest = SideBySide; + ManifestKind Manifest = No; int ManifestID = 1; StringRef ManifestDependency; bool ManifestUAC = true; Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/COFF/Driver.cpp Sat Jul 29 21:30:27 2017 (r321698) @@ -899,18 +899,25 @@ void LinkerDriver::link(ArrayRef ArgsArr for (auto *Arg : Args.filtered(OPT_section)) parseSection(Arg->getValue()); - // Handle /manifest - if (auto *Arg = Args.getLastArg(OPT_manifest_colon)) - parseManifest(Arg->getValue()); + // Handle /manifestdependency. This enables /manifest unless /manifest:no is + // also passed. + if (auto *Arg = Args.getLastArg(OPT_manifestdependency)) { + Config->ManifestDependency = Arg->getValue(); + Config->Manifest = Configuration::SideBySide; + } + // Handle /manifest and /manifest: + if (auto *Arg = Args.getLastArg(OPT_manifest, OPT_manifest_colon)) { + if (Arg->getOption().getID() == OPT_manifest) + Config->Manifest = Configuration::SideBySide; + else + parseManifest(Arg->getValue()); + } + // Handle /manifestuac if (auto *Arg = Args.getLastArg(OPT_manifestuac)) parseManifestUAC(Arg->getValue()); - // Handle /manifestdependency - if (auto *Arg = Args.getLastArg(OPT_manifestdependency)) - Config->ManifestDependency = Arg->getValue(); - // Handle /manifestfile if (auto *Arg = Args.getLastArg(OPT_manifestfile)) Config->ManifestFile = Arg->getValue(); @@ -918,6 +925,11 @@ void LinkerDriver::link(ArrayRef ArgsArr // Handle /manifestinput for (auto *Arg : Args.filtered(OPT_manifestinput)) Config->ManifestInput.push_back(Arg->getValue()); + + if (!Config->ManifestInput.empty() && + Config->Manifest != Configuration::Embed) { + fatal("/MANIFESTINPUT: requires /MANIFEST:EMBED"); + } // Handle miscellaneous boolean flags. if (Args.hasArg(OPT_allowisolation_no)) Modified: vendor/lld/dist/ELF/InputFiles.cpp ============================================================================== --- vendor/lld/dist/ELF/InputFiles.cpp Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/ELF/InputFiles.cpp Sat Jul 29 21:30:27 2017 (r321698) @@ -91,8 +91,7 @@ template void elf::ObjectFile::init template Optional elf::ObjectFile::getDILineInfo(InputSectionBase *S, uint64_t Offset) { - if (!DwarfLine) - initializeDwarfLine(); + llvm::call_once(InitDwarfLine, [this]() { initializeDwarfLine(); }); // The offset to CU is 0. const DWARFDebugLine::LineTable *Tbl = DwarfLine->getLineTable(0); Modified: vendor/lld/dist/ELF/InputFiles.h ============================================================================== --- vendor/lld/dist/ELF/InputFiles.h Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/ELF/InputFiles.h Sat Jul 29 21:30:27 2017 (r321698) @@ -24,6 +24,7 @@ #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" #include "llvm/Object/IRObjectFile.h" +#include "llvm/Support/Threading.h" #include @@ -211,6 +212,7 @@ template class ObjectFile : public ELFFil // single object file, so we cache debugging information in order to // parse it only once for each object file we link. std::unique_ptr DwarfLine; + llvm::once_flag InitDwarfLine; }; // LazyObjectFile is analogous to ArchiveFile in the sense that Modified: vendor/lld/dist/ELF/SymbolTable.cpp ============================================================================== --- vendor/lld/dist/ELF/SymbolTable.cpp Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/ELF/SymbolTable.cpp Sat Jul 29 21:30:27 2017 (r321698) @@ -211,6 +211,12 @@ static uint8_t getMinVisibility(uint8_t VA, uint8_t VB // Find an existing symbol or create and insert a new one. template std::pair SymbolTable::insert(StringRef Name) { + // @@ means the symbol is the default version. In that + // case @@ will be used to resolve references to . + size_t Pos = Name.find("@@"); + if (Pos != StringRef::npos) + Name = Name.take_front(Pos); + auto P = Symtab.insert( {CachedHashStringRef(Name), SymIndex((int)SymVector.size(), false)}); SymIndex &V = P.first->second; @@ -312,15 +318,36 @@ Symbol *SymbolTable::addUndefined(StringRef Name return S; } +// Using .symver foo,foo@@VER unfortunately creates two symbols: foo and +// foo@@VER. We want to effectively ignore foo, so give precedence to +// foo@@VER. +// FIXME: If users can transition to using +// .symver foo,foo@@@VER +// we can delete this hack. +static int compareVersion(Symbol *S, StringRef Name) { + if (Name.find("@@") != StringRef::npos && + S->body()->getName().find("@@") == StringRef::npos) + return 1; + if (Name.find("@@") == StringRef::npos && + S->body()->getName().find("@@") != StringRef::npos) + return -1; + return 0; +} + // We have a new defined symbol with the specified binding. Return 1 if the new // symbol should win, -1 if the new symbol should lose, or 0 if both symbols are // strong defined symbols. -static int compareDefined(Symbol *S, bool WasInserted, uint8_t Binding) { +static int compareDefined(Symbol *S, bool WasInserted, uint8_t Binding, + StringRef Name) { if (WasInserted) return 1; SymbolBody *Body = S->body(); if (!Body->isInCurrentDSO()) return 1; + + if (int R = compareVersion(S, Name)) + return R; + if (Binding == STB_WEAK) return -1; if (S->isWeak()) @@ -333,8 +360,9 @@ static int compareDefined(Symbol *S, bool WasInserted, // is a conflict. If the new symbol wins, also update the binding. template static int compareDefinedNonCommon(Symbol *S, bool WasInserted, uint8_t Binding, - bool IsAbsolute, typename ELFT::uint Value) { - if (int Cmp = compareDefined(S, WasInserted, Binding)) { + bool IsAbsolute, typename ELFT::uint Value, + StringRef Name) { + if (int Cmp = compareDefined(S, WasInserted, Binding, Name)) { if (Cmp > 0) S->Binding = Binding; return Cmp; @@ -362,7 +390,7 @@ Symbol *SymbolTable::addCommon(StringRef N, uint bool WasInserted; std::tie(S, WasInserted) = insert(N, Type, getVisibility(StOther), /*CanOmitFromDynSym*/ false, File); - int Cmp = compareDefined(S, WasInserted, Binding); + int Cmp = compareDefined(S, WasInserted, Binding, N); if (Cmp > 0) { S->Binding = Binding; replaceBody(S, N, Size, Alignment, StOther, Type, File); @@ -439,7 +467,7 @@ Symbol *SymbolTable::addRegular(StringRef Name, std::tie(S, WasInserted) = insert(Name, Type, getVisibility(StOther), /*CanOmitFromDynSym*/ false, File); int Cmp = compareDefinedNonCommon(S, WasInserted, Binding, - Section == nullptr, Value); + Section == nullptr, Value, Name); if (Cmp > 0) replaceBody(S, Name, /*IsLocal=*/false, StOther, Type, Value, Size, Section, File); @@ -485,7 +513,7 @@ Symbol *SymbolTable::addBitcode(StringRef Name, std::tie(S, WasInserted) = insert(Name, Type, getVisibility(StOther), CanOmitFromDynSym, F); int Cmp = compareDefinedNonCommon(S, WasInserted, Binding, - /*IsAbs*/ false, /*Value*/ 0); + /*IsAbs*/ false, /*Value*/ 0, Name); if (Cmp > 0) replaceBody(S, Name, /*IsLocal=*/false, StOther, Type, 0, 0, nullptr, F); @@ -717,32 +745,9 @@ void SymbolTable::assignWildcardVersion(SymbolVe B->symbol()->VersionId = VersionId; } -static bool isDefaultVersion(SymbolBody *B) { - return B->isInCurrentDSO() && B->getName().find("@@") != StringRef::npos; -} - // This function processes version scripts by updating VersionId // member of symbols. template void SymbolTable::scanVersionScript() { - // Symbol themselves might know their versions because symbols - // can contain versions in the form of @. - // Let them parse and update their names to exclude version suffix. - for (Symbol *Sym : SymVector) { - SymbolBody *Body = Sym->body(); - bool IsDefault = isDefaultVersion(Body); - Body->parseSymbolVersion(); - - if (!IsDefault) - continue; - - // @@ means the symbol is the default version. If that's the - // case, the symbol is not used only to resolve of version - // but also undefined unversioned symbols with name . - SymbolBody *S = find(Body->getName()); - if (S && S->isUndefined()) - S->copy(Body); - } - // Handle edge cases first. handleAnonymousVersion(); Modified: vendor/lld/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/lld/dist/docs/ReleaseNotes.rst Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/docs/ReleaseNotes.rst Sat Jul 29 21:30:27 2017 (r321698) @@ -1,5 +1,5 @@ ======================= -LLD 5.0.0 Release Notes +lld 5.0.0 Release Notes ======================= .. contents:: @@ -13,25 +13,170 @@ LLD 5.0.0 Release Notes Introduction ============ -This document contains the release notes for the LLD linker, release 5.0.0. -Here we describe the status of LLD, including major improvements -from the previous release. All LLD releases may be downloaded -from the `LLVM releases web site `_. +lld is a linker from the LLVM project. It supports ELF (Unix), COFF (Windows) +and Mach-O (macOS), and it is generally faster than the GNU bfd or gold linkers +or the MSVC linker. +lld is designed to be a drop-in replacement for the system linkers, so that +users don't need to change their build systems other than swapping the linker +command. + +All lld releases may be downloaded from the `LLVM releases web site +`_. + Non-comprehensive list of changes in this release ================================================= ELF Improvements ---------------- -* Item 1. +* First and foremost, a lot of compatibility issues and bugs have been fixed. + Linker script support has significantly improved. As a result, we believe you + are very likely to be able to link your programs with lld without experiencing + any problem now. +* Error message format has changed in order to improve readability. + Traditionally, linker's error messages are concise and arguably too terse. + This is an example of lld 4.0's error message (they are actually in one line):: + + /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:207: + undefined symbol 'lld::elf::EhFrameSection::addSection()' + + It is not easy to read because too much information is packed into a single line + and the embedded text, particularly a symbol name, is sometimes too long. + In lld 5.0, we use more vertical space to print out error messages in a more + structured manner like this:: + + bin/ld.lld: error: undefined symbol: lld::elf::EhFrameSection::addSection() + >>> Referenced by Writer.cpp:207 (/ssd/llvm-project/lld/ELF/Writer.cpp:207) + >>> Writer.cpp.o in archive lib/liblldELF.a + + As a bonus, the new error message contains source code location of the error + if it is available from debug info. + +* ``./configure`` scripts generated by GNU autoconf determines whether a linker + supports modern GNU-compatible features or not by searching for "GNU" in the + ``--help`` message. To be compatible with the scripts, we decided to add a + string "(compatible with GNU linkers)" to our ``--help`` message. This is a + hack, but just like the web browser's User-Agent string (which everyone still + claim they are "Mozilla/5.0"), we had no choice other than doing this to claim + that we accept GNU-compatible options. + +* The ``-Map`` option is added. The option is to make the linker to print out how + input files are mapped to the output file. Here is an example:: + + Address Size Align Out In Symbol + 00000000016d84d8 00000000008f8f50 8 .eh_frame + 00000000016d84d8 00000000008f8f50 8 :(.eh_frame) + 0000000001fd2000 00000000034b3bd0 16 .text + 0000000001fd2000 000000000000002a 1 /usr/lib/x86_64-linux-gnu/crt1.o:(.text) + 0000000001fd2000 0000000000000000 0 _start + 0000000001fd202a 0000000000000000 1 /usr/lib/x86_64-linux-gnu/crti.o:(.text) + 0000000001fd2030 00000000000000bd 16 /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o:(.text) + 0000000001fd2030 0000000000000000 0 deregister_tm_clones + 0000000001fd2060 0000000000000000 0 register_tm_clones + + This format is not the same as GNU linkers as our linker internal data + structure is different from them but contains the same amount of information + and should be more readable than their outputs. + + As with other lld features, the ``-Map`` option is designed with speed in mind. + The option would generate a hundred megabyte text file if you link a large + program with it. lld can usually do that in a few seconds, and it is generally + a few times faster than the GNU gold's ``-Map`` option. + +* lld's ``--gdb-index`` option used to be slow, but we sped it up so that it is + at least as fast as the GNU gold. + +* Some nonstandard relocations, such as R_X86_64_8 or R_X86_64_16, are supported. + They are not used for 32/64-bit applications, but some 16-bit bootloaders need + them. + +* Paddings in executable text sections are now filled with trap instructions + (such as INT3) instead of being left as null bytes. This change improves + disassembler outputs because it now prints out trap instructions instead of + trying to decode 0x00 as an instruction. It also makes debugging of some type + of program easier because when the control reaches a padding, the program + immediately raises an error. + +* The following options are added: ``-M``, ``-Map``, + ``-compress-debug-sections``, ``-emit-relocs``, + ``-error-unresolved-symbols``, ``-exclude-libs``, ``-filter``, + ``-no-dynamic-linker``, ``-no-export-dynamic``, ``-no-fatal-warnings``, + ``-print-map``, ``-warn-unresolved-symbols``, ``-z nocopyreloc``, + ``-z notext``, ``-z rodynamic`` + + COFF Improvements ----------------- * Item 1. -MachO Improvements ------------------- +Contributors to lld 5.0 +======================= -* Item 1. +We had 63 individuals contribute to lld 5.0. Thank you so much! + +- Adrian McCarthy +- Alberto Magni +- Alexander Richardson +- Andre Vieira +- Andrew Ng +- Anton Korobeynikov +- Bob Haarman +- David Blaikie +- Davide Italiano +- David L. Jones +- Dmitry Mikulin +- Ed Maste +- Ed Schouten +- Eric Beckmann +- Eric Fiselier +- Eugene Leviant +- Evgeniy Stepanov +- Galina Kistanova +- George Rimar +- Hans Wennborg +- Igor Kudrin +- Ismail Donmez +- Jake Ehrlich +- James Henderson +- Joel Jones +- Jon Chesterfield +- Kamil Rytarowski +- Kevin Enderby +- Konstantin Zhuravlyov +- Kyungwoo Lee +- Leslie Zhai +- Mark Kettenis +- Martell Malone +- Martin Storsjo +- Meador Inge +- Mehdi Amini +- Michal Gorny +- NAKAMURA Takumi +- Paul Robinson +- Pavel Labath +- Petar Jovanovic +- Peter Collingbourne +- Peter Smith +- Petr Hosek +- Rafael Espindola +- Reid Kleckner +- Richard Smith +- Robert Clarke +- Rui Ueyama +- Saleem Abdulrasool +- Sam Clegg +- Sean Eveson +- Sean Silva +- Shankar Easwaran +- Shoaib Meenai +- Simon Atanasyan +- Simon Dardis +- Simon Tatham +- Sylvestre Ledru +- Tom Stellard +- Vitaly Buka +- Yuka Takahashi +- Zachary Turner Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp Sat Jul 29 21:30:27 2017 (r321698) @@ -11,6 +11,7 @@ #include "ArchHandler.h" #include "File.h" +#include "MachONormalizedFileBinaryUtils.h" #include "MachOPasses.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" @@ -29,7 +30,7 @@ namespace mach_o { /// class ObjCImageInfoAtom : public SimpleDefinedAtom { public: - ObjCImageInfoAtom(const File &file, + ObjCImageInfoAtom(const File &file, bool isBig, MachOLinkingContext::ObjCConstraint objCConstraint, uint32_t swiftVersion) : SimpleDefinedAtom(file) { @@ -54,6 +55,8 @@ class ObjCImageInfoAtom : public SimpleDefinedAtom { ( } Data.info.flags |= (swiftVersion << 8); + + normalized::write32(Data.bytes + 4, Data.info.flags, isBig); } ~ObjCImageInfoAtom() override = default; @@ -109,7 +112,8 @@ class ObjCPass : public Pass { (public) private: const DefinedAtom* getImageInfo() { - return new (_file.allocator()) ObjCImageInfoAtom(_file, + bool IsBig = MachOLinkingContext::isBigEndian(_ctx.arch()); + return new (_file.allocator()) ObjCImageInfoAtom(_file, IsBig, _ctx.objcConstraint(), _ctx.swiftVersion()); } Modified: vendor/lld/dist/test/COFF/manifest.test ============================================================================== --- vendor/lld/dist/test/COFF/manifest.test Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/test/COFF/manifest.test Sat Jul 29 21:30:27 2017 (r321698) @@ -1,6 +1,10 @@ # RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj +# RUN: rm -f %t.exe.manifest # RUN: lld-link /out:%t.exe /entry:main %t.obj +# RUN: test ! -e %t.exe.manifest + +# RUN: lld-link /manifest /out:%t.exe /entry:main %t.obj # RUN: FileCheck -check-prefix=MANIFEST %s < %t.exe.manifest MANIFEST: @@ -15,7 +19,7 @@ MANIFEST: MANIFEST: MANIFEST: -# RUN: lld-link /out:%t.exe /entry:main \ +# RUN: lld-link /out:%t.exe /entry:main /manifest \ # RUN: /manifestuac:"level='requireAdministrator' uiAccess='true'" %t.obj # RUN: FileCheck -check-prefix=UAC %s < %t.exe.manifest @@ -31,6 +35,7 @@ UAC: UAC: UAC: +# /manifestdependency implies /manifest. (/manifestuac doesn't.) # RUN: lld-link /out:%t.exe /entry:main \ # RUN: /manifestdependency:"foo='bar'" %t.obj # RUN: FileCheck -check-prefix=DEPENDENCY %s < %t.exe.manifest @@ -52,7 +57,7 @@ DEPENDENCY: DEPENDENCY: DEPENDENCY: -# RUN: lld-link /out:%t.exe /entry:main /manifestuac:no %t.obj +# RUN: lld-link /manifest /out:%t.exe /entry:main /manifestuac:no %t.obj # RUN: FileCheck -check-prefix=NOUAC %s < %t.exe.manifest NOUAC: Modified: vendor/lld/dist/test/COFF/manifestinput.test ============================================================================== --- vendor/lld/dist/test/COFF/manifestinput.test Sat Jul 29 21:30:01 2017 (r321697) +++ vendor/lld/dist/test/COFF/manifestinput.test Sat Jul 29 21:30:27 2017 (r321698) @@ -2,15 +2,6 @@ # RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj # RUN: lld-link /out:%t.exe /entry:main \ -# RUN: /manifestuac:"level='requireAdministrator'" \ -# RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj -# RUN: FileCheck %s < %t.exe.manifest - -CHECK: -CHECK: - -# RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj -# RUN: lld-link /out:%t.exe /entry:main \ # RUN: /manifest:embed \ # RUN: /manifestuac:"level='requireAdministrator'" \ # RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj Added: vendor/lld/dist/test/ELF/Inputs/symver-archive1.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/Inputs/symver-archive1.s Sat Jul 29 21:30:27 2017 (r321698) @@ -0,0 +1,6 @@ +.text +.globl x +.type x, @function +x: + +.symver x, xx@@VER Added: vendor/lld/dist/test/ELF/Inputs/symver-archive2.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/Inputs/symver-archive2.s Sat Jul 29 21:30:27 2017 (r321698) @@ -0,0 +1 @@ +call xx@PLT Added: vendor/lld/dist/test/ELF/symver-archive.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/symver-archive.s Sat Jul 29 21:30:27 2017 (r321698) @@ -0,0 +1,15 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1 +# RUN: rm -f %t.a +# RUN: llvm-ar rcs %t.a %t1 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symver-archive1.s -o %t2.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symver-archive2.s -o %t3.o +# RUN: ld.lld -o %t.out %t2.o %t3.o %t.a + +.text +.globl x +.type x, @function +x: + +.globl xx +xx = x From owner-svn-src-all@freebsd.org Sat Jul 29 21:30:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6689ADCB913; Sat, 29 Jul 2017 21:30:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D82A7D50C; Sat, 29 Jul 2017 21:30:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TLUV1v068879; Sat, 29 Jul 2017 21:30:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLUVG2068878; Sat, 29 Jul 2017 21:30:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292130.v6TLUVG2068878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321699 - vendor/lld/lld-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_50-r309439 X-SVN-Commit-Revision: 321699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:30:32 -0000 Author: dim Date: Sat Jul 29 21:30:31 2017 New Revision: 321699 URL: https://svnweb.freebsd.org/changeset/base/321699 Log: Tag lld release_50 branch r309439. Added: vendor/lld/lld-release_50-r309439/ - copied from r321698, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:31:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57C51DCBAFE; Sat, 29 Jul 2017 21:31: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 0F02B7D92E; Sat, 29 Jul 2017 21:31:55 +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 v6TLVtRr072736; Sat, 29 Jul 2017 21:31:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLVt04072735; Sat, 29 Jul 2017 21:31:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292131.v6TLVt04072735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321701 - vendor/lldb/lldb-release_50-r309439 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_50-r309439 X-SVN-Commit-Revision: 321701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:31:56 -0000 Author: dim Date: Sat Jul 29 21:31:54 2017 New Revision: 321701 URL: https://svnweb.freebsd.org/changeset/base/321701 Log: Tag lldb release_50 branch r309439. Added: vendor/lldb/lldb-release_50-r309439/ - copied from r321700, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Sat Jul 29 21:31:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A660DCBAEF; Sat, 29 Jul 2017 21:31:53 +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 3635E7D923; Sat, 29 Jul 2017 21:31:53 +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 v6TLVqd9072687; Sat, 29 Jul 2017 21:31:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TLVpwT072680; Sat, 29 Jul 2017 21:31:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707292131.v6TLVpwT072680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Jul 2017 21:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r321700 - in vendor/lldb/dist: include/lldb/API scripts/interface X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lldb/dist: include/lldb/API scripts/interface X-SVN-Commit-Revision: 321700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 21:31:53 -0000 Author: dim Date: Sat Jul 29 21:31:51 2017 New Revision: 321700 URL: https://svnweb.freebsd.org/changeset/base/321700 Log: Vendor import of lldb release_50 branch r309439: https://llvm.org/svn/llvm-project/lldb/branches/release_50@309439 Modified: vendor/lldb/dist/include/lldb/API/SBAttachInfo.h vendor/lldb/dist/include/lldb/API/SBBreakpoint.h vendor/lldb/dist/include/lldb/API/SBProcess.h vendor/lldb/dist/scripts/interface/SBBreakpoint.i vendor/lldb/dist/scripts/interface/SBModule.i vendor/lldb/dist/scripts/interface/SBSymbol.i Modified: vendor/lldb/dist/include/lldb/API/SBAttachInfo.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBAttachInfo.h Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/include/lldb/API/SBAttachInfo.h Sat Jul 29 21:31:51 2017 (r321700) @@ -162,7 +162,7 @@ class LLDB_API SBAttachInfo { (public) /// Get the listener that will be used to receive process events. /// /// If no listener has been set via a call to - /// SBLaunchInfo::SetListener(), then an invalid SBListener will be + /// SBAttachInfo::SetListener(), then an invalid SBListener will be /// returned (SBListener::IsValid() will return false). If a listener /// has been set, then the valid listener object will be returned. //---------------------------------------------------------------------- Modified: vendor/lldb/dist/include/lldb/API/SBBreakpoint.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBBreakpoint.h Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/include/lldb/API/SBBreakpoint.h Sat Jul 29 21:31:51 2017 (r321700) @@ -154,9 +154,9 @@ class LLDB_API SBBreakpointList { (public) SBBreakpoint FindBreakpointByID(lldb::break_id_t); - void Append(const SBBreakpoint &sb_file); + void Append(const SBBreakpoint &sb_bkpt); - bool AppendIfUnique(const SBBreakpoint &sb_file); + bool AppendIfUnique(const SBBreakpoint &sb_bkpt); void AppendByID(lldb::break_id_t id); Modified: vendor/lldb/dist/include/lldb/API/SBProcess.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBProcess.h Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/include/lldb/API/SBProcess.h Sat Jul 29 21:31:51 2017 (r321700) @@ -350,7 +350,7 @@ class LLDB_API SBProcess { (public) bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); - // Save the state of the process in a core file (or mini dump on Windows). + /// Save the state of the process in a core file (or mini dump on Windows). lldb::SBError SaveCore(const char *file_name); //------------------------------------------------------------------ Modified: vendor/lldb/dist/scripts/interface/SBBreakpoint.i ============================================================================== --- vendor/lldb/dist/scripts/interface/SBBreakpoint.i Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/scripts/interface/SBBreakpoint.i Sat Jul 29 21:31:51 2017 (r321700) @@ -70,7 +70,7 @@ SBBreakpoint supports breakpoint location iteration, f print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) print('breakpoint location condition: %s' % hex(bl.GetCondition())) -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if aBreakpoint == bBreakpoint: ... Modified: vendor/lldb/dist/scripts/interface/SBModule.i ============================================================================== --- vendor/lldb/dist/scripts/interface/SBModule.i Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/scripts/interface/SBModule.i Sat Jul 29 21:31:51 2017 (r321700) @@ -26,7 +26,7 @@ SBModule supports symbol iteration, for example, saddr = symbol.GetStartAddress() eaddr = symbol.GetEndAddress() -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if thisModule == thatModule: print('This module is the same as that module') Modified: vendor/lldb/dist/scripts/interface/SBSymbol.i ============================================================================== --- vendor/lldb/dist/scripts/interface/SBSymbol.i Sat Jul 29 21:30:31 2017 (r321699) +++ vendor/lldb/dist/scripts/interface/SBSymbol.i Sat Jul 29 21:31:51 2017 (r321700) @@ -11,7 +11,7 @@ namespace lldb { %feature("docstring", "Represents the symbol possibly associated with a stack frame. -SBModule contains SBSymbol(s). SBSymbol can also be retrived from SBFrame. +SBModule contains SBSymbol(s). SBSymbol can also be retrieved from SBFrame. See also SBModule and SBFrame." ) SBSymbol; From owner-svn-src-all@freebsd.org Sat Jul 29 22:01:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF70CDCC359; Sat, 29 Jul 2017 22:01:18 +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 B9E437E42E; Sat, 29 Jul 2017 22:01:18 +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 v6TM1HlC081076; Sat, 29 Jul 2017 22:01:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TM1Hvb081075; Sat, 29 Jul 2017 22:01:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707292201.v6TM1Hvb081075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 29 Jul 2017 22:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321702 - head/tests/sys/geom/class/gate X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/tests/sys/geom/class/gate X-SVN-Commit-Revision: 321702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 22:01:19 -0000 Author: ngie Date: Sat Jul 29 22:01:17 2017 New Revision: 321702 URL: https://svnweb.freebsd.org/changeset/base/321702 Log: Load geom_gate(4) if necessary before running tests; skip if it can't be loaded The test code prior to r311893 loaded geom_gate at test start if necessary and skipped the tests if it couldn't be loaded. The ATF-ifcation of this test done in r311893 unfortunately dropped this functionality. This change restores the geom_gate module load and skips the test(s) if unavailable in an ATF-like way. MFC after: 1 month PR: 220164 Reported by: gjb Modified: head/tests/sys/geom/class/gate/ggate_test.sh Modified: head/tests/sys/geom/class/gate/ggate_test.sh ============================================================================== --- head/tests/sys/geom/class/gate/ggate_test.sh Sat Jul 29 21:31:54 2017 (r321701) +++ head/tests/sys/geom/class/gate/ggate_test.sh Sat Jul 29 22:01:17 2017 (r321702) @@ -16,6 +16,8 @@ ggated_head() ggated_body() { + load_ggate + us=$(alloc_ggate_dev) work=$(alloc_md) src=$(alloc_md) @@ -57,6 +59,8 @@ ggatel_file_head() ggatel_file_body() { + load_ggate + us=$(alloc_ggate_dev) echo src work >> ${PLAINFILES} @@ -91,6 +95,8 @@ ggatel_md_head() ggatel_md_body() { + load_ggate + us=$(alloc_ggate_dev) work=$(alloc_md) src=$(alloc_md) @@ -193,6 +199,19 @@ common_cleanup() rm md.devs fi true +} + +load_ggate() +{ + local class=gate + + # If the geom class isn't already loaded, try loading it. + if ! kldstat -q -m g_${class}; then + if ! geom ${class} load; then + atf_skip "could not load module for geom class=${class}" + exit 0 + fi + fi } # Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create` From owner-svn-src-all@freebsd.org Sat Jul 29 22:03:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0E1ADCC4EE; Sat, 29 Jul 2017 22:03: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 9F9697E732; Sat, 29 Jul 2017 22:03: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 v6TM3Lnl085030; Sat, 29 Jul 2017 22:03:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TM3LcU085029; Sat, 29 Jul 2017 22:03:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707292203.v6TM3LcU085029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 29 Jul 2017 22:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321703 - head/tests/sys/geom/class/gate X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/tests/sys/geom/class/gate X-SVN-Commit-Revision: 321703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 22:03:22 -0000 Author: ngie Date: Sat Jul 29 22:03:21 2017 New Revision: 321703 URL: https://svnweb.freebsd.org/changeset/base/321703 Log: Remove superfluous `exit 0` added in r321702 atf_skip triggers equivalent functionality, which means the `exit 0` is unreachable code. PR: 220164 MFC after: 1 month MFC with: r321702 Modified: head/tests/sys/geom/class/gate/ggate_test.sh Modified: head/tests/sys/geom/class/gate/ggate_test.sh ============================================================================== --- head/tests/sys/geom/class/gate/ggate_test.sh Sat Jul 29 22:01:17 2017 (r321702) +++ head/tests/sys/geom/class/gate/ggate_test.sh Sat Jul 29 22:03:21 2017 (r321703) @@ -209,7 +209,6 @@ load_ggate() if ! kldstat -q -m g_${class}; then if ! geom ${class} load; then atf_skip "could not load module for geom class=${class}" - exit 0 fi fi } From owner-svn-src-all@freebsd.org Sat Jul 29 22:16:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F0C9DCC6E0; Sat, 29 Jul 2017 22:16:06 +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 44AB17EB17; Sat, 29 Jul 2017 22:16:06 +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 v6TMG5JK089245; Sat, 29 Jul 2017 22:16:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TMG5Qh089244; Sat, 29 Jul 2017 22:16:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707292216.v6TMG5Qh089244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 29 Jul 2017 22:16:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321704 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 321704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 22:16:06 -0000 Author: ngie Date: Sat Jul 29 22:16:05 2017 New Revision: 321704 URL: https://svnweb.freebsd.org/changeset/base/321704 Log: Add sys/socket.h to SYNOPSIS for libprocstat(3) sys/socket.h is required for procstat_get_socket_info(3), added in r221807. MFC after: 1 month PR: 217884 Submitted by: tobik Modified: head/lib/libprocstat/libprocstat.3 Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:03:21 2017 (r321703) +++ head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:16:05 2017 (r321704) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 27, 2017 +.Dd July 29, 2017 .Dt LIBPROCSTAT 3 .Os .Sh NAME @@ -66,6 +66,7 @@ .Sh SYNOPSIS .In sys/param.h .In sys/queue.h +.In sys/socket.h .In libprocstat.h .Ft void .Fn procstat_close "struct procstat *procstat" From owner-svn-src-all@freebsd.org Sat Jul 29 22:19:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA604DCC770; Sat, 29 Jul 2017 22:19:01 +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 6C7FD7EC6B; Sat, 29 Jul 2017 22:19:01 +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 v6TMJ0o1089398; Sat, 29 Jul 2017 22:19:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TMJ0kZ089397; Sat, 29 Jul 2017 22:19:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707292219.v6TMJ0kZ089397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 29 Jul 2017 22:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321705 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 321705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 22:19:01 -0000 Author: ngie Date: Sat Jul 29 22:19:00 2017 New Revision: 321705 URL: https://svnweb.freebsd.org/changeset/base/321705 Log: libprocstat(3): fix reference (typo) to procstat_freeenvv in description for procstat_getargv(3) PR: 217884 MFC after: 1 month Submitted by: tobik Modified: head/lib/libprocstat/libprocstat.3 Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:16:05 2017 (r321704) +++ head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:19:00 2017 (r321705) @@ -379,7 +379,7 @@ function is similar to .Fn procstat_getargv but returns the vector of environment strings. The caller may free the allocated memory with a subsequent -.Fn procstat_freeenv +.Fn procstat_freeenvv function call. .Pp The From owner-svn-src-all@freebsd.org Sat Jul 29 22:25:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1046BDCC9C2; Sat, 29 Jul 2017 22:25:47 +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 D2D857F0BE; Sat, 29 Jul 2017 22:25:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TMPjKv093210; Sat, 29 Jul 2017 22:25:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TMPjkx093209; Sat, 29 Jul 2017 22:25:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707292225.v6TMPjkx093209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 29 Jul 2017 22:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321706 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 321706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 22:25:47 -0000 Author: ngie Date: Sat Jul 29 22:25:45 2017 New Revision: 321706 URL: https://svnweb.freebsd.org/changeset/base/321706 Log: libprocstat(3): fix arguments list for procstat_getargv(3) and procstat_getenvv(3) Neither libcall takes a fourth argument (`char *errbuf`). PR: 217884 Submitted by: tobik MFC after: 1 month Modified: head/lib/libprocstat/libprocstat.3 Modified: head/lib/libprocstat/libprocstat.3 ============================================================================== --- head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:19:00 2017 (r321705) +++ head/lib/libprocstat/libprocstat.3 Sat Jul 29 22:25:45 2017 (r321706) @@ -157,7 +157,6 @@ .Fa "struct procstat *procstat" .Fa "const struct kinfo_proc *kp" .Fa "size_t nchr" -.Fa "char *errbuf" .Fc .Ft "Elf_Auxinfo *" .Fo procstat_getauxv @@ -170,7 +169,6 @@ .Fa "struct procstat *procstat" .Fa "const struct kinfo_proc *kp" .Fa "size_t nchr" -.Fa "char *errbuf" .Fc .Ft "struct filestat_list *" .Fo procstat_getfiles From owner-svn-src-all@freebsd.org Sat Jul 29 23:31:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5630BDCD82A; Sat, 29 Jul 2017 23:31:22 +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 243638070A; Sat, 29 Jul 2017 23:31:22 +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 v6TNVLv1017764; Sat, 29 Jul 2017 23:31:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TNVLLO017763; Sat, 29 Jul 2017 23:31:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201707292331.v6TNVLLO017763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 29 Jul 2017 23:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321707 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 23:31:22 -0000 Author: cem Date: Sat Jul 29 23:31:21 2017 New Revision: 321707 URL: https://svnweb.freebsd.org/changeset/base/321707 Log: kldstat: Use sizeof in place of named constants for sizing No functional change. This is handy for FreeBSD derivatives that want to modify the value of MAXPATHLEN, but not the kld_file_stat ABI. Submitted by: Siddhant Agarwal Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Jul 29 22:25:45 2017 (r321706) +++ head/sys/kern/kern_linker.c Sat Jul 29 23:31:21 2017 (r321707) @@ -1243,8 +1243,8 @@ kern_kldstat(struct thread *td, int fileid, struct kld /* Version 1 fields: */ namelen = strlen(lf->filename) + 1; - if (namelen > MAXPATHLEN) - namelen = MAXPATHLEN; + if (namelen > sizeof(stat->name)) + namelen = sizeof(stat->name); bcopy(lf->filename, &stat->name[0], namelen); stat->refs = lf->refs; stat->id = lf->id; @@ -1252,8 +1252,8 @@ kern_kldstat(struct thread *td, int fileid, struct kld stat->size = lf->size; /* Version 2 fields: */ namelen = strlen(lf->pathname) + 1; - if (namelen > MAXPATHLEN) - namelen = MAXPATHLEN; + if (namelen > sizeof(stat->pathname)) + namelen = sizeof(stat->pathname); bcopy(lf->pathname, &stat->pathname[0], namelen); sx_xunlock(&kld_sx); From owner-svn-src-all@freebsd.org Sat Jul 29 23:45:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7D8FDCDAA6; Sat, 29 Jul 2017 23:45:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B29D480C42; Sat, 29 Jul 2017 23:45:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TNjwwH025617; Sat, 29 Jul 2017 23:45:58 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TNjvSb025615; Sat, 29 Jul 2017 23:45:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707292345.v6TNjvSb025615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 29 Jul 2017 23:45:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321708 - in head/sys: conf dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: conf dev/iicbus X-SVN-Commit-Revision: 321708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 23:45:59 -0000 Author: ian Date: Sat Jul 29 23:45:57 2017 New Revision: 321708 URL: https://svnweb.freebsd.org/changeset/base/321708 Log: Replace the pcf8563 i2c RTC driver with a new nxprtc driver which handles all the chips in the NXP PCA212x and PCA/PCF85xx series. In addition to supporting more chips, this driver uses the countdown timer on the chips as a fractional seconds counter, giving it a resolution of about 15 milliseconds. Added: head/sys/dev/iicbus/nxprtc.c (contents, props changed) Deleted: head/sys/dev/iicbus/pcf8563.c head/sys/dev/iicbus/pcf8563reg.h Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jul 29 23:31:21 2017 (r321707) +++ head/sys/conf/files Sat Jul 29 23:45:57 2017 (r321708) @@ -1737,8 +1737,8 @@ dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/iicbus/iicoc.c optional iicoc dev/iicbus/lm75.c optional lm75 +dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus -dev/iicbus/pcf8563.c optional pcf8563 dev/iicbus/s35390a.c optional s35390a dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir Added: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/nxprtc.c Sat Jul 29 23:45:57 2017 (r321708) @@ -0,0 +1,787 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for NXP real-time clock/calendar chips: + * - PCF8563 = low power, countdown timer + * - PCA8565 = like PCF8563, automotive temperature range + * - PCF8523 = low power, countdown timer, oscillator freq tuning, 2 timers + * - PCF2127 = like PCF8523, industrial, tcxo, tamper/ts, i2c & spi, 512B ram + * - PCA2129 = like PCF8523, automotive, tcxo, tamper/ts, i2c & spi, no timer + * - PCF2129 = like PCF8523, industrial, tcxo, tamper/ts, i2c & spi, no timer + * + * Most chips have a countdown timer, ostensibly intended to generate periodic + * interrupt signals on an output pin. The timer is driven from the same + * divider chain that clocks the time of day registers, and they start counting + * in sync when the STOP bit is cleared after the time and timer registers are + * set. The timer register can also be read on the fly, so we use it to count + * fractional seconds and get a resolution of ~15ms. + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#ifdef FDT +#include +#include +#include +#endif + +#include "clock_if.h" +#include "iicbus_if.h" + +/* + * I2C address 1010 001x : PCA2129 PCF2127 PCF2129 PCF8563 PCF8565 + * I2C address 1101 000x : PCF8523 + */ +#define PCF8563_ADDR 0xa2 +#define PCF8523_ADDR 0xd0 + +/* + * Registers, bits within them, and masks that are common to all chip types. + */ +#define PCF85xx_R_CS1 0x00 /* CS1 and CS2 control regs are in */ +#define PCF85xx_R_CS2 0x01 /* the same location on all chips. */ + +#define PCF85xx_B_CS1_STOP 0x20 /* Stop time incrementing bit */ +#define PCF85xx_B_SECOND_OS 0x80 /* Oscillator Stopped bit */ + +#define PCF85xx_M_SECOND 0x7f /* Masks for all BCD time regs... */ +#define PCF85xx_M_MINUTE 0x7f +#define PCF85xx_M_HOUR 0x3f +#define PCF85xx_M_DAY 0x3f +#define PCF85xx_M_MONTH 0x1f +#define PCF85xx_M_YEAR 0xff + +/* + * PCF2127-specific registers, bits, and masks. + */ +#define PCF2127_R_TMR_CTL 0x10 /* Timer/watchdog control */ + +#define PCF2127_M_TMR_CTRL 0xe3 /* Mask off undef bits */ + +#define PCF2127_B_TMR_CD 0x40 /* Run in countdown mode */ +#define PCF2127_B_TMR_64HZ 0x01 /* Timer frequency 64Hz */ + +/* + * PCA/PCF2129-specific registers, bits, and masks. + */ +#define PCF2129_B_CS1_12HR 0x04 /* Use 12-hour (AM/PM) mode bit */ +#define PCF2129_B_CLKOUT_OTPR 0x20 /* OTP refresh command */ +#define PCF2129_B_CLKOUT_HIGHZ 0x07 /* Clock Out Freq = disable */ + +/* + * PCF8523-specific registers, bits, and masks. + */ +#define PCF8523_R_CS3 0x02 /* Control and status reg 3 */ +#define PCF8523_R_SECOND 0x03 /* Seconds */ +#define PCF8523_R_TMR_CLKOUT 0x0F /* Timer and clockout control */ +#define PCF8523_R_TMR_A_FREQ 0x10 /* Timer A frequency control */ +#define PCF8523_R_TMR_A_COUNT 0x11 /* Timer A count */ + +#define PCF8523_M_TMR_A_FREQ 0x07 /* Mask off undef bits */ + +#define PCF8523_B_HOUR_PM 0x20 /* PM bit */ +#define PCF8523_B_CS1_SOFTRESET 0x58 /* Initiate Soft Reset bits */ +#define PCF8523_B_CS1_12HR 0x08 /* Use 12-hour (AM/PM) mode bit */ +#define PCF8523_B_CLKOUT_TACD 0x02 /* TimerA runs in CountDown mode */ +#define PCF8523_B_CLKOUT_HIGHZ 0x38 /* Clock Out Freq = disable */ +#define PCF8523_B_TMR_A_64HZ 0x01 /* Timer A freq 64Hz */ + +#define PCF8523_M_CS3_PM 0xE0 /* Power mode mask */ +#define PCF8523_B_CS3_PM_NOBAT 0xE0 /* PM bits: no battery usage */ +#define PCF8523_B_CS3_PM_STD 0x00 /* PM bits: standard */ +#define PCF8523_B_CS3_BLF 0x04 /* Battery Low Flag bit */ + +/* + * PCF8563-specific registers, bits, and masks. + */ +#define PCF8563_R_SECOND 0x02 /* Seconds */ +#define PCF8563_R_TMR_CTRL 0x0e /* Timer control */ +#define PCF8563_R_TMR_COUNT 0x0f /* Timer count */ + +#define PCF8563_M_TMR_CTRL 0x93 /* Mask off undef bits */ + +#define PCF8563_B_TMR_ENABLE 0x80 /* Enable countdown timer */ +#define PCF8563_B_TMR_64HZ 0x01 /* Timer frequency 64Hz */ + +#define PCF8563_B_MONTH_C 0x80 /* Century bit */ + +/* + * We use the countdown timer for fractional seconds. We program it for 64 Hz, + * the fastest available rate that doesn't roll over in less than a second. + */ +#define TMR_TICKS_SEC 64 +#define TMR_TICKS_HALFSEC 32 + +/* + * The chip types we support. + */ +enum { + TYPE_NONE, + TYPE_PCA2129, + TYPE_PCA8565, + TYPE_PCF2127, + TYPE_PCF2129, + TYPE_PCF8523, + TYPE_PCF8563, + + TYPE_COUNT +}; +static const char *desc_strings[] = { + "", + "NXP PCA2129 RTC", + "NXP PCA8565 RTC", + "NXP PCF2127 RTC", + "NXP PCF2129 RTC", + "NXP PCF8523 RTC", + "NXP PCF8563 RTC", +}; +CTASSERT(nitems(desc_strings) == TYPE_COUNT); + +/* + * The time registers in the order they are laid out in hardware. + */ +struct time_regs { + uint8_t sec, min, hour, day, wday, month, year; +}; + +struct nxprtc_softc { + device_t dev; + device_t busdev; + struct intr_config_hook + config_hook; + u_int flags; /* SC_F_* flags */ + u_int chiptype; /* Type of PCF85xx chip */ + uint8_t secaddr; /* Address of seconds register */ + uint8_t tmcaddr; /* Address of timer count register */ + uint8_t slave_addr; /* PCF85xx slave address */ + bool use_timer; /* Use timer for fractional sec */ +}; + +#define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ +#define SC_F_AMPM (1 << 1) /* Use PM flag in hours reg */ + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"nxp,pca2129", TYPE_PCA2129}, + {"nxp,pca8565", TYPE_PCA8565}, + {"nxp,pcf2127", TYPE_PCF2127}, + {"nxp,pcf2129", TYPE_PCF2129}, + {"nxp,pcf8523", TYPE_PCF8523}, + {"nxp,pcf8563", TYPE_PCF8563}, + + /* Undocumented compat strings known to exist in the wild... */ + {"pcf8563", TYPE_PCF8563}, + {"phg,pcf8563", TYPE_PCF8563}, + {"philips,pcf8563", TYPE_PCF8563}, + + {NULL, TYPE_NONE}, +}; +#endif + +static int +read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val) +{ + + return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), IIC_WAIT)); +} + +static int +write_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t val) +{ + + return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), IIC_WAIT)); +} + +static int +read_timeregs(struct nxprtc_softc *sc, struct time_regs *tregs, uint8_t *tmr) +{ + int err; + uint8_t sec, tmr1, tmr2; + + /* + * The datasheet says loop to read the same timer value twice because it + * does not freeze while reading. To that we add our own logic that + * the seconds register must be the same before and after reading the + * timer, ensuring the fractional part is from the same second as tregs. + */ + do { + if (sc->use_timer) { + if ((err = read_reg(sc, sc->secaddr, &sec)) != 0) + break; + if ((err = read_reg(sc, sc->tmcaddr, &tmr1)) != 0) + break; + if ((err = read_reg(sc, sc->tmcaddr, &tmr2)) != 0) + break; + if (tmr1 != tmr2) + continue; + } + if ((err = iicdev_readfrom(sc->dev, sc->secaddr, tregs, + sizeof(*tregs), IIC_WAIT)) != 0) + break; + } while (sc->use_timer && tregs->sec != sec); + + /* + * If the timer value is greater than our hz rate (or is zero), + * something is wrong. Maybe some other OS used the timer differently? + * Just set it to zero. Likewise if we're not using the timer. After + * the offset calc below, the zero turns into 32, the mid-second point, + * which in effect performs 4/5 rounding, which is just the right thing + * to do if we don't have fine-grained time. + */ + if (!sc->use_timer || tmr1 > TMR_TICKS_SEC) + tmr1 = 0; + + /* + * Turn the downcounter into an upcounter. The timer starts counting at + * and rolls over at mid-second, so add half a second worth of ticks to + * get its zero point back in sync with the tregs.sec rollover. + */ + *tmr = (TMR_TICKS_SEC - tmr1 + TMR_TICKS_HALFSEC) % TMR_TICKS_SEC; + + return (err); +} + +static int +write_timeregs(struct nxprtc_softc *sc, struct time_regs *tregs) +{ + + return (iicdev_writeto(sc->dev, sc->secaddr, tregs, + sizeof(*tregs), IIC_WAIT)); +} + +static int +pcf8523_start(struct nxprtc_softc *sc) +{ + int err; + uint8_t cs1, cs3, clkout; + bool is2129; + + is2129 = (sc->chiptype == TYPE_PCA2129 || sc->chiptype == TYPE_PCF2129); + + /* Read and sanity-check the control registers. */ + if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { + device_printf(sc->dev, "cannot read RTC CS1 control\n"); + return (err); + } + if ((err = read_reg(sc, PCF8523_R_CS3, &cs3)) != 0) { + device_printf(sc->dev, "cannot read RTC CS3 control\n"); + return (err); + } + + /* + * Do a full init (soft-reset) if... + * - The chip is in battery-disable mode (fresh from the factory). + * - The clock-increment STOP flag is set (this is just insane). + * After reset, battery disable mode has to be overridden to "standard" + * mode. Also, turn off clock output to save battery power. + */ + if ((cs3 & PCF8523_M_CS3_PM) == PCF8523_B_CS3_PM_NOBAT || + (cs1 & PCF85xx_B_CS1_STOP)) { + cs1 = PCF8523_B_CS1_SOFTRESET; + if ((err = write_reg(sc, PCF85xx_R_CS1, cs1)) != 0) { + device_printf(sc->dev, "cannot write CS1 control\n"); + return (err); + } + cs3 = PCF8523_B_CS3_PM_STD; + if ((err = write_reg(sc, PCF8523_R_CS3, cs3)) != 0) { + device_printf(sc->dev, "cannot write CS3 control\n"); + return (err); + } + /* + * For 2129 series, trigger OTP refresh by forcing the OTPR bit + * to zero then back to 1, then wait 100ms for the refresh, and + * finally set the bit back to zero with the COF_HIGHZ write. + */ + if (is2129) { + clkout = PCF2129_B_CLKOUT_HIGHZ; + if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT, + clkout)) != 0) { + device_printf(sc->dev, + "cannot write CLKOUT control\n"); + return (err); + } + if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT, + clkout | PCF2129_B_CLKOUT_OTPR)) != 0) { + device_printf(sc->dev, + "cannot write CLKOUT control\n"); + return (err); + } + pause_sbt("nxpotp", mstosbt(100), mstosbt(10), 0); + } else + clkout = PCF8523_B_CLKOUT_HIGHZ; + if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT, clkout)) != 0) { + device_printf(sc->dev, "cannot write CLKOUT control\n"); + return (err); + } + device_printf(sc->dev, + "first time startup, enabled RTC battery operation\n"); + + /* + * Sleep briefly so the battery monitor can make a measurement, + * then re-read CS3 so battery-low status can be reported below. + */ + pause_sbt("nxpbat", mstosbt(100), 0, 0); + if ((err = read_reg(sc, PCF8523_R_CS3, &cs3)) != 0) { + device_printf(sc->dev, "cannot read RTC CS3 control\n"); + return (err); + } + } + + /* Let someone know if the battery is weak. */ + if (cs3 & PCF8523_B_CS3_BLF) + device_printf(sc->dev, "WARNING: RTC battery is low\n"); + + /* Remember whether we're running in AM/PM mode. */ + if (is2129) { + if (cs1 & PCF2129_B_CS1_12HR) + sc->flags |= SC_F_AMPM; + } else { + if (cs1 & PCF8523_B_CS1_12HR) + sc->flags |= SC_F_AMPM; + } + + return (0); +} + +static int +pcf8523_start_timer(struct nxprtc_softc *sc) +{ + int err; + uint8_t clkout, stdclk, stdfreq, tmrfreq; + + /* + * Read the timer control and frequency regs. If they don't have the + * values we normally program into them then the timer count doesn't + * contain a valid fractional second, so zero it to prevent using a bad + * value. Then program the normal timer values so that on the first + * settime call we'll begin to use fractional time. + */ + if ((err = read_reg(sc, PCF8523_R_TMR_A_FREQ, &tmrfreq)) != 0) + return (err); + if ((err = read_reg(sc, PCF8523_R_TMR_CLKOUT, &clkout)) != 0) + return (err); + + stdfreq = PCF8523_B_TMR_A_64HZ; + stdclk = PCF8523_B_CLKOUT_TACD | PCF8523_B_CLKOUT_HIGHZ; + + if (clkout != stdclk || (tmrfreq & PCF8523_M_TMR_A_FREQ) != stdfreq) { + if ((err = write_reg(sc, sc->tmcaddr, 0)) != 0) + return (err); + if ((err = write_reg(sc, PCF8523_R_TMR_A_FREQ, stdfreq)) != 0) + return (err); + if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT, stdclk)) != 0) + return (err); + } + return (0); +} + +static int +pcf2127_start_timer(struct nxprtc_softc *sc) +{ + int err; + uint8_t stdctl, tmrctl; + + /* See comment in pcf8523_start_timer(). */ + if ((err = read_reg(sc, PCF2127_R_TMR_CTL, &tmrctl)) != 0) + return (err); + + stdctl = PCF2127_B_TMR_CD | PCF8523_B_TMR_A_64HZ; + + if ((tmrctl & PCF2127_M_TMR_CTRL) != stdctl) { + if ((err = write_reg(sc, sc->tmcaddr, 0)) != 0) + return (err); + if ((err = write_reg(sc, PCF2127_R_TMR_CTL, stdctl)) != 0) + return (err); + } + return (0); +} + +static int +pcf8563_start_timer(struct nxprtc_softc *sc) +{ + int err; + uint8_t stdctl, tmrctl; + + /* See comment in pcf8523_start_timer(). */ + if ((err = read_reg(sc, PCF8563_R_TMR_CTRL, &tmrctl)) != 0) + return (err); + + stdctl = PCF8563_B_TMR_ENABLE | PCF8563_B_TMR_64HZ; + + if ((tmrctl & PCF8563_M_TMR_CTRL) != stdctl) { + if ((err = write_reg(sc, sc->tmcaddr, 0)) != 0) + return (err); + if ((err = write_reg(sc, PCF8563_R_TMR_CTRL, stdctl)) != 0) + return (err); + } + return (0); +} + +static void +nxprtc_start(void *dev) +{ + struct nxprtc_softc *sc; + int clockflags, resolution; + uint8_t sec; + + sc = device_get_softc((device_t)dev); + config_intrhook_disestablish(&sc->config_hook); + + /* First do chip-specific inits. */ + switch (sc->chiptype) { + case TYPE_PCA2129: + case TYPE_PCF2129: + if (pcf8523_start(sc) != 0) + return; + /* No timer to start */ + break; + case TYPE_PCF2127: + if (pcf8523_start(sc) != 0) + return; + if (pcf2127_start_timer(sc) != 0) + return; + break; + case TYPE_PCF8523: + if (pcf8523_start(sc) != 0) + return; + if (pcf8523_start_timer(sc) != 0) + return; + break; + case TYPE_PCA8565: + case TYPE_PCF8563: + if (pcf8563_start_timer(sc) != 0) + return; + break; + default: + device_printf(sc->dev, "missing init code for this chiptype\n"); + return; + } + + /* + * Common init. Read the seconds register so we can check the + * oscillator-stopped status bit in it. + */ + if (read_reg(sc, sc->secaddr, &sec) != 0) { + device_printf(sc->dev, "cannot read RTC seconds\n"); + return; + } + if ((sec & PCF85xx_B_SECOND_OS) != 0) { + device_printf(sc->dev, + "WARNING: RTC battery failed; time is invalid\n"); + } + + /* + * Everything looks good if we make it to here; register as an RTC. If + * we're using the timer to count fractional seconds, our resolution is + * 1e6/64, about 15.6ms. Without the timer we still align the RTC clock + * when setting it so our error is an average .5s when reading it. + */ + resolution = sc->use_timer ? 1000000 / TMR_TICKS_SEC : 1000000 / 2; + clockflags = CLOCKF_GETTIME_NO_ADJ | CLOCKF_SETTIME_NO_TS; + clock_register_flags(sc->dev, resolution, clockflags); +} + +static int +nxprtc_gettime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct time_regs tregs; + struct nxprtc_softc *sc; + int err; + uint8_t cs1, tmrcount; + + sc = device_get_softc(dev); + + /* + * Read the time, but before using it, validate that the oscillator- + * stopped/power-fail bit is not set, and that the time-increment STOP + * bit is not set in the control reg. The latter can happen if there + * was an error when setting the time. + */ + if ((err = read_timeregs(sc, &tregs, &tmrcount)) != 0) { + device_printf(dev, "cannot read RTC time\n"); + return (err); + } + if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { + device_printf(dev, "cannot read RTC time\n"); + return (err); + } + if ((tregs.sec & PCF85xx_B_SECOND_OS) || (cs1 & PCF85xx_B_CS1_STOP)) { + device_printf(dev, "RTC clock not running\n"); + return (EINVAL); /* hardware is good, time is not. */ + } + + ct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; + ct.sec = FROMBCD(tregs.sec & PCF85xx_M_SECOND); + ct.min = FROMBCD(tregs.min & PCF85xx_M_MINUTE); + ct.hour = FROMBCD(tregs.hour & PCF85xx_M_HOUR); + ct.day = FROMBCD(tregs.day & PCF85xx_M_DAY); + ct.mon = FROMBCD(tregs.month & PCF85xx_M_MONTH); + ct.year = FROMBCD(tregs.year & PCF85xx_M_YEAR); + ct.year += 1900; + if (ct.year < POSIX_BASE_YEAR) + ct.year += 100; /* assume [1970, 2069] */ + + /* + * Old PCF8563 datasheets recommended that the C bit be 1 for 19xx and 0 + * for 20xx; newer datasheets don't recommend that. We don't care, + * but we may co-exist with other OSes sharing the hardware. Determine + * existing polarity on a read so that we can preserve it on a write. + */ + if (sc->chiptype == TYPE_PCF8563) { + if (tregs.month & PCF8563_B_MONTH_C) { + if (ct.year >= 2000) + sc->flags |= SC_F_CPOL; + } else if (ct.year < 2000) + sc->flags |= SC_F_CPOL; + } + + /* If this chip is running in 12-hour/AMPM mode, deal with it. */ + if ((sc->flags & SC_F_AMPM) && (tregs.hour & PCF8523_B_HOUR_PM)) + ct.hour += 12; + + err = clock_ct_to_ts(&ct, ts); + ts->tv_sec += utc_offset(); + + return (err); +} + +static int +nxprtc_settime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct time_regs tregs; + struct nxprtc_softc *sc; + long waitns; + int err; + uint8_t cflag, cs1, pmflag; + + sc = device_get_softc(dev); + + /* + * We stop the clock, set the time, then restart the clock. Half a + * second after restarting the clock it ticks over to the next second. + * So to align the RTC, sleep until system time is halfway through the + * current second (shoot for .495 to allow time for i2c operations). + */ + getnanotime(ts); + waitns = 495000000 - ts->tv_nsec; + if (waitns < 0) + waitns += 1000000000; + pause_sbt("nxpset", nstosbt(waitns), 0, C_PREL(31)); + + /* + * Reserve use of the i2c bus and stop the RTC clock. Note that if + * anything goes wrong from this point on, we leave the clock stopped, + * because we don't really know what state it's in. + */ + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) != 0) + return (err); + if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) + goto errout; + cs1 |= PCF85xx_B_CS1_STOP; + if ((err = write_reg(sc, PCF85xx_R_CS1, cs1)) != 0) + goto errout; + + /* Grab a fresh post-sleep idea of what time it is. */ + getnanotime(ts); + ts->tv_sec -= utc_offset(); + ts->tv_nsec = 0; + clock_ts_to_ct(ts, &ct); + + /* If the chip is in AMPM mode deal with the PM flag. */ + pmflag = 0; + if ((sc->flags & SC_F_AMPM) && ct.hour > 12) { + ct.hour -= 12; + pmflag = PCF8523_B_HOUR_PM; + } + + /* On 8563 set the century based on the polarity seen when reading. */ + cflag = 0; + if (sc->chiptype == TYPE_PCF8563) { + if ((sc->flags & SC_F_CPOL) != 0) { + if (ct.year >= 2000) + cflag = PCF8563_B_MONTH_C; + } else if (ct.year < 2000) + cflag = PCF8563_B_MONTH_C; + } + + tregs.sec = TOBCD(ct.sec); + tregs.min = TOBCD(ct.min); + tregs.hour = TOBCD(ct.hour) | pmflag; + tregs.day = TOBCD(ct.day); + tregs.month = TOBCD(ct.mon); + tregs.year = TOBCD(ct.year % 100) | cflag; + tregs.wday = ct.dow; + + /* + * Set the time, reset the timer count register, then start the clocks. + */ + if ((err = write_timeregs(sc, &tregs)) != 0) + goto errout; + + if ((err = write_reg(sc, sc->tmcaddr, TMR_TICKS_SEC)) != 0) + return (err); + + cs1 &= ~PCF85xx_B_CS1_STOP; + err = write_reg(sc, PCF85xx_R_CS1, cs1); + +errout: + + iicbus_release_bus(sc->busdev, sc->dev); + + if (err != 0) + device_printf(dev, "cannot write RTC time\n"); + + return (err); +} + +static int +nxprtc_probe(device_t dev) +{ + int chiptype; + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + chiptype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (chiptype == TYPE_NONE) + return (ENXIO); +#else + /* Historically the non-FDT driver supports only PCF8563. */ + chiptype = TYPE_PCF8563; +#endif + device_set_desc(dev, desc_strings[chiptype]); + + return (BUS_PROBE_DEFAULT); +} + +static int +nxprtc_attach(device_t dev) +{ + struct nxprtc_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->busdev = device_get_parent(dev); + sc->slave_addr = iicbus_get_addr(dev); + + /* + * We need to know what kind of chip we're driving. Historically the + * non-FDT driver supported only PCF8563. There is no machine-readable + * identifier in the chip so we would need a set of hints defined to use + * the other chips on non-FDT systems. + */ +#ifdef FDT + sc->chiptype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; +#else + sc->chiptype = TYPE_PCF8563; + if (sc->slave_addr == 0) + sc->slave_addr = PCF8563_ADDR; +#endif + + /* The features and some register addresses vary by chip type. */ + switch (sc->chiptype) { + case TYPE_PCA2129: + case TYPE_PCF2129: + sc->secaddr = PCF8523_R_SECOND; + sc->tmcaddr = 0; + sc->use_timer = false; + break; + case TYPE_PCF2127: + case TYPE_PCF8523: + sc->secaddr = PCF8523_R_SECOND; + sc->tmcaddr = PCF8523_R_TMR_A_COUNT; + sc->use_timer = true; + break; + case TYPE_PCA8565: + case TYPE_PCF8563: + sc->secaddr = PCF8563_R_SECOND; + sc->tmcaddr = PCF8563_R_TMR_COUNT; + sc->use_timer = true; + break; + default: + device_printf(dev, "impossible: cannot determine chip type\n"); + return (ENXIO); + } + + /* + * We have to wait until interrupts are enabled. Sometimes I2C read + * and write only works when the interrupts are available. + */ + sc->config_hook.ich_func = nxprtc_start; + sc->config_hook.ich_arg = dev; + if (config_intrhook_establish(&sc->config_hook) != 0) + return (ENOMEM); + + return (0); +} + +static int +nxprtc_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static device_method_t nxprtc_methods[] = { + DEVMETHOD(device_probe, nxprtc_probe), + DEVMETHOD(device_attach, nxprtc_attach), + DEVMETHOD(device_detach, nxprtc_detach), + + DEVMETHOD(clock_gettime, nxprtc_gettime), + DEVMETHOD(clock_settime, nxprtc_settime), + + DEVMETHOD_END +}; + +static driver_t nxprtc_driver = { + "nxprtc", + nxprtc_methods, + sizeof(struct nxprtc_softc), +}; + +static devclass_t nxprtc_devclass; + +DRIVER_MODULE(nxprtc, iicbus, nxprtc_driver, nxprtc_devclass, NULL, NULL); +MODULE_VERSION(nxprtc, 1); +MODULE_DEPEND(nxprtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);